简体   繁体   中英

How do you check if a Meteor.Collection is synchronized?

In my application, I have an object whose fields are Meteor.Collections, some of which are not yet saved on the server. For example:

var tables = {};
tables["existent"] = new Meteor.Collection("existent"); // existent on server
tables["nonexistent"] = new Meteor.Collection(null); // nonexistent on server

I need to check if the collection also exists on the server. Is there any other way to check for that, other than attaching some flag to each Collection?

I discovered that Collections have a field, _name , where the name passed to the constructor is stored. Therefore, if you check collection._name , it should return the name passed to it (if it was initialized with one), and null otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM