[SERVER-27129] Does ObjectId type affect lookup performance? Created: 19/Nov/16 Updated: 19/Nov/16 Resolved: 19/Nov/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Minor - P4 |
| Reporter: | Cyril Auburtin | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
If if I insert documents with `_id: ObjectId().toString()` (a 24chars string) or a base64 version of it `_id: base64(ObjectId().toString())` (16chars) Will this affect performance for lookups, compared to keeping the default ObjectId type? |
| Comments |
| Comment by Kelsey Schubert [ 19/Nov/16 ] |
|
Hi caub, Thanks for your report. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group where it would reach a wider audience. Kind regards, |
| Comment by Cyril Auburtin [ 19/Nov/16 ] |
|
For Node's driver, https://github.com/mongodb/node-mongodb-native/blob/2.2/lib/collection.js#L178 I don't see anything that show a difference, maybe it's more in the c++ parts note: base64ObjectId is better done with: new ObjectId().generate().toString('base64') ObjectId is probably more efficient in storage space |