Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Update array at index #5440

Closed
dplewis opened this issue Mar 21, 2019 · 5 comments
Closed

[Feature Request] Update array at index #5440

dplewis opened this issue Mar 21, 2019 · 5 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@dplewis
Copy link
Member

dplewis commented Mar 21, 2019

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

const list = object.get('list');
list[0] = "insert me";
object.set('list', list);
await object.save();

This will send the whole array to the server, not just the index that you changed

Describe the solution you'd like
A clear and concise description of what you want to happen.

object.add('list', value, index);

Additional context
Add any other context or screenshots about the feature request here.

Mongo and Postgres supports this
Mongo has $ positional operator
Postgres has element[index]

@acinader
Copy link
Contributor

I think the arguments would be: object.add('list', value, index);

@TomWFox TomWFox added the type:feature New feature or improvement of existing feature label May 5, 2019
@omairvaiyani
Copy link
Contributor

I imagine this will need co-ordination between the server and client-side libraries. Has anyone taken up the server-side work for this? If not I'm happy to get that side done.

@dplewis
Copy link
Member Author

dplewis commented May 13, 2019

@omairvaiyani Feel free to open a PR. The server-side work hasn't been done yet.

Thanks for getting started on this!

@omairvaiyani
Copy link
Contributor

Sounds good! FYI this mongodb article is more closer to the add operator since it will only append items to the add, rather than replacing existing items.

I'm not at all familiar with postgres so my PR might be a little lacking

@dplewis
Copy link
Member Author

dplewis commented Dec 5, 2019

If there is enough support for this feature we will reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

5 participants