Prevent default values for array attributes

This commit is contained in:
kodumbeats
2021-10-26 16:14:25 -04:00
parent cb6a21f34f
commit c6ee3766b7
2 changed files with 17 additions and 1 deletions
+5 -1
View File
@@ -76,6 +76,10 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
throw new Exception('Cannot set default value for required attribute', 400);
}
if ($array && $default) {
throw new Exception('Cannot set default value for array attributes', 400);
}
try {
$attribute = new Document([
'$id' => $collectionId.'_'.$attributeId,
@@ -1591,7 +1595,7 @@ App::post('/v1/database/collections/:collectionId/documents')
$usage
->setParam('database.documents.create', 1)
->setParam('collectionId', $collectionId)
;
;
$audits
->setParam('event', 'database.documents.create')