<!-- 
RSS generated by JIRA (5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9) at Mon May 20 02:42:34 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.couchbase.com/issues/si/jira.issueviews:issue-xml/MB-7346/MB-7346.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Couchbase</title>
    <link>http://www.couchbase.com/issues</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.4</version>
        <build-number>845</build-number>
        <build-date>26-12-2012</build-date>
    </build-info>

<item>
            <title>[MB-7346] Documentation outdated in page http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html </title>
                <link>http://www.couchbase.com/issues/browse/MB-7346</link>
                <project id="10010" key="MB">Couchbase Server</project>
                        <description>The page at:&lt;br/&gt;
&lt;br/&gt;
&lt;a href=&quot;http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html&quot;&gt;http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html&lt;/a&gt;&lt;br/&gt;
&lt;br/&gt;
Shows several documents with the _id and _rev fields. These meta data fields are no longer inlined in documents after DP4.&lt;br/&gt;
&lt;br/&gt;
Also, the field &amp;quot;language&amp;quot; for design documents has no special meaning in Couchbase (unlike Apache CouchDB), being superfluous and confusing to users.&lt;br/&gt;
&lt;br/&gt;
There&amp;#39;s also a map function example with duplicated if conditional:&lt;br/&gt;
&lt;br/&gt;
function(doc) {&lt;br/&gt;
	if (doc.title) {&lt;br/&gt;
&amp;nbsp;&amp;nbsp;	if(doc.title) {&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;	emit(doc.title, null);&lt;br/&gt;
&amp;nbsp;&amp;nbsp;	}&lt;br/&gt;
&amp;nbsp;&amp;nbsp;}&lt;br/&gt;
}&lt;br/&gt;
&lt;br/&gt;
Finally, the following paragraph:&lt;br/&gt;
&lt;br/&gt;
&amp;quot;As a best practice we want make sure that the fields we want to include in our index actually exist. Therefore we have our map function within a conditional: if (doc.age &amp;amp;&amp;amp; doc.name). This ensures the fields exist in documents when we query the view and we therefore avoid a view failure when Couchbase Server generates the index.&amp;quot;&lt;br/&gt;
&lt;br/&gt;
Is not completely correct. If doc.age or doc.name don&amp;#39;t exist in a document, using them as keys or values doesn&amp;#39;t produce an error.&lt;br/&gt;
Undefined fields in JavaScript are serialized to a JSON null value.&lt;br/&gt;
What would produce an error would be something like referencing doc.name.length, when name isn&amp;#39;t defined in the document.&lt;br/&gt;
</description>
                <environment></environment>
            <key id="21106">MB-7346</key>
            <summary>Documentation outdated in page http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html </summary>
                <type id="1" iconUrl="http://www.couchbase.com/issues/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.couchbase.com/issues/images/icons/priorities/major.png">Major</priority>
                    <status id="6" iconUrl="http://www.couchbase.com/issues/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10011">Public</security>
                        <assignee username="kzeller">Karen Zeller</assignee>
                                <reporter username="FilipeManana">Filipe Manana</reporter>
                        <labels>
                    </labels>
                <created>Tue, 4 Dec 2012 08:38:50 -0600</created>
                <updated>Tue, 11 Dec 2012 10:18:06 -0600</updated>
                    <resolved>Tue, 11 Dec 2012 10:13:42 -0600</resolved>
                            <version>2.0-beta</version>
                <version>2.0-beta-2</version>
                <version>2.0</version>
                                <fixVersion>2.0</fixVersion>
                                <component>documentation</component>
                                <votes>0</votes>
                        <watches>1</watches>
                                                    <comments>
                    <comment id="45764" author="kzeller" created="Mon, 10 Dec 2012 16:22:45 -0600"  >Ok. I&amp;#39;ve updated the paragraph to say:&lt;br/&gt;
&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;para&amp;gt;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Here is how the map function appears when you provide full&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handling of all JSON document information:&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/para&amp;gt;&lt;br/&gt;
&lt;br/&gt;
&amp;lt;programlisting&amp;gt;&lt;br/&gt;
function (doc, meta) {&lt;br/&gt;
&amp;nbsp;&amp;nbsp;if (meta.type == &amp;quot;json&amp;quot; &amp;amp;amp;&amp;amp;amp; doc.title &amp;amp;amp;&amp;amp;amp; doc.date) {&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Check if doc is JSON&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;emit(doc.title, doc.date);&lt;br/&gt;
&amp;nbsp;&amp;nbsp;} else {&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// do something with binary value&lt;br/&gt;
&amp;nbsp;&amp;nbsp;}&lt;br/&gt;
}&lt;br/&gt;
&amp;lt;/programlisting&amp;gt;&lt;br/&gt;
&amp;nbsp;&amp;nbsp;	&lt;br/&gt;
&amp;nbsp;&amp;nbsp;	&amp;lt;para&amp;gt; As a best practice we want make sure that the fields we want to emit in our index&lt;br/&gt;
&amp;nbsp;&amp;nbsp;		actually exist before we emit it to the index. Therefore we have our map function within a&lt;br/&gt;
&amp;nbsp;&amp;nbsp;		conditional: &amp;lt;literal&amp;gt;if (doc.title &amp;amp;amp;&amp;amp;amp; doc.date)&amp;lt;/literal&amp;gt;. For instance, &lt;br/&gt;
&amp;nbsp;&amp;nbsp;		if we wanted to perform a views function &lt;br/&gt;
&amp;nbsp;&amp;nbsp;		that tried to reference &amp;lt;literal&amp;gt;doc.name.length&amp;lt;/literal&amp;gt; we would get a null value if the &lt;br/&gt;
&amp;nbsp;&amp;nbsp;		field does not exist and the view function would fail. By checking for the field we avoid &lt;br/&gt;
&amp;nbsp;&amp;nbsp;	these potential types of errors.&amp;lt;/para&amp;gt;&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
This will be available here later today: &lt;a href=&quot;http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html&quot;&gt;http://www.couchbase.com/docs/couchbase-devguide-2.0/filter-extract-data.html&lt;/a&gt;&lt;br/&gt;
</comment>
                    <comment id="45765" author="kzeller" created="Mon, 10 Dec 2012 16:23:54 -0600"  >See updated text/example.</comment>
                    <comment id="45795" author="FilipeManana" created="Tue, 11 Dec 2012 09:08:38 -0600"  >Karen, Thanks.&lt;br/&gt;
&lt;br/&gt;
However this part:&lt;br/&gt;
&lt;br/&gt;
For instance, &lt;br/&gt;
&amp;nbsp;&amp;nbsp;	 if we wanted to perform a views function &lt;br/&gt;
&amp;nbsp;&amp;nbsp;	 that tried to reference &amp;lt;literal&amp;gt;doc.name.length&amp;lt;/literal&amp;gt; we would get a null value if the &lt;br/&gt;
&amp;nbsp;&amp;nbsp;	 field does not exist and the view function would fail. By checking for the field we avoid &lt;br/&gt;
&amp;nbsp;&amp;nbsp;	these potential types of errors.&amp;lt;/para&amp;gt; &lt;br/&gt;
&lt;br/&gt;
Is still not correct. For that example (doc.name.length) we would not get null, but rather an &amp;quot;undefined reference&amp;quot; exception would be raised by the JavaScript engine. Doing &amp;quot;doc.name&amp;quot; is what would produce a null.&lt;br/&gt;
&lt;br/&gt;
</comment>
                    <comment id="45796" author="FilipeManana" created="Tue, 11 Dec 2012 09:08:53 -0600"  >See comment above.</comment>
                    <comment id="45800" author="kzeller" created="Tue, 11 Dec 2012 10:13:36 -0600"  >I see, and will add this information. In the future for these types of issues, it would be more helpful if you not only call out the error, but also explain what happens to server behavior (does it crash, does it freeze, is it unable to handle other views in the design document, etc. and if there is a solution/workaround) This is truly the important information for customers/customer support not just errorname=XYZ appears.....&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
Thanks!</comment>
                    <comment id="45803" author="FilipeManana" created="Tue, 11 Dec 2012 10:18:06 -0600"  >Karen, I said what it happens, the JavaScript function will raise an exception.&lt;br/&gt;
&lt;br/&gt;
As described in the wiki and other places, when that happens a log message is logged to mapreduce_errors.N file, referencing the error, document ID, bucket name, design document name, etc. This doesn&amp;#39;t crash or freezes the server.</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                        <customfield id="customfield_10180" key="com.atlassian.jira.ext.charting:firstresponsedate">
                <customfieldname>Date of First Response</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>Mon, 10 Dec 2012 16:22:45 -0600</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10081" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Rank</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>3361</customfieldvalue>
                </customfieldvalues>
            </customfield>
                                                                                                                                                                                        <customfield id="customfield_10181" key="com.atlassian.jira.ext.charting:timeinstatus">
                <customfieldname>Time In Status</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                </customfields>
    </item>
</channel>
</rss>