{"version":"1.0","type":"rich","title":"Aggregate data from MongoDB with Node.js and mongoose","description":"This example demonstrates how to calculate an account balance by aggregating embedded financial records in MongoDB using Node.js and Mongoose. It defines Account and Record schemas, inserts sample data, and runs an aggregation pipeline with `$match`, `$unwind`, and `$group` to sum record amounts via `AccountModel.aggregate()`. The code also shows CRUD operations for accounts and records, with results logged to the console.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-aee1442df6afb91964716c89c1863c68?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}