Collections and Schemas

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:

  1. Interesting articles related to the content
  2. New ways to do things that aren’t covered in the Guide
  3. Suggestions for Guide improvements

Or anything else related to this topic that people could find useful!

3 Likes

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

Negative - you’d want to import it wherever you use it. Like in the todos example app:

Exporting:

Importing:

@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

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

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!

Did you import your methods on the client?

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 :slight_smile: ) 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.

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.