[CDRIVER-1201] Examples for common tasks with no helper functions Created: 14/Apr/16 Updated: 19/Oct/16 Resolved: 17/Jun/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | docs, libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Ian Boros |
| Resolution: | Done | Votes: | 0 |
| Labels: | intern2016 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The C Driver is lower-level than most, and doesn't provide helper functions for some common tasks like "explain" and "distinct". 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 "explain" command example at the bottom of mongoc_collection_find.page to this new page. |
| Comments |
| Comment by Githook User [ 27/Jun/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #342 from puppyofkosh/
|
| Comment by Githook User [ 27/Jun/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #342 from puppyofkosh/
|
| Comment by Githook User [ 17/Jun/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: |
| Comment by Githook User [ 17/Jun/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #337 from puppyofkosh/
|
| Comment by Githook User [ 17/Jun/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #337 from puppyofkosh/
|
| Comment by Githook User [ 17/Jun/16 ] |
|
Author: {u'name': u'ian boros', u'email': u'ian.boros@10gen.com'}Message: |
| Comment by Bernie Hackett [ 14/Jun/16 ] |
|
Lets not provide examples for group. See |
| Comment by A. Jesse Jiryu Davis [ 14/Jun/16 ] |
|
Yes, perfect. For all these commands you can do db = mongoc_client_get_database, then mongoc_database_command_simple (db, ...). copydb's distinctive among these because it must be run on the database called "admin". Since it's always run on the same database, it might be more natural to demonstrate it with mongoc_client_command_simple (client, "admin", ...). https://docs.mongodb.com/manual/reference/command/copydb/ For "distinct" and "group", you can include instructions for setting read preferences. We can talk over how to instruct users to run "mapreduce". 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 "inline" 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. |
| Comment by Ian Boros [ 14/Jun/16 ] |
|
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'm not sure if there's a more idiomatic way. |
| Comment by A. Jesse Jiryu Davis [ 13/Jun/16 ] |
|
Let's do:
For mapreduce and group, port the examples from the Python driver: https://api.mongodb.com/python/current/examples/aggregation.html copydb: https://api.mongodb.com/python/current/examples/copydb.html Test against MongoDB 3.2. You can use the MongoDB Manual for command syntax, e.g. for cloneCollection: https://docs.mongodb.com/manual/reference/command/cloneCollection/#dbcmd.cloneCollection Test out the command syntax in the mongo shell first, then write a C example and include it in an "examples" doc. Consider how best to organize these examples so users can find them and they don't collect into one huge page. |