Reputation: 85
No error... just doesn't update the document. The weirdest thing is that the update returns 1 in console, as quantity of documents updated, but the value in the base Mongo did not change.
In the server:
export const closeCard = new ValidatedMethod({
name: 'BoardCard.close',
validate: new SimpleSchema({
id : { type: String
, regEx: SimpleSchema.RegEx.Id
},
solved: {type: Boolean}
}).validator(),
run(oneCard) {
BoardCards.update(oneCard.id, {
$set: { solved: ! oneCard.solved},
});
},
});
In the client:
tarjeta = {id : this.props.card._id, solved: this.props.card.solved}
Meteor.call('BoardCard.close', tarjeta, (error, response) => {
if (error) {
console.log(error)
}})
The document exists, i can do a findOne() of it and i get the document. But the update by _id doesn't change the value.
Upvotes: 0
Views: 308