I’m trying to make a KineticJS object’s position update via Meteor.
It appears that the trouble is in:
Players.update({name: "Rect"}, {xpos: this.attrs.x})
Here’s what the meteor docs say:
// Find the document with id "123", and completely replace it.
Users.update({_id: "123"}, {name: "Alice", friends: ["Bob"]});
I tried to check to see if the data was being updated via:
console.log(Players.findOne({name: "Rect"}).xpos);
Here’s the github:
https://github.com/randompast/randomtests/tree/master/meteorCanvasTest
First of all, always use $set to update your attributes lest you stomp on things like the name. Since you had stomped on the name in subsequent updates there was no attribute named ‘rect’ to update.
Players.update({name: "Rect"}, {$set: {xpos: this.attrs.x}})Just insert that observe function and make sure that your dragend is using the $set notation.