Mongo Db M101 JS

Description

Note on Mongo Db M101 JS, created by Muhammad Akif on 06/01/2018.
Muhammad Akif
Note by Muhammad Akif, updated more than 1 year ago
Muhammad Akif
Created by Muhammad Akif almost 7 years ago
17
0

Resource summary

Page 1

What is mongo db? MongoDb document based no-sql database. To query mongodb we use json. Benefits:  i) Programmers only need to create a data model that fits there application. ii) mongodb predicates on data models to it is easy to shard data or distribute data on multiple servers. iii) Supports scaling out feature. iv) We dont need to depend on deployment model.it can deployed easily on one server or one node,a few nodes or a hundred of shards. v)  In MongoDB, a write operation is atomic on the level of a single document, even if the operation modifies multiple embedded documents within a single document.When a single write operation modifies multiple documents, the modification of each document is atomic, but the operation as a whole is not atomic and other operations may interleave.

Page 2

Mongo Shell Node js communicate with mongodb using v8 js. V8 is written in c++. Other way to communicate with mongo db is through mongo shell which is written in c++  when we enter commands it interprets using its own v8 bindings.

Page 3

BSON(Binary JSON): Node js communicate with mongo db using bson data format. mongo send and  receive data in bson format. 1)Lightweight  2) Traversable. 3) Efficient Difference between json and bson is that bson support more datatypes as compare to json. If you create a new document without an _id field, MongoDB automatically creates the field and assigns a unique BSON ObjectId. BSON plays the role of a canonical (i.e., "unique") representation of documents shared across all drivers and tools.

Page 4

CURD using a mongo db query language. db is a global variable used to set current database. help command used check available commands. use  now db point to dbname. switched to defined db. if exist only switch otherwise create new  db. same with collections. find() return all documents. find({}) return all documents. find({your constraints}); returned all records matching constraints. Find command is only a array of document but it is a cursor object. Shell is a javascript interpreter we can write javascript in the shell. var c = db.collection.find(); return a cursor to records which is stored in variable c; c.hasNext(); return true if next record is available and false if no row in next. c.next(); return that document.

Show full summary Hide full summary

Similar

Architecture and Science Connections
JoseAmbassador
Structure and Function of Lymph Node and Spleen
Matthew Coulson
Node.Js
Kyle Peters
Making my app
johngalt
Getting started with Node and Mongo
James Drummond
Architecture and Science Connections
M Sirsi
Describe - Practice questions and answers for AS Physics A
nikeishabk
Belonging in Jasper Jones and Related Texts
robminiter2
anatomy of the moving body: Skeletal system
Rupa Kleyn
Topic 1 Quiz - Elements & The Periodic Table
Musicdudejoe
Queen Elizabeth Quiz
Natalie Robbins