parse-community / parse-community/parse-server
Count does not work with masterKey on postgres
Open
Nobody has claimed this yet.
type:bug
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
Using query.count({useMasterKey: true}) returns 0 objects.
Steps to reproduce
it('count objects', async () => {
const obj = new Parse.Object('TestObject');
const obj2 = new Parse.Object('TestObject');
await Parse.Object.saveAll([obj, obj2]);
const query = new Parse.Query('TestObject');
const count = await query.count({ useMasterKey: true });
equal(count, 2); // this fails, count is 0.
});
Actual Outcome
Count is 0
Expected Outcome
Count should return.
Environment
Server
- Parse Server version: 5.3.0
- Operating system:
macos - Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
localhsot
Database
- System (MongoDB or Postgres):
Postgres - Database version:
latest - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
local
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
js - SDK version:
-
Logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided JavaScript reproduction against Parse Server 5.3.0 with PostgreSQL, then trace the query.count path and the PostgreSQL adapter. Done means the same setup returns 2 for two saved TestObject instances when useMasterKey is true, with a regression test covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, postgresql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100