say I have a product listing. When I add a new product I save it using something like
var doc=products.Insert(p);
The pro
When you insert an object into the mongodb, mongo will update the object with the internal ID.
So if
data = {
title: "Howdy"
}
Then when we insert the data object into the db
db.collection('collectionName', function(err, collection) {
collection.insert(data);
console.log(data._id); // <- The mongodb id is now set on the item
});