Can't deleteMany when using UUID
See original GitHub issueI get the following error message when trying to deleteMany a model that has uuid.
I’m currently using postgres as database provider
model
model Vault {
id String @id @default(uuid())
createdAtTick Int
x Int
y Int
userId String?
resourceId String
facilityId String
}
code
const { findMany, deleteMany } = photon.vaults];
const results = await findMany();
if (results.length > 0) {
await deleteMany({
where: { id: { in: results.map(({ id }) => id) } },
});
}
error message
Invalid `photon.vaults.deleteMany()` invocation:
{
where: {
id: {
in: [
'd4082b42-b161-11e9-8754-6542abf52968',
'd4082b45-b161-11e9-8754-6542abf52968',
'd4f9de42-b161-11e9-b0ed-f5aa37e6d1ec',
'd4f9de45-b161-11e9-b0ed-f5aa37e6d1ec'
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
}
}
Argument in: Got invalid value
[
'd4082b42-b161-11e9-8754-6542abf52968',
'd4082b45-b161-11e9-8754-6542abf52968',
'd4f9de42-b161-11e9-b0ed-f5aa37e6d1ec',
'd4f9de45-b161-11e9-b0ed-f5aa37e6d1ec'
]
on photon.deleteManyVault. Provided List<UUID>, expected List<String>.
1836 | return `${this.args
1837 | .map(arg => arg.toString())
> 1838 | .filter(a => a)
| ^
1839 | .join('\n')}`;
1840 | }
1841 | collectErrors() {
at Document.validate (src/server/photon/runtime/index.js:1838:23)
at VaultClient.validate (src/server/photon/index.js:250:22)
at VaultClient.document [as then] (src/server/photon/index.js:272:61)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
db.collection.deleteMany() — MongoDB Manual
Specifies deletion criteria using query operators. To delete all documents in a collection, pass in an empty document ( { } ).
Read more >How to delete N numbers of documents in mongodb
FYI: you cannot remove documents from a capped collection. ... Use the same filter (owner:uid) to match the first find, and delete many...
Read more >Unable to delete doc with UUID as _id · Issue #668 - GitHub
Document not found appears when I try to delete a doc that uses UUID instead of ObjectId. I use UUIDs because it looks...
Read more >How to find orphan documents and delete them?
Step 2:-- deleteMany() will delete those child document whose parents are no longer exists in the parent collections. db.child.deleteMany({"_id" ...
Read more >Mass delete via HTTP/Rest how do you do it? - ITNEXT
In the project I am working on, we have a need to sometimes delete several items at once. The UI would send a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for reporting! Fixed in latest alpha.
Looks like the problem is caused by another reason, but maybe fixing one will fix this one?