暗黑模式
Recipe
路线数据库MongoDB
Referenced documents VS Subdocuments
js
parentDoc.childDocA.name = 'xxx'; // childDocA is a subdocument
parentDoc.childDocB.name = 'yyy'; // childDocB is a referenced document
parentDoc.save(); // Does not save referenced document(childDocB) but save childDocA
1
2
3
2
3
Reconfig Replica set
如果复制集所在的电脑IP更改了,例如从 192.168.1.15 变为了 192.168.1.101,那么需要重新配置复制集:
bash
mongosh --port 28017
# in mongosh
use admin
db.auth("admin")
...
var cfg = rs.conf()
cfg.members[0].host = "192.168.1.101:28017"
rs.reconfig(cfg)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9