DB/MongoDB

[ MongoDB ] mongorestore

HEON.D 2021. 12. 24. 01:43

Mongo CLI 설치

brew tap mongodb/brew
brew install mongodb-community@5.0

mongodb-database-tools는 내장되어있지만 추가 설치가 필요한 경우

brew install mongodb-database-tools

 

Brew Install 실패하는 경우

Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins
mkdir -p /Applications/Docker.app/Contents/Resources/cli-plugins
brew cleanup

 

mongod

"error":"NonExistentPath: Data directory /data/db not found.

 Mac Catalina (10.15이상)부터는 root폴더에 Writing이 불가능 ( 임의 폴더 지정 )

mongod --dbpath=/Users/user/data/db

 

mongorestore

https://docs.mongodb.com/database-tools/mongorestore/

 

mongorestore — MongoDB Database Tools

Docs Home → MongoDB Database ToolsThe mongorestore program loads data from either a binary database dump created by mongodump or the standard input into a mongod or mongos instance.Run mongorestore from the system command line, not the mongo shell.See al

docs.mongodb.com

mongorestore --archive="/Users/heon/data/dump/mongodump-classes-db" --nsFrom='classes.' --nsTo='classes.';

 

'DB > MongoDB' 카테고리의 다른 글

[ MONGODB ] 기간 조회  (0) 2022.06.08
[ MongoDB ] MongoDB update : useUnifiedTopology: true  (0) 2021.10.10
[ MongoDB ] Populate Self Reference Fail  (0) 2021.05.11
[ MongoDB ] match 사용  (0) 2021.01.06
[ MongoDB ] Object Child Update Detection  (0) 2021.01.04