My experience with mongodb is very limited, so I need help on how to retrieve a document from a meteor collection. I am trying to check if a document exists for the user and update it with an object.
if (Saves.find({_id: Meteor.userId()}).fetch()) {
console.log("Before " +Saves.find({_id: Meteor.userId()}).fetch())
if (Meteor.isServer){
Saves.update( {_id: Meteor.userId(), save: save} )
}
console.log("Success " + Saves.find({_id: Meteor.userId()}).fetch())
I am trying to log the "save" object using console.log
, but currently all I get is either nothing or [object Object]
if I do not use fetch()
(which outputs a cursor object).