MongoDB and Date


#1

Hi,

I get an error message when querying a “table” in MongoDB using a date:


Command failed with error 15999: ‘exception: invalid operator ‘$dateToString’’ on server myserver:27017. The full response is { “errmsg” : “exception: invalid operator ‘$dateToString’”, “code” : 15999, “ok” : 0.0 }


When i look in the MongoDB collection the date looks like this:

ISODate(“2015-11-26T23:00:00.000Z”)

Is it a bug in the Metabase MongoDB-driver or is it some issue in my environment?

Thanks and regards,

/ Mikael


#2

In your MongoDB do you have the type for that field defined as a Date type? Are you saying the value of the fields have the actual string “ISODate” in the front of the value?

All I know is that when setting up MongoDB with Metabase is to verify that the BSON types are defined properly because it is expecting certain types. Also properly setting up the Date type opens up the better context menu in Metabase that lets you choose date ranges and specialized choices like “yesterday”.


#3

Hi,

Thanks for your answer!

I found this post, explaining that Mongodb 3.0 is required.

I tried with Mongodb 3.6, but ran into new problems. Next step will be to try MongoDB 3.0 or 3.2.

Regards,

/ Mikael