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

Allow adapter swapping #63

Closed
FossPrime opened this issue Sep 26, 2023 · 0 comments · Fixed by #64
Closed

Allow adapter swapping #63

FossPrime opened this issue Sep 26, 2023 · 0 comments · Fixed by #64

Comments

@FossPrime
Copy link
Collaborator

FossPrime commented Sep 26, 2023

Marshall states hookContext.params.adapter.model = anotherModel should work... but it doesn't.

context.service.db = anotherLowDBService.db does work however.

Part of the issue is this is based on a service that is not a database adapter... Decoupling the adapter from the service should help. May require minor api changes.

I confirmed with Marshall that this is supposed to work.
https://stackblitz.com/edit/feathers-v5-adapter-swapping?file=app.ts,messages.yaml

Fix may just be moving db to Model


All the tests are passing... this is just a feature that is not tested for, we should upstream a test for it

> feathers-lowdb@1.0.0-alpha.8 test
> NODE_OPTIONS='' npx mocha --config .mocharc.json --recursive test/**/*.test.ts



  ............................................,............,,.....................
Skipped the following 3 Feathers adapter test(s) out of 73 total:
[
  ".create ignores query",
  ".find + $and",
  ".find + $and + $or"
]
...............
  .......................,............,,.....................
Skipped the following 3 Feathers adapter test(s) out of 73 total:
[
  ".create ignores query",
  ".find + $and",
  ".find + $and + $or"
]


  148 passing (256ms)
  6 pending

npm notice 
npm notice New major version of npm available! 8.19.2 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g npm@10.1.0 to update!
npm notice 

Worse still... attempting to use the feature causes the service to break.


Looks like I screwed this up royally... I was supposed to use getModel for my model... but I implemented my own load function.

https://github.com/feathersjs/feathers/blob/dove/packages/mongodb/src/adapter.ts#L98C3-L101C4


Feathers memory also lacks support for the feature
feathersjs/feathers#3283

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 a pull request may close this issue.

1 participant