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

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Why won't my code write to SQL? -

c# - Avoiding duplicate methods for Task and Task<T> -