08、MongoDB实战:MongoDB的文档操作-插入文档

MongoDB 的文档操作-插入文档

    • 1.插入单个文档
    • 1.1 insert 函数
    • 1.2 save 函数
    • 1.3 insertOne 函数
  • 2.插入多个文档
    • 2.1 insert 或者 save 函数
    • 2.2 insertMany 函数
  • 3.通过变量插入文档
    • 3.1 通过变量插入单个文档
    • 3.2 通过变量插入多个文档

1.插入单个文档

1.1 insert 函数

  • 语法格式为:db.COLLECTION_NAME.insert(document)
  • eg:向dqcgm集合中插入单个文档。db.dqcgm.insert({titl

版权声明:本文不是「本站」原创文章,版权归原作者所有 | 原文地址: