Skip to content

Commit c477501

Browse files
committed
Removed ISODate()
Function not needed anymore with mongsh 2.3.1. See https://jira.mongodb.org/browse/MONGOSH-1859
1 parent a6b4edb commit c477501

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

snippets/mongocompat/mongotypes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ Date.prototype.tojson = function() {
7575
ofs + '")';
7676
};
7777

78-
ISODate = function(isoDateStr) {
78+
if (buildInfo().version.split('.').reverse().map((x,i) => parseInt(x) * Math.pow(10,3*i)).reduce((sum, x) => sum + x, 0) < 2003001) {
79+
// Not needed anymore in version 2.3.1 or later
80+
ISODate = function(isoDateStr) {
7981
if (!isoDateStr)
8082
return new Date();
8183

@@ -121,7 +123,8 @@ ISODate = function(isoDateStr) {
121123
throw Error("invalid ISO date: " + isoDateStr);
122124

123125
return new Date(time);
124-
};
126+
};
127+
}
125128

126129
// Regular Expression
127130
RegExp.escape = function(text) {

0 commit comments

Comments
 (0)