In Rails, thanks to the incredible ActiveRecord library, we can do these things:
bear = Bear.find(id)
bear.eyes = 'blue'
bear.friends += 1
bear.save
And the changes are then saved in the database.
In Meteor, I can do this:
bear = Bears.findOne({});
bear.eyes = 'blue';
bear.friends++;
The two changes made are made only in the local copy in memory. As far as I see, changes cannot be saved without calling the Mongo update instruction.
Bears.update({
_id: bear._id,
$inc: { friend: 1 },
eyes: 'blue'
});
I love Meteor, this is quite surprising ... but this would seem to be a big step backwards, if this is not possible.
Is there a way to save the bear , as we did in Rails / ActiveRecord?
source
share