mysqlx.DbDoc¶
- class mysqlx.DbDoc(value: str | Dict[str, Any])¶
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.
- as_str() str ¶
Serialize
mysqlx.DbDoc
to a JSON formattedstr
.- Returns:
A JSON formatted
str
representation of the document.- Return type:
str
New in version 8.0.16.
- copy(doc_id: str | None = None) DbDoc ¶
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 newmysqlx.DbDoc
object.- Parameters:
doc_id (Optional[str]) – Document ID
- Returns:
A new instance of DbDoc containing the _id provided
- Return type:
- keys() KeysView[str] ¶
Returns the keys.
- Returns:
The keys.
- Return type:
list