You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support MongoDB in SQL Review (DML rules such as require filter / affected document limit) #21573
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:
Require filter (like statement.where.require): flag updateMany / deleteMany / updateOne / deleteOne / replaceOne / findOneAndUpdate / findOneAndDelete with an empty or missing filter.
Limit affected documents (like statement.affected-row-limit): estimate with countDocuments(filter) or explain, and alert above a configurable threshold.
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
h3n4l commentedon Oct 20, 2026
Thanks for your report! We plan to introduce AI driven review. Will this be helpful to you?