The MongoDB is correctly keeping the total count at 100 as items are added, but the client side is not doing so:
Using observeChanges, it appears that only "added" happens - not sure if that means the opLog doesn't record 'removes' for capped collections (and they're implicit) or if they're recorded in some different format than a normal remove or what.
This was the js I used (in a top-level .js, running on both client and server)
Last100 = new Meteor.SmartCollection("last100");
Query = Last100.find();
var count = 0;
Query.observeChanges({
added: function (id, user) {
count++;
console.log("ADDED:", count, Query.count());
},
removed: function () {
count--;
console.log("REMOVED:", count, Query.count());
}
});
I created a capped collection with count limit of 100:
db.createCollection('last100', {capped : true, size: 1024*1024, max: 100 })
The MongoDB is correctly keeping the total count at 100 as items are added, but the client side is not doing so:
Using observeChanges, it appears that only "added" happens - not sure if that means the opLog doesn't record 'removes' for capped collections (and they're implicit) or if they're recorded in some different format than a normal remove or what.
This was the js I used (in a top-level .js, running on both client and server)