$vectorSearch with pre-filtering on ObjectId

Greetings all.
I have followed the guide on using $vectorSearch. But I cannot find any reference to ObjectId.
How to filter by an ObjectId?
I’ve tried the following but it produces an error:

"filter": {
  "location_id": { "$eq": location_id }
}

where location_id is an ObjectId.
The error is the following: “pymongo.errors.OperationFailure: Operand type is not supported for $vectorSearch: objectId”.
Thank you!

2 Likes

Hey,
You might want to take a look at SuperDuperDB GitHub - SuperDuperDB/superduperdb: 🔮 SuperDuperDB: Bring AI to your favourite database! Integrate, train and manage any AI models and APIs directly with your database and your data.
It has out of box support for vector search with atlas.

Let us know if it helps in solving your problem, also
Leave a star at GitHub - SuperDuperDB/superduperdb: 🔮 SuperDuperDB: Bring AI to your favourite database! Integrate, train and manage any AI models and APIs directly with your database and your data. :star2:

Thanks

Hey @Mathieu_Morgensztern
Did you find any solution? I’m having the same error with the operand $in (list of objectId).