How to do Advanced Sync Rules on Date field with Relative Date for MongoDB

I am trying to setup a MongoDB index sync that pulls over all records where a date field is $gte the current date. I assumed something like the following would work as it worked on the Mongo command line, but alas it pulled in 0 records:

{
  "aggregate": {
    "pipeline": [
      {
        "$match": {
          "expiresAt": {
            "$gte": "new Date()"
          }
        }
      }
    ]
  }
}

My hunch is that it's trying to do new Date() as a string literal and not actually evaluating that function. I've also tried doing "$gte": "now" but that doesn't work either. Is what I'm trying to do here possible?

System
Host: ElasticCloud
Elasticsearch Version: 8.6.2

Is this "index sync" a mongo concept? I haven't seen it in Elasticsearch.

EDIT - oh is this Enterprise Search?

Yes, sorry should have specified! This is Enterprise Search.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.