-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The syntax (and behaviour) of $push differs for tables and collections. This does not seem to be captured by the UpdateBuilders class, which lets you create unacceptable commands.
Reference fact sheet on $push:
Tables:
- can target lists,sets,maps
- Can use [k, v]] for a kv pair, or a one-key {k: v} object
- no $position admitted anywhere
- (need a filter, or the api will error)
- supports $each
Collections:
- There's no notion of set; and push cannot target "maps" (json objects)
- So it's only for LISTS
- It admits $position
- supports $each
Additionally
The current description for the Push method says, Add a value to a set at a specified position.. The improved scoping notwithstanding (below), this is problematic in itself as for sets the order is not supposed to count.
Moreover, internally the Push implementations become a one-item $each (a minor waste of bandwitdh, one might note. Not so critical but...)
Desired
(this holds for the pushEach as well. $each is supported on tables and collections alike.)
Separate filter builders for tables/collection in order to offer $position only for collections.
Also for typed collections only list types should admit push (with position)