官术网_书友最值得收藏!

  • 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.
主站蜘蛛池模板: 深州市| 临沂市| 凤凰县| 泾川县| 西贡区| 井陉县| 永修县| 大邑县| 大姚县| 来凤县| 琼海市| 夹江县| 东乡县| 洪洞县| 兴隆县| 敦煌市| 社旗县| 榆社县| 宿州市| 吉木萨尔县| 法库县| 资源县| 莱芜市| 丽江市| 鹤岗市| 林周县| 安福县| 木里| 来安县| 呈贡县| 河北区| 辽源市| 隆安县| 马鞍山市| 阿瓦提县| 乐清市| 西充县| 丘北县| 黔西县| 泾川县| 迭部县|