> db.student.drop()
true
> db.student.insert({"_id": 1, "name":"zhangsan", "age": 28})
WriteResult({ "nInserted" : 1 })
> db.student.find()
{ "_id" : 1, "name" : "zhangsan", "age" : 28 }
> db.student.insert({"_id": 1, "name":"zhangsan", "age": 27})
WriteResult({
"nInserted" : 0,
"writeError" : {
"code" : 11000,
"errmsg" : "E11000 duplicate key error collection: zyhdb.student index: _id_ dup key: { : 1.0 }"
}
})
> db.student.find()
{ "_id" : 1, "name" : "zhangsan", "age" : 28 }
> db.student.save({"_id": 1, "name":"zhangsan", "age": 27})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.student.find()
{ "_id" : 1, "name" : "zhangsan", "age" : 27 }
> db.student.insert([{"_id": 2, "name": "lisi"},{"_id": 3, "name": "wangwu"}, {"_id": 4, "name": "zhaoliu", "age": 28}])
BulkWriteResult({
"writeErrors" : [ ],
"writeConcernErrors" : [ ],
"nInserted" : 3,
"nUpserted" : 0,
"nMatched" : 0,
"nModified" : 0,
"nRemoved" : 0,
"upserted" : [ ]
})
> db.student.find()
{ "_id" : 1, "name" : "zhangsan", "age" : 27 }
{ "_id" : , "name" : "lisi" }
{ "_id" : , "name" : "wangwu" }
{ "_id" : 4, "name" : "zhaoliu", "age" : 28 }
> for(var i=; i<; i++){db.fortest.insert({num: i})}
WriteResult({ "nInserted" : })
> db.fortest.find()
{ "_id" : ObjectId("eceadaeabab"), "num" : 0}
{ "_id" : ObjectId("eceadaeabab"), "num" : 1}
{ "_id" : ObjectId("eceadaeabab"), "num" : 2}
{ "_id" : ObjectId("eceadaeabab"), "num" : 3}
{ "_id" : ObjectId("eceadaeabab"), "num" : 4}
{ "_id" : ObjectId("eceadaeababa"), "num" : 5}
{ "_id" : ObjectId("eceadaeababb"), "num" : 6}
{ "_id" : ObjectId("eceadaeababc"), "num" : 7}
{ "_id" : ObjectId("eceadaeababd"), "num" : 8}
{ "_id" : ObjectId("eceadaeababe"), "num" : 9}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有