0
I have a Node application that connects to Mongodb, in it I have an endpoint using express that returns me the largest balances grouped by agency:
router.get("/private", async (_, res) => {
try {
const accounts = await accountsModel.aggregate([
{
$group: {
_id: "$agencia",
maxBalance: { $max: "$balance" },
},
},
]);
res.send(accounts);
} catch (error) {
res.status(500).send(error);
}
});
This endpoint returns me the following result:
Only I need to update the agency values (_id) all to 99. Does anyone know how to do this on Mongodb?