Skip to content

Commit

Permalink
removes extra db call and uses document find method
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Banga authored and Prateek Banga committed Jul 24, 2023
1 parent 7d412b4 commit f7c02d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/controllers/api/databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -2535,13 +2535,12 @@ function updateAttribute(
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);
});


Expand Down

0 comments on commit f7c02d9

Please sign in to comment.