当前位置:网站首页>Mongodb initialization
Mongodb initialization
2022-07-28 18:53:00 【Water and moon are clear and bright】
1, Create users and instances
use test
db.createUser({user:'test',pwd:'xxx',roles:[{role:"dbOwner",db:"test"}],passwordDigestor:"server"})
db.grantRolesToUser("test",[{role:"dbOwner",db:"test"}])
2, Create set
db.createCollection("test")
3, Enable sharding
use admin
db.runCommand({enableSharding:"test"})
4, Fragment the set
sh.shardCollection("testdb.test",{"_id":1})
5, View set fragment
db.getCollection("test").getShardDistribution();
6, Look at the index
db.test.getIndexes()
7, Create index
db.test.createIndex({"id":1,"name":1},{backgroud:1})
边栏推荐
- Ue5 gas learning notes 1.8 game special effects (gameplaycue)
- SwiftUI Swift 之正向地理编码与反向地理编码(教程含源码)
- What is the future of software testing?
- JVM four reference types
- My creation anniversary -- July 25th, 2022
- Ue5 gas learning notes 1.7 task ability tasks
- 先验、后验、似然
- jvm四种引用类型
- 1.3、链表
- Ue5 gas learning notes 1.3 attribute
猜你喜欢

Unity 之 切换语言导致报错:System.FormatException:String was not recognized as a valid DateTime.

EasyCVR新版本级联时,下级平台向上传递层级目录显示不全的原因分析

Win11怎么调亮度?Win11调屏幕亮度的四种方法

One Hot编码是什么?为什么要用它,什么时候用它?

Redis缓存雪崩、穿透、击穿,布隆过滤器,分布式锁详解

LeetCode_96_不同的二叉搜索树

Getting started with gateway

NPM cannot recognize the "NPM" item as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is correct,

2022年中国企业服务产业市场行情

@The difference between Autowired and @resource
随机推荐
Apple develops a complete creation process of Apple certificate and description file
Attention mechanism and code implementation
Differences between RDB and AOF for redis persistence
Interviewer: what are the usage scenarios of ThreadLocal? How to avoid memory leakage?
“讳疾忌医”的开源走不远
Golang is packaged and released to various platforms
Leetcode binary tree class
Ue5 gas learning notes 1.3 attribute
Ue5 gas learning notes 1.1 capability system component
112. Use the self-developed proxy server to solve the cross domain access error encountered when uploading files by SAP ui5 fileuploader
全新升级!《云原生架构白皮书 2022 版》重磅发布
1.3、链表
What is the future of software testing?
行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
Ue5 gas learning notes 1.4 attribute set
什么样的知识付费系统功能,更有利于平台与讲师发展?
GC garbage collector details
LeetCode_ 343_ integer partition
The switching language of unity causes an error: system FormatException:String was not recognized as a valid DateTime.
Cause analysis and solution of video jam after easycvr is connected to the device