neosqlite.collection.query_helper.crud_operations module¶
CRUD operations for QueryHelper.
- class neosqlite.collection.query_helper.crud_operations.CRUDOperationsMixin[source]¶
Bases:
objectMixin providing CRUD operations for QueryHelper.
- collection: Collection¶
- _get_integer_id_for_oid: Any¶
- _validate_json_document: Any¶
- _get_json_error_position: Any¶
- _internal_insert(document: dict[str, Any]) Any[source]¶
Inserts a document into the collection and returns the inserted document’s _id.
This method inserts a document into the collection after converting any bytes objects to Binary objects for proper JSON serialization and validating the resulting JSON string. It handles both databases with JSON1 support and those without by providing appropriate fallbacks.
- Parameters:
document (dict) – The document to insert. Must be a dictionary.
- Returns:
The auto-increment id of the inserted document.
- Return type:
int
- Raises:
MalformedDocument – If the document is not a dictionary
ValueError – If the document contains invalid JSON
sqlite3.Error – If database operations fail