Exec query in js via mongosh 5 July 2024 / 1 min readmongodb, mongosh 💻 Tech Sometimes, it would be better if you have queries in your .js file instead of entering queries directly via mongosh. For example, you have queries that join multiple documents. load("/home/user1/query.js")