Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Mongoose in Meteor?

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?

like image 502
ilmatic Avatar asked Dec 27 '12 02:12

ilmatic


2 Answers

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.

like image 162
ecbrodie Avatar answered Sep 28 '22 02:09

ecbrodie


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');
like image 29
Tarang Avatar answered Sep 28 '22 02:09

Tarang