Sub query support for indexes

This commit is contained in:
Eldad Fux
2021-08-22 18:00:00 +03:00
parent e39ed9cf9b
commit 31500cd675
4 changed files with 152 additions and 25 deletions
+16 -9
View File
@@ -922,14 +922,22 @@ App::post('/v1/database/collections/:collectionId/indexes')
}
// TODO@kodumbeats should $lengths be a part of the response model?
$index = new Document([
'$collection' => $collectionId,
'$id' => $indexId,
'type' => $type,
'attributes' => $attributes,
'lengths' => $lengths,
'orders' => $orders,
]);
try {
$index = $dbForInternal->createDocument('indexes', new Document([
'$id' => $collectionId.'_'.$indexId,
'key' => $indexId,
'status' => 'processing', // processing, available, failed, deleting
'collectionId' => $collectionId,
'type' => $type,
'attributes' => $attributes,
'lengths' => $lengths,
'orders' => $orders,
]));
} catch (DuplicateException $th) {
throw new Exception('Attribute already exists', 409);
}
$dbForInternal->purgeDocument('collections', $collectionId);
$database
->setParam('type', DATABASE_TYPE_CREATE_INDEX)
@@ -944,7 +952,6 @@ App::post('/v1/database/collections/:collectionId/indexes')
$response->setStatusCode(Response::STATUS_CODE_CREATED);
$response->dynamic($index, Response::MODEL_INDEX);
});
App::get('/v1/database/collections/:collectionId/indexes')