当前位置:网站首页>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})
边栏推荐
- One Hot编码是什么?为什么要用它,什么时候用它?
- 2022.7.26 constructor, interview: the role of new, deep copy and shallow copy
- Introduction and advanced level of MySQL (6)
- Go concurrency one
- Full analysis of warehouse building on the lake: how to build a lake warehouse integrated data platform | deepnova technology collection series open class phase IV
- 视频融合云服务EasyCVR平台白名单功能如何使用?
- Apple develops a complete creation process of Apple certificate and description file
- @The difference between Autowired and @resource
- leetcode 二叉树类
- 行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
猜你喜欢

Three minutes to understand, come to new media

MYSQL入门与进阶(十)

What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?

1.2、队列

EasyCVR设备离线后无法再次上线该如何解决?

Bubble sorting and Related videos

历史上的今天:微软收购 QDOS;模型检测先驱出生;第一张激光照排的中文报纸...

真正的 HTAP 对用户和开发者意味着什么?

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

Redis cache avalanche, penetration, breakdown, bloom filter, detailed explanation of distributed lock
随机推荐
MySQL日期函数
Ue5 gas learning notes 0.1 case Preview
New upgrade! The 2022 white paper on cloud native architecture was released
Ue5 gas learning notes 1.1 capability system component
JVM tuning
微信安装包11年膨胀575倍,UP主:“98%的文件是垃圾”;苹果应用商店被曝大量色情App;四大科技巨头呼吁废除闰秒|极客头条...
Introduction and advanced level of MySQL (8)
MySQL index usage and optimization
When golang encounters high concurrency seckill
2022杭电多校第二场1011 DOS Card(线段树)
2022年牛客多校第2场 J . Link with Arithmetic Progression (三分+枚举)
数字经济时代的开源数据库创新 | 2022开放原子全球开源峰会数据库分论坛圆满召开
Software testing needs more and more talents, but fewer people are on the road of testing?
Ue5 gas learning notes 8.0 references
行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
SwiftUI 组件之如何实现电话号码掩码隐藏部分的文本字段TextField(教程含源码)
EasyCVR新版本级联时,下级平台向上传递层级目录显示不全的原因分析
Ue5 gas learning notes 1.5 gameplay effects game effects
1.3 linked list
Gaode map realizes customized small blue dots, customized point markers, drawing polygon / circular areas, and displaying or hiding customized point markers according to the movement of the map