我希望在 MongoDB 中储存一个 Mongo 查询,比如可能类似下面这样:
{ $set: { account_id: ObjectID('525284cc2cebb6d0008b4567') } }
但是我并不能直接储存在 MongoDB 中,因为 $set 在 MongoDB 中是一个不合法的属性名。
$set
而且也不能用 JSON 序列化,因为 ObjectID 这种对象序列化之后没法被正确地还原。
学习是最好的投资!
Escape loses the string...how to unescape it back when needed
Why don’t you just save the ID and spell out the query yourself next time?
What about BSON serialization?
Escape loses the string...how to unescape it back when needed
Why don’t you just save the ID and spell out the query yourself next time?
What about BSON serialization?