[SERVER-2770] Any collection name on db w/corresponding function name fail Created: 16/Mar/11 Updated: 24/Mar/20 Resolved: 24/Mar/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Won't Fix | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
For example the config.version collection in sharding config is not accessible from the shell since the version function is returned. We should check if the collection exists before returning the function: > use config exported 1 records |
| Comments |
| Comment by Ratika Gandhi [ 24/Mar/20 ] |
|
Fixing this would be backwards incompatible with existing scripts so please use the workaround of calling getCollection directly. |
| Comment by Brian [ 23/Apr/12 ] |
| Comment by Mark Waschkowski [ 07/Apr/11 ] |
|
ya, I ran into this when I named a collection 'auth'. it was a pain to find out what the problem was. The should be fixed, it is a bug. If a name is reserved, or there are going to be side effects, at the very least a warning should be shown in the log, developers shouldn't have to track this kinda thing down. I kept getting: typeerror "find is not a function" or when trying to save: Thu Apr 07 13:36:28 TypeError: db.auth.save is not a function (shell):1 |
| Comment by Scott Hernandez (Inactive) [ 18/Mar/11 ] |
|
You can use db.getCollection("<coll-name>") to get around this issue, but I still think it is an ugly solution. |