[GODRIVER-2613] Error EOF on decode aggregate cursor Created: 26/Oct/22 Updated: 27/Oct/23 Resolved: 16/Nov/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Javad Rajabzadeh | Assignee: | Preston Vasquez |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
I want decode one result on one object but got error EOF on cursor decode.
|
| Comments |
| Comment by Preston Vasquez [ 22/Sep/23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
diamondheadqueen@gmail.com Apologies for any inconvenience. Are you calling Cursor.Decode within the context of Cursor.Next ? From the Cursor.Decode documentation:
From the Cursor.Next documentation:
That is, you must call next before you call decode. And if next returns "false", then the cursor has been exhausted and there is nothing that can be decoded (and calling decode will return EOF). Here is an example of misuse: https://gist.github.com/prestonvasquez/91392ba8a8228bad7e47764770cf351f If the issue persists, could you provide us with a the version of the Go Driver and server version you are using? Could you also extend the code you've provided to illustrate how you are decoding data from the cursor? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Teresa Hale • Diamond Head Queen [ 20/Sep/23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm facing the same issue.
Regardless of whether I call `cursor.Next()` or not, I still get the error on decoding. Fix your shit please. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by PM Bot [ 16/Nov/22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Preston Vasquez [ 01/Nov/22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ja7ad@live.com From the documentation on mongo.Cursor:
It looks like you are trying to decode data from an empty cursor (i.e. cursor.Current == nil), try calling cursor.Next before cursor.Decode. Here is an example from the README.md:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Esha Bhargava [ 28/Oct/22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ja7ad@live.com Thanks for reporting this issue! We'll look into it and get back to you soon. |