如何在命令行插入当前时间的数据
db.favors.insert({"xsId":ObjectId("5551335b322ae4de5a53cfa4”), "feedId" : ObjectId("555023342284ba365a652a2f"), "feedUserId" : ObjectId("554f2a9a0c02c2fa51456706"), "hasRead" : true, "date" : date.now()})
报错:2015-05-13T11:48:48.210+0800 SyntaxError: Unexpected identifier
db.favors.insert({"xsId":ObjectId("5551335b322ae4de5a53cfa4”), "feedId" : ObjectId("555023342284ba365a652a2f"), "feedUserId" : ObjectId("554f2a9a0c02c2fa51456706"), "hasRead" : true, "date" : ISODate("2015-05-11T12:49:46.121Z")})
报错:2015-05-13T11:52:40.841+0800 SyntaxError: Unexpected identifier
急急急,谢谢!
The first
ObjectId("5551335b322ae4de5a53cfa4”)
uses Chinese quotation marks;I don’t know your
mongodb
什么版本,date.now()
是不合法的,可以使用Date()
waitReference
http://www.cnblogs.com/yuechaotian/archive/2013/02/02/2889824.html