node.js - How to add unique id to sub-document in a document in mongoose -
how add unique id sub-document in document in mongoose. mongoose model sub document not adding object id.
try "new objectid()" wherever want unique id. e.g
db.news.insert({"name":"political", "group":{"x":new objectid(),"type":"breaking"}})
i tried in mongodb 2.4.8 , working fine.
Comments
Post a Comment