How to Run Atlas Search Queries with a object id Range Filter?

if we have a query like Users.find({ _id: { $gt: "uid50", $lt: "uid100" } })
so how can we use the same filter with the MongoDB atlas search without using this in the match pipeline?

Hi @sajan_kumar,

Could you provide the following information:

  • Sample document(s)
  • Expected output
  • Use case details

Atlas search has the range operator which can be used to perform a search over:

  • Number fields of BSON int32 , int64 , and double data types.
  • Date fields of BSON date data type in ISODate format.

However, it seems the values you’ve provided in the original query is of string type where as the range operator.

Look forward to hearing from you.

Regards,
Jason