Skip to content

Validate collection names #806

Closed
FerretDB/dance
#164
@AlekSi

Description

After #750, we should validate that MongoDB collection names are valid.

MongoDB rules are documented here: https://www.mongodb.com/docs/manual/reference/limits/#mongodb-limit-Restriction-on-Collection-Names

Let's simplify them to two rules:

  • collection names should match regular expression ^[a-zA-Z_][a-zA-Z0-9_]{0,119}$ (that excludes non-latin letters, spaces, dots, dollars, dashes, long names, etc);
  • collection names can't start with a reserved prefix _ferretdb_.

We could relax those rules in the future.

  • implement collection name validation on collection/table creation;
  • add integration test;
  • document the difference in rules in README.md;
  • add diff dance test.

Tigris is not in scope.

Metadata

Assignees

Labels

code/featureSome user-visible feature is not implemented yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions