You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A true ES2015 iterator would be impossible to implement, because data is fetched asynchronously (in chunks). The iterator has to return something synchronously from the next() call though, and so it would never be able to set .done until the data is loaded (not synchronously, i.e. not right away so a synchronous for loop would either quit early or loop forever).
However, there is in fact also an upcoming spec for async iterators, where the next() call returns a Promise for the done/value object. At the moment this hasn't really been implemented yet in Node though (we need Symbol.asyncIterator for this to work fully).
The good news is that the next version of TypeScript (2.3) will include a shim for this. See this issue. Once that lands I'll add it to my project documentdb-typescript, and you'll be able to write a loop in TypeScript as if everything was synchronous for await (const myResult of coll.queryDocuments(...)) { ... }.
We have recently announced deprecation version 1.x of the Azure Cosmos JavaScript SDK. We will end support for the documentdb package and this repo on August 30, 2020. Please update to our new package @azure/cosmos as soon as possible. If you encounter any issues, you can raise them in the Azure central JS SDK repo. If something is preventing you from upgrading to the latest version of the SDK, you can always email me directly: stfaul@microsoft.com
ES2015 provides a standard for implementing iterators in JavaScript, and it's rather misleading that something called
QueryIterator
doesn't actually support this.The text was updated successfully, but these errors were encountered: