mongoolia icon indicating copy to clipboard operation
mongoolia copied to clipboard

Inconsistent behavior with mongoose 5

Open callmephilip opened this issue 6 years ago • 7 comments

I am running mongoolia with mongoose 5.2.8. syncWithAlgolia() works fine some times, other times it errors with doc.pushToAlgolia is not a function reproduction here: https://github.com/bakery/algolia-mongoose-5

callmephilip avatar Aug 16 '18 10:08 callmephilip

your code seems to be correct; do you know what kind of use cases you have in which it errors?

Haroenv avatar Aug 16 '18 10:08 Haroenv

if you just rerun this a few times in a row - it starts throwing that doc.pushToAlgolia is not a function error pretty randomly, as far as i can tell. now, given that the DB gets wiped out on every run, it might have smth to do with that but i would expect syncWithAlgolia to handle this in a consistent manner

callmephilip avatar Aug 16 '18 10:08 callmephilip

Hi @callmephilip

This library is meant to be used with mongoose v4. I did not tested it for mongoose v5.

I'll submit a PR to add a notice about versions support.

iam4x avatar Aug 16 '18 17:08 iam4x

@iam4x should i open a ticket regarding v5 support then?

callmephilip avatar Aug 17 '18 10:08 callmephilip

I think this issue if fine.

But, I'm not sure this will be fixed anytime soon. I'm not working with Mongoose anymore and I'm full time working on my startup.

Maybe some Algolian will take some time to debug this? Or you might want to debug it and make a PR 👍

iam4x avatar Aug 17 '18 11:08 iam4x

@iam4x gotcha, thanks. i'll take a look to see if it's something i could tackle

callmephilip avatar Aug 17 '18 11:08 callmephilip

Somehow changing doc.pushToAlgolia to doc.addObjectToAlgolia in algolia-mongoose-model.js made it work with [email protected] Annotation 2020-08-22 235157 I haven't read the code well enough to understand why this worked, just wanted to point it out.

johancc avatar Aug 23 '20 06:08 johancc