-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insertMany with large data #8420
Comments
My first guess would be that this is an issue with the code calling this code snippet, since the |
export const migrateDataDecimal = new ValidatedMethod({
name: 'app.migrateDataDecimal',
mixins: [CallPromiseMixin],
validate: null,
async run() {
if (Meteor.isServer) {
console.log('Starting...');
let data
data = await Journals.find().lean()
await Journals.deleteMany({})
await Journals.insertMany(data)
console.log('done Journal!');
return `Success`
}
},
})
// methods on client
migrateData() {
this.loading = true
migrateDataDecimal
.callPromise()
.then(res => {
this.loading = false
console.log('res', res)
})
.catch(err => {
this.loading = false
console.log('err', err)
})
} |
It's not easy for me to reproduce using a client side/server side code kind of thing. There is a lot that could change in my setup that would make my test inaccurate. Can you abstract your code in a single script that reproduces the issue? An example would look like the first code snippet in #8371 (comment). |
So what exactly is the issue here? It looks like your code runs twice, and one of those times it takes longer to execute than the other. Is that the problem, or do you not expect the code to run twice? |
I try to insert data with
insertMany
in Mongoose .but it alway execute two time when call it(1 time) .
Version
The text was updated successfully, but these errors were encountered: