silent problem getting large result sets

11 views
Skip to first unread message

David

unread,
Jun 16, 2017, 10:51:12 AM6/16/17
to ReactiveMongo - http://reactivemongo.org
Hello,

I have the following method (called from a play application):

  def getPlateListEntries(plateListId: JsValue): Future[Seq[JsObject]] = {

    database.flatMap(db => {

      val collection = db.collection(plateListEntriesColl, failoverStrategy)

      val source: Source[JsObject, Future[State]] = collection.find(Json.obj("plateList" -> plateListId),

        Json.obj(

          "_id" -> 1,

          "country" -> 1,

          "plate" -> 1,

          "metadata" -> 1,

          "begin_date" -> 1,

          "end_date" -> 1,

          "vehicle_type" -> 1)

      )

        .cursor[JsObject](readPreference = reactivemongo.api.ReadPreference.nearest)

        .documentSource()

      source.runWith(Sink.seq[JsObject])

    })

  }


The method works well when it has to return a limited number of records but fails but fails silently for a query that should return more records (e.g., 1,460,738 records).

I have tried to visualize the problem as follows:

        mongo.getPlateListEntries(_id).onComplete{

            case Failure(e) => {

                Logger.debug(">>>>>>>>>>>>>> Fail loading entries for black list : "+id)

                e.printStackTrace()

            }

            case Success( entries ) => {

                Logger.debug( s">>>>>>>>>>>>>> Got subset of PlateListEntries for corresponding PlateList oid: ${id} with ${entries.length} entries")

            }

        }


When things go well, the Success case is called as expected, but for queries that should return a large number of results, nothing happens.

What am I missing? 

Thanks,

David

David

unread,
Jun 16, 2017, 12:48:11 PM6/16/17
to ReactiveMongo - http://reactivemongo.org
Never mind!  The process just takes time.  The Success log was lost further down in the logs.
David
Reply all
Reply to author
Forward
0 new messages