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