How can I work with “join” to export data from MongoDB?
I have 2 collections: list1 and list2. list1 have some fields and list2 have another fields, including the id referring to list1. I need to do a query to export all items on list1 that have at least one item referring to him on list2. How can I do this? It's something like a join from list1 to list2. I need to run a mongoexport command to generate a csv file. The way I do this is to create a short javascript program that will transfer the data you want to export into a new temporary collection, which you can then export. For example, create a file export.js: //initialise the export results