Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
How to save thousand data in Parse Platform NodeJS

I am new to the parse platform and i'm trying to insert 81000 rows of data in to the Parse DB, here the code

        const uri = "/the.json"
        const res = await axios.get(uri)
        const dataresult = Object.keys(res.data)

        if (dataresult.length > 0) {
            res.data.forEach(function (datakp) {
                var kp = new Parse.Object("theClass");
                kp.save(datakp)
                    .then((res) => {
                        console.log('oke ' + res.id)
                    }),
                    (error) => {
                        console.log('err : '+ error.message)
                    }
            })
         }

There is no error in console log, and no data is saved in Parse DB, but if I only insert 1000 rows, it will save to the database.

EG:

            if (dataresult.length > 0) {
            res.data.forEach(function (datakp, index) {
                if (index < 1000) {
                 var kp = new Parse.Object("theClass");
                 kp.save(datakp)
                    .then((res) => {
                        console.log('oke ' + res.id)
                    }),
                    (error) => {
                        console.log('err : '+ error.message)
                    }
                })
               }
           }

Thank You

UPDATE

I fix this case based on answer @davi-macêdo here a complete code

    const uri = "/the.json"
    const res = await axios.get(uri)
    const dataresult = Object.keys(res.data)
    const objs = [];
    const theKP = Parse.Object.extend("theClass")
    if (dataresult.length > 0) {
        res.data.forEach(function (datakp) {
            var thekp = new theKP()
            thekp.set(datakp)
            objs.push(thekp);
        })
     }

    Parse.Object.saveAll(objs)
                .then((res) => {
                    console.log('oke updated ' + dataresult.length)
                }),
                (error) => {
                    console.log('err : '+ error.message)
                }
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The most efficient way is using Parse.Object.saveAll function. Something like this:

        const uri = "/the.json"
        const res = await axios.get(uri)
        const dataresult = Object.keys(res.data)
        const objs = [];

        if (dataresult.length > 0) {
            res.data.forEach(function (datakp) {
                objs.push(new Parse.Object("theClass", datakp));
            })
         }

        Parse.Object.saveAll(objs)
                    .then((res) => {
                        console.log('oke ' + res.id)
                    }),
                    (error) => {
                        console.log('err : '+ error.message)
                    }

Anyways, since you have no error and no data currently being saved, you might be kitting some memory limit. So that's something you also need to be aware about.

about 4 years ago · Juan Pablo Isaza Relatório

0

You're probably hitting rate limits, I can't imagine saving 81,000 records in one shot is normal behaviour for many applications.

I looked through the documentation and couldn't find anything that might mention a save limit, however sending 1000 requests would trigger most rate limit protection

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda