Mongo.jl
Mongo.jl copied to clipboard
Cursor reset looses query information
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
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.