0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 13:22:40 +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)=>{
try {
const countLocksPipeline = [
{
$match :
{
lock : true
}
},
{
$count :
'count'
}
];
const count = await HomebrewModel.aggregate(countLocksPipeline);
const countLocksQuery = {
lock : { $exists: true }
};
const count = await HomebrewModel.countDocuments(countLocksQuery)
.then((result)=>{
return result;
});
return res.json({
count
});