Sdílet prostřednictvím


DocumentCollection Class

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)
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.

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.

IndexingPolicy getIndexingPolicy()

Gets the indexing policy.

PartitionKeyDefinition 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.

UniqueKeyPolicy 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:

jsonString - the json string that represents the document collection.

Method Details

equals

public boolean equals(Object obj)

Parameters:

obj

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:

ConflictResolutionPolicy

getConflictsLink

public String getConflictsLink()

Gets the self-link for conflicts in a collection.

Returns:

the conflicts link.

getDefaultTimeToLive

public Integer getDefaultTimeToLive()

Gets the collection's default time-to-live value.

Returns:

the default time-to-live value in seconds.

getDocumentsLink

public String getDocumentsLink()

Gets the self-link for documents in a collection.

Returns:

the document link.

getIndexingPolicy

public IndexingPolicy getIndexingPolicy()

Gets the indexing policy.

Returns:

the indexing policy.

getPartitionKey

public PartitionKeyDefinition getPartitionKey()

Gets the collection's partition key definition.

Returns:

the partition key definition.

getStoredProceduresLink

public String getStoredProceduresLink()

Gets the self-link for stored procedures in a collection.

Returns:

the stored procedures link.

getTriggersLink

public String getTriggersLink()

Gets the self-link for triggers in a collection.

Returns:

the trigger link.

getUniqueKeyPolicy

public UniqueKeyPolicy getUniqueKeyPolicy()

Sets the Uni that guarantees uniqueness of documents in collection in the Azure Cosmos DB service.

Returns:

UniqueKeyPolicy

getUserDefinedFunctionsLink

public String getUserDefinedFunctionsLink()

Gets the self-link for user defined functions in a collection.

Returns:

the user defined functions link.

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:

value - ConflictResolutionPolicy to be used.

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:

timeToLive - the default time-to-live value in seconds.

setIndexingPolicy

public void setIndexingPolicy(IndexingPolicy indexingPolicy)

Sets the indexing policy.

Parameters:

indexingPolicy - the indexing policy.

setPartitionKey

public void setPartitionKey(PartitionKeyDefinition partitionKey)

Sets the collection's partition key definition.

Parameters:

partitionKey - the partition key definition.

setUniqueKeyPolicy

public void setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy)

Parameters:

uniqueKeyPolicy

Applies to