skip to Main Content

How to merge two mongodb query into one

I have two mongodb aggregate query as shown below. The below query gives me the count of total failed and the sectionType db.Departments.aggregate([ { $match: {$and: [{"subject.failed": {$eq: 'true'}}, {"section": {$eq: 'A'}}]} }, { $group: { _id: {"sectionType": "$sectionType"}, "COUNT(*)":…

VIEW QUESTION

Mongodb – Form DELETE method is redirecting to the GET method instead in EXPRESS JS

I have a form here with the delete method being used: <form action="/article/<%= articles[i]._id %>" method="DELETE"><button class="btn btn-danger" type="submit">Delete</button></form> Then my routes for the article ID's look like this: const articleById = require('../controllers/article/articleById') router.get('/:id', articleById) const deleteArticleById = require('../controllers/article/deleteArticleById') router.delete('/:id',…

VIEW QUESTION
Back To Top
Search