DocumentCollection Class
- java.
lang. Object - com.
microsoft. azure. documentdb. JsonSerializable - com.
microsoft. azure. documentdb. Resource - com.
microsoft. azure. documentdb. DocumentCollection
- com.
- com.
- com.
public final 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. |
DocumentCollection(JSONObject jsonObject) |
Initialize a document collection object from json object. |
Method Summary
Modifier and Type | Method and Description |
---|---|
boolean | equals(Object obj) |
java.util.Collection<Partition |
getCollectionPartitionStatistics()
Gets the collection's partition key statistics for each physical partition in the collection. |
Conflict |
getConflictResolutionPolicy()
Gets the conflict |
java.lang.String |
getConflictsLink()
Gets the self-link for conflicts in a collection. |
java.lang.Integer |
getDefaultTimeToLive()
Gets the collection's default time-to-live value. |
java.lang.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. |
java.lang.String |
getStoredProceduresLink()
Gets the self-link for stored procedures in a collection. |
java.lang.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. |
java.lang.String |
getUserDefinedFunctionsLink()
Gets the self-link for user defined functions in a collection. |
int | hashCode() |
void |
setConflictResolutionPolicy(ConflictResolutionPolicy value)
Sets the conflict |
void |
setDefaultTimeToLive(Integer timeToLive)
Sets the collection's default 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) |
Methods inherited from JsonSerializable
Methods inherited from Resource
Methods inherited from java.lang.Object
Constructor Details
DocumentCollection
public DocumentCollection()
Initialize a document collection object.
DocumentCollection
public DocumentCollection(String jsonString)
Initialize a document collection object from json string.
Parameters:
DocumentCollection
public DocumentCollection(JSONObject jsonObject)
Initialize a document collection object from json object.
Parameters:
Method Details
equals
public boolean equals(Object obj)
Overrides:
DocumentCollection.equals(Object obj)Parameters:
getCollectionPartitionStatistics
public Collection
Gets the collection's partition key statistics for each physical partition in the collection.
Returns:
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()
Overrides:
DocumentCollection.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: