quave:collections is a Meteor package that allows you to create your collections in a standard way.
meteor add quave:collections
To use Type or Hooks options you need to install meteor-collection-hooks
meteor add matb33:collection-hooks
To use Schema options you need to install meteor-collection2
meteor add aldeed:firstname.lastname@example.org meteor npm install --save simpl-schema
To use Helpers options you need to install meteor-collection-helpers
meteor add dburles:collection-helpers
Check the documentation of each package to learn how to use them.
Every application connection to databases usually need the same features:
- A way to access object instances when they come from the database: helpers
- Provide new methods to collections: collection
- Add a few hooks to react to changes in different collections: hooks
- Map some types to avoid manual conversion all the time: types
- Valid the data before persisting: schemas
- Centralize behaviors: composers
Meteor.users collection in the same way as any other collection.
We are not reinventing the wheel, we are mounting the wheels in the vehicle :).
You can't apply
typeFieldswhen you inform an instance of a MongoDB collection, usually you only use an instance for
Meteor.users. In this case I would recommend you to don't add fields with custom types to the users documents.
If you want to use your objects from the database also in the client but you don't use your whole collection in client (you are not using Mini Mongo) you need to instantiate your type also in the client, you can do this importing your type and calling
register. This is important to register it as an EJSON type.