【发布时间】:2019-04-14 09:29:20
【问题描述】:
我有大量从 API 获得的对象,这是它的 URL: https://api.opensea.io/api/v1/asset_contracts/ 我想把这个 JSON 传递给 MongoDB,以便为这个数组中的每个对象创建一个记录(目前有 ~230 个)。
最好的方法是什么?我目前有这样的json:
fetch("https://api.opensea.io/api/v1/asset_contrcts/"}).then(r => r.json())
.then(data => {
// Add all of the data to a collection;
return data;
});
}
最好的方法是什么?在每个对象上运行一个 for 循环并插入它,或者有什么方法可以以更优化的方式执行它?
【问题讨论】:
标签: javascript node.js mongodb mongoose nosql