Open jetlej opened 8 years ago
Just check that the query
object has an _id
value set (the transactions package ignores everything else in the object). That query isn't treated like a true mongo selector (at all). See 1. here.
The query object definitely has an _id value set, and it's the only value set in that object.
Here's some more sample code (defined as Meteor methods):
approveArticle: function(id, owner) {
Meteor.call('updateArticle', id, {
status: STATUS_APPROVED,
owner: null,
lastChanged: new Date()
});
},
updateArticle: function(id, data) {
return Articles.update({_id: id}, { $set: data }, {tx: true});
}
Any other suggestions?
Bump
Hmmm... not sure what to suggest here. That code looks fine to me. Note: the return value from the method shown above will not be the return value from the mongo update command, it will just be true
if the transaction has been completed as expected.
If there's a minimal repro I could look at I could figure out what's going on.
I'm getting what looks to be correct messages in console, but the action itself is not being done in the first place.
Relevant line of code:
return Articles.update(query, { $set: data }, {tx: true});