Large sized Mongodb


#1

I am still a newbie to Meteor and have this question.

Am I right in saying that a collection in Mongo on the server will be synchronised to the client? If so, what happens when a collection becomes very large and you’re running an app on a mobile for the first time, does it have to pull down a huge sized collection?

Thanks,
Marcus


#2

Only if you publish / subscribe to the entire collection, or you haven’t turned autopublish off yet. When you publish you’ll generally use some kind of query to limit the results. For example finding all the messages addressed to the current user:

Meteor.publish('messages-for-user', function () {
    var options = {};
    return Messages.find({ recipientUserId: this.userId }, options);
});

You can also use skip and limit in the options to further limit the amount of data sent to the client e.g.

var options = {
    skip: 20,
    limit: 10
}

#3

Thanks for the info!