本文介绍了如何在mongo JavaScript shell中中止查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mongo的JavaScript外壳中执行查询就像在bash外壳中执行命令一样.因此,我的手指一直试图通过 + 从我想中止"的命令中退出并返回命令提示符.不幸的是,在2.0.4的mongo shell中,当我 + 时,它使我退出了JavaScript shell,而不仅仅是中止命令并给了我命令提示符.

Executing queries in the JavaScript shell of Mongo feels a lot like executing commands right in the bash shell. Because of this, my fingers keep trying to + my way out of a command that I want to "abort" and land back at the command prompt. Unfortunately, in the mongo shell at 2.0.4, when I +, it drops me out of the JavaScript shell, rather than just aborting the command and giving me the command prompt.

JavaScript Shell中是否有一种方法可以在不执行当前命令的情况下放弃当前命令并返回到命令提示符?

Is there a way in the JavaScript shell to abandon the current command without executing it and land back at the command prompt?

推荐答案

我一直很自然地做的就是键入(,然后立即按回车三下. Shell会假设您只是按Enter键来破坏您的命令,但是如果您再按Enter 2次,它将退出并返回Shell.没什么,但是行得通.

What I've always naturally done is type a ( and then immediately hit enter three times. The shell will assume you are just hitting enter to break up your command, but if you hit enter 2 more times it will exit back to the shell. It's wonky, but it works.

使用ctrl + d,根据 http://www.gotothings.com/unix/bash-hotkeys.htm .如果您在mongo shell中键入命令的中途打了回车,然后又打了一次,它将退出您的继续操作,并带您回到干净的mongo提示符.击中两次将退出mongo shell.

Use ctrl+d, which "kills the shell" according to http://www.gotothings.com/unix/bash-hotkeys.htm. If you hit this once after hitting enter in the middle of typing a command in the mongo shell, it will exit your continuation and get you back to a clean mongo prompt. Hitting it twice will exit the mongo shell.

这篇关于如何在mongo JavaScript shell中中止查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 00:54