Skip to content

Conversation

@ArnabChatterjee20k
Copy link
Contributor

@ArnabChatterjee20k ArnabChatterjee20k commented Oct 12, 2025

Summary by CodeRabbit

  • New Features

    • Added MongoDB adapter support, including Shared Tables variants.
    • Introduced UUIDv7 identifiers and increased key/label length limits to 255 characters.
    • Enhanced schemaless document handling and selection across adapters.
  • Chores

    • Added MongoDB services to docker-compose (with optional UI) and enabled MongoDB PHP extension in Docker image.
    • Updated Redis and MySQL container versions.
    • Declared MongoDB-related dependencies in project configuration.
  • Tests

    • Expanded test matrix and end-to-end coverage to include MongoDB and Shared Tables adapters.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 12, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • 0.69.x

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds MongoDB support across infrastructure, dependencies, and tests. Expands adapter interfaces for capabilities and casting hooks, updates SQL/Pool adapters, and revises Database control flow to use instance query conversion and pre/post casting. Validators gain attribute-support flags and dynamic limits. Tests updated/added for MongoDB, shared tables, schemaless, and UUID7 handling.

Changes

Cohort / File(s) Summary
CI & Containers
.github/workflows/tests.yml, Dockerfile, docker-compose.yml, tests/resources/mongo/*
Expands test matrix with MongoDB and SharedTables variants; adds PHP ext-mongodb install; introduces MongoDB service (replica set, keyfile), mongo-express, volumes/secrets; adds mongo entrypoint and keyfile resources.
Dependencies
composer.json
Adds ext-mongodb and utopia-php/mongo; relaxes laravel/pint constraint; updates suggestions for DB adapters.
Adapter Interfaces & Impl.
src/Database/Adapter.php, src/Database/Adapter/SQL.php, src/Database/Adapter/Pool.php
Introduces capability methods (UID length, multiple fulltext, identical indexes, random order, UTC casting); adds castingBefore/After and UTC helpers; changes getAttributeProjection return to mixed; SQL implements defaults; Pool delegates.
Core Database Flow
src/Database/Database.php
Replaces VAR_OBJECT_ID with VAR_UUID7; converts query conversion methods to instance; integrates adapter casting hooks across CRUD/query paths; updates relationship-query processing; wires validator constructors with capability flags.
Validators
src/Database/Validator/*
Index: new constructor (accepts indexes, capability flags), checks for multiple fulltext and identical indexes. Key/Label/UID: dynamic max length (default 255). Structure/Query validators (Filter/Order/Select/Documents/Document): add supportForAttributes flag and gated validations. Sequence: switch ObjectId to UUID7 case.
E2E Adapters
tests/e2e/Adapter/Base.php, tests/e2e/Adapter/MongoDBTest.php, tests/e2e/Adapter/SharedTables/MongoDBTest.php
Adds SchemalessTests trait to Base; introduces MongoDB adapter tests for standard and SharedTables configurations.
E2E Scopes
tests/e2e/Adapter/Scopes/*
Makes tests capability-aware (attributes, indexes, random order, spatial, relationships); adds schemaless test suite; adjusts index definitions; updates ID expectations to UUID7 where applicable.
Unit Tests
tests/unit/*
Updates Index tests for new constructor and messages; increases Key/Label/Permissions max-length expectations to 255; Structure tests switch to UUID7; minor comment cleanup in QueryTest.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor T as Test/Client
  participant DB as Database
  participant V as Validators
  participant A as Adapter (SQL/Mongo/Pool)

  T->>DB: create/find/update/delete(...)
  DB->>V: init validators (supportForAttributes, index flags, max UID)
  V-->>DB: validation result

  rect rgb(235, 245, 255)
    note right of DB: Pre-processing
    DB->>A: castingBefore(collection, document)
    A-->>DB: pre-cast document
  end

  DB->>A: execute operation (queries now instance-based)
  A-->>DB: raw result(s)

  rect rgb(235, 255, 235)
    note right of DB: Post-processing
    DB->>A: castingAfter(collection, document)
    A-->>DB: post-cast document
  end

  DB-->>T: response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Possibly related PRs

Suggested reviewers

  • abnegate
  • fogelito

Poem

A nibble of code, a hop through the logs,
New Mongo burrows where our test runner jogs.
UUID7 stars twinkle in night,
Casting before, after—just right.
I thump in delight—schemas less stressed,
Carrots compiled, adapters expressed. 🥕🐇

Pre-merge checks and finishing touches and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.55% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly identifies the addition of schemaless support and the MongoDB adapter, which is the central theme of this large changeset. Although the phrasing and punctuation could be polished, it succinctly describes the primary enhancement introduced by the pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ArnabChatterjee20k ArnabChatterjee20k changed the base branch from main to feat-mongodb October 12, 2025 14:01
Copy link
Contributor Author

@ArnabChatterjee20k ArnabChatterjee20k Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MultipleFulltextIndex should get the first priority in case of mongodb especially when supportForAttributes is true and we have multiple full text indexes like here

@abnegate abnegate merged commit 08b568d into feat-mongodb Oct 13, 2025
18 checks passed
@abnegate abnegate deleted the feat-documentsdb branch October 13, 2025 09:38
@coderabbitai coderabbitai bot mentioned this pull request Oct 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants