Datastore Paging, Ordering and Filtering API #321
Unanswered
jbee
asked this question in
Specs & RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Filtering
In contrast to schema based metadata the datastore is schema-less. Values can be any type of JSON node.
This is especially relevant for filtering as proper comparison may depend on the actual type of JSON node.
Instead of creating the proper filter based on schema information the filter used is based on the operator and provided value:
null
this is a null check for any node typetrue
orfalse
it is a check for a boolean node'<text>'
is same as<text>
except that the target node type is stringSome operators have special semantics.
empty
is a check for a empty object, array or string node!empty
is a check for non empty object, array or string nodeProperty Expressions
_
.
[<index>]
<name>
<root>.<child>
root.child
is ...<root>[0].<child>
child
of the first element of the array held by theroot
member of the root object is ...Operators
Ordering
Similar to filtering the lack of schema information is a problem for ordering as it is unclear if we should do an alphanumeric or numeric order. Therefore 4 sort order types can be distinguished:
asc
desc
nasc
ndesc
Alphanumeric could also be considered the natural order that is always defined.
Numeric order will require a conversion which can fail should a value not be numeric.
To start with it seems sufficient to only support single property sorting.
When a filter is used on the sort property we could infer numeric order in case we use a numeric filter.
This is not implemented but worth considering.
Paging
Like in metadata results are paged by default.
A paged result has the form
As usual
page
andpageSize
have a minimum value of1
.If
paging
is setfalse
or ifheadless=true
is used the response has the formThis array being the same array that otherwise lists entries as the
entries
property in the root object.Paging does not support counting the total number of matches or total number of pages.
Fields
For completion some notes on
fields
filtering.Since we always include the entry key as
key
property of the resulting entries it does make sense to allow an emptyfields=
(nothing) parameter list so only extract the keys of matching entries.Outlook
In the future we might support
name:isa:string
(isa
would be a new operator for node type checks)[{"key":"x"}, {"key":"y"}]
into just["x","y"]
(which is same as the long time supported listing of all keys - this would basically allow to filter keys as they were returned for a long time)Beta Was this translation helpful? Give feedback.
All reactions