Product SiteDocumentation Site

Chapter 3. Collections

Even though you can build your own JSON values with JSONiq by copying-and-pasting JSON documents, most of the time, your JSON data will be in a collection. Collections are sequences of objects, identified by a name which is a string.
Adding or deleting collections from the set of known collections to a query processor, and loading the data in a collection are implementation-dependent and outside of the scope of this specification.
The collection() function returns all objects associated with the provided collection name.
Example 3.1. Getting all objects from a collection
Result (run with Zorba):
{ "foo" : "bar" }

For illustrative purposes, we will assume that we have the following collections: