Mongoose Plugin

What We Will Cover Plug-ins Middleware Hooks Discriminators Promises Main Take-away – MongoDB is “schema-less” – Everything in Mongoose starts with a Schema Schema –

MongoDb – Query for Array Element

db.Posts.insert({ PostBy: “Pankaj Choudhary”, Time:new Date(), Title:”MonogoDB Day2″, Tags:[ “NoSQL”, “MonogoDB”, “Database”, “SQL” ], Likes:3, Comment: [ { CommentBY : “Sanjeev”, Text: “Nice Show” },{

MongoDb – Tips

MongoDB Data Types Object This data type stores embedded documents. When a document contains another document in the form of key-value pair then such type

MonogDb – Index

Index Overview Index Creation Process B-Tree and how index works Default _id index with ObjectID getIndexes() Create new index – Which Fields should be added

MongoDB Aggregation 02

db.Persons.aggregate([ {$project: {isActive: 1, name:1, gender:1}} ]) //OUTPUT : { “_id” : ObjectId(“5f1f23e002c633f9f578dcde”), “name” : “Aurelia Gonzales”, “isActive” : false, “gender” : “female” } db.Persons.aggregate([

MongoDb – Queries

Sample Document Git { “index”: NumberInt(0), “name”: “Aurelia Gonzales”, “isActive”: false, “registered”: ISODate(“2015-02-11T04:22:39+0000”), “age”: NumberInt(20), “gender”: “female”, “eyeColor”: “green”, “favoriteFruit”: “banana”, “company”: { “title”: “YURTURE”,