[CDRIVER-196] Existence of namespace in mongodb Created: 11/Feb/13 Updated: 05/Dec/13 Resolved: 13/Nov/13 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.7 |
| Fix Version/s: | 0.90.0 |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Robert G. Brown | Assignee: | Christian Hergert |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Centos/ 6.3 |
||
| Description |
|
I attempted to use mongo_validate_ns() to determine if e.g. mydb.frog already existed, but apparently the routine only validates whether or not the ns string is well formed, not whether or not the db/collection combo already exist under the mongo server. I looked through the source and (still pretty sketchy) documentation and couldn't find anything that either did the equivalent of "show dbs" or "show collections" or (more reasonably) mongo_exists_ns() – a routine that returns a list of the existing mongodb dbs and their collections or a routine that takes a well-formed ns and tells you if THAT collection exists already. Possibly for the future? rgb |
| Comments |
| Comment by Mira Carey [ 13/Nov/13 ] |
|
Looks good to me |
| Comment by Christian Hergert [ 12/Nov/13 ] |
|
https://github.com/chergert/libmongoc/commit/d322dc27b2b9f273318d440cd251133b5a5b0cbb |
| Comment by Christian Hergert [ 12/Nov/13 ] |
|
I'm adding a function to the new C driver that will check this against a MongoDB servers known collections. |