[英]How to loop a Documents on a MongoDB Collection and perform a post request with each one?
This is a one time task that I need to perform. 这是我需要执行的一项任务。 I'm new to mongo and programming but I think that I figured out a way of doing it but I need some help with details.
我是mongo和程序设计的新手,但我认为我想出了一种方法,但是在细节方面我需要一些帮助。
I want to loop over a whole collection and send each document as a POST request. 我想遍历整个集合并将每个文档作为POST请求发送。
col.find().sort('updatedAt', pymongo.ASCENDING).forEach( javascript function )
The above commenad should work. 以上建议应该起作用。 But my concerns are:
但我担心的是:
Thanks in advance! 提前致谢!
Javascript (ES5) Javascript(ES5)
db.collection.find({}).sort('updatedAt': 1).forEach(function(doc){postFunction(doc)});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.