0

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?

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471
turiLauke
  • 11
  • 1
  • Seems similar to http://stackoverflow.com/questions/23401597/casbah-cursor-and-tolist – Ross May 01 '14 at 17:37
  • Can you provide a test case? How did you check the size of `cur`? What does `collection.find(MongoDBObject("brand" -> "someBrand")).count()` return? Also can you try a `foldLeft` as well? `collection.find(MongoDBObject("brand" -> "someBrand")).foldLeft(0)((x, doc) => x+1)` Finally what type of mongodb setup do you have single node or sharded? – Ross May 01 '14 at 17:41

0 Answers0