Merge branch 'feat-mongodb-pulls' of github.com:appwrite/appwrite into feat-mongodb-pulls

# Conflicts:
#	composer.lock
This commit is contained in:
shimon
2025-09-16 17:43:47 +03:00
9 changed files with 86 additions and 49 deletions
+8 -35
View File
@@ -1540,15 +1540,6 @@ return [
],
],
'indexes' => [
// Mongodb do not allow two fulltext indexes on the same field in a single collection
// https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/text-index-restrictions/
// [
// '$id' => ID::custom('_fulltext_name'),
// 'type' => Database::INDEX_FULLTEXT,
// 'attributes' => ['name'],
// 'lengths' => [],
// 'orders' => [],
// ],
[
'$id' => ID::custom('_key_search'),
'type' => Database::INDEX_FULLTEXT,
@@ -1563,14 +1554,13 @@ return [
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
// Mongodb do not allow two indexes on the same field in a single collection
// [
// '$id' => ID::custom('_key_name'),
// 'type' => Database::INDEX_KEY,
// 'attributes' => ['name'],
// 'lengths' => [],
// 'orders' => [Database::ORDER_ASC],
// ],
[
'$id' => ID::custom('_key_name'),
'type' => Database::INDEX_KEY,
'attributes' => ['name'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_fileSecurity'),
'type' => Database::INDEX_KEY,
@@ -1779,15 +1769,6 @@ return [
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
// Mongodb do not allow two fulltext indexes on the same field in a single collection
// https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/text-index-restrictions/
// [
// '$id' => ID::custom('_key_name'),
// 'type' => Database::INDEX_FULLTEXT,
// 'attributes' => ['name'],
// 'lengths' => [],
// 'orders' => [Database::ORDER_ASC],
// ],
[
'$id' => ID::custom('_key_type'),
'type' => Database::INDEX_KEY,
@@ -2055,16 +2036,8 @@ return [
'filters' => ['topicSearch'],
],
],
// Mongodb do not allow two fulltext indexes on the same field in a single collection
// https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/text-index-restrictions/
'indexes' => [
// [
// '$id' => ID::custom('_key_name'),
// 'type' => Database::INDEX_FULLTEXT,
// 'attributes' => ['name'],
// 'lengths' => [],
// 'orders' => [],
// ],
[
'$id' => ID::custom('_key_search'),
'type' => Database::INDEX_FULLTEXT,
+1 -1
View File
@@ -54,7 +54,7 @@
"utopia-php/cache": "0.13.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "dev-feat-mongo-tmp-pulls as 1.4.6",
"utopia-php/database": "dev-feat-mongo-inversion as 1.4.6",
"utopia-php/detector": "0.1.*",
"utopia-php/domains": "0.8.*",
"utopia-php/dns": "0.3.*",
@@ -113,7 +113,7 @@ class Upsert extends Action
try {
$modified = $dbForProject->withPreserveDates(function () use ($dbForProject, $database, $collection, $documents, $plan, &$upserted) {
return $dbForProject->createOrUpdateDocuments(
return $dbForProject->upsertDocuments(
'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(),
$documents,
onNext: function (Document $document) use ($plan, &$upserted) {
@@ -243,7 +243,7 @@ class Upsert extends Action
$upserted = [];
try {
$dbForProject->withPreserveDates(function () use (&$upserted, $dbForProject, $database, $collection, $newDocument) {
return $dbForProject->createOrUpdateDocuments(
return $dbForProject->upsertDocuments(
'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(),
[$newDocument],
onNext: function (Document $document) use (&$upserted) {
@@ -435,7 +435,7 @@ class StatsResources extends Action
$message = 'Stats writeDocuments project: ' . $project->getId() . '(' . $project->getSequence() . ')';
try {
$dbForLogs->createOrUpdateDocuments(
$dbForLogs->upsertDocuments(
'stats',
$this->documents
);
+2 -2
View File
@@ -424,7 +424,7 @@ class StatsUsage extends Action
try {
$dbForProject = $getProjectDB($projectStats['project']);
Console::log('Processing batch with ' . count($projectStats['stats']) . ' stats');
$dbForProject->createOrUpdateDocumentsWithIncrease('stats', 'value', $projectStats['stats']);
$dbForProject->upsertDocumentsWithIncrease('stats', 'value', $projectStats['stats']);
Console::success('Batch successfully written to DB');
unset($this->projects[$sequence]);
@@ -468,7 +468,7 @@ class StatsUsage extends Action
try {
Console::log('Processing batch with ' . count($this->statDocuments) . ' stats');
$dbForLogs->createOrUpdateDocumentsWithIncrease(
$dbForLogs->upsertDocumentsWithIncrease(
'stats',
'value',
$this->statDocuments
+7 -8
View File
@@ -3,7 +3,6 @@
namespace Tests\E2E\General;
use Appwrite\Platform\Modules\Compute\Specification;
use Appwrite\Tests\Retry;
use CURLFile;
use DateTime;
use Tests\E2E\Client;
@@ -714,7 +713,7 @@ class UsageTest extends Scope
$response = $this->client->call(
Client::METHOD_POST,
'/tablesdb/' . $databaseId . '/tables',
'/databases/' . $databaseId . '/tables',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -743,7 +742,7 @@ class UsageTest extends Scope
if ($i < (self::CREATE / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/tablesdb/' . $databaseId . '/tables/' . $tableId,
'/databases/' . $databaseId . '/tables/' . $tableId,
array_merge([
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()),
@@ -758,7 +757,7 @@ class UsageTest extends Scope
$response = $this->client->call(
Client::METHOD_POST,
'/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns' . '/string',
'/databases/' . $databaseId . '/tables/' . $tableId . '/columns' . '/string',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -781,7 +780,7 @@ class UsageTest extends Scope
$response = $this->client->call(
Client::METHOD_POST,
'/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows',
'/databases/' . $databaseId . '/tables/' . $tableId . '/rows',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -803,7 +802,7 @@ class UsageTest extends Scope
if ($i < (self::CREATE / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId,
'/databases/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId,
array_merge([
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()),
@@ -899,7 +898,7 @@ class UsageTest extends Scope
$response = $this->client->call(
Client::METHOD_GET,
'/tablesdb/' . $databaseId . '/tables/' . $tableId . '/usage?range=30d',
'/databases/' . $databaseId . '/tables/' . $tableId . '/usage?range=30d',
$this->getConsoleHeaders()
);
@@ -1291,7 +1290,7 @@ class UsageTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()),
[
'domain' => 'test-' . ID::unique() . '.' . System::getEnv('_APP_DOMAIN_FUNCTIONS'),
'domain' => 'test-' . ID::unique() . System::getEnv('_APP_DOMAIN_FUNCTIONS'),
'functionId' => $functionId,
],
);
@@ -5909,6 +5909,11 @@ trait DatabasesBase
public function testSpatialPointAttributes(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6047,6 +6052,11 @@ trait DatabasesBase
public function testSpatialLineAttributes(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6184,6 +6194,11 @@ trait DatabasesBase
public function testSpatialPolygonAttributes(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6319,6 +6334,11 @@ trait DatabasesBase
public function testSpatialAttributesMixedCollection(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6473,6 +6493,11 @@ trait DatabasesBase
public function testUpdateSpatialAttributes(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6632,6 +6657,11 @@ trait DatabasesBase
public function testSpatialQuery(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7043,6 +7073,10 @@ trait DatabasesBase
public function testSpatialRelationshipOneToOne(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7181,6 +7215,10 @@ trait DatabasesBase
public function testSpatialRelationshipOneToMany(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7315,6 +7353,11 @@ trait DatabasesBase
public function testSpatialRelationshipManyToOne(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7440,6 +7483,10 @@ trait DatabasesBase
public function testSpatialRelationshipManyToMany(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7565,6 +7612,11 @@ trait DatabasesBase
public function testSpatialIndex(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -7675,6 +7727,11 @@ trait DatabasesBase
public function testSpatialDistanceInMeter(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6203,6 +6203,10 @@ class DatabasesCustomServerTest extends Scope
public function testSpatialBulkOperations(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
// Create database
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
@@ -6604,6 +6608,10 @@ class DatabasesCustomServerTest extends Scope
public function testSpatialBulkOperationsWithLineStrings(): void
{
if($this->isMongoDB()) {
$this->markTestSkipped('MongoDB is not supported for this test');
}
// Create database
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',