Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for batch creates and updates #297

Merged
merged 14 commits into from
Aug 16, 2023
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": ">=8.0",
"utopia-php/framework": "0.*.*",
"utopia-php/cache": "0.8.*",
"utopia-php/mongo": "0.0.2"
"utopia-php/mongo": "0.3.*"
},
"require-dev": {
"ext-redis": "*",
Expand Down
287 changes: 192 additions & 95 deletions composer.lock

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/Database/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,17 @@ abstract public function getDocument(string $collection, string $id, array $quer
*/
abstract public function createDocument(string $collection, Document $document): Document;

/**
* Create Documents in batches
*
* @param string $collection
* @param Document[] $documents
* @param int $batchSize
*
* @return Document[]
*/
abstract public function createDocuments(string $collection, array $documents, int $batchSize): array;

/**
* Update Document
*
Expand All @@ -305,6 +316,17 @@ abstract public function createDocument(string $collection, Document $document):
*/
abstract public function updateDocument(string $collection, Document $document): Document;

/**
* Update Documents in batches
*
* @param string $collection
* @param Document[] $documents
* @param int $batchSize
*
* @return Document[]
*/
abstract public function updateDocuments(string $collection, array $documents, int $batchSize): array;

/**
* Delete Document
*
Expand Down
Loading