Skip to content

[Feature Request] Deselect Keys #4948

Closed

Description

@dplewis

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 [...]

I often find myself wanting to select all keys except one or a few. This requires me to specify a lot of keys which is a lot of work.

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

query.deselect('somefield'); or unselect or exclude or selectAllExcluding()?

If used with select just remove from select
If used without select all keys added excluding

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Aggregate project { key: -1 } will exclude that key. (Only for Mongo 3.4+)

Alternatively you can get the schema and find all the keys from that then remove what you don't need

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

From a quick glance adding this to Mongo should be pretty easy
Postgres uses * or column names. You don’t know the column names if you only uses exclude. So you’ll have to get all fields first then use exclude

Activity

  1. ozeas commented on Oct 4, 2018

    @ozeas

    Hello, I would like to help with this, can I?

  2. dplewis commented on Oct 4, 2018

    @dplewis
    MemberAuthor

    @ozeas Its all yours feel free to open a PR and let us know if you need direction

  3. srameshr commented on Dec 4, 2018

    @srameshr
    Contributor

    @dplewis @ozeas You guys working on this?

  4. dplewis commented on Dec 4, 2018

    @dplewis
    MemberAuthor

    It’s up for grabs. Feel free to do a PR.

  5. ozeas commented on Jan 21, 2019

    @ozeas

    Hi everyone, I had some personal problems, I could not continue. Sorry about that.

  6. flovilmart commented on Jan 21, 2019

    @flovilmart
    Contributor

    Take care @ozeas

  7. RaschidJFR commented on Jun 15, 2019

    @RaschidJFR
    Contributor

    🙋‍♂️ I want in!
    So I just start working on this, right? I guess there's no specific deadline, but anyway I'll try not to delay it that much while getting familiar with the repo.

    Just point me in the right direction: It seems to me this is to be done in the JS-SDK, not on the server... or why is this posted in the server repo? I'm I supposing wrong?

  8. dplewis commented on Jun 15, 2019

    @dplewis
    MemberAuthor

    You have to add it to the server first. Here is a sample PR. #4195 and there are a lot of other examples from previous Pull Requests.

    The SDK sends the request to the server. You can use the Rest API to send the requests.

  9. RaschidJFR commented on Jun 19, 2019

    @RaschidJFR
    Contributor

    So how do you think guys this restOption should be called? Currently the selecting option is keys, so let's call this new option excludeKeys, ok?

  10. dplewis commented on Jun 19, 2019

    @dplewis
    MemberAuthor

    excludeKeys or exclude whichever one you want

  11. srameshr commented on Jun 20, 2019

    @srameshr
    Contributor

    exclude

  12. RaschidJFR commented on Jun 24, 2019

    @RaschidJFR
    Contributor

    I have added and tested a new restOption as excludeKeys. Can you have a look @dplewis ? If that's ok then all proceed to update the docs and add the function to the SDK repo i guess.

  13. added
    type:featureNew feature or improvement of existing feature
    and removed on Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions