Total Pageviews

Wednesday 9 July 2014

MongoDB Steps Up To Enterprise Expectations

MongoDB Steps Up To Enterprise Expectations


MongoDB, the NoSQL darling of developers, aims to improve scalability, analytics, security, and manageability in significant upgrade.
If  you're entirely new to MongoDB - this is just a very gentle introduction that gets you up and running with a sample database in just a few easy steps. 

It's really easy to get started. The steps are:

1. Install MongoDB
2. Create a Database
3. Query the Database
1. Install MongoDB
     Download your MongoDB below given link :
                       http://www.mongodb.org/download
      Set up the MongoDB environment:
                     Run this  command on cmd
                   C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data

    Start MongoDB:

                                         C:\Program Files\MongoDB\bin\mongod.exe

     Connect to MongoDB:

                                  C:\mongodb\bin\mongo.exe


2. Create a Database:
       From the mongo shell, display the list of databases, with the following operation:
        show dbs
Switch to a new database named mydb, with the following operation:
           use mydb






3. Query the Database:

The createCollection() Method

MongoDB db.createCollection(name, options) is used to create collection.

SYNTAX:

Basic syntax of createCollection() command is as follows

db.createCollection(name, options)

>use test
switched to db test
>db.createCollection("mycollection")
{ "ok" : 1 }
> 
>show collections
mycollection
system.indexes>db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } )
{ "ok" : 1 }
> 
 








No comments:

Post a Comment