Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda