diff --git a/Readme.md b/Readme.md index 6f6df9a..9d96b58 100644 --- a/Readme.md +++ b/Readme.md @@ -36,7 +36,7 @@ const rsqlMongoDB = require('rsql-mongodb'); try{ - // String comparison : you have to add quotes for string values + // String comparison : you can add quotes for string values rsqlMongoDB('lastName=="doe"'); //=> { "lastName" : "doe" } @@ -50,7 +50,7 @@ try{ // Date comparison rsqlMongoDB('birthday=ge=1959-10-21'); - //=> { "birthday": { $gte: new Date("1959-10-21") } } + //=> { "birthday": { $gte: new Date("1959-10-21T00:00:00.000Z") } } // In comparison rsqlMongoDB('childs=in=(1,2,3)'); @@ -61,7 +61,7 @@ try{ //=> { "childs": { $nin: [1,2,3] } } // Groups - rsqlMongoDB('(firstName=="john";lastName=="doe"),(firstName=="janne";lastName=="doe")'); + rsqlMongoDB('(firstName=="john";lastName=="doe"),(firstName==janne;lastName==doe)'); //=> { $or: [ { $and: [ { "firstName" : "john" } , { "lastName" : "doe" } ] } , { $and: [ { "firstName" : "janne" } , { "lastName" : "doe" } ] } ] } } diff --git a/package.json b/package.json index f35a360..c3cbb4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rsql-mongodb", - "version": "1.1.0", + "version": "1.1.1", "description": "Converting RSQL queries to MongoDB queries", "main": "rsql-mongodb.js", "typings": "rsql-mongodb.ts", diff --git a/rsql-mongodb.js b/rsql-mongodb.js index e8689cf..1b7f2c6 100644 --- a/rsql-mongodb.js +++ b/rsql-mongodb.js @@ -20,7 +20,8 @@ function setType(input) { } else if(matchDate.exec(input)){ if(Date.parse(input)){ - typedInput = new Date('"' + input + '"'); + var isoUTCDate = new Date(input).toISOString(); + typedInput = new Date('"' + isoUTCDate + '"'); } }