开发者

Is it possible to make a REST call from a MongoDB Map/Reduce function and process the results?

开发者 https://www.devze.com 2023-01-26 13:47 出处:网络
I am wondering if it is possible to make a REST request from within a Map-Reduce or system.js function. I would like to be able to call an external service, and from the returned JSON results, take so

I am wondering if it is possible to make a REST request from within a Map-Reduce or system.js function. I would like to be able to call an external service, and from the returned JSON results, take some ids and use them as BSON ObjectIDs for a second Mongo query.

An example for this would be selecting a collection of ObjectIDs from Mongo, and then making a REST开发者_运维技巧 call with these ids as a parameter to a graph database. The graph database would then send back a json list of results/new ids, which Mongo would then use to do a second lookup before returning the entire result set to the user.

Thanks!


I don't believe so - purely because of the security implications of such a feature. It would allow a malicious attacker who finds an injection vulnerability to use your database for DDoS attacks, as a proxy for further nefarious activities, etc.


It is not possible; It is probably best to do this in your code and not javascript on the server even if it was.

0

精彩评论

暂无评论...
验证码 换一张
取 消