Categories
JavaScript Answers

How to use populate and aggregate in same statement with Node Mongoose?

Spread the love

To use populate and aggregate in same statement with Node Mongoose, we call the populate method.

For instance, we write

Patients.populate(result, { path: "patient" }, callback);

to call the populate method with result and an object with the fields to get to populate the result.

callback is a function with the results.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *