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

148
Views
Comprobación de diferencia horaria de Mongodb

aquí están mis datos en un documento mongodb

 [ { startTime: "08:00", endTime: "09:00", id: 1 }, { startTime: "08:10", endTime: "09:00", id: 2 }, { startTime: "10:00", endTime: "11:00", id: 3 } ]

Necesito encontrar una manera de obtener elementos superpuestos en el tiempo usando mangosta con node.js. Intenté usar $dateFromString pero hasta ahora no tuve suerte. por ejemplo, los elementos id 1 y 2 tienen superposición de tiempo

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

db.collection.aggregate([ { $match: {} }, { $setWindowFields: { partitionBy: "", sortBy: { startTime: 1 }, output: { previous_endTime: { $shift: { output: "$endTime", by: -1, default: "Not available" } } } } }, { $set: { c: { $cond: { if: { $and: [ { $gte: [ "$previous_endTime", "$endTime" ] }, { $gte: [ "$previous_endTime", "$startTime" ] } ] }, then: 0, else: 1 } } } }, { $setWindowFields: { partitionBy: "", sortBy: { startTime: 1 }, output: { c: { $sum: "$c", window: { documents: [ "unbounded", "current" ] } } } } }, { $group: { _id: "$c", c: { $sum: 1 }, id_List: { $push: "$id" } } }, { $match: { c: { $gt: 1 } } } ])

parque infantil mongo

about 4 years ago · Juan Pablo Isaza Report
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!