我正在尝试通过ID选择文档
我试过了:
collection.update({ "_id": { "$oid": + theidID } } collection.update({ "_id": theidID } collection.update({ "_id.$oid": theidID }}
还尝试了:
collection.update({ _id: new ObjectID(theidID ) }
这给我一个错误500 …
var mongo = require('mongodb') var BSON = mongo.BSONPure; var o_id = new BSON.ObjectID(theidID ); collection.update({ _id: o_id }
这些都不起作用。如何通过_id选择?
var mongo = require('mongodb'); var o_id = new mongo.ObjectID(theidID); collection.update({'_id': o_id});