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

99
Visualizações
How to post element in existing document couchdb

Hi I want to create a couchdb database of this format where I can add items in the right type of item(Vegetables or Fruits) enter image description here

But I want to know how can I add some products in the catalog with the nano utils of couchdb without erasing the list of items already created. The actual method to add products in my catalog is this one: but the problem is that I can add only one item to the catalog. I wanted to make a product.get() but how can I add items to the get result and how can I insert the new list to the database?

function AddProduct(name, price, image, category, id) {

  return new Promise((resolve, reject) => {
    var catalog = 'catalog'
  
    catalog.insert(
      // 1st argument of nano.insert()
      {
        "catalog": {
          category: {
            id: {
              'name': name,
              'price': price,
              'image': image,
              'category': category
            }
          }
        }
      }, 'catalog',
      (error, success) => {
        if (success) {
          resolve(name)
        } else {
          reject(
            new Error(`In adding (${name}). Reason: ${error.reason}.`)
          )
        }
      }
    )
  })
}```
about 4 years ago · Juan Pablo Isaza
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