MongoDB toArray performance
问题 I'm trying to build a category tree from a term collection in Mongo/Node, but first I select all tree elements using $in: console.time('termsCol.find'); var terms = await termsCol.find({term_id: {'$in': flatTree}}); console.timeEnd('termsCol.find'); console.time('termsCol.toArray'); terms = await terms.toArray(); console.timeEnd('termsCol.toArray'); This performs: termsCol.find: 0.162ms termsCol.toArray: 30.910ms I've read posts about toArray performance on SO, but would like to know if