move - Move a keypath
Keypaths are sometimes spread out, which complicates queries and makes reading the resulting document challenging. move
will move a given keypath to a different location in a document.
NOTE: If a keypath is an object, the keypath and all child keys are moved.
Syntax
Example - Moving a key to an easier location
Consider the following document:
We are primarily interested in labels
but to access it, we must traverse the object hierarchy. This can quickly make queries needlessly complex. Instead, we can move
the labels
keypath to a better location.
This results in the following document:
Now, instead of data.my_data.labels
, I can simply access labels
directly.
Theme
Light