开发者社区 问答 正文

学习MongoDB基本操作中如何插入文档

学习MongoDB基本操作中如何插入文档

展开
收起
不变的狗子 2021-09-28 11:31:32 825 分享 版权
1 条回答
写回答
取消 提交回答
  • 热爱技术
    db.products.insertOne( { item: "card", qty: 15 } );
    insertMany
    db.products.insertMany( [ { _id: 10, item: "large box", 
    qty: 20 }, { _id: 11, item: "small
    box", qty: 55 }, { _id: 12, item: "medium box", qty: 30 } 
    ] );
    Insert
    db.collection.insert( <document or array of 
    documents>, { writeConcern: <document>, ordered: 
    <boolean> } )
    
    

    资源来源:电子书《玩转MongoDB从入门到实战》,下载链接:https://developer.aliyun.com/topic/download?id=1060

    2021-09-28 11:32:53
    赞同 展开评论