Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour while calling ScanDoc on ResultSet #576

Closed
robsztal opened this issue Jan 13, 2023 · 3 comments · Fixed by #610
Closed

Strange behaviour while calling ScanDoc on ResultSet #576

robsztal opened this issue Jan 13, 2023 · 3 comments · Fixed by #610
Labels
Milestone

Comments

@robsztal
Copy link

Bug Report Checklist (remove this template if submitting a feature request)

  1. Which version of Kivik are you using? Please state a version number, or master.
  • v4.0.0
  1. Which version of Go are you using? (Output of go version) -- Kivik 3.x supports Go 1.9 and later. Kivik 4.x requires Go 1.13 or later, with module support. The Kivik 4/master aims to support Go 1.11 and later, with module support.
  • 1.19.3
  1. What did you do? (Include your code if possible)

I want to get one specific document with specific id prefix so I am using Find with query selector

doc := db.Find(ctx, query)
res := model.ExampleModel{}
err = doc.ScanDoc(&res)
  1. What did you expect to see?

two cases:

  • first when there is no document I want empty res or error from ScanDoc?
  • second where there is a document I want filled res
  1. What did you see instead?
  • first example: ScanDoc stays in infinite loop
  • second example: works fine

When I am using :

doc := db.Find(ctx, query)
res := model.ExampleModel{}
for doc.Next() {
		err = doc.ScanDoc(&res)
	}

it works like intended but despite that why code is entering infinite loop instead of error or something?

@flimzy
Copy link
Member

flimzy commented Jan 18, 2023

That code has undergone some changes in the 4.x branch, that have not been fully tested. And I haven't had a chance to get back to it in a while.

My suggestion is to use the stable branch (3.x) instead. It should not have those problems. If it does, of course, please file a bug report about that, and I'll prioritize fixing that.

@flimzy flimzy added the bug label Jan 18, 2023
@flimzy flimzy added this to the v4.0 milestone Jan 18, 2023
@robsztal
Copy link
Author

@flimzy Ok great! Thanks for reply.

@flimzy
Copy link
Member

flimzy commented May 10, 2023

I believe I have now reproduced this, and have a good idea the cause. I hope to have a fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants