Recursive ObjectID hook. Good, bad or ugly? #2575
Unanswered
ericuldall
asked this question in
Q&A
Replies: 1 comment
-
I updated it to allow array and it will convert all keys in one pass. Not sure of the exact O complexity, but considering most queries are pretty small I don't think it will be problematic.
Implementation:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think most veteran feathers users are well aware of the issue with querying by _id not coercing data automatically to mongo ObjectID, if you're not get educated on #757
I've decided to implement a hook that should be easily configurable and allow for a slightly less heavy handed implementation, and more flexibility in the client.
It looks like this as of now:
It's a basic recursion concept and currently tested it working with a query like:
I know that query doesn't make sense but the _id fields do get successfully converted.
Hook implementation:
Really just looking for feedback on if @daffl or anyone else has gone down this rabbit hole and has any life lessons to share on the topic.
Thanks in advance :D
Beta Was this translation helpful? Give feedback.
All reactions