0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-16 10:22:42 +00:00

Fix lock count function

This commit is contained in:
G.Ambatte
2024-06-08 16:36:20 +12:00
parent bc7731b819
commit 240342007b

View File

@@ -141,19 +141,13 @@ router.get('/admin/stats', mw.adminOnly, async (req, res)=>{
router.get('/admin/lock', mw.adminOnly, async (req, res)=>{ router.get('/admin/lock', mw.adminOnly, async (req, res)=>{
try { try {
const countLocksPipeline = [ const countLocksQuery = {
{ lock : { $exists: true }
$match : };
{ const count = await HomebrewModel.countDocuments(countLocksQuery)
lock : true .then((result)=>{
} return result;
}, });
{
$count :
'count'
}
];
const count = await HomebrewModel.aggregate(countLocksPipeline);
return res.json({ return res.json({
count count
}); });