Class DbDoc
Represents a generic document in JSON format.
Inheritance
Namespace: MySqlX.XDevAPI
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
public class DbDoc
Constructors
DbDoc(Object)
Initializes a new instance of the DbDoc class based on the object provided. The value can be a domain object, anonymous object, or JSON string.
Declaration
public DbDoc(object val = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | val | The value for this DbDoc. |
Properties
HasId
Gets a value indicating if this document has an identifier (property named _id with a value).
Declaration
public bool HasId { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Id
Gets the identifier of the document.
Declaration
public object Id { get; }
Property Value
Type | Description |
---|---|
System.Object |
Item[String]
Gets the value of a document property.
Declaration
public object this[string path] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The key path for the property. |
Property Value
Type | Description |
---|---|
System.Object |
Methods
Equals(Object)
Compares this DbDoc with another one.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The DbDoc to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if they are equal, false otherwise. |
Overrides
GetHashCode()
Gets a value that serves as a hash function for a particular type.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the current object. |
Overrides
SetValue(String, Object)
Sets a property on this document.
Declaration
public void SetValue(string key, object val)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the property. |
System.Object | val | The new property value. |
ToString()
Returns this document in Json format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A Json formatted string. |