Hi,
I got problem with Near Operator when i try to use date.
My mapping

My pipeline

pivot was 1 week in milliseconds
I got date not near in result

Thanks for your help
Hi,
I got problem with Near Operator when i try to use date.
My mapping

My pipeline

pivot was 1 week in milliseconds
I got date not near in result

Thanks for your help
I would recommend running a simpler query as in our example. Using a direct “near” clause and replacing new Date with
"origin": ISODate("1995-01-01T00:00:00.000+00:00")
Thanks,
Pavel
No documents closer to 1995 ! Every time got false/positive result.
near will return all documents, but will score those closer to a date higher. So the first result will be the document closest to new Date("1995")
using near in a must clause will have no effect on a filter as defined on filter or must or mustNot.
If you want to filter your results, you can use a range operator.
Thanks for your help, i will use range now.
I understand how near works now 
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.