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

192
Views
Cómo verificar si un campo en un documento y un campo dentro de una matriz en otro documento son iguales usando la búsqueda en mongodb
 { "_id" : ObjectId("61bc628385fcf3659d2291ac"), "hotel" : ObjectId("61bc621585fcf3659d2291ab"), "rooms" : [ { "roomno" : "P1", } ] { "_id" : ObjectId("61bc63f485fcf3659d2291b0"), "payment" : "COD", "roomno" : "P1", "category" : "premium", "user" : ObjectId("61bc638b85fcf3659d2291af"), "hotel" : ObjectId("61bc617285fcf3659d2291a9"), new Promise(async(resolve,reject)=>{ let booking= await db.get().collection(collections.BOOKING_COLLECTION).aggregate([ { $match:{hotel:ObjectId(hotelID)} }, { $lookup:{ from:collections.ROOM_COLLECTION, localField:'roomno', foreignField:'rooms.roomno', as:'bookingrooms' } }, { $lookup:{ from:collections.USER_COLLECTION, localField:'user', foreignField:'_id', as:'user' } }, { $unwind:'$bookingrooms' } ]).toArray() console.log("yes booking"); console.log(booking.bookingrooms); resolve(booking)e here

Quiero verificar que el 'roomno' en la matriz de habitaciones en la primera colección y el 'roomno' en la segunda colección sean iguales y quiero obtener el documento si ambas habitaciones coinciden. Uso la búsqueda pero no obtengo una respuesta.

over 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!