Hi m working to load data from mongodb but it is loading all data at once i wants to load only that loggedin user related data,
code:
async function getMeetingsViewData(req) {
try {
checkRoles(req);
const meetings = await Meeting.find({
$or: [{ "attendees.user": req.user._id }, { chair: req.user._id }],
}).sort({ status: 1, date: 1 });
const taskMetas = await batchUserTasks(req, Task.find().stream());
const tasks = await prepareTasks(taskMetas, req.user._id);
here is complete code:
paste.ofcode.org/fxJESwAgM8iHc6RhF4a6AR