Match with regex not working at Aggregate

21 views
Skip to first unread message

Lukma Gayo Arizky

unread,
May 31, 2016, 8:03:38 AM5/31/16
to ReactiveMongo - http://reactivemongo.org

Hay i actually running command for matching text with regex at aggregate, i have tested at mongo shell and working but with reactivemongo api command match result not working


val commandDoc = BSONDocument(
      "aggregate" -> "posts",
      "pipeline" -> BSONArray(
        BSONDocument("$unwind" -> "$keywords"),
        BSONDocument("$match" -> BSONDocument("keywords" -> BSONDocument("$regex" -> filter, "$options" -> "i"))),
        BSONDocument("$group" -> BSONDocument("_id" -> "$keywords")),
        BSONDocument("$limit" -> (offset + limit)),
        BSONDocument("$skip" -> offset),
        BSONDocument("$sort" -> BSONDocument("keywords" -> sortValue))
      )
    )

    val runner = Command.run(BSONSerializationPack)

    runner.apply(reactiveMongoApi.db, runner.rawCommand(commandDoc)).one[JsObject].map {... }


Thanks, for help

Cédric Chantepie

unread,
May 31, 2016, 2:46:03 PM5/31/16
to ReactiveMongo - http://reactivemongo.org
Reply all
Reply to author
Forward
0 new messages