1
0
Fork 0
mirror of synced 2024-07-02 21:20:58 +12:00

removes extra db call and uses document find method

This commit is contained in:
Prateek Banga 2023-07-24 23:41:49 +05:30
parent 7d412b4741
commit f7c02d9308

View file

@ -2535,13 +2535,12 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/indexes/:key')
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}
$index = $dbForProject->find('indexes', [Query::equal('$id', [$database->getInternalId() . '_' . $collection->getInternalId() . '_' . $key]), Query::limit(1)]);
$index = $collection->find('key', $key, 'indexes');
if (empty($index)) {
throw new Exception(Exception::INDEX_NOT_FOUND);
}
$response->dynamic($index[0], Response::MODEL_INDEX);
$response->dynamic($index, Response::MODEL_INDEX);
});