On this page本页内容
isInteractive()¶New in version 4.2.版本4.2中的新功能。
Returns a boolean value indicating if the current mongo shell is running in interactive mode or in script mode:
true if in interactive modefalse if in script modeCreate a JavaScript testExample.js file with the content:
From a terminal/command-line prompt (i.e. not inside the mongo shell), specify the javascript file to the mongo shell to execute the file:
The operation prints to the terminal information about the MongoDB shell version and various information followed by: