Document service
The document service provides storage for all types of data. The primary use case for document service is to store user-centric, self-contained data typically produced and maintained by apps.
Concepts
You need to know the following concepts to work with the document service.
Document
Every document consists of metadata and content. The metadata contains information such as the document name and timestamps, which you can use to filter and sort your documents.
Following are some essential things to remember about documents:
- The document service generates a unique ID for each document and doesn't rely on the document's name for identification. Therefore, document names don't have to be unique.
- The content of documents isn't indexed. Therefore, you can't search the contents of a document.
- It's essential to ensure your document content doesn't exceed a maximum size.
The document service is entirely agnostic of the content and the content type.
Ownership
The user who creates a document becomes the owner of that document. The owner has permission to share and delete the document. Only the owner can access the document unless the owner shares it with others.
Sharing documents
Users can share the document with other users. The document owner can grant either read-only or read-write access to the document for other users. Document service also prevents accidental overwriting due to collaboration using Optimistic locking
There are two ways a user can share documents:
- Environment: The owner of a document can allow all users of the same environment to access the document. The other users may opt-in to access the document.
- Direct: The owner of a document can allow specific users or groups to access a document.
All the apps can access a document, even when the owner is restricting access to the document.
Restore deleted documents
Deleting a document moves it into the trash and makes it inaccessible. Documents in the trash automatically get permanently deleted after some time. Alternatively, you can manually delete it from the trash if you don't want to wait for the automatic deletion. A document can be restored from the trash, making it accessible and sparing it from permanent deletion.
Data consistency
The document service guarantees eventual consistency.