
How to Render Tables in Mongoose Studio Dashboards
Dashboards are great for charts, but not every result belongs in a graph. Sometimes the clearest way to present data is a table: top customers, recent failed jobs, inventory snapshots, leaderboard rows, or any result where exact values matter. Mongoose Studio dashboards support table output directly. If your dashboard code returns a $table object with columns and rows , Studio will render it as a proper table in the dashboard UI. That gives you a simple way to turn aggregation results or query output into something readable without building a frontend by hand. The Shape of a Table Result To render a table, return an object with a $table property. Inside $table , define the column names and the row data: const users = await User . find (). sort ({ createdAt : - 1 }). limit ( 5 ). lean (); return { $table : { columns : [ ' Name ' , ' Email ' , ' Created At ' ], rows : users . map ( user => [ user . name , user . email , user . createdAt ?. toISOString () ]) } }; columns is an array of he
Continue reading on Dev.to
Opens in a new tab


