Collections

Collections are used to store documents and are defined at either the root level or document level. Collections defined at the document level are known as sub-collections. A collection or sub-collection must be unique to other collections at their respective level.

For example:

/my-first-collection and /my-second-collection `/my-first-collection/document/my-first-collection and /my-first-collection/document/my-second-collection

Collections can be aliased to one another using the collection alias feature. This allows multiple collection paths to reference the same collection of documents, with the ability to have different document properties specified for the alias.

Collections have the following actions that act on the documents stored within;

Create

Add a new document in the collection with a document ID generated by Datastore.

List

Retrieve all the documents in the collection.

The multi-collection feature and the JavaScript SDK are used to get documents from multiple collections in one request.