MongoDB deleteAll() tells users to call where() even after where({})
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #30785 by @lazerg — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- mongodb, node.js, typescript
- Domain
- backend-api-design, database
Research direction
Start with the MongoDB ORM's .where({}) handling and the .deleteAll() guard that emits the misleading error; the issue provides the reproduction but no file or test paths. Read that guard and its related tests first. Done means an empty filter produces accurate guidance on the supported explicit delete-all path, with regression coverage. An open linked pull request already addresses this issue.
Written by the indexing model from the issue text.
Description
Package and version
@prisma/[email protected], [email protected]
What happened?
While clearing a collection before reseeding, .where({}).deleteAll() throws an error instructing me to call .where(), which I already did.
If an empty filter is intentionally blocked for safety, the message does not explain that or tell me how to explicitly clear the collection.
What did you expect to happen?
Explain that an empty filter is rejected and show the supported way to explicitly delete everything, rather than instructing me to call .where() again.
Minimal reproduction
With a configured transactions collection, run:
await db.orm.transactions.where({}).deleteAll(); // Throws despite calling .where():
// deleteAll() requires a .where() filter. Call .where() before .deleteAll()
No dataset is required: the guard throws before a database command is sent.
Environment
- Node.js:
24.9.0 - OS: macOS, Darwin
24.6.0 - Package manager: npm
11.6.0 - Database: MongoDB
8.2.0-rc4, local single-node replica set - Scaffold:
[email protected]
Additional context
The workaround used was the MongoDB driver's collection.deleteMany({}).
In current source, .where({}) adds no filter expressions, so .deleteAll() treats it like a missing .where() call.
The separate db.query builder exposes .from('transactions').deleteAll(), but the ORM error does not direct users to it.
The current source was checked; the reproduction was not rerun during drafting.
- Dominant language
- TypeScript
- Stars
- 47.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 227
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from prisma/orm
-
bug/1-unconfirmed kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
get-platform: distros with ID_LIKE=alpine are not detected as musl, so glibc engines are used on Alpine-based imagesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prisma/orm#31281 · 1 comment ·
Maintainers usually reply within 1 day
-
adapter-pg: connectToShadowDb connects to the main database when built from a connection stringMay be free again @cestercian claimed this 10 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
prisma/orm#31196 · 1 comment ·
Maintainers usually reply within 1 day
-
[Prisma 8] Type-check time grows exponentially with chained .include() callsPossibly taken @SiKreuz claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
prisma/orm#31161 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
prisma/orm#31125 · 4 comments · 6 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tashfeenahmed/freellmapi#2305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prime-radiant-inc/evener#8335 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel-labs/ui#1921 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
microsoft/monaco-editor#5626 ·
Maintainers usually reply within 1 day