In the example code in the docs, the return value of watch is being used as if the function ran synchronously, where in reality it returns a Promise. Also, if watch is not awaited, inserting items cause race conditions and will not be properly handled by the callback passed to watch.
In the example code in the docs, the return value of
watch
is being used as if the function ran synchronously, where in reality it returns aPromise
. Also, if watch is notawait
ed, inserting items cause race conditions and will not be properly handled by the callback passed towatch
.Wrong (how it is currently)
Correct