NodeJS + Mongo - how to get the contents of collection? NodeJS + Mongo - how to get the contents of collection? mongodb mongodb

NodeJS + Mongo - how to get the contents of collection?


The companies parameter that's passed into your find callback is a Cursor object, not an array. Call toArray on it to convert the query results to an array of objects, or each to process the results one at a time.


use .each on companies, instead of forEach