Getting Started with MongoDB

I’ve only ever used SQL Server and am only familiar with relational databases.  You’ve probably heard all the talk about NoSQL and I thought I’d have a quick look at MongoDB which saves data in JSON documents rather than in relational format.

I’ve just managed to install it and set it up as a service running on Windows and it seems to work with out any problems.  Here are the instructions I followed

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

I extracted the contents of the download to

D:\mongodb

and saved the following in a batch file so I can just double click to connect.

D:\mongodb\bin\mongo.exe

Just type “exit” to exit.

There is a very quick example of how to add and extract data on this page

db.test.save( { a: 1 } )
db.test.find()

When you run the find() command you’ll see that you get an “_id” field back. This is the unique identifier for the document, equivalent to a primary key in SQL. You can set this value in the document you save, for example

db.test.save( {_id: 1, a: 1 } )

That’s as far as I’ve got so far but I’ve also just signed up to “M101J: MongoDB for Java Developers” in https://education.mongodb.com/. It’s been 14 years since I last looked at any Java code so it might be a struggle.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s