我希望在 MongoDB 中储存一个 Mongo 查询,比如可能类似下面这样:
{
$set: {
account_id: ObjectID('525284cc2cebb6d0008b4567')
}
}
但是我并不能直接储存在 MongoDB 中,因为 $set
在 MongoDB 中是一个不合法的属性名。
而且也不能用 JSON 序列化,因为 ObjectID 这种对象序列化之后没法被正确地还原。
天蓬老师2017-04-17 11:14:29
Why don’t you just save the ID and spell out the query yourself next time?