mongodb-win32-x86_64-2008plus-ssl-3.2.0-signed Hello World

 

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. all rights reserved.

PS C:\Users\Administrator> mongo
2016-05-23T07:27:25.301+0800 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, will zero-out data fil
es
MongoDB shell version: 3.2.0
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, seehttp://docs.mongodb.org/Questions? Try the support grouphttp://groups.google.com/group/mongodb-user> use mydatabaseswitched to db mydatabase> db.persons.insert({name:"xiongjiajia"})WriteResult({ "nInserted" : 1 })> show dbslocal       0.000GBmydatabase  0.000GB>show collectionspersons
       

       









> db.system.indexes.find()
> db.persons.find()
{ "_id" : ObjectId("57424110232724e077252bd8"), "name" : "xiongjiajia" }
> db.persons.update({name:"xiongjiajia"},{$set:{name:"admin"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.persons.find()
{ "_id" : ObjectId("57424110232724e077252bd8"), "name" : "admin" }
>  var p=db.persons.findOne();
> p
{ "_id" : ObjectId("57424110232724e077252bd8"), "name" : "admin" }
> db.persons.update(p,{name:"root"})
WriteResult({ "nMatched" : 1, "nUpserted" :0, "nModified" : 1 })
> var p=db.persons.findOne();
> p
{ "_id" : ObjectId("57424110232724e077252bd8"), "name" : "root" }
> db.persons.update({name:"root"},{$set:{name:"admin",age:1}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> var p=db.persons.findOne();
> p
{
        "_id" : ObjectId("57424110232724e077252bd8"),
        "name" : "admin",
        "age" : 1
}
> db.persons.remove({age:2})
WriteResult({ "nRemoved" : 0 })
> db.persons.find()
{ "_id" : ObjectId("57424110232724e077252bd8"), "name" : "admin", "age" : 1 }
> db.persons.remove({age:1})
WriteResult({ "nRemoved" : 1 })
> db.persons.find()
>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326939844&siteId=291194637