Skip to content

Commit

Permalink
Merge pull request #13 from reedsy/use-count-documents
Browse files Browse the repository at this point in the history
🐛 Use countDocuments for mongo query instead of count
  • Loading branch information
dawidreedsy authored Dec 12, 2023
2 parents 08d3a95 + 988edf9 commit fa2f225
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adminjs/mongoose",
"version": "4.0.0-reedsy-0.0.1",
"version": "4.0.0-reedsy-1.0.0",
"description": "Mongoose adapter for adminjs",
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Resource extends BaseResource {

async count(filters = null) {
if (Object.keys(convertFilter(filters)).length > 0) {
return this.MongooseModel.count(convertFilter(filters))
return this.MongooseModel.countDocuments(convertFilter(filters))
}
return this.MongooseModel.estimatedDocumentCount()
}
Expand Down

0 comments on commit fa2f225

Please sign in to comment.