abort operations with AbortController #11811
jimmywarting
started this conversation in
Ideas
Replies: 3 comments 6 replies
-
Makes sense. Does mongodb native driver support an AbortController? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Any latest info on this? I would also really like to have this feature. |
Beta Was this translation helpful? Give feedback.
3 replies
-
@vkarpov15 MongoDB Node.js driver now supports aborts for find/aggregate/countDocuments/findOne mongodb/node-mongodb-native#4364. This could be a good addition as it would be just passing the cursor to mongodb driver. Would you like me to open a PR for that? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
An AbortController can come from multiple places such as a spec compatible whatwg/Request or some server that wraps incoming http server request into a standard whatwg/request with a AbortSignal. they can also be constructed with
new AbortController()
or the new proposedAbortController.timeout(ms)
This are useful b/c the can cancel multiple operations simultaneously at once.
calling
abort()
on the controller could close the request connection, stop listening on a other multiple event listener,addEventListener(name, fn, { signal })
and many more thing at once. this signal could also be forwarded to mongoose operation too, to abort any mongodb operation if say a user decide to close the request/connectionit would be cool if the
.find()
, and.cursor()
could take an optional{ signal }
parameter that abort the hole operation when the signal dispatch an abort event, likewise withdb.connect()
and also aggregationBeta Was this translation helpful? Give feedback.
All reactions