mongodb: fix iterator crashes
authorAlexandre Terrasa <alexandre@moz-code.org>
Sun, 29 Nov 2015 22:42:30 +0000 (17:42 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sun, 29 Nov 2015 22:43:08 +0000 (17:43 -0500)
commit5a5be3af12309740d26008f67a77856ec9e2cb5a
tree4e695dd70fe792b25481eaa2ddaa7030a1e3859c
parent65942d13e0fb20e27d37d025457ccfbca1190da7
mongodb: fix iterator crashes

Before this PR, the iterator `is_ok` status relied on `mongoc_cursor_more` that can return
true even if the iterator is terminated.
This PR fixes the problem by using the result of `mongoc_cursor_next` instead.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/mongodb/mongodb.nit
lib/mongodb/native_mongodb.nit