Skip to content

Commit 19fe260

Browse files
committed
fix: missing default sort
1 parent a20257b commit 19fe260

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

api/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { VercelRequest, VercelResponse } from '@vercel/node'
2+
import process from 'process'
23
import { Collection, Db, MongoClient } from 'mongodb'
34
import { HandleRouter, Route, getProjectSrotFromStr } from 'serverless-kit'
45

@@ -28,7 +29,7 @@ Route.prototype.parseLimits = function () {
2829
return this.check((ctx) => {
2930
ctx.offset = parseInt((ctx.req.query.offset as string) || '0')
3031
ctx.limit = Math.min(25, parseInt((ctx.req.query.limit as string) || '10'))
31-
ctx.sort = getProjectSrotFromStr((ctx.req.query.sort as string) || '')
32+
ctx.sort = getProjectSrotFromStr((ctx.req.query.sort as string) || '!_id')
3233

3334
ctx.project = null
3435
ctx.req.query.project = ctx.req.query.project || ctx.req.query.prop || ''

0 commit comments

Comments
 (0)