Skip to content

Commit

Permalink
Fix order of mongo query
Browse files Browse the repository at this point in the history
  • Loading branch information
megastary committed Oct 11, 2024
1 parent 95e18b8 commit dba3cab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requests.http
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ sbf-API-secret: developmentsecret

###

GET https://localhost/api/orders HTTP/1.1
GET https://localhost/api/latestOrders HTTP/1.1
Content-Type: application/json
6 changes: 3 additions & 3 deletions routes/api/latestOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const router = Router()
router.get('/', ensureAuthenticatedDashboardAPI, function (req, res) {
// Find products in database
Order.aggregate([
{
$limit: parseInt(req.query.limit) || 25
},
{
$sort: {
_id: -1
}
},
{
$limit: parseInt(req.query.limit) || 25
},
{
$lookup: {
from: 'deliveries',
Expand Down

0 comments on commit dba3cab

Please sign in to comment.