6

I've looked at the answer posted here: Meteor: integration with Mongoose?, but I'm looking for a simpler, more modular solution if possible for using Mongoose with Meteor.js.

Is there a better way that I should be handling ODM or native support I haven't seen?

Community
  • 1
  • 1
ilmatic
  • 565
  • 3
  • 11

2 Answers2

13

I've decided to just use the Collection2 package because it seems to offer everything that I wanted from Mongoose as an ORM. This packages uses the Simple Schema as a dependency.

ajduke
  • 4,991
  • 7
  • 36
  • 56
ecbrodie
  • 11,246
  • 21
  • 71
  • 120
4

Meteor already talks to mongodb. But you can use mongoose. You might have an issue with a 10 second delay with reactivity. Also you won't be able to enjoy using it on the client.

Meteor already has methods to query/update,etc mongodb. But if want you could force mongoose in:

Install mongoose (npm install mongoose). And use it in your meteor code:

 require = __meteor_bootstrap__.require; //to use npm require must be exposed.
 var mongoose = require('mongoose');
Tarang
  • 75,157
  • 39
  • 215
  • 276
  • 2
    The issue with not having Mongoose is the inability to support schema validation with just the Collections API. – ecbrodie Oct 07 '13 at 11:53
  • 1
    @ecbrodie At the moment there isn't an official model system in meteor, but if you check up on atmosphere.meteor.com (the community repository) there are model packages that let you put in validation. Additionally when it comes to fields you could use the `check` methods recently added into meteor – Tarang Oct 07 '13 at 12:51