|
The (native) "version()" function we install for JavaScript prints the version string to stdout and also prints the Git hash if the version string includes a "+". The function then returns "undefined" (which is displayed as "null" in the shell).
This function would be more useful if it instead returned the version string and let the caller parse it and/or display it if desired.
MongoDB shell version: 2.1.2-pre-
|
connecting to: test
|
> var versionString = version(); // prints string instead of returning it
|
version: 2.1.2-pre-
|
> versionString
|
> versionString == null
|
true
|
>
|
|