Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongoskin findAndModify ID object id

Tags:

mongoskin

Using nodejs, mongoskin.. I'd like to return the updated doc so Im using findAndModify, however the query {_id: "someid"} doesn't work. I think I need to use {id: ObjectID{'someid'} as the query. How do I get the ObjectId type into JS?

like image 887
John Williams Avatar asked Dec 05 '22 14:12

John Williams


1 Answers

try this:

ObjectID = require('mongoskin').ObjectID

{_id: new ObjectID("someid")}
like image 125
label Avatar answered Jan 28 '23 15:01

label