- 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.
推薦閱讀
- 計(jì)算機(jī)圖形學(xué)
- 工業(yè)機(jī)器人技術(shù)及應(yīng)用
- AWS:Security Best Practices on AWS
- Photoshop CS4經(jīng)典380例
- 21天學(xué)通C++
- Matplotlib 3.0 Cookbook
- Hands-On Linux for Architects
- 分布式多媒體計(jì)算機(jī)系統(tǒng)
- 數(shù)據(jù)通信與計(jì)算機(jī)網(wǎng)絡(luò)
- 21天學(xué)通C語言
- Ruby on Rails敏捷開發(fā)最佳實(shí)踐
- Visual FoxPro數(shù)據(jù)庫基礎(chǔ)及應(yīng)用
- Google SketchUp for Game Design:Beginner's Guide
- 所羅門的密碼
- 基于RPA技術(shù)財(cái)務(wù)機(jī)器人的應(yīng)用與研究