8000 fix(memory/mongodb): $select as only property & force 'id' in '$select' by fratzinger · Pull Request #3081 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

fix(memory/mongodb): $select as only property & force 'id' in '$select'#3081

Merged
daffl merged 6 commits intodovefrom
dove-fix-memory-select
Mar 8, 2023
Merged

fix(memory/mongodb): $select as only property & force 'id' in '$select'#3081
daffl merged 6 commits intodovefrom
dove-fix-memory-select

Conversation

@fratzinger
Copy link
Member
@fratzinger fratzinger commented Feb 27, 2023

Quick fix for @feathersjs/memory.

First commit is the test which should work but fails without the second commit.

The problem was, that select(...) only was called if there was $sort, $limit or $skip in the query.

While being at it:

‼️ diffing behaviour of $select also returning id, also if not added explicitely.

I think that should be tested by @feathersjs/adapter-tests. We have it in:

This PR adds explicit tests to @feathersjs/adapter-tests and makes sure, that all tests pass for these linked tests.

@fratzinger fratzinger changed the title fix(memory): $select as only property fix(memory/mongodb): $select as only property & force 'id' in '$select' Feb 27, 2023
@fratzinger
Copy link
Member Author

This came up while porting feathers-graph-populate to dove (cc @marshallswain).
Also for feathers-trigger.

This stops me from releasing dove versions of these two packages.

@daffl
Copy link
Member
daffl commented Mar 1, 2023

I think that makes sense. It looks like the virtual property resolver test needs to be updated accordingly. I'm also wondering if this could be considered a breaking change 🤔

< 8000 circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" fill="none">

@DaddyWarbucks
Copy link
Member

Sorry gents! Glad yall got it worked out.

@fratzinger
Copy link
Member Author

It looks like the virtual property resolver test needs to be updated accordingly.

The test expects two properties (I guess 'user' and 'text', but it's not clear). In reality it only returns 'text' (I double checked that).
To get that fixed, I check now, if $select has virtual properties and if so then skip $select for adapter entirely. In some way this is, how the test was 'working' before.

I'm also wondering if this could be considered a breaking change

No, not at all. This was how every adapter was working in v4, even feathers-memory. Only @feathersjs/memory introduced a test to explicitly not adding service.id.

@daffl daffl merged commit fbe3cf5 into dove Mar 8, 2023
@daffl daffl deleted the dove-fix-memory-select branch March 8, 2023 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0