Is there a save
operation in mongoose.js or mongodb api, which returns the _id of stored entry?
In mongoose the following will save the Entry.
p.save(function (err) {
if (err) return handleError(err);
else console.log('saved');
})
})
Likewise db.collection.save(document)
will save document in mongodb api. But in both cases, you need to query db again for _id, which I want to avoid. As it seems ineffient.