globalsign / mgo

The MongoDB driver for Go
Other
1.97k stars 230 forks source link

Cursor HasNext #225

Open pajecha opened 6 years ago

pajecha commented 6 years ago

https://docs.mongodb.com/manual/reference/method/cursor.hasNext/#cursor.hasNext

Will there be support for cursor.hasNext() ??

tadukurow commented 6 years ago

Hi @pajecha

It is the vacation season currently, so we're not planning on implementing new features soon. But we are definitely open to a PR for this, as it looks like a straightforward addition.

domodwyer commented 6 years ago

Hi @pajecha

Is this somehow different to Iter.Done()? Obviously apart from being inverted. Iter.Done() uses internal state and doesn't make a query to the server, so it could return an incorrect value if a new document matching the cursor is added I imagine.

Dom

pajecha commented 6 years ago

@domodwyer Im not sure if Iter.Done() does what cursor.hasNext() does. I am trying to implement a range query that then check if my the last found item, if used in a query has more documents. @tadukurow will implement and issue the pull request.