Closed adamghill closed 1 year ago
If multiple identical keys exists, the one at the outermost indentation level is returned. I haven't considered using XPath-like syntax yet, that would require further analysis if the performance would suffer from it.
The reasoning here is that if you store objects by their id and then it is reasonable to assume that you would want to have the outermost key, at least that is what I have found in some real-world examples.
I will keep this issue open to add it to the readme when I have the time, thanks for mentioning this!
Gotcha, that makes sense and I guess you can use where
to look for something specific. Maybe an additional kwarg
if the user knows a particular nested path they are searching for? Anyways, thanks for the response -- I have a few use-cases I'm going to be using DictDataBase
for in the future!
@adamghill I updated the docs accordingly.
I don't have a good idea yet on how to implement XPath-like searching without sacrificing performance, I will open a new issue for that!
I love the idea of this library! Thanks for building it. :)
This isn't an issue, but more of a question. When I was playing with this library, the results of
key
were surprising to me because I was unclear what was going to match.Have you thought about requiring the
key
to be more explicit? Maybe something like XPath (key='Ben/job'
), jq (key='.Ben.job'
), or glom (key='Ben.job'
), or something else?Or maybe if there is a reason to keep the current functionality, a note in the readme about this behavior might be useful for other devs?