Support MongoDB in SQL Review (DML rules such as require filter / affected document limit) · Issue #21573 · bytebase/bytebase · GitHub
Skip to content

Support MongoDB in SQL Review (DML rules such as require filter / affected document limit) #21573

Open

Description

@ensean

Is your feature request related to a problem?

We use Bytebase to manage change review for self-hosted MongoDB. Bytebase already supports MongoDB for the SQL Editor and change workflow, but SQL Review has no rules for MongoDB: none of the rules in https://docs.bytebase.com/sql-review/review-rules list MongoDB as a supported engine, and backend/plugin/advisor has no mongodb package.

As a result, a dangerous statement such as db.orders.deleteMany({}) or db.users.updateMany({}, {$set: {...}}) passes review the same way as a targeted one. Human approval is the only safeguard.

Describe the solution you'd like

MongoDB support in SQL Review, starting with DML rules that have a direct SQL equivalent:

  1. Require filter (like statement.where.require): flag updateMany / deleteMany / updateOne / deleteOne / replaceOne / findOneAndUpdate / findOneAndDelete with an empty or missing filter.
  2. Limit affected documents (like statement.affected-row-limit): estimate with countDocuments(filter) or explain, and alert above a configurable threshold.
  3. Disallow dangerous commands: e.g. drop, dropDatabase, remove({}), configurable allow/deny list.

The existing MongoDB parser in backend/plugin/parser/mongodb (statement splitting, query type) looks like a possible base for this.

Additional context

Is MongoDB SQL Review on the roadmap? If it is not planned, would you accept a community PR adding a mongodb advisor along these lines? Any guidance on the preferred design would help.

Activity

  1. h3n4l commented on Oct 20, 2026

    @h3n4l
    Member

    Thanks for your report! We plan to introduce AI driven review. Will this be helpful to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions