Today we introduced the first beta of the new MongoDB Shell (mongosh - mongo - es - eɪtʃ), a shell for MongoDB with a modern user experience that will grow in functionality along with the MongoDB data platform.
Okay, I dont have to type .pretty() for the queries with larger document outputs - (it is pretty printing on its own). Also, noticed the MongoDB green in the syntax highlighting.
Do we have full documentation to mongosh ?
I just tried db.version() in mongosh and got TypeError: db.version is not a function
So I think I need some help
The documentation for mongosh can be found on https://docs.mongodb.com/mongodb-shell/
Currently mongosh (beta) supports a subset of the legacy mongo shell commands. Extending the MongoDB Shell API coverage is an ongoing effort.
This particular method is not currently covered in the documentation unfortunately.
There are a number of convenience wrappers/methods that only exists in the legacy mongo shell. A general work around is to find out what the wrapper is executing. You can execute the method without invoking it .i.e. minus the () for example:
Then we can find out under mongo shell methods documentation what does serverBuildInfo does. i.e. db.serverBuildInfo(). With this knowledge we can then use it in mongosh:
db.runCommand( { buildInfo: 1 } ).version
If you have additional questions, it would be helpful if you can open a new topic discussion. This would help others with similar issues to find relevant topic easily.