Use the cursor stream in combination with JSONStream
to pipe it to your response object.
cursor.stream().pipe(JSONStream.stringify()).pipe(res);
More Related Contents:
- Unable to delete data from mongoDB
- collection is not defined in mongodb
- Push items into mongo array via mongoose
- Avoid “current URL string parser is deprecated” warning by setting useNewUrlParser to true
- Cannot overwrite model once compiled Mongoose
- MongoDB/Mongoose querying at a specific date?
- How to use a variable as a field name in mongodb-native findOne()?
- add created_at and updated_at fields to mongoose schemas
- How to populate a sub-document in mongoose after creating it?
- TypeError: db.collection is not a function
- mongoose custom validation using 2 fields
- How to protect the password field in Mongoose/MongoDB so it won’t return in a query when I populate collections?
- How to get a callback on MongoDB collection.find()
- Error: getaddrinfo ENOTFOUND in nodejs for get call
- MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
- Mongoose update without callback
- How to fix ‘Error: querySrv EREFUSED’ when connecting to MongoDB Atlas?
- What is best way to handle global connection of Mongodb in NodeJs
- Model.find() returns empty in mongoose [duplicate]
- Mongoose – caused by :: 11000 E11000 duplicate key error index?
- How can I get Express.js to 404 only on missing routes?
- Unable to Change Favicon with Express.js
- Mongodb find created results by date today
- How to use socket.io in express routes?
- Mongoose overwrite the document rather that `$set` fields
- Express Router undefined params with router.use when split across files
- Connect or Express middleware to modify the response.body [closed]
- CORS-enabled server not denying requests
- Using multiple parameters in URL in express
- Create unique autoincrement field with mongoose [duplicate]