Other nosql database than mongodb with mongoose? - node.js

I would like to use another platform than mongodb with mongoose.
I used mongoose in my school project, and my school ask me to have a multiple database project.
Any idea ? I don't want to duplicate my code..
Thanks

Mongoose is MongoDB-specific as the website says:
elegant mongodb object modeling for node.js
so it's not possible to use it with another NoSQL tool.

CosmosDB from Azure is compatible with Mongoose and I have used this setup.
TingoDB claims to be compatible too using an additional driver called Tingus.
NeDB claims "its API is a subset of the MongoDB API" so there may be some compatibility with Mongoose too.
There may be other projects out there.

Related

mongoose or mongo node.js driver? [duplicate]

I just want to know, what are differences of mongoose and mongoJS. And, what the advantage and the lack if we use mongoose or mongoJS ?
Because we know that are many depedency that use to connecting NodeJS and MongoDB. For example mongoose and mongoJS.
Mongoose is higher level interface to Mongodb and actually uses mongodb.js, the MongoDB driver. The question is not really which one is better or worse, the question for us is
> Do the benefits of an ODM in Mongoose outweigh the drawbacks?
If you’re looking for an object modeling (ODM) tool so that you do not have to learn a lot about the way Mongodb works, then Mongoose is probably for you. If you want a fast driver and really get the most out of Mongodb, then use the native driver. We know our way around Mongodb so Mongoose would have slowed use down and our app.
If you are attempting to connect to a MongoDB database instance, then you will need some sort of driver. I have never heard of a MongoJS, but maybe you are referring to the MongoDB driver? This driver will help you communicate with the database, such as saving documents or retrieving them.
MongooseJS is an object modeling library. It sits on top of the MongoDB driver and manages relationships and object mapping. It can detect changed properties in objects, and then run validation and update operations.
You don't need to explicitly install both, as Mongoose will include the MongoDB driver when installing through NPM. You don't need either if you are not connecting to a MongoDB database.
Better you prefer mongoose since it comes with both libraries which may used to invoke instances and drivers for mongoDB connection .
mongoose is ORM - Object-relational mapping. It adds an abstract layer with many methods to manipulate data. Such as chaining like this:
Tank
.find({ size: 'small' })
.where('createdDate')
.gt(oneYearAgo)
.exec(callback);
It may be good for newbies because it's easy to use, with clear syntax. But it may be slower than native approach.
MongoJS is just a wrapper of node-mongodb-native, with some improvements. What is native? It's a driver that allows to directly call to MongoDB from Node.js program. While native version by MongoDB is the best choice for performance, it follows origin syntax same as Mongo Shell, that's quite complicate for newcomers.
Personally, I used Mongoose at first. Now I like to use node-mongodb-native, but have to add some methods to make it easier. Anyway, MongoJS is a balance solution.

What are difference of mongoose and mongoJS ? Which should I use?

I just want to know, what are differences of mongoose and mongoJS. And, what the advantage and the lack if we use mongoose or mongoJS ?
Because we know that are many depedency that use to connecting NodeJS and MongoDB. For example mongoose and mongoJS.
Mongoose is higher level interface to Mongodb and actually uses mongodb.js, the MongoDB driver. The question is not really which one is better or worse, the question for us is
> Do the benefits of an ODM in Mongoose outweigh the drawbacks?
If you’re looking for an object modeling (ODM) tool so that you do not have to learn a lot about the way Mongodb works, then Mongoose is probably for you. If you want a fast driver and really get the most out of Mongodb, then use the native driver. We know our way around Mongodb so Mongoose would have slowed use down and our app.
If you are attempting to connect to a MongoDB database instance, then you will need some sort of driver. I have never heard of a MongoJS, but maybe you are referring to the MongoDB driver? This driver will help you communicate with the database, such as saving documents or retrieving them.
MongooseJS is an object modeling library. It sits on top of the MongoDB driver and manages relationships and object mapping. It can detect changed properties in objects, and then run validation and update operations.
You don't need to explicitly install both, as Mongoose will include the MongoDB driver when installing through NPM. You don't need either if you are not connecting to a MongoDB database.
Better you prefer mongoose since it comes with both libraries which may used to invoke instances and drivers for mongoDB connection .
mongoose is ORM - Object-relational mapping. It adds an abstract layer with many methods to manipulate data. Such as chaining like this:
Tank
.find({ size: 'small' })
.where('createdDate')
.gt(oneYearAgo)
.exec(callback);
It may be good for newbies because it's easy to use, with clear syntax. But it may be slower than native approach.
MongoJS is just a wrapper of node-mongodb-native, with some improvements. What is native? It's a driver that allows to directly call to MongoDB from Node.js program. While native version by MongoDB is the best choice for performance, it follows origin syntax same as Mongo Shell, that's quite complicate for newcomers.
Personally, I used Mongoose at first. Now I like to use node-mongodb-native, but have to add some methods to make it easier. Anyway, MongoJS is a balance solution.

How to build models (ODM) in nodejs to use with nedb

I am looking for a ODM module that can be used with Nedb in NodeJs-Express. Is it somehow possible to use Mongoose or Waterline schemas in combination with nedb for validation? Mongoose and Waterline do not provide an official adapter for nedb.
At the moment have very low requirements for performance and i am working on a project for the raspberry pi therefore i would like to stick with nedb (or similar file-based nosql database).
Camo is an ODM for nedb and MongoDB, on Node.js.
I haven't been able to try it, but there is an adapter for Nedb for waterline that looks like it is dependent from building a Sails application.
It's available at: https://github.com/adityamukho/sails-nedb
EDIT: Sorry, I was incorrect, I was assuming this would work without sails, but I think this blog from the creator might prove that wrong

CRUD operations with Node.js and MongoDB

What is the optimal way to perform CRUD operations when using Node.js with MongoDB. Can I reuse the same queries that work on mongo shell? What advantages does a ODM like mongoose provide? Any other ODMs which fit into the mean.io stack?
vmr.
Well, I guess it depends of what you want to do.
Lets take what Mongoose says in their website:
Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.
Resuming what I understood of that it helps you to model your database and helps you to mantain your logic organized using model like in an MVC. It's a very mature ODM and very recomended for using with MVC.
In my personal experience I started using Monk, which did the trick for a while, but the I started to need to use aggregate and other stuff that apparently Monk can't handle. And I don't wanted to tie my system to an model because is a very mutable project, so I started using Mongoskin which is, at least for now, perfect for me because I can use pratically the same query that I use at Robomongo (Which is like a Navicat, PgAdmin, PhpMyAdmin but for MongoDB) in my ExpressJs code.
Mongoose is saving your time by mapping the JavaScript Data objects to the MongoDB database.
MongoDB and NodeJS Integration

node-mongodb-native or Mongoose

We are going to develop an application that will work with MongoDB. The users of the application will create custom entities with the help of the GUI so we don't have any predefined entities while developing the application. Should we go with mongodb-native or use Mongoose?
Thanks.
If you don't plan on using predefined entities or "schema" don't use Mongoose.
I suggest using a wrapper around the native driver, such as https://github.com/kissjs/node-mongoskin , it does everything the native driver is doing, but much simpler.

Resources