Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Eliminar elemento de CosmosDB

Estoy tratando de eliminar entradas de Azure CosmosDB.

Documentación dice:

 /** * Delete item * Pass the id and partition key value to delete the item */ const { resource: result } = await container.item(id, category).delete(); console.log(`Deleted item with id: ${id}`);

Mi función para eliminar y elementos es:

 // takes in an entry id to detete and deletes it with the documentation async function findItemsToDelete(idToDelete){ const category = config.partitionKey; // partitionKey is {kind: "Hash", paths: ["/requests"]} and I've also tried just "/requests" // the four lines below are correct const { endpoint, key, databaseId, containerId } = config; const client = new CosmosClient({ endpoint, key }); const database = client.database(databaseId); const container = database.container(containerId); // query to return item with id (random code to make sure the item exists)- not important const querySpec = { query: `SELECT * FROM c WHERE c.id = "${idToDelete}"` }; const { resources: items } = await container.items .query(querySpec) .fetchAll(); // below is the delete code from the documentation const { resource: result } = await container.item(idToDelete, category).delete(); // random array holding the item that was just deleted- not important return items; }

Cuando intento llamar a esto, aparece un error que dice: La entidad con la identificación especificada no existe en el sistema. ¿Alguien sabe cómo implementar correctamente esto? Sé que la identificación es correcta, pero creo que puedo estar haciendo algo mal con la parte de clave de partición/categoría.

Vi en esta publicación: No se puede eliminar el elemento de CosmosDB que puedo necesitar el valor de la clave de partición, pero no sé qué es ni cómo obtenerlo. Por favor, hágamelo saber si sabe lo que está pasando!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!