2

I am trying do execute the following command using RawCommand in ReactiveMongo:

val commandDoc =
      BSONDocument(
        "update" -> "users",
        "updates" -> BSONArray(
          BSONDocument("q" -> BSONDocument("_id" -> BSONObjectID("53f265da13d3f885ed8bf75d")),
            "u" -> BSONDocument("$push" -> BSONDocument("v" -> 6)), "upsert" -> false, "multi" -> false)
         // BSONDocument("q" -> query, "u" -> update2, "upsert" -> false, "multi" -> false)
        ),
        "ordered" -> true
      )

    // we get a Future[BSONDocument]
    val futureResult = con("tests").command[BSONDocument](RawCommand(commandDoc))

    futureResult.map { result => // result is a BSONDocument

      println(result)

      true
    }

But I got this strange error as result:

[DefaultCommandError: 
   BSONCommandError['command failed because the 'ok' field is missing or equals 0'] 
   with original doc { 
     ok: BSONInteger(1), 
     nModified: BSONInteger(0), 
     n: BSONInteger(0) 
   }
]

What's happening?

Grzegorz Żur
  • 47,257
  • 14
  • 109
  • 105
Lucas Batistussi
  • 2,283
  • 3
  • 27
  • 35

0 Answers0