![]() Windows non-PATH example: "C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" -help The mongo Command The MongoDB shell version is listed at the top. The help list is quite long, so I won’t output it all here. Windows non-PATH example: "C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" -version The mongo -help CommandĪnother way to get the mongo shell version is to run mongo -help from a Terminal window or Command Prompt. If you need the mongo shell version, you can run the mongo -version command from a Terminal window or Command Prompt. You could alternatively navigate to the folder via the file explorer – a process which will also reveal the version number. Ironically, you’ll need to know the version before you can write the path! (You’ll need to replace 4.4 with the your MongoDB version). Like this: "C:\Program Files\MongoDB\Server\4.4\bin\mongod.exe" -version If you’re on Windows and you haven’t added MongoDB to your PATH, you’ll need to use the full path. If you’re not connected to MongoDB, you can open a Terminal window or Command Prompt and run mongod -version. Result: 4.4.1 The mongod -version Command ![]() ![]() This method returns the version of the mongod or mongos instance. If you’re already connected to MongoDB, you can use the db.version() method to check the version. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.If you’re wondering what version of MongoDB you’re running, here are 7 ways you can use to check.Īctually, some of these check your MongoDB server version, and some check your mongo shell version. Dj Walker-Morgan was Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. In 2.6 the -quiet option, which suppresses all logging messages except errors, is supported by all the MongoDB command-line tools rather than a select few. If you've ever felt that the MongoDB executables were somewhat noisy, the -quiet option may bring some calm to your day. So, you can save keystrokes by exporting your data to a file with the collection name its destined for (or be caught out when you accidentally forget the -c option and wonder where that new collection in your database came from). In MongoDB 2.6, you can drop the -collection option and the importer will use the name of the file you are importing from as the name of the collection. The mongoimport command takes as an option -collection (also -c), which lets you specify which collection the imported data is going into – in 2.4 and before it was pretty much mandatory. Outside the shell one of the smaller changes could save you a few keystrokes or cost you a few key if you don't know about it. Secondly, you need to make really sure that your /etc/mongorc.js is valid and correct. First, the global file is also a good place to put commands you want people to use and not have the excuse they didn't realise they weren't loading them. One thing you can't do is stop the global file from being run the user's own startup file can be disabled with -norc as an option to mongo, but that doesn't affect the global file. If a number of users share various tools in the shell, it's really useful to have them in /etc/mongorc.js, as long as everyone has read permission for that file of course. ![]() In MongoDB 2.6 there's now another startup file, /etc/mongorc.js, which is a global shell startup file that is run before the user's own. You can, for example, load it with time-saving functions and pre-initialised variables. This file, which lives in a user's home directory, is automatically executed when the mongo shell is run, making it a great place to customise your Mongo shell experience. MongoDB 2.6 Shell
0 Comments
Leave a Reply. |