MongoCursor size is decreasing when it is converted to list using toList

拥有回忆 提交于 2019-12-13 05:09:57

问题


I am having weird issue with mongo cursor. I am using casbah to access Mongo through Scala code. I have following code:

val cur = collection.find(MongoDBObject("brand" -> "someBrand")

val items = cur.toList.map(dbo => ScalaJack.readDB [ T ] (dbo))

I have 387 item in the db that should be returned with the query above. But it is returning 364 items only. When I checked the size of cur it is 387, but when I checked the size of cur.toList it is 364.

I am not sure why doing toList on cursor is decreasing the size. What might cause it?

来源:https://stackoverflow.com/questions/23410483/mongocursor-size-is-decreasing-when-it-is-converted-to-list-using-tolist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!