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

Differences between scripting for the mongo shell and using it directly

When writing scripts for the mongo shell we cannot use the shell helpers. MongoDB's commands like use <database_name>, show collections, and other helpers are built into the shell and so are not available from the JavaScript context where our scripts will get executed. Fortunately, there are equivalents to them that are available from the JavaScript execution context, as shown in the following table:

 

In the previous table, it is the iteration cursor that the mongo shell returns when we query and get back too many results to show in one batch.

Using the mongo shell, we can script almost anything that we would from a client, meaning that we have a really powerful tool for prototyping and getting quick insights into our data.

主站蜘蛛池模板: 北川| 洛扎县| 安岳县| 海安县| 武清区| 仲巴县| 湘潭市| 灯塔市| 沙河市| 泸州市| 东至县| 东宁县| 秦安县| 荆门市| 娄烦县| 济阳县| 邵东县| 花莲市| 玛纳斯县| 龙泉市| 依安县| 新巴尔虎右旗| 鸡泽县| 黔西县| 丰都县| 大厂| 阳信县| 武汉市| 沙河市| 瑞金市| 本溪市| 信丰县| 常山县| 绥阳县| 法库县| 万载县| 崇左市| 凌海市| 永清县| 买车| 大宁县|