MongoDB how to prevent Object.save prevent duplicate row?

#1

Hi all,

I already have check duplicate with first in beforeSave but if I test via Promise.all call to cloud function

It’s not work.

Have any solutions for me?

Thank you so much.

#2

Ideally you can add a unique index to the mongo collection. If you do that, then object.save will fail.

1 Like
#3

Yeah, final solution for me right now.

Thanks