MongoDB is an open-source document database, and leading NoSQL database. MongoDB is written in c++
This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance oriented database.
Installing Mongo
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org
Remove the logs and the data if something got corrupted
sudo rm -rf /var/lib/mongodb/*sudo rm -rf /var/log/mongodb/*
Start Mongo
sudo mongod --config /etc/mongod.conf --smallfilesVerify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log.
Some references to Mongo documentation
http://www.mongodb.com/architecturehttp://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
http://docs.mongodb.org/manual/tutorial/getting-started/
Start the mongo shell
mongoDifferent Mongo commands
show dbsuse mydb
j = { name : "mongo" }
k = { x : 3 }
db.testData2.insert( j )
db.testData2.insert( k )
show collections
db.testData2.find()
db.testData2.find( { x : 3 } )
db.testData.findOne()
db.testData.find().limit(3)
db.users.insert (
{
name: "praveen",
age: 30,
gender: "M",
groups: [ "news", "computer" ]
age: 30,
gender: "M",
groups: [ "news", "computer" ]
}
)
No comments:
Post a Comment