美文网首页
MongoDB 命令收集

MongoDB 命令收集

作者: wlianfu | 来源:发表于2018-07-06 14:39 被阅读11次
* 启动 mongodb 服务
brew services start mongodb

* 创建集合,并自动生成 `_id` 的唯一索引
db.createCollection(name, {autoIndexId: true})

* 插入一条数据
db.collection.insertOne({});

* 插入多条数据
db.collection.insertMany([{}]);

* 查询
db.collection.find();
db.collection.findOne();

相关文章

网友评论

      本文标题:MongoDB 命令收集

      本文链接:https://www.haomeiwen.com/subject/twavuftx.html