简体   繁体   English

如何从Java应用程序禁用MongoDB上的服务器端JavaScript

[英]How to disable server-side JavaScript on MongoDB from Java Application

I have a java web application that does CRUD ops on a MongoDB Atlas instance. 我有一个Java Web应用程序,可以在MongoDB Atlas实例上执行CRUD操作。 I want to disable server-side JavaScript for my Atlas instance from my Java web application. 我想从Java Web应用程序中为Atlas实例禁用服务器端JavaScript。
What I have found out are this and this which basically say that I need to either alter the mongod.conf file or use the command line args --noscripting on mongod command. 我已经发现有这个这个基本上说,我需要可以改变mongod.conf文件或使用命令行参数--noscriptingmongod命令。 But I want to accomplish this using my Java web application when the web app starts. 但是我想在Web应用程序启动时使用Java Web应用程序来完成此操作。

Does the MongoDB java driver provide a mechanism to achieve this? MongoDB Java驱动程序是否提供实现此目的的机制?
Are there any alternate ways to get this done? 是否有其他替代方法可以做到这一点?

Note: I do not want to pass mongod command from my web application. 注意:我不想从Web应用程序传递mongod命令。

Does the MongoDB java driver provide a mechanism to achieve this? MongoDB Java驱动程序是否提供实现此目的的机制?

The option to enable or disable server-side JavaScript can only be set in the MongoDB server configuration on startup; 只能在启动时在MongoDB服务器配置中设置启用或禁用服务器端JavaScript的选项。 it is not possible to change via a driver or runtime API call. 无法通过驱动程序或运行时API调用进行更改。

Since MongoDB Atlas is a managed service, end users do not have direct access to MongoDB server configuration and are limited to options exposed via the admin UI. 由于MongoDB Atlas是一项托管服务,因此最终用户无法直接访问MongoDB服务器配置,并且只能使用通过管理UI公开的选项。

MongoDB Atlas does not currently allow configuring the security.javascriptEnabled value: server-side JavaScript execution is disabled for free/shared clusters (M0, M2, M5) and enabled for M10+ clusters. MongoDB Atlas当前不允许配置security.javascriptEnabled值: 对于自由/共享集群 (M0,M2,M5),服务器端JavaScript执行被禁用,对于M10 +集群,服务器端JavaScript执行被禁用

Are there any alternate ways to get this done? 是否有其他替代方法可以做到这一点?

If you have an M10+ MongoDB Atlas cluster (which currently has JavaScript execution enabled by default) you can open a support case and ask if it would be possible to disable server-side JavaScript for your cluster. 如果您有一个M10 + MongoDB Atlas集群(当前默认情况下启用了JavaScript执行),则可以打开一个支持案例 ,询问是否可以为该集群禁用服务器端JavaScript。 Customer requests/feedback are one signal that would encourage either changing the default value in MongoDB Atlas or making it configurable via UI. 客户请求/反馈是一种信号,它会鼓励您更改MongoDB Atlas中的默认值或通过UI对其进行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM