class mysqlx.DbDoc(value)

Bases: object

Represents a generic document in JSON format.

Parameters:value (object) – The value can be a JSON string or a dict.
Raises:ValueError – If value type is not a basestring or dict.

Serialize mysqlx.DbDoc to a JSON formatted str.

Returns:A JSON formatted str representation of the document.
Return type:str

New in version 8.0.16.


Returns a new copy of a mysqlx.DbDoc object containing the doc_id provided. If doc_id is not provided, it will be removed from new mysqlx.DbDoc object.

Parameters:doc_id (Optional[str]) – Document ID
Returns:A new instance of DbDoc containing the _id provided
Return type:mysqlx.DbDoc

Returns the keys.

Returns:The keys.
Return type:list