How do I execute a MongoDB js script using the Java MongoDriver

前端 未结 4 757
刺人心
刺人心 2020-12-10 17:00

I have implemented a JavaScript function inside the Mongodb server using this example.

It works fine when I use mongo shell, but I want to run it from inside a Java

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 17:55

    Since MongoDB 4.2 the eval command is removed (it was deprecated in 3.0). There is no more way to eval JavaScript scripts into MongoDB from the Java Driver.

    See https://docs.mongodb.com/manual/reference/method/db.eval/

提交回复
热议问题