in my scenario the use case in which the document will be already available is far away the most frequent. So, in the majority of cases, step one will be the only one that the procedure will take.
Under these conditions, the approach described in the article should be the optimal one.
Cheers,
Riccardo
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, why don't you save one step by doing the insert right away?
According to the doc insert won't return 1 if the document was existing, and so you can do the insert, then the update.
In fact, you might even not have to check the returned value of the insert, as it doesn't matter.
What do you think?
-- Constantin
Hello Constantin,
in my scenario the use case in which the document will be already available is far away the most frequent. So, in the majority of cases, step one will be the only one that the procedure will take.
Under these conditions, the approach described in the article should be the optimal one.
Cheers,
Riccardo