版权声明:本文为博主原创文章,未经博主允许欢迎转载,请注明原文链接。一起交流,共同进步。 https://blog.csdn.net/newbie_907486852/article/details/82722060
mongodb之insert操作
插入操作运算符:
运算符 | 含义 |
---|---|
db.collection.insertOne() | 插入一个文档 |
db.collection.insertMany() | 插入多个文档 |
db.collection.insert() | 插入一个或者多个 |
db.products.insertOne( { _id: 10, "item" : "packing peanuts", "qty" : 200 } );
db.products.insert( { _id: 10, item: "box", qty: 20 } )
db.products.insertMany( [
{ _id: 14, item: "envelopes", qty: 60 },
{ _id: 15, item: "stamps", qty: 110 },
{ _id: 16, item: "packing tape", qty: 38 }
] );