ArrayField operations #615
chladog
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
Hey @chladog — because this is so Mongo-specific, I feel like we will have a hard time creating a pattern that will be able to be leveraged and extended on if we decide to support other databases in the future. It almost feels like something that should be done with Mongoose / raw Mongo given its specificity. I think what would make sense to me is to create your own endpoint or GraphQL mutation. You can leverage Payload's authentication and even its access control in your own logic so ideally you'd be able to replicate whatever you're trying to retain from Payload operations themselves. What do you think? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have long arrays of objects in my ArrayFields and I'm looking for operations similar to MongoDB's $set and find of array item by prop value, as I want to be able to update and get single items without retrieving/sending the full array.
I'm able to use native MongoDB operations, but I would rather use payload's functions to let it handle permissions.
$push, $pull functions is actually working now:
For update operation it would ideally take arrayFilters property (and rest/graphql param) and would look like this:
I'm not sure how find operation for particular array item should look like, but maybe allow $elemMatch argument for find's
where
prop. Then I could create my custom query that would return only matched array item.Beta Was this translation helpful? Give feedback.
All reactions