MongoDB配置 本地启动
c:\MongoDB\bin>mongod.exe --dbpath "C:\\MongoDB\data\db" --logpath "c:\\MongoDB\
Data\log\Mongodb.log"
C:\Users\jiangchunming>cd C:\MongoDB\bin
C:\MongoDB\bin>mongo.exe --port 27017
Mongodb插入时间
> db.orders.insert({id:104,title:"yuiyuig",price:18.9,addtime:new Date(2017,0,31
,12,01,00)})
删除数据库
查询数据库
MongoDB修改数据
{ "_id" : ObjectId("5901a40981f45b10993c9d58"), "id" : 1101, "name" : "person",
"age" : 222, "address" : "china" }
> db.user.insert({id:1101,name:test})
2017-04-27T16:22:31.997+0800 E QUERY [thread1] ReferenceError: test is not de
fined :
@(shell):1:25
> db.user.insert({id:1101,name:"test"})
WriteResult({ "nInserted" : 1 })
> db.user.find()
{ "_id" : ObjectId("5901aa5081f45b10993c9d59"), "id" : 1101, "name" : "test" }
> db.user.insert({id:1102,name:"dest"})
WriteResult({ "nInserted" : 1 })
> db.user.find()
{ "_id" : ObjectId("5901aa5081f45b10993c9d59"), "id" : 1101, "name" : "test" }
{ "_id" : ObjectId("5901aa6681f45b10993c9d5a"), "id" : 1102, "name" : "dest" }
*******************************************mongoDB修改数据操作*********************************************
修改Id
> var model = db.user.findOne({"name":"test"})
> model.id=1103
1103
> db.user.update({"name":"test"},model)
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.user.find()
{ "_id" : ObjectId("5901aa5081f45b10993c9d59"), "id" : 1103, "name" : "test" }
{ "_id" : ObjectId("5901aa6681f45b10993c9d5a"), "id" : 1102, "name" : "dest" }
>
*******************************************mongoDB修改数据操作*********************************************
https://git.oschina.net/lookingdreamer/RexDeploy_v1
*******************************************************************************************************************
MongoDB插入时间笔记
>db.orders.insert({id:104,title:"yuiyuig",price:18.9,addtime:new Date(2017,0,31
,12,01,00)})
插入当前时间:
> db.orders.insert({id:104,title:"yuiyuig",price:18,addtime:new Date()})
WriteResult({ "nInserted" : 1 })
http://xiaorui.cc/2014/05/01/mongodb%E7%9A%84%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E7%9A%84%E6%8F%92%E5%85%A5%E5%8F%8A%E6%9F%A5%E8%AF%A2/
插入当前时间:
> db.orders.insert({id:104,title:"yuiyuig",price:18,addtime:new Date().toLocaleS
tring()})
删除数据库
show dbs --展示数据库
db.dropDatabase() --删除数据库
D:\MongoCTest\RiderPosition
D:\Projects\OTS\ExFresh.OTS\1. Presentation\1.2 API\Contract\O2OManager