Class Document
A class representing a document which cannot be altered
Implements
Inherited Members
Namespace: Couchbase.Lite
Assembly: Couchbase.Lite.dll
Syntax
public class Document : IDictionaryObject, IDictionaryFragment, IEnumerable<KeyValuePair<string, object>>, IEnumerable, IJSON, IDisposable
Fields
| Improve this Doc View Source_dict
The backing dictionary for this document
Declaration
protected IDictionaryObject _dict
Field Value
Type | Description |
---|---|
IDictionary |
Properties
| Improve this Doc View SourceCollection
Gets the Collection that this document belongs to, if any
Declaration
public Collection Collection { get; set; }
Property Value
Type | Description |
---|---|
Collection |
Count
Gets the number of entries in this dictionary
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System. |
Id
Gets this document's unique ID
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System. |
Item[String]
Gets the value of the given key, or lack thereof, wrapped inside of a IFragment
Declaration
public IFragment this[string key] { get; }
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check |
Property Value
Type | Description |
---|---|
IFragment | The value of the given key, or lack thereof |
Keys
Gets all the keys held by this dictionary
Declaration
public ICollection<string> Keys { get; }
Property Value
Type | Description |
---|---|
System. |
RevisionID
The RevisionID in Document class is a constant, while the RevisionID in Mutable
Declaration
public string RevisionID { get; }
Property Value
Type | Description |
---|---|
System. |
Sequence
Gets the sequence of this document (a unique incrementing number identifying its status in a database)
Declaration
public ulong Sequence { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceContains(String)
Checks if a given key is present in the dictionary
Declaration
public bool Contains(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check for |
Returns
Type | Description |
---|---|
System. |
|
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj |
Returns
Type | Description |
---|---|
System. |
Overrides
GetArray(String)
Gets the value of a given key as an IArray
Declaration
public ArrayObject GetArray(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
Array |
The contained value, or |
GetBlob(String)
Gets the value of a given key as a Blob
Declaration
public Blob GetBlob(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
Blob | The contained value, or |
GetBoolean(String)
Gets the value of a given key as a System.
Declaration
public bool GetBoolean(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or its converted equivalent |
Remarks
Any non-zero object will be treated as true, so don't rely on any sort of parsing
GetDate(String)
Gets the value of a given key as a System.
Declaration
public DateTimeOffset GetDate(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or a default value |
GetDictionary(String)
Gets the value of a given key as a readonly dictionary
Declaration
public DictionaryObject GetDictionary(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
Dictionary |
The contained value, or |
GetDouble(String)
Gets the value of a given key as a System.
Declaration
public double GetDouble(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or its converted equivalent |
Remarks
true
will be converted to 1.0, and everything else that
is non-numeric will be 0.0
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
Type | Description |
---|---|
System. |
GetFloat(String)
Gets the value of a given key as a System.
Declaration
public float GetFloat(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or its converted equivalent |
Remarks
true
will be converted to 1.0f, and everything else that
is non-numeric will be 0.0f
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
Overrides
GetInt(String)
Gets the value of a given key as an System.
Declaration
public int GetInt(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or its converted equivalent |
Remarks
true
will be converted to 1, a System.
GetLong(String)
Gets the value of a given key as an System.
Declaration
public long GetLong(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or its converted equivalent |
Remarks
true
will be converted to 1, a System.
GetString(String)
Gets the value of a given key as a System.
Declaration
public string GetString(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or |
GetValue(String)
Gets the value of a given key as an untyped object
Declaration
public object GetValue(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key to check the value for |
Returns
Type | Description |
---|---|
System. |
The contained value, or |
Remarks
This method should be avoided for numeric types, whose
underlying representation is subject to change and thus
System.
ToDictionary()
Converts this object to a standard .NET string to object System.Collections.Generic.Dictionary<TKey, TValue>
Declaration
public Dictionary<string, object> ToDictionary()
Returns
Type | Description |
---|---|
System. |
The contents of this object as a .NET dictionary |
ToJSON()
Converts this object to JSON format string.
Declaration
public string ToJSON()
Returns
Type | Description |
---|---|
System. |
The contents of this object in JSON format string |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if ToJSON is called from Mutable |
ToMutable()
Creates a mutable version of a document (i.e. one that can be edited)
Declaration
public virtual MutableDocument ToMutable()
Returns
Type | Description |
---|---|
Mutable |
A mutable version of the document |
Exceptions
Type | Condition |
---|---|
System. |
InvalidOperationException thrown when trying edit Documents from a replication filter. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System. |