<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:11:52 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>[CDRIVER-1201] Examples for common tasks with no helper functions</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-1201</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;The C Driver is lower-level than most, and doesn&apos;t provide helper functions for some common tasks like &quot;explain&quot; and &quot;distinct&quot;. Make a list of common tasks and make a new page in the documentation with a copy-and-pastable example for each. Move some existing examples like the &quot;explain&quot; command example at the bottom of mongoc_collection_find.page to this new page.&lt;/p&gt;</description>
                <environment></environment>
        <key id="279725">CDRIVER-1201</key>
            <summary>Examples for common tasks with no helper functions</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="ian.boros@mongodb.com">Ian Boros</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                            <label>intern2016</label>
                    </labels>
                <created>Thu, 14 Apr 2016 16:16:54 +0000</created>
                <updated>Wed, 19 Oct 2016 14:15:21 +0000</updated>
                            <resolved>Fri, 17 Jun 2016 17:51:57 +0000</resolved>
                                                    <fixVersion>1.4.0</fixVersion>
                                    <component>docs</component>
                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1307474" author="xgen-internal-githook" created="Mon, 27 Jun 2016 15:23:52 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #342 from puppyofkosh/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt;-fix-man&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; fix man&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/da098a6fc30ef670e935a4465758417068733dbc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/da098a6fc30ef670e935a4465758417068733dbc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1307473" author="xgen-internal-githook" created="Mon, 27 Jun 2016 15:23:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #342 from puppyofkosh/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt;-fix-man&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; fix man&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/da098a6fc30ef670e935a4465758417068733dbc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/da098a6fc30ef670e935a4465758417068733dbc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1298099" author="xgen-internal-githook" created="Fri, 17 Jun 2016 17:15:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; common-operations doc layout&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/b6c9403335656dccc66051faf43bc80e9d633f4d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/b6c9403335656dccc66051faf43bc80e9d633f4d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1298065" author="xgen-internal-githook" created="Fri, 17 Jun 2016 16:48:10 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #337 from puppyofkosh/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; added documentation for common operations&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/943de1b9bfae62ab2c8485f57c29a09c268d191e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/943de1b9bfae62ab2c8485f57c29a09c268d191e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1298064" author="xgen-internal-githook" created="Fri, 17 Jun 2016 16:48:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@emptysquare.net&apos;}
&lt;p&gt;Message: Merge pull request #337 from puppyofkosh/&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; added documentation for common operations&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/943de1b9bfae62ab2c8485f57c29a09c268d191e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/943de1b9bfae62ab2c8485f57c29a09c268d191e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1298063" author="xgen-internal-githook" created="Fri, 17 Jun 2016 16:48:08 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;ian boros&apos;, u&apos;email&apos;: u&apos;ian.boros@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1201&quot; title=&quot;Examples for common tasks with no helper functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1201&quot;&gt;&lt;del&gt;CDRIVER-1201&lt;/del&gt;&lt;/a&gt; added documentation for common operations&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/5c17557e9146058aa4c3d83d315da41eb4bac5fb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/5c17557e9146058aa4c3d83d315da41eb4bac5fb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1293763" author="behackett" created="Tue, 14 Jun 2016 15:43:40 +0000"  >&lt;p&gt;Lets not provide examples for group. See &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-14193&quot; title=&quot;deprecate (JS) group command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-14193&quot;&gt;&lt;del&gt;SERVER-14193&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="1293723" author="jesse" created="Tue, 14 Jun 2016 15:24:09 +0000"  >&lt;p&gt;Yes, perfect. For all these commands you can do db = mongoc_client_get_database, then mongoc_database_command_simple (db, ...).&lt;/p&gt;

&lt;p&gt;copydb&apos;s distinctive among these because it must be run on the database called &quot;admin&quot;. Since it&apos;s always run on the same database, it might be more natural to demonstrate it with mongoc_client_command_simple (client, &quot;admin&quot;, ...).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/copydb/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/command/copydb/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For &quot;distinct&quot; and &quot;group&quot;, you can include instructions for setting read preferences.&lt;/p&gt;

&lt;p&gt;We can talk over how to instruct users to run &quot;mapreduce&quot;. By default mapreduce creates a collection that you must query to get the results. This has to be done on the primary, since only the primary is allowed to create a collection. You can also do an &quot;inline&quot; mapreduce that returns the results directly. This can be run on a secondary since it only stores the results temporarily in server memory, not disk.&lt;/p&gt;</comment>
                            <comment id="1293615" author="ian.boros" created="Tue, 14 Jun 2016 14:37:42 +0000"  >&lt;p&gt;For all of these examples, can I just use the mongoc_database_command_simple function to invoke the command on the server? That seems to work for all of them, but I&apos;m not sure if there&apos;s a more idiomatic way.&lt;/p&gt;</comment>
                            <comment id="1292285" author="jesse" created="Mon, 13 Jun 2016 16:07:08 +0000"  >&lt;p&gt;Let&apos;s do:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;explain&lt;/li&gt;
	&lt;li&gt;distinct&lt;/li&gt;
	&lt;li&gt;mapreduce&lt;/li&gt;
	&lt;li&gt;&lt;del&gt;group&lt;/del&gt;&lt;/li&gt;
	&lt;li&gt;copydb&lt;/li&gt;
	&lt;li&gt;cloneCollection&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For mapreduce and group, port the examples from the Python driver: &lt;a href=&quot;https://api.mongodb.com/python/current/examples/aggregation.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://api.mongodb.com/python/current/examples/aggregation.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;copydb: &lt;a href=&quot;https://api.mongodb.com/python/current/examples/copydb.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://api.mongodb.com/python/current/examples/copydb.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test against MongoDB 3.2.&lt;/p&gt;

&lt;p&gt;You can use the MongoDB Manual for command syntax, e.g. for cloneCollection:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/cloneCollection/#dbcmd.cloneCollection&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/command/cloneCollection/#dbcmd.cloneCollection&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test out the command syntax in the mongo shell first, then write a C example and include it in an &quot;examples&quot; doc.&lt;/p&gt;

&lt;p&gt;Consider how best to organize these examples so users can find them and they don&apos;t collect into one huge page.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="279693">CDRIVER-1200</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrcygf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="970">C Driver 2016 sprint 5</customfieldvalue>

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