0

I have a mongodb, via node.js, that stores "events" with a start and end datetime.

I don't want any events to overlap, even of two or more users try to store overlapping events at "exactly" the same time.

and by that I mean, within the time it takes to do two finds and inserts ( so I can't simply do a find, and decide wether to insert)

I know how to find overlapping events (with the $gte and $lte operators) what I don't know is how to regroup in one atomic operation the find and insert.

this case, to my knowledge, is not handled by the update or insert methods, regardless,of the options used.

0 Answers0