25.05.2017.
Tuesday.
Mongodb
Mongodb is a client sever architecture.
Write terminal
⟹sudo ./mongod open sever
⟹sudo ./mongo start work
⟹show dbs we already create database.we write this command sever list the
database.
⟹use students This command we used create a new database.student is a new
database name.
⟹db.createCollection("deatils") create anew collection.deatils is a collection
⟹db.details.insert({name:"mala",age:22})
or
⟹db.details.insert({"name":"mala","age":22}) Insert the data in collection.
⟹db.details.find() Find the insert all data.
⟹db.dropCollection Delete the collection
⟹db.dropDatabase Delete the database
⟹db.details.drop() Delete the inset data
⟹db.detais.find({},{age:22,preety}) Only find age 22 data
⟹db.detail.find({},{name:1})
⟹db.detail.find({},{name:1},_id:0)
⟹db.detail.find().preety()
No comments:
Post a Comment