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

138
Views
Mongodb: mire el flujo de cambios en documentos con un elemento de matriz anidado de cierto valor

Aquí está mi documento:

 { "_id": { "$oid": "6257a55d04bf2167733f5b72" }, "attributes": { "CustomerName": "John", "CustomerID": "28374", "LoanID": "82349327409234" "type": "Record", "Pointers": [ {"type":"car","token_id":"123"}, {"type":"house","token_id":"456"} ] } }

Aquí está mi consulta de reloj con el objetivo de buscar elementos de punteros con tipo: "automóvil":

 var watchCursor = db.loans.watch([ { $match: { "$or": [ { "updateDescription.updatedFields.attributes.Pointers": { $elemMatch: { "type": "car" } } }, { "fullDocument.attributes.Pointers": { $elemMatch: { "type": "car" } } } ] } } ]); while (!watchCursor.isExhausted()){ if (watchCursor.hasNext()){ print(JSON.stringify(watchCursor.next())); } }

El problema es que modifico el documento pero no devuelve ningún resultado de cambio.

Como prueba, cambié la etapa $elemMatch a $exists: true , luego modifiqué el documento y devolvió el documento modificado con éxito.

¡¿qué ocurre?!

about 4 years ago · Santiago Trujillo
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!