I'm trying to display an alert to the user when data is added to the database. So I wrote (on the client side) :
Meteor.autosubscribe(function() {
ItemCollection.find().observe({
added: function(item) {
// Alert code
}
});
});
And I found that not only alerts are displayed when a new item is added to the database on the server side ( which I suppose is normal :) ) but alerts are also displayed for each previously added item when I refresh the page. I suppose Meteor fetch all the data from the Mongo database on startup (to populate the local Minimongo DB) and then fires 'added' event for each item added in the local database.
But is this the normal behavior ? How can I receive only items that are "truly" added in the database on the server ?