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

More flexibility with array query operators #167

Open
Xemiru opened this issue Aug 19, 2020 · 0 comments
Open

More flexibility with array query operators #167

Xemiru opened this issue Aug 19, 2020 · 0 comments

Comments

@Xemiru
Copy link

Xemiru commented Aug 19, 2020

As an example of what does work, you can easily filter through items when your target is a single field inside an array object element -- here's a query that asks for all armor pieces with at least one rank 4 decoration slot.

armor?q={"slots.rank": 4}&p={"slots.rank": true}

Can't ask much about fields holding arrays of non-object values

Here's a few different ways of asking for all weapons who support ammo and have at least one ammo type with a capacity of 3 at any level (all of which fail).

weapons?q={"ammo.capacities": 3}&p={"ammo": true}                    // empty response..
weapons?q={"ammo.capacities": { "$eq": 3 }}&p={"ammo": true }        // empty response..
weapons?q={"ammo.capacities": { "$contains": 3 }}&p={"ammo": true }  // Unrecognized operator: $contains

weapons?q={"ammo.capacities": { "$size": 3 }}&p={"ammo": true }      // $size is the only op that works -- not that it helps in what we wanted to do here

Here's a more likely scenario: ask for all bows that support the sleep coating.

weapons?q={"coatings": "sleep"}                  // empty response..
weapons?q={"coatings": {"$contains": "sleep"}}   // Unrecognized operator: $contains

Cannot ask about specific array indices

Let's define two ideas of sharpness in the context of how it's stored in the database: base sharpness and potential sharpness.

Base sharpness is a weapon's original sharpness values -- sharpness at Handicraft level 0.
Potential sharpness is a weapon's maximum possible sharpness weapons -- Handicraft level 5.
Within weapon data, this is stored in indices 0 and 5 of the durability field, respectively. As of writing, there doesn't seem to be an obvious way to query for data at a specific array index.

The queries below intend ask for weapons with a base white sharpness of 40, then for weapons with a potential white sharpness of 90.

weapons?q={"durability.0.white": { "$gte": 40 }} // Unknown field: durability.0.white
weapons?q={"durability.5.white": { "$gte": 90 }} // Unknown field: durability.5.white
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

No branches or pull requests

1 participant