简体   繁体   English

从列表集合mongodb中读取文档

[英]Read document from list collection mongodb

db(database).listCollection().toArray(function (error, isListCollection){if(error){response.json(error.message)}else if(isListCollection){for(var i = 0; i < isListCollection.length; i++){const listColl = isListcoll.name; db(database).collection(listColl, (error, data) => { if(errr){responden.json(error.message)}else if(data){respons.json(data)});}

How to loop and push the respon data to Json file. 如何循环并将响应数据推送到Json文件。 Thanks 谢谢

Are you trying to take backup? 你想要备份吗? If yes there is a command mongoexport you can use to get response directly in json format. 如果是,则可以使用命令mongoexport直接以json格式获取响应。 It is provided by mongo 它由mongo提供

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

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