Posts

Showing posts with the label MongoDb Introduction

Restore mongoDb data

Image

Dump MongoDB Data

Image

Delete collection in mongodb

Image

Update document in mongodb

Image
Basic syntax of update() method is as follows db.COLLECTION_NAME.update (SELECTIOIN_CRITERIA, UPDATED_DATA)

Insert And Find In MongoDb

Image
To insert data into MongoDB collection, you need to use MongoDB's insert() or save()method. Basic syntax of insert() command is as follows: db.COLLECTION_NAME.insert(document) To query data from MongoDB collection, you need to use MongoDB's find() method. Basic syntax of find() method is as follows db.COLLECTION_NAME.find() To display the results in a pretty way, you can use pretty() method. SYNTAX: db.mycol.find().pretty() Apart from find() method there is findOne() method, that reruns only one document.

Drop Collections

Image
Basic syntax of drop collection command is as follows db.COLLECTION_NAME.drop()

Create Collections

Image
Basic syntax of createCollection() command is as follows db.createCollection(name, options) option is optional

drop database

Image
dropDatabase() command is used to drop a database

Create database

Image
Command use database_name is used to create a database. You can use any name for database_name. If you want to show the database you must want to insert atleast one document into it.

show dbs

Image
Command show dbs used to show all the databases

MongoDB Statistics

Image
Command db.stats() gives the detais of the particular database

MongoDB Help

Image
You can get mongodb commands and descriptions using db.help()

Getting start with mongoDb

Image
1. *open a cmd *change the directotry as mongodb installation didirectory. eg:- C:\mongodb\bin>mongod 2. *open another cmd *change the directotry as mongodb installation didirectory. eg:- C:\mongodb\bin>mongo Then you can work with the 2nd cmd

MongoDb Introduction

Image
*MongoDb is a Nosql database.This is something different from the RDBMS. *Colloction-This is like a table of RDBMS.