Pull Operator not Existing?
Hi. For some reason, in the data of my updateMany, pull is getting this type error:
Which is weird because pull is a documented update operator under MongoDB here:
https://www.prisma.io/dataguide/mongodb/managing-documents
Also, my schema states guildIds as
string[]
. So indeed it is an array, and indeed guild_id is a string.
Thanks!5 Replies
I think it’s supposed to be
$pull
instead of pull
?Same error. That doesn't exist.
Why would push not be $push if pull were supposed to be $pull too?
Oh! I'm sorry, I really messed up.
Those commands (and the dataguide as a whole) are for their respective DB. The examples aren't using Prisma ORM, they're examples inside of the Mongo shell. You can see similar examples in MongoDB's docs here: https://www.mongodb.com/docs/manual/reference/operator/update/pull/
For Prisma ORM + MongoDB docs, this page is your best bet: https://www.prisma.io/docs/orm/overview/databases/mongodb
Prisma
MongoDB database connector
How Prisma can connect to a MongoDB database using the MongoDB database connector.
Hm. Doesn't look like pull even exists.
The only fix I can think of is finding the document, grabbing guildIds, then updating guildIds to be the pre-found array filtering out guild_id.
But that seems too complex for the task at hand. Surely, a method exists somewhere?
Thanks nonetheless.
Ended up removing my string array and replacing it with an ‘AccountGuild’ model array. This way I can target each one individually.