[SERVER-5939] JavaScript version() function should return version string Created: 27/May/12  Updated: 11/Jul/16  Resolved: 27/Sep/12

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: None
Fix Version/s: 2.3.0

Type: Improvement Priority: Major - P3
Reporter: Tad Marshall Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-7187 Add function to shell to get what ver... Closed
Backwards Compatibility: Minor Change
Participants:

 Description   

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
>



 Comments   
Comment by Spencer Brody (Inactive) [ 27/Sep/12 ]

Relevant commit: https://github.com/mongodb/mongo/commit/54d96ade4e71b6472b99d575dc38e6472b30a8b0

Generated at Thu Feb 08 03:10:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.