Best Practice of Connecting MongoDB Using Mongoose ODM

Mongoose ODM provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box. Mongoose is the Object Document Mapper (ODM) for Node.js and it is written on the top of the Node.js and native MongoDB driver. Mongoose ODM gives the ability to define a schema for their documents which can then be used to map documents to objects in their programming language. It makes you to type-caste & validate your object before saving your document to MongoDB
(more…)

Read More

MongoDB – GridFS Using Mongoose On Node.js

MongoDB and Node.js are often used together because of their shared use of JavaScript and its object notation (JSON & BSON). MongoDB is a type of NoSQL database will stores its data in documents. MongoDB stores data as BSON with a limitation of document size 16 MB, Where BSON is a binary serialization format used to store documents and make remote procedure calls in MongoDB. GridFS is MongoDB’s solution for storing and retrieving files that exceed the BSON-document size limit of 16 MB. Instead of storing a file in a single document, GridFS divides the file into parts, or chunks, and stores each chunk as a separate document.

(more…)

Read More