I have a document that has an attribute which is an ObjectId. For example anchor field in the code below:
{ "__v" : 0, "_id" : ObjectId("5654d896481c5186ddaf4481"), "anchor" : ObjectId("565480e5481c5186ddaf446c"), "base_url" : "http://example.com"}
I saw the documentation here but it is not clear how to update an ObjectId reference field. I want this reference to just point to another anchor
document, can I just place the ObjectId as a string like this:
db.categories.update(
{ },
{
$set {anchor: "5654d47a481c5186ddaf4479"}
},
{ multi: true }
)