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

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.

主站蜘蛛池模板: 梨树县| 富宁县| 兰溪市| 洛扎县| 吴桥县| 中阳县| 池州市| 邹平县| 阳朔县| 冕宁县| 宣汉县| 巴南区| 大埔县| 阿勒泰市| 刚察县| 东宁县| 东乡县| 大足县| 汾西县| 阆中市| 濮阳县| 海阳市| 彭阳县| 楚雄市| 通化市| 汉寿县| 宜兰县| 固原市| 浙江省| 金昌市| 宁波市| 凯里市| 正蓝旗| 东明县| 安岳县| 秀山| 嘉荫县| 常宁市| 刚察县| 博乐市| 闽清县|