Book Image

Mastering Spring Application Development

By : Anjana Mankale
Book Image

Mastering Spring Application Development

By: Anjana Mankale

Overview of this book

Table of Contents (19 chapters)
Mastering Spring Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing MongoDB and creating a database


In this section we shall install MongoDB and create a database:

  1. Download the MongoDB database at http://www.mongodb.org/downloads.

  2. Configure the data folder by executing the following command in the bin folder:

    >mongod.exe -dbpath e:\mongodata\db 
    
  3. Start mongod.exe in another Command Prompt.

  4. Execute the following command:

    >show databaseExecute
    

    The >show dbs command also works fine with MongoDB.

  5. Execute the following command to create a new database, namely eshopdb.

    >use new-eshopdb
    
  6. Executing > show dbs will still show that eshopdb hasn't been created yet; this is because it doesn't contain any collections. Let's add some collections in the next step, once a collection is added.

  7. Execute the following snippet in the Command Prompt. The following snippets will insert sample documents into the collection:

    db.eshopdb.insert({cust_id:1,name:"kishore",address:"jayangar"})
    db.eshopdb.insert({cust_id:2,name:"bapi",address:"HAL Layout"})
    db.eshopdb.insert({cust_id:3,name:"srini",address:"abbigere street"})
    db.eshopdb.insert({cust_id:4,name:"sangamesha",address: "Kattarigupee layout"})