please briefly explain what are the differences between mongoose, mongodbapi & mongos
Does it come with the installation of MongoDB or do they need extra installations?
please briefly explain what are the differences between mongoose, mongodbapi & mongos
Does it come with the installation of MongoDB or do they need extra installations?
You need to know these keywords when you're talking about MongoDB database, Explaining all these as most of them are inter -linked.
Database keywords :
mongod
& then execute mongo
to access database. Ref : mongodSharding : Sharding is a method for distributing data across multiple machines. So sharding has a group of replica sets where each replica set has different data of same application. you'll go to sharding only if you've large datasets & larger than the system’s RAM stress the I/O capacity of disk drives. In general if you're starting from scratch you might not need it that early. Ref : sharding
mongos : So when you finally have to do sharding & have a sharded cluster then mongos instances provide the interface between the client applications and the sharded cluster. mongos will route queries to respective shard(replica set). So you'll connect to mongos rather than a replica set. Ref : mongos
Driver keywords :
MongoDB Driver : When you're using node.js for development & say mongodb driver then it is native mongodb driver which is pretty much sufficient to access database through code. Ref : node-mongodb-native
const MongoClient = require('mongodb').MongoClient;
Mongoose : This is a node.js library/driver which is a wrapper to mongodb driver. It is an Object Data Modeling (ODM). In basic terms to say, as MongoDB is schema-less if you wanted to make it work like SQL which is schema based then you can use mongoose. So you can create schemas for collections - which can be used for schema validation while writing data to DB that way you can ensure your collection has certain data across all documents, Though using this driver is optional but there are mixed-opinions from users & many features which might lean you towards it. Ref : mongoosejs & Introduction-to-mongoose
const mongoose = require('mongoose')
There are many other drivers based on language. Ex:- PyMongo for python.
Shell keywords :