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
This is somewhat expected due to the way cursors in MongoDB work. In order to count results, we have to exhaust the underlying Cursor, which will cause the current iteration state to be lost. I'd have to check whether it's possible to work around this without a big effort in the ODM, but for the time being you should not run count on results object while you're iterating them. What's preventing you from fetching the count before starting iteration?
@alcaeus I have found a workaround for my situation. I just reported the issue to know if is this expected behavior or not. Thank you for your response and time.
I recently found that when applying foreach loop to the result of an ODM query and taking its count inside the loop, the loop breaks. For example
This loop executes only one time even if the count of results is more. But when removing count inside loop it works normally.
The text was updated successfully, but these errors were encountered: