- MongoDB 4 Quick Start Guide
- Doug Bierer
- 172字
- 2021-08-13 15:25:05
.mongorc.js File
All command line option flags can be coded into a file, mongorc.js (https://docs.mongodb.com/manual/reference/program/mongo/#files). When you run the mongo command, this file is parsed unless you include the command line switch mongo --norc. There are two primary locations for this file; the user home directory, or the operating system's /etc directory:

It is very important to set the rights properly if using /etc/mongorc.js. Otherwise, you will receive a permissions error when the mongo shell first starts. The recommended rights would be to assign ownership to the user mongodb, and read + execute rights to all others.
Here is a sample mongorc.js file, which customizes the prompt (https://docs.mongodb.com/manual/tutorial/configure-mongo-shell/) to display the database, hostname, and up time:

If you have defined both a global /etc/mongorc.js as well as a ~/.mongorc.js config file in the user home folder, the global file will be processed first. Another important consideration is that if the user uses the --norc option, it only suppresses execution of the local home directory file, not the global mongorc.js file.
推薦閱讀
- 中文版Photoshop CS5數(shù)碼照片處理完全自學(xué)一本通
- 平面設(shè)計(jì)初步
- 空間機(jī)器人遙操作系統(tǒng)及控制
- Getting Started with Containerization
- PyTorch深度學(xué)習(xí)實(shí)戰(zhàn)
- Windows 7寶典
- 控制系統(tǒng)計(jì)算機(jī)仿真
- Docker on Amazon Web Services
- 突破,Objective-C開發(fā)速學(xué)手冊(cè)
- 大數(shù)據(jù)技術(shù)基礎(chǔ):基于Hadoop與Spark
- 三菱FX/Q系列PLC工程實(shí)例詳解
- C#求職寶典
- Kubernetes on AWS
- 創(chuàng)客機(jī)器人實(shí)戰(zhàn):基于Arduino和樹莓派
- 多媒體技術(shù)應(yīng)用教程