KEMBAR78
Introduction to MongoDB and CRUD operations | PPTX
MongoDB:
• It is a database.
• It is document-oriented database.
• It is No-SQL database.
• NoSQL (originally referring to "non SQL" or "non
relational“.
RDBMS VS MongoDB
• MongoDB is an open-source document database.
•open-source - refers to any program whose source code is
made available for use or modification.
• Each document can have the same or different structure.
• MongoDB is written in C++.
• It is very easy to install and setup the MongoDB.
• Schema less : Number of fields, content and size of the
document can differ from one document to another.
• Deep query-ability : supports dynamic queries on
documents using a document-based query language .
• Ease of scale-out: extra capability and resources can be
added to one single component easily.
• No complex joins.
1. Go to http://www.mongodb.org/downloads
Click on Community Server link. Then you will find
like below for windows.
Download and install it .
1. Go to C drive if you have installed mongodb in c drive.
2. Create folder db inside data. (c:datadb)
3. Open command prompt.
4. Type mongod. Server will start on port 27017.
5. Open another command prompt.
6. Type mongo
Now you are ready to do CRUD operations.
We will use test database which is by default.
CRUD means Create, Read, Update, Delete
Create Operations
Create or insert operations add new documents to
a collection. If the collection does not currently exist,
insert operations will create the collection.
Syntax for read or query documents:
db.COLLECTION_NAME.find()
Example:
db.mycollection.find();
Method for update documents:
Syntax:
db.COLLECTION_NAME.update(SELECTIOIN_CRITERI
A, UPDATED_DATA)
Example:
db.mycollection.update({name:’Anand’},{$set:{name:’ak’}});
Method for delete documents:
Syntax:
db.collection_name.remove (DELETION_CRITERIA)
Example:
db.mycollection.remove({name:’ak’});

Introduction to MongoDB and CRUD operations

  • 1.
    MongoDB: • It isa database. • It is document-oriented database. • It is No-SQL database. • NoSQL (originally referring to "non SQL" or "non relational“.
  • 2.
  • 3.
    • MongoDB isan open-source document database. •open-source - refers to any program whose source code is made available for use or modification. • Each document can have the same or different structure. • MongoDB is written in C++.
  • 4.
    • It isvery easy to install and setup the MongoDB. • Schema less : Number of fields, content and size of the document can differ from one document to another. • Deep query-ability : supports dynamic queries on documents using a document-based query language . • Ease of scale-out: extra capability and resources can be added to one single component easily. • No complex joins.
  • 5.
    1. Go tohttp://www.mongodb.org/downloads Click on Community Server link. Then you will find like below for windows. Download and install it .
  • 6.
    1. Go toC drive if you have installed mongodb in c drive. 2. Create folder db inside data. (c:datadb) 3. Open command prompt. 4. Type mongod. Server will start on port 27017. 5. Open another command prompt. 6. Type mongo Now you are ready to do CRUD operations. We will use test database which is by default.
  • 7.
    CRUD means Create,Read, Update, Delete Create Operations Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection.
  • 8.
    Syntax for reador query documents: db.COLLECTION_NAME.find() Example: db.mycollection.find();
  • 9.
    Method for updatedocuments: Syntax: db.COLLECTION_NAME.update(SELECTIOIN_CRITERI A, UPDATED_DATA) Example: db.mycollection.update({name:’Anand’},{$set:{name:’ak’}});
  • 10.
    Method for deletedocuments: Syntax: db.collection_name.remove (DELETION_CRITERIA) Example: db.mycollection.remove({name:’ak’});