I have a Content Schema. If a user creates a Content document, they are able to edit it. I want users to be able to choose whether they see the “original” Content, or the “updated” version of Content. My idea is that when Content is created, an OriginalContent document is also created and both contain the same ObjectId. OriginlContent will never be edited after initialization, only Content will. Then based on which view the user chooses, they see either Content or OriginalContent. Can I explicitly choose the ObjectId for OriginalContent so it matches that of Content? Any other ideas?
NO!! Don't use same ObjectID on 2 different Object, what I would recommend would be you can structure your Object like this
{
_id:ObjectId()
OrignalContent:{
Properties of Orignal Content
}
UpdatedContent:{
Same Properties with OrignalContent but Different values
}
}
This way you can always get the Item
with _id
and choose either to display Orignal Content
or Updated Content
. This could be your dummy Item (Add many properties as you want)
{
_id:ObjectId("5db9a2c5c58a7738508bc3ac")
Orignal:{
name: Jon
}
Updated:{
name: Jon Doe
}
}
This way you don't have to create 2 Object