Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB shell: reading a line from the console

Is there a way to read a line from the Mongo shell? readline() is not defined and neither is system.stdin.

I need to do this in interactive mode, as opposed to feeding input to a script executed by the MongoDB shell.

like image 887
Sim Avatar asked Jul 04 '12 17:07

Sim


People also ask

How do I access MongoDB from terminal?

To open up the MongoDB shell, run the mongo command from your server prompt. By default, the mongo command opens a shell connected to a locally-installed MongoDB instance running on port 27017 . Try running the mongo command with no additional parameters: mongo.

How does shell script connect to MongoDB?

Use connect() to Connect to a MongoDB Instance You can also use the connect() method to connect to the MongoDB instance. The following command: Connects to the MongoDB instance that is running on localhost with the non-default port 27020 , and. Sets the global db variable.

Which is the command line interface in MongoDB?

MongoDB Mongo shell is the default client for the MongoDB database server. It's a command-line interface (CLI), where the input and output are all console-based. The Mongo shell is a good tool to manipulate small sets of data.

How do I query a document in MongoDB?

Use the db. collection. find() method in the MongoDB Shell to query documents in a collection.


1 Answers

Per @Stennie's comment, this is not possible right now.

like image 151
Sim Avatar answered Oct 11 '22 11:10

Sim