mongodbscalaplayframeworkreactivemongoplay-reactivemongo

Can I run mongo js scripts from reactivemongo


Stack: Scala 2.11.8, ReactiveMongo 0.11.10, Playframework 2.4.6

We manage mongo update scripts through mongo scripts, which we manually apply on each update. I want to automate this process and make this part of startup process in Play, but it seems the only way to do this, is start writing scripts in Scala, using ReactiveMongo DSL.

Is there a way to use ReactiveMongo to send mongo scripts without rewriting them in ReactiveMongo terms?

UPDATE

Since it turned out, it's impossible to do it with Reactivemongo, I've just ran script from scala

    import sys.process._
    val mongoUpdateResult = "conf/mongo/update_mongo.sh" !!

Solution

  • You cannot execute MongoShell script, as they are specific to this client (not even to the wire protocol).