Search code examples
mongodbmongodb-compass

Mongo DB Compass and Filtering on int 64


Below is an image of a single record in my mongo database. I am using mongodb compass and if I search with the term

{date: 1567532362460}

I find my record. If however I search with terms like:

{key: 6366627898639550262} or {user: -6302170947335878914}

Then are no records found. At first I thought it was a format issue except compass will auto complete everything so I assume this because these are int64's and there is a rounding error. How do I search on these fields with compass?

enter image description here


Solution

  • If filter accepts extended json syntax, use {key:{$numberLong:"1234..."}} to specify long values.