Is there any benefit to storing an id to a related document as an ObjectId versus storing it as a string literal?
Using ObjectID:
{
"_id": ObjectId("522bb79455449d881b004d27"),
"username": "admin",
"folder": ObjectId("522bb79455449d881b004d23")
}
versus a string:
{
"_id": ObjectId("522bb79455449d881b004d27"),
"username": "admin",
"folder": "522bb79455449d881b004d23"
}
For my API where I'm sending data back to a client... using the string means I don't have to "cleanup" the data... and as we have to do a second query to get the folder document anyway... is it worth using ObjectId? (and if so why?)
Thanks