Show / Hide Table of Contents

Class Document

A class representing a document which cannot be altered

Inheritance
System.Object
Document
MutableDocument
Implements
IDictionaryObject
IDictionaryFragment
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Object>>
System.Collections.IEnumerable
IJSON
System.IDisposable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
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
IDictionaryObject

Properties

| Improve this Doc View Source

Collection

Gets the Collection that this document belongs to, if any

Declaration
public Collection Collection { get; set; }
Property Value
Type Description
Collection
| Improve this Doc View Source

Count

Gets the number of entries in this dictionary

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Id

Gets this document's unique ID

Declaration
public string Id { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

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.String key

The key to check

Property Value
Type Description
IFragment

The value of the given key, or lack thereof

| Improve this Doc View Source

Keys

Gets all the keys held by this dictionary

Declaration
public ICollection<string> Keys { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<System.String>
| Improve this Doc View Source

RevisionID

The RevisionID in Document class is a constant, while the RevisionID in MutableDocument class is not. Newly created document will have a null RevisionID. The RevisionID in MutableDocument will be updated on save. The RevisionID format is opaque, which means it's format has no meaning and shouldn’t be parsed to get information.

Declaration
public string RevisionID { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

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

Methods

| Improve this Doc View Source

Contains(String)

Checks if a given key is present in the dictionary

Declaration
public bool Contains(string key)
Parameters
Type Name Description
System.String key

The key to check for

Returns
Type Description
System.Boolean

true if the dictionary contains the key, else false

| Improve this Doc View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetArray(String)

Gets the value of a given key as an IArray

Declaration
public ArrayObject GetArray(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
ArrayObject

The contained value, or null

| Improve this Doc View Source

GetBlob(String)

Gets the value of a given key as a Blob

Declaration
public Blob GetBlob(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
Blob

The contained value, or null

| Improve this Doc View Source

GetBoolean(String)

Gets the value of a given key as a System.Boolean

Declaration
public bool GetBoolean(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Boolean

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

| Improve this Doc View Source

GetDate(String)

Gets the value of a given key as a System.DateTimeOffset

Declaration
public DateTimeOffset GetDate(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.DateTimeOffset

The contained value, or a default value

| Improve this Doc View Source

GetDictionary(String)

Gets the value of a given key as a readonly dictionary

Declaration
public DictionaryObject GetDictionary(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
DictionaryObject

The contained value, or null

| Improve this Doc View Source

GetDouble(String)

Gets the value of a given key as a System.Double

Declaration
public double GetDouble(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Double

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

| Improve this Doc View Source

GetEnumerator()

Declaration
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, System.Object>>
| Improve this Doc View Source

GetFloat(String)

Gets the value of a given key as a System.Single

Declaration
public float GetFloat(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Single

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

| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

GetInt(String)

Gets the value of a given key as an System.Int32

Declaration
public int GetInt(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Int32

The contained value, or its converted equivalent

Remarks

true will be converted to 1, a System.Double value will be rounded, and everything else non-numeric will be 0

| Improve this Doc View Source

GetLong(String)

Gets the value of a given key as an System.Int64

Declaration
public long GetLong(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Int64

The contained value, or its converted equivalent

Remarks

true will be converted to 1, a System.Double value will be rounded, and everything else non-numeric will be 0

| Improve this Doc View Source

GetString(String)

Gets the value of a given key as a System.String

Declaration
public string GetString(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.String

The contained value, or null

| Improve this Doc View Source

GetValue(String)

Gets the value of a given key as an untyped object

Declaration
public object GetValue(string key)
Parameters
Type Name Description
System.String key

The key to check the value for

Returns
Type Description
System.Object

The contained value, or null

Remarks

This method should be avoided for numeric types, whose underlying representation is subject to change and thus System.InvalidCastExceptions

| Improve this Doc View Source

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.Collections.Generic.Dictionary<System.String, System.Object>

The contents of this object as a .NET dictionary

| Improve this Doc View Source

ToJSON()

Converts this object to JSON format string.

Declaration
public string ToJSON()
Returns
Type Description
System.String

The contents of this object in JSON format string

Exceptions
Type Condition
System.NotSupportedException

Thrown if ToJSON is called from MutableDocument,
MutableDictionaryObject, or MutableArrayObject

| Improve this Doc View Source

ToMutable()

Creates a mutable version of a document (i.e. one that can be edited)

Declaration
public virtual MutableDocument ToMutable()
Returns
Type Description
MutableDocument

A mutable version of the document

Exceptions
Type Condition
System.InvalidOperationException

InvalidOperationException thrown when trying edit Documents from a replication filter.

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

IDictionaryObject
IDictionaryFragment
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
IJSON
System.IDisposable

Extension Methods

DocumentExtensions.RevisionIDs(Document)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX