i use sails js 0.12.14 with mongodb. if i try to get a document after insert the document the document is empty
Products.create(product).exec(function(err, createdProduct) {
Products.find({_id : createdProduct.id}).exec(function(err, foundProductAfterCreate) {
console.log(foundProductAfterCreate);
})});
Can anybody explain why the document is not available?
Update: This is the correct code for me...
Products.create(product).exec(function(err, createdProduct) {
Products.find({_id : createdProduct[0].id}).exec(function(err, foundProductAfterCreate) {
console.log(foundProductAfterCreate);
})});