随笔分类 -  MongoDB

摘要:1. 初始化数据 db.createCollection("t_demo") db.t_demo.insertMany([ {num:[1,2,3], obj: [{name: "zhang1", age: 12}, {name: "li1", age: 13}]}, {num:[1,2], obj 阅读全文
posted @ 2022-02-19 16:23 林宇风 阅读(417) 评论(0) 推荐(0) 编辑
摘要:1. 安装 使用 docker-compose 参考: https://hub.docker.com/_/mongo version: '3.1' services: mongo: image: mongo restart: always environment: MONGO_INITDB_ROOT 阅读全文
posted @ 2022-02-19 12:32 林宇风 阅读(172) 评论(0) 推荐(0) 编辑
摘要:use test db.createCollection('t1') 使用test数据库, 并创建集合, 就会自动创建 test 数据库了 阅读全文
posted @ 2022-02-11 16:22 林宇风 阅读(102) 评论(0) 推荐(0) 编辑
摘要:创建账户 use admin db.createUser( { user: "Admin", pwd: "admin_password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] # 指定数据库 } ) 集群模式使用root权 阅读全文
posted @ 2022-01-17 12:31 林宇风 阅读(212) 评论(0) 推荐(0) 编辑
摘要:原文地址: https://www.jianshu.com/p/e7e70ca7c7e5 1. 集群架构(生产可用) MongoDB机器信息 192.168.252.121 192.168.252.122 192.168.252.123 mongos mongos mongos config ser 阅读全文
posted @ 2022-01-17 11:33 林宇风 阅读(861) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示