Skip to content

Cursor reset looses query information #22

@rened

Description

@rened

Perhaps this is by design, but I would have expected a cursor, when it is reset, to always perform identically. The following shows that the cursor reset code in reset(cursor::MongoCursor) seems to remove the query information?

using Mongo
client = MongoClient();
db = "test.people"
insert(client, db, { "name" => "A", "age" => 20})
insert(client, db, { "name" => "B", "age" => 20})
insert(client, db, { "name" => "C", "age" => 30})
cursor = find(client, "test.people", { "age" => 20 })

# this will display A and B
for doc in cursor
  @show doc
end

# this will display _all_ entries, A,B,C
for doc in cursor
  @show doc
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions