The Document's Index is a unique reference to a document.
The id is always unique. The Id can be client-provided when creating a new Document or it is created by the service and responded to the client.
Document identifier: Either id or the document-key(key,context,userId) is used to identify an existing record. When the document-key is provided the key field is mandatory, while context and userId are optional. Multiple documents with the same document-key can exist with a different rank. The rank used as an indexer: document-key [rank] -> document.
Property
Description
key
(mandatory)
The key is the type-name of the document. It describes what the document contains. I recommend to using namespaces for keys.
Example: MSPro.Templates.WelcomeEMail
The context describes the context in which the current document exists. You can use, for example a ServiceReferenceID an execution-id etc. You may compare the Context with a directory in your filesystem.Example: Key=MSPro.Inbound.ServiceRequest; Context=<CustomerName>
userId
(default = null)
The UserId was introduced to support an index that came with the document itself. For example, an external key/id like an invoice-id.
Rank is used to store multiple documents (Array) with the same document-key information.
The document content can be any information, like a JSON or an XML document, a string or a binary stream. Provide an appropriate contentType when creating the document.
Property
Description
content
(mandatory)
contentType
(mandatory)
The following content-types are supported:
text/plain, text/html, text/xml,
application/json, application/xml
more to come...
The two user fields are not used or interpreted by the service. It is solely up to the user to give them a meaning and to use them.
Property
Description
userState
(mandatory, default=0)
The intention of the userState was to offer some processing state for the Document, like:
0=pending -> 1=in process -> 2=processed -> 99=error .
You may completely ignore this is go with the default=0.
The userState is part of the APIs and can be used to GET or Query (filter) Documents. For example, all Documents: key="MSPro.SAP.Invoice" and userState=99 to fetch all documents with error (see below).
userInfo
Any text information you might find useful storing with the Document.
Property
Description
lastUpdateUtc
The UTC date/time with milliseconds when the document was updated last.
createdDateUtc
The UTC date/time with milliseconds when the document was created.
recordVersion
uNow.ToUnixTimeMilliseconds() when the document was updated. You can use this long (64-bit) integer to check if a document has changed. Basically a different format for lastUpdateUtc.
All documents do have a life-time which is, by default, one hour!
This means, by default, documents are deleted after one hour.
Each document has a expirationDateUtc which tells you exactly when the life-time expires. You can set or update that property at any time to adjust a dcoument's life-time according to your needs.
Last updated
(default = null)
(default = 0)
Note, that your may limited the maximum lifetime you can define.