<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:41:48 UTC 2024

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 append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[DOCS-1744] Use Cases - Storing Comments</title>
                <link>https://jira.mongodb.org/browse/DOCS-1744</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;The code example under the heading view paginated comments on &lt;a href=&quot;http://docs.mongodb.org/manual/use-cases/storing-comments/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/use-cases/storing-comments/&lt;/a&gt; doesn&apos;t seem to work.&lt;/p&gt;

&lt;p&gt;The code seems to indicate that the find will be run on each iteration of the cursor and update the skip and limit variables. However, this doesn&apos;t appear to be the case. The original skip and limit values passed into the find are used on each document matched.&lt;/p&gt;</description>
                <environment></environment>
        <key id="83460">DOCS-1744</key>
            <summary>Use Cases - Storing Comments</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="andrew.aldridge@mongodb.com">Andrew Aldridge</assignee>
                                    <reporter username="mattcampbell">Matt Campbell</reporter>
                        <labels>
                            <label>query</label>
                    </labels>
                <created>Thu, 25 Jul 2013 09:45:00 +0000</created>
                <updated>Wed, 24 Feb 2016 20:21:51 +0000</updated>
                            <resolved>Wed, 18 Mar 2015 19:52:24 +0000</resolved>
                                                                    <component>ecosystem</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="859500" author="xgen-internal-githook" created="Fri, 20 Mar 2015 18:46:10 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;i80and&apos;, u&apos;name&apos;: u&apos;Andrew Aldridge&apos;, u&apos;email&apos;: u&apos;i80and@foxquill.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-1744&quot; title=&quot;Use Cases - Storing Comments&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-1744&quot;&gt;&lt;del&gt;DOCS-1744&lt;/del&gt;&lt;/a&gt;: Fix comment pagination example, s/page/bucket&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs-ecosystem/commit/8d7556274deb1c9b5613248694d4e850efde7473&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs-ecosystem/commit/8d7556274deb1c9b5613248694d4e850efde7473&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="388483" author="mattcampbell" created="Thu, 25 Jul 2013 09:58:38 +0000"  >&lt;p&gt;Here is a solution that works:&lt;/p&gt;

&lt;p&gt;def find_comments(discussion_id, skip, limit):&lt;br/&gt;
    result = []&lt;br/&gt;
    pages = db.test.find(&lt;br/&gt;
        &lt;/p&gt;
{ &apos;discussion_id&apos;: discussion_id }
&lt;p&gt;,&lt;/p&gt;
        { &apos;page&apos;: 1 }
&lt;p&gt;    )&lt;br/&gt;
    pages = pages.sort(&apos;page&apos;)&lt;/p&gt;

&lt;p&gt;    for page in pages:&lt;br/&gt;
        page_query = db.test.find_one(&lt;br/&gt;
            &lt;/p&gt;
{ &apos;discussion_id&apos;: discussion_id,
              &apos;page&apos;: page[&apos;page&apos;] }
&lt;p&gt;,&lt;br/&gt;
            { &apos;count&apos;: 1, &apos;comments&apos;: &lt;/p&gt;
{ &apos;$slice&apos;: [ skip, limit ] }
&lt;p&gt; }&lt;br/&gt;
        )&lt;br/&gt;
        result += page_query&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;comments&amp;#39;&amp;#93;&lt;/span&gt;&lt;br/&gt;
        skip = max(0, skip - page_query&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;count&amp;#39;&amp;#93;&lt;/span&gt;)&lt;br/&gt;
        limit -= len(page_query&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;comments&amp;#39;&amp;#93;&lt;/span&gt;)&lt;br/&gt;
        if limit == 0: break&lt;br/&gt;
    return result&lt;/p&gt;

&lt;p&gt;You perform a find call for each page. If it can be done the way outlined at the above mention page it would be good to know what environment / setup it works under.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10855" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Actual Time</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 18 Mar 2015 17:49:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 47 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>jess.mokrzecki@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 47 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.aldridge@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>mattcampbell</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrrrvb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrru8n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>76290</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="435">Docs Sprint 17 - Ending 4/3</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hryvb3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                </customfields>
    </item>
</channel>
</rss>