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

106
Views
Archivo Mongo Script: exporte el resultado de la ejecución a un archivo CSV después de registrar dos colecciones

Quiero exportar el resultado a un archivo CSV después de ejecutar el archivo de script usando mongo shell.

 topoList = db.collection1.aggregate([{ $match: { equipments: { $elemMatch: { "identification": { $exists: true; } } } } }, { $unwind: "$equipments" }]); print("--- collection1 : load" + topoList.length) while (topoList.hasNext()) { print("--- Inside while: load") topo_id = topoList.next().equipments while(topo_id.hasNext()){ collection2_id = topo_id.next()._id print(" * " + collection2_id) } print("- " + topo_id) gatewayList = db.collection2.find({ type: 'GATEWAY', collection1Id: topo_id }, { _id: 1 }) print("--- collection1 :" + topo_id) db.collection1.find({ _id: topo_id }) print("---- collection2s") collection2sList = db.collection2.find({ collection1Id: topo_id }) while (collection2sList.hasNext()) { collection2_id = collection2sList.next()._id print(" * " + collection2_id) db.collection2.find({ _id: collection2_id }) } print("----- end of collection1") } print("----- end of collection1")

¿Cómo exportar el resultado a un archivo CSV? Específicamente, las identificaciones resultantes (_id: collection2_id) deben exportarse a un archivo CSV.

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!