when I insert many Data to MongoDB,
the main code like this:
like an
arr = [obj, obj, obj, ...]
it's length like more 60000
//Girl is a Model in mondoDB
jsonArr.forEach((v, i) => {
const json = require(`../${f}/${v}`)
json.userInfo.forEach((v, i) => {
Girl({ ...v }).save(function (err, data) {
if (err) console.log(err)
})
})
})
I use insetMany it (what like big data ) also cause the error :
Girl.insertMany(arr)
it show an error:
like this:
MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [MongoNetworkError: connection 0 to 127.0.0.1:27017 timed out]
how should I put it into MongoDB,