diff --git a/staticbackend/database.py b/staticbackend/database.py index c7bcb13..d45ca4f 100644 --- a/staticbackend/database.py +++ b/staticbackend/database.py @@ -27,6 +27,13 @@ def create_document(self, repo: str, data: Dict[str, Any]) -> Dict[str, Any]: resp: Any = self._request(f"/db/{repo}", body=data) return resp # type: ignore + def bulk_create_documents( + self, repo: str, data: List[Dict[str, Any]] + ) -> Dict[str, Any]: + """Create documents in bulk.""" + resp: Any = self._request(f"/db/{repo}?bulk=1", body=data) + return resp # type: ignore + def list_documents( self, repo: str, page: int = 1, size: int = 25, desc: bool = False ) -> DocumentResults: @@ -62,3 +69,8 @@ def update_document( def delete_document(self, repo: str, doc_id: str) -> int: resp: Any = self._request(f"/db/{repo}/{doc_id}", method="delete") return int(resp) + + def increment(self, repo: str, doc_id: str, field: str, range: int) -> Any: + data = {"field": field, "range": range} + resp: Any = self._request(f"/inc/{repo}/{doc_id}", body=data) + return resp