native update in Sails with Mongo does not work with ObjectId

前端 未结 3 773
心在旅途
心在旅途 2020-12-21 05:44

I wonder what I am doing wrong.

I use Sailsv0.10 and mongo2.6.0 and want to update an array field (using $push) in a collection via native.

My model:

3条回答
  •  暖寄归人
    2020-12-21 06:20

    if you use sailsjs then:

    ObjectID = require('sails-mongo/node_modules/mongodb').ObjectID;
    var o_id = new ObjectID(req.param('id'));
    console.log(o_id );
    

    :)

    rhernandez@itemsoft.mx

提交回复
热议问题