How can I filter vectors by date?

How can I filter vectors by date?

If I run a vectorSearch with following filter value:

filter = {"$and": [{"my_date_field": {"$lte": datetime.now()}}]}

then it returns me the following error:

```Operand type is not supported for $vectorSearch: date’, ‘code’: 7828301`

where my vector search index is as follow:

const vectorIndex = {
    name: indexName,
    definition: {
      mappings: {
        dynamic: false,
        fields: {
          embeddings: {
            type: 'knnVector',
            dimensions: 768,
            similarity: 'cosine'
          },
          my_date_field: { type: 'date' },
        }
      }
    }
  }

Likewise, I’m getting the same error when attempting to do this filter over a datetime field in my Atlas Vector Search index: {'$and': [{'datetime': {'$gte': datetime.datetime(2023, 1, 1, 0, 0)}}]}.

A few months ago, I was able to run range filters over an Atlas Search index using $knnBeta however now that MongoDBAtlasVectorSearch in Langchain uses $searchVector I’m switching over from an Atlas Search index to an Atlas Vector Search index and can’t filter over datetimes any longer.

Does anyone know if there any plans to add support for date range filtering in the MongoDBAtlasVectorSearch in Langchain?

I filed an issue within the Langchain repo for now.