mongoosastic icon indicating copy to clipboard operation
mongoosastic copied to clipboard

Hydrate check if _id are strings or not

Open streetlib opened this issue 10 years ago • 0 comments

I found there could be a problem if you don't index the MongoDB _id field and you try to use hydrate option.

Basically the problem is the _id comes as string if you doesn't index it and so this query query = model.find({_id: {$in: ids}}) fails (cannot find any document).

To reproduce the issue, you have to change your MongoDB schema with _id: { es_indexed: false }, then you should synchronize and finally try to do a query with hydrate option set true.

You should see the hits only with the hydrate set to false.

streetlib avatar Nov 10 '15 14:11 streetlib