mongoolia icon indicating copy to clipboard operation
mongoolia copied to clipboard

_algoliaObjectID is not being returned

Open mikekoro opened this issue 6 years ago • 3 comments

I noticed that "_algoliaObjectID" is not being returned when I query my model. I need to know its ID to update it on Algolia when I update my local db. How can I achieve that?

p.s. When I update my db using methods like findOneAndUpdate() or findByIdAndUpdate() it simply doesn't update any data on Algolia

mikekoro avatar Oct 03 '18 03:10 mikekoro

could you give the code you are using now?

Haroenv avatar Oct 03 '18 09:10 Haroenv

To update my db model I use

Ad.findByIdAndUpdate(req.params.id, req.body, {new: true}).then((response) => {
   res.status(200).json(response);
}).catch(() => {
   res.status(403).json({ "error": { "code": 500, "message": "Something went wrong." } })
})

My model is set up based on the "How-to" tutorial from the readme file.

mikekoro avatar Oct 03 '18 16:10 mikekoro

Sorry, I meant a complete example that can be run directly with minimal setup.

Haroenv avatar Oct 04 '18 09:10 Haroenv