DocumentCollection Class
- java.
lang. Object - JsonSerializable
- Resource
- com.
microsoft. azure. cosmosdb. DocumentCollection
- com.
public class DocumentCollection extends Resource
Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container for documents.
A database may contain zero or more named collections and each collection consists of zero or more JSON documents. Being schema-free, the documents in a collection do not need to share the same structure or fields. Since collections are application resources, they can be authorized using either the master key or resource keys.
Constructor Summary
Constructor | Description |
---|---|
DocumentCollection() |
Initialize a document collection object. |
DocumentCollection(String jsonString) |
Initialize a document collection object from json string. |
Method Summary
Modifier and Type | Method and Description |
---|---|
boolean | equals(Object obj) |
Conflict |
getConflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service. |
String |
getConflictsLink()
Gets the self-link for conflicts in a collection. |
Integer |
getDefaultTimeToLive()
Gets the collection's default time-to-live value. |
String |
getDocumentsLink()
Gets the self-link for documents in a collection. |
Indexing |
getIndexingPolicy()
Gets the indexing policy. |
Partition |
getPartitionKey()
Gets the collection's partition key definition. |
String |
getStoredProceduresLink()
Gets the self-link for stored procedures in a collection. |
String |
getTriggersLink()
Gets the self-link for triggers in a collection. |
Unique |
getUniqueKeyPolicy()
Sets the Uni that guarantees uniqueness of documents in collection in the Azure Cosmos DB service. |
String |
getUserDefinedFunctionsLink()
Gets the self-link for user defined functions in a collection. |
int | hashCode() |
void |
setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service. |
void |
setDefaultTimeToLive(Integer timeToLive)
Sets the collection's default time-to-live value. The default time-to-live value on a collection is an optional property. If set, the documents within the collection expires after the specified number of seconds since their last write time. The value of this property should be one of the following: null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether individual documents have their time-to-live set. nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden by individual documents' time-to-live value. -1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' time-to-live value. |
void |
setIndexingPolicy(IndexingPolicy indexingPolicy)
Sets the indexing policy. |
void |
setPartitionKey(PartitionKeyDefinition partitionKey)
Sets the collection's partition key definition. |
void | setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) |
Inherited Members
Constructor Details
DocumentCollection
public DocumentCollection()
Initialize a document collection object.
DocumentCollection
public DocumentCollection(String jsonString)
Initialize a document collection object from json string.
Parameters:
Method Details
equals
public boolean equals(Object obj)
Parameters:
getConflictResolutionPolicy
public ConflictResolutionPolicy getConflictResolutionPolicy()
Gets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service.
Returns:
getConflictsLink
public String getConflictsLink()
Gets the self-link for conflicts in a collection.
Returns:
getDefaultTimeToLive
public Integer getDefaultTimeToLive()
Gets the collection's default time-to-live value.
Returns:
getDocumentsLink
public String getDocumentsLink()
Gets the self-link for documents in a collection.
Returns:
getIndexingPolicy
public IndexingPolicy getIndexingPolicy()
Gets the indexing policy.
Returns:
getPartitionKey
public PartitionKeyDefinition getPartitionKey()
Gets the collection's partition key definition.
Returns:
getStoredProceduresLink
public String getStoredProceduresLink()
Gets the self-link for stored procedures in a collection.
Returns:
getTriggersLink
public String getTriggersLink()
Gets the self-link for triggers in a collection.
Returns:
getUniqueKeyPolicy
public UniqueKeyPolicy getUniqueKeyPolicy()
Sets the Uni that guarantees uniqueness of documents in collection in the Azure Cosmos DB service.
Returns:
getUserDefinedFunctionsLink
public String getUserDefinedFunctionsLink()
Gets the self-link for user defined functions in a collection.
Returns:
hashCode
public int hashCode()
setConflictResolutionPolicy
public void setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflictResolutionPolicy that is used for resolving conflicting writes on documents in different regions, in a collection in the Azure Cosmos DB service.
Parameters:
setDefaultTimeToLive
public void setDefaultTimeToLive(Integer timeToLive)
Sets the collection's default time-to-live value.
The default time-to-live value on a collection is an optional property. If set, the documents within the collection expires after the specified number of seconds since their last write time. The value of this property should be one of the following:
null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether individual documents have their time-to-live set.
nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden by individual documents' time-to-live value.
-1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' time-to-live value.
Parameters:
setIndexingPolicy
public void setIndexingPolicy(IndexingPolicy indexingPolicy)
Sets the indexing policy.
Parameters:
setPartitionKey
public void setPartitionKey(PartitionKeyDefinition partitionKey)
Sets the collection's partition key definition.
Parameters:
setUniqueKeyPolicy
public void setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)
Parameters:
Applies to
Azure SDK for Java