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?
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.
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');
Related
I am bit confuse right now, I am new to graphql and now I have seen some people use mongodb with mongoose and others use with typeorm, I dont know which one is better to use with nodejs, typescript, graphql, mongodb.
can anyone guide me on this please?
I want to connect mongodb with elasticsearch. I have used logstash-input-mongodb plugin, but this doesn't take my elasticsearch data updates. So when i update a document at mongodb it doesn't change at elasticsearch. I have searched through web but couldn't find a way to fix it? Is it a bug?
Which other plugins or tools do you suggest me to use for making the connection?
You could try mongoosastic however I think its community is a little bit small and there have been practically no updates since a year ago.
Looking to build a react-native app and was going to use MongoDB Atlas for the database, express/apollo/graphql mixed in there for better querying. Has anyone had any experience with these techs together? especialy MongoDB Atlas and express?
I'm not sure how all these techs link together. Any tutorials will be handy as well. Thanks.
MongoDB Atlas provides you the endpoint where you can connect to the replica set and use mongodb.
This takes over many other factors such as installing mongodb, backups and restore. Also, the endpoint(connection string) provided by MongoDB Atlas comes with built-in:
Authentication enabled
Authorized users
Replica set to maintain HA
All of these factors give you advantages of using MongoDB Altas so that you can focus on developing your apps
Using mongodb atlas is likely to give you same things you would expect from your local mongodb and express with additional advantages listed above
If you're planning on using MongoDB and GraphQL in a NodeJs service in the interest of getting better querying capabilities, I'd suggest looking at GraphQL-to-MongoDB, or how I learned to stop worrying and love generated query APIs.
Disclaimer: I wrote that blog post.
MongoDB Atlas just announced GraphQL support for Atlas and Stitch. In a nutshell , you can easily generate/ create Schema for a collection in Atlas, Define access rules, relations and generate queries and mutations. GraphiQL is also integrated to run and test your queries. Check this blog post for more details - https://www.mongodb.com/blog/post/introducing-graphql-support-in-mongodb-atlas-with-stitch
I want to use mongoose in my meteor app for validation and also because I am quite comfortable with it coming from Node background. I read at multiple places that using mongoose gives 10 sec delay in comparison to using Meteor's in-built Mongo driver. But on this question (Meteor.js and Mongoose Compatibility), it says
EDIT: As of December 2013, Meteor's Mongo package listens to Mongo's
oplog, and will reflect any changes done by external mongoose activity
in real-time.
Is it true that reactivity issues with mongoose has been solved? If not, is there any other package I can use? Thanks
I can't find article on Meteor blog, but yes, there is no more problem with reactivity, changes are pushed on instant, not after 10 seconds.
I would recommend that you look at aldeed:simple-schema and possibly even aldeed:collection2 and aldeed:autoform. Their functionality is not a direct overlap, but they give you similar schema validation capability as mongoose.
I want to use the Mongoose ORM with meteor mainly on the server side until meteor releases a schema approach.
Can i call Mongoose ORM operations within Meteor methods and publish using the Mongoose retrieving methods likefindById.
Are there any potential problems or meteor features that i would miss out on if i approached things this way?
Unfortunately, there are problems. We've wanted to do the same thing, but (out of the box) the mongoose package doesn't use Meteor's DDP protocol, and won't trigger the reactivity when you do CRUD operations. There may be also issues with Fibers/etc, although we haven't pushed with Mongoose enough to find them.
The good news is that (server-side) Meteor watches the db for any changes, DDP-induced or not, and will pick them up in about 10-seconds or so. It will then publish them to the clients, which will pick them up in standard meteor format.
We've been looking for a mongoose-ddp-meteor package to solve this issue, and might have to end up building one ourselves.
EDIT:
As of December 2013, Meteor's Mongo package listens to Mongo's oplog, and will reflect any changes done by external mongoose activity in real-time.