Imbo\Database\Mongo::updateMetadata PHP Method

updateMetadata() public method

public updateMetadata ( $user, $imageIdentifier, array $metadata )
$metadata array
    public function updateMetadata($user, $imageIdentifier, array $metadata)
    {
        try {
            // Fetch existing metadata and merge with the incoming data
            $existing = $this->getMetadata($user, $imageIdentifier);
            $updatedMetadata = array_merge($existing, $metadata);
            $this->getImageCollection()->updateOne(['user' => $user, 'imageIdentifier' => $imageIdentifier], ['$set' => ['updated' => time(), 'metadata' => $updatedMetadata]]);
        } catch (MongoException $e) {
            throw new DatabaseException('Unable to update meta data', 500, $e);
        }
        return true;
    }