[CDRIVER-2757] createIndexes guide is unclear Created: 19/Jul/18 Updated: 28/Oct/23 Resolved: 19/Jul/18 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | docs, libmongoc |
| Affects Version/s: | 1.12.0 |
| Fix Version/s: | 1.13.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Gustaf Neumann | Assignee: | Kevin Albertson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | api | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
all |
||
| Issue Links: |
|
||||
| Description |
|
is it possible to provide an additional public API function forĀ mongoc_collections to access the database, e.g. calledĀ mongoc_collection_get_database()? The need arose from trying to replace the deprecated function mongoc_collection_create_index() with the recommended interface based on mongoc_database_write_command_with_opts(), but this requires the db. The function has just the collection as input, so it would be appreciated to access the ->db member this way. |
| Comments |
| Comment by Githook User [ 19/Jul/18 ] |
|
Author: {'username': 'kevinAlbs', 'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com'}Message: |
| Comment by Kevin Albertson [ 19/Jul/18 ] |
|
Glad to help! That docs page is a bit misleading, and does indicate that mongoc_database_write_command_with_opts is the only way to create an index. We'll fix that. |
| Comment by Gustaf Neumann [ 19/Jul/18 ] |
|
perfect! Thanks a lot. I have missed this API function! The issue is solved, sorry for the noise! |
| Comment by Kevin Albertson [ 19/Jul/18 ] |
|
Hi gustafn, I think you can use mongoc_collection_write_command_with_opts. The only difference between mongoc_collection_write_command_with_opts and mongoc_database_write_command_with_opts is where the default read preference, read concern, and write concern of the command are inherited from. |