public final class DocumentCollection extends Resource
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 and Description |
---|
DocumentCollection()
Initialize a document collection object.
|
DocumentCollection(org.json.JSONObject jsonObject)
Initialize a document collection object from json object.
|
DocumentCollection(String jsonString)
Initialize a document collection object from json string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
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.
|
String |
getUserDefinedFunctionsLink()
Gets the self-link for user defined functions in a collection.
|
int |
hashCode() |
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.
|
getETag, getId, getResourceId, getSelfLink, getTimestamp, setId, setResourceId
get, getBoolean, getCollection, getCollection, getDouble, getHashMap, getInt, getLogger, getLong, getMapper, getObject, getObject, getObjectByPath, getString, has, remove, set, toJson, toJson, toObject, toString
public DocumentCollection()
public DocumentCollection(String jsonString)
jsonString
- the json string that represents the document collection.public DocumentCollection(org.json.JSONObject jsonObject)
jsonObject
- the json object that represents the document collection.public IndexingPolicy getIndexingPolicy()
public void setIndexingPolicy(IndexingPolicy indexingPolicy)
indexingPolicy
- the indexing policy.public PartitionKeyDefinition getPartitionKey()
public void setPartitionKey(PartitionKeyDefinition partitionKey)
partitionKey
- the partition key definition.public Integer getDefaultTimeToLive()
public void setDefaultTimeToLive(Integer timeToLive)
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.
timeToLive
- the default time-to-live value in seconds.public String getDocumentsLink()
public String getStoredProceduresLink()
public String getTriggersLink()
public String getUserDefinedFunctionsLink()
public String getConflictsLink()
Copyright © 2018. All rights reserved.