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

.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.
主站蜘蛛池模板: 盐城市| 唐山市| 遵化市| 巴中市| 岚皋县| 深水埗区| 霍州市| 阿荣旗| 峨边| 安康市| 哈密市| 甘孜县| 湖北省| 文安县| 溆浦县| 田东县| 常宁市| 宜昌市| 凤城市| 廉江市| 古田县| 米泉市| 扬州市| 景德镇市| 辽阳市| 保德县| 渭南市| 平泉县| 桂平市| 含山县| 丹阳市| 浑源县| 杭锦旗| 同德县| 台南市| 城口县| 白河县| 巫溪县| 乐清市| 保定市| 古蔺县|