sashko
March 18, 2016, 12:23am
1
This is the comment thread for the Collections and Schemas article in the Meteor Guide.
Read the article: http://guide.meteor.com/collections.html
The comment thread for each article appears at the very bottom of the page. Use this thread to post:
Interesting articles related to the content
New ways to do things that aren’t covered in the Guide
Suggestions for Guide improvements
Or anything else related to this topic that people could find useful!
3 Likes
sashko
March 18, 2016, 12:31am
2
It works! Now we can comment on Guide articles.
2 Likes
To make the navigation a bit easier, It would be helpful if links to Previous and Next sections of the tutorial can also be added to the top of the page as well.
So how about the aldeed:collection2
package? I see you’re making use of aldeed:simple-schema
, but then show only how to validate manually.
Does the collection2 package still work with Meteor 1.3? Is its use recommended? Any disadvantages to validating automatically rather than manually?
1 Like
Is it still considered best practice to load the collection as a global variable?
1 Like
sashko
April 12, 2016, 8:37pm
6
Negative - you’d want to import it wherever you use it. Like in the todos example app:
Exporting:
}
return super.insert(ourList, callback);
}
remove(selector, callback) {
Todos.remove({ listId: selector });
return super.remove(selector, callback);
}
}
export const Lists = new ListsCollection('Lists');
// Deny all client-side updates since we will be using methods to manage this collection
Lists.deny({
insert() { return true; },
update() { return true; },
remove() { return true; },
});
Lists.schema = new SimpleSchema({
name: { type: String },
Importing:
nbrady
April 12, 2016, 8:38pm
7
@sashko I’ve been doing this recently, but now I can’t access that collection on the browser console. Is that supposed to be the case? Also, it seems slower which makes me feel like minimongo isn’t being used.
1 Like
sashko
April 12, 2016, 8:39pm
8
It’s definitely not slower, it’s exactly identical to before.
If you want to access from the console I’d suggest putting a:
global.Lists = Lists
near where you export it.
1 Like
nbrady
April 12, 2016, 8:40pm
9
Interesting. I must be doing something else wrong, because it seems to be making the round trip call to the server db before updating my view. Thanks!
sashko
April 12, 2016, 8:42pm
10
Did you import your methods on the client?
nbrady
April 12, 2016, 8:44pm
11
Yes, and tested that both the client and the server methods are being called. Can’t figure out where the latency is coming from, but only started happening today after I moved to modules.
Why is there no mention of Astronomy in the guide?
1 Like
@sashko Does Astronomy have some clashes or overlayed functionality with Apollo?
See the discussion here: https://github.com/meteor/guide/issues/10
At the end of the day we felt we had to make a decision so we picked simple schema.
You could at least mention that there is an alternative, since Astronomy is in some peoples (plural since I think there are more than me ) view preferrable?
Probably a good idea to mention it at least, @tmeasday what do you think?
Yeah, we should mention it. I’m not sure what the best format is.
1 Like
Is the Lists.deny
lines in the code above from Todos necessary? I thought all collections were deny by default as long as the insecure package is not installed.
sashko
May 5, 2016, 11:05pm
19
Yes - if you read the text right next to it, it says that we add that so that nobody else can ever accidentally call allow
on that collection.
Thanks for clarifying, but I must be blind because I don’t see the “accidentally” quote.