Hello @zodern and @denyhs, as indicated here, to scroll the result of a search we used the syntax below which allows other asynchronous methods to be invoked within the loop:
for await (const doc of collection.find({})) {
await collection2.findOneAsync(...);
}
This works in version 2.13.3 while alpha version 11 returns the error:
TypeError: cursor[methodName] is not a function
at Cursor.<computed> (packages/mongo/mongo_driver.js:879:30)
at _asyncIterator (/Users/pbeato/Documents/ksource/meteor12.3/meteor-collection2/tests/node_modules/@babel/runtime/helpers/asyncIterator.js:7:41)
at Hook.<anonymous> (multi.tests.js:92:13)
at run (packages/meteortesting:mocha-core/server.js:36:29)
at Context.wrappedFunction (packages/meteortesting:mocha-core/server.js:65:14)
at processImmediate (node:internal/timers:476:21)
at process.topLevelDomainCallback (node:domain:161:15)
at process.callbackTrampoline (node:internal/async_hooks:128:24)
Before opening an issue I wanted to discuss with you to see if I had missed something.
Hi @denyhs and @grubba, have you figured out yet whether it will be possible to use the asyncIterator to scroll mongo cursors as in v2.13.3? In 3 alpha 15 are there any changes in this regard? We are migrating packages that provide for their use in an asynchronous context. Thank you.
Yeah, it will be possible to continue using the async iterator.
The only change we have planned so far for the MongoDB package was that we added a clearer error message when using sync methods in the server(PR)