MongoDB Insert(插入)

插入方法 描述
db.collection.insertOne() Inserts a single document into a collection.
db.collection.insertMany() db.collection.insertMany() inserts multiple documents into a collection.
db.collection.insert() db.collection.insert() inserts a single document or multiple documents into a collection.

1.如果collection,不存在则创建集合,再插入
2.如果不指定_id列,会自动创建.必须保证_id唯一,否则会报错

你可能感兴趣的:(mongodb,mongodb)