Mongo.jl icon indicating copy to clipboard operation
Mongo.jl copied to clipboard

Cursor reset looses query information

Open rened opened this issue 11 years ago • 1 comments

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

rened avatar Nov 19 '13 16:11 rened

The cursor should definitely retain the query and fields, so this is a bug. I'll take a look as soon as I get a chance.

Lytol avatar Nov 19 '13 18:11 Lytol