- MongoDB Tutorial - Tutorialspoint
- Indexes — MongoDB Manual
- Types of index
- Single Field
- Compound Field
- Multikey Index
- Geospatial Index
- Text Index
- Hashed Index
- Types of index
- MongoDB Limits and Thresholds
GUI
- Robo 3T | Free, open-source MongoDB GUI (formerly Robomongo)
- Robo 3T
- Studio 3T
- MongoDB 可视化工具 Studio 3T 破解教程(Mac 版)2019.3.0版本
- 替换文件后运行
xattr -cr '/Applications/Studio 3T.app'
- 替换文件后运行
- MongoDB 可视化工具 Studio 3T 破解教程(Mac 版)2019.3.0版本
- Compass | MongoDB
16M 大小限制
- MongoDB Limits and Thresholds — MongoDB Manual
- Understanding MongoDB BSON Document size limit - Stack Overflow
- [SERVER-431] Increase the 4mb BSON Object Limit to 16mb - MongoDB
- GridFS — MongoDB Manual
Mongo data babckup and restore
mongodump
, mongorestore
- mongodb/homebrew-brew: The Official MongoDB Software Homebrew Tap
brew tap mongodb/brew
brew install mongodb-community
Dump and restore database test
:
> mongodump -d test
2020-07-05T17:38:52.589+0800 writing test.hi to dump/test/hi.bson
2020-07-05T17:38:52.595+0800 done dumping test.hi (2 documents)
> tree dump
dump
└── test
├── hi.bson
└── hi.metadata.json
> mongorestore dump/
2020-07-05T17:41:08.621+0800 preparing collections to restore from
2020-07-05T17:41:08.627+0800 restoring to existing collection test.hi without dropping
2020-07-05T17:41:08.627+0800 reading metadata for test.hi from dump/test/hi.metadata.json
2020-07-05T17:41:08.628+0800 restoring test.hi from dump/test/hi.bson
2020-07-05T17:41:08.639+0800 continuing through error: E11000 duplicate key error collection: test.hi index: _id_ dup key: { : ObjectId('5f0197ec39fc5ab33fd67b38') }
2020-07-05T17:41:08.639+0800 continuing through error: E11000 duplicate key error collection: test.hi index: _id_ dup key: { : ObjectId('5f0197fdd5d229b1aa990191') }
2020-07-05T17:41:08.639+0800 no indexes to restore
2020-07-05T17:41:08.639+0800 finished restoring test.hi (0 documents, 2 failures)
2020-07-05T17:41:08.639+0800 0 document(s) restored successfully. 2 document(s) failed to restore.
> mongorestore --drop dump/
2020-07-05T17:41:54.236+0800 preparing collections to restore from
2020-07-05T17:41:54.262+0800 reading metadata for test.hi from dump/test/hi.metadata.json
2020-07-05T17:41:54.292+0800 restoring test.hi from dump/test/hi.bson
2020-07-05T17:41:54.296+0800 no indexes to restore
2020-07-05T17:41:54.296+0800 finished restoring test.hi (2 documents, 0 failures)
2020-07-05T17:41:54.296+0800 2 document(s) restored successfully. 0 document(s) failed to restore.
archive one db
> mongodump --archive=test.$(date '+%Y%m%d').archive --db=test
2020-07-05T17:53:30.880+0800 writing test.hi to archive 'test.20200705.archive'
2020-07-05T17:53:30.890+0800 done dumping test.hi (2 documents)
> ll test.20200705.archive
-rw-r--r-- 1 garden staff 2.7K Jul 5 17:53 test.20200705.archive
> mongorestore --drop --archive=test.20200705.archive
# or
> mongorestore --drop --archive < test.20200705.archive
2020-07-05T17:50:43.290+0800 preparing collections to restore from
2020-07-05T17:50:43.329+0800 reading metadata for test.20200705.archive from archive on stdin
2020-07-05T17:50:43.360+0800 restoring test.hi from archive on stdin
2020-07-05T17:50:43.367+0800 no indexes to restore
2020-07-05T17:50:43.367+0800 finished restoring test.20200705.archive (2 documents, 0 failures)
2020-07-05T17:50:43.367+0800 2 document(s) restored successfully. 0 document(s) failed to restore.
更改命名空间
mongorestore --archive="mongodump-test-db" --nsFrom='test.*' --nsTo='examples.*'