mongo insert可以添加多条数据

db.inventory.insertOne(
{ item: "canvas", qty: 100, tags: ["cotton"], size: { h: 28, w: 35.5, uom: "cm" } }
)

db.inventory.insertMany([
{ item: "journal", qty: 25, tags: ["blank", "red"], size: { h: 14, w: 21, uom: "cm" } },
{ item: "mat", qty: 85, tags: ["gray"], size: { h: 27.9, w: 35.5, uom: "cm" } },
{ item: "mousepad", qty: 25, tags: ["gel", "blue"], size: { h: 19, w: 22.85, uom: "cm" } }
])

新增一条或多条数据: db.collection.insert('数据')

eg:

db.inventory.insert(
{ item: "canvas", qty: 100, tags: ["cotton"], size: { h: 28, w: 35.5, uom: "cm" } }
)

新增一条或多条数据: db.collection.insert('数据')

db.inventory.insert(
{ item: "canvas", qty: 100, tags: ["cotton"], size: { h: 28, w: 35.5, uom: "cm" } }
)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、MongoDB简介 1.概述 ​ MongoDB是一个基于分布式文件存储的数据库,由C++语言编写。旨在为WE...
    郑元吉阅读 984评论 0 2
  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,726评论 0 3
  • MongoDB插入文档: db.COLLECTION_NAME.insert(document) 示例: db.m...
    bless_vi阅读 446评论 0 0
  • 一、安装 1 brew install mongodb 2 配置bash_profile MONGODB_HOME...
    佐佐木君阅读 306评论 0 0
  • 窗外有两棵杨树和一颗槐树,即使 窗棱也许不太碍事,或者镜子在左边 日常活动中,后置式的迷恋 我将不安地停留 宁静于...
    齐大鲸阅读 376评论 1 14