Skip to content

[multi tenant + slug]: slug is unique for all the collection, ignoring the tenant #14938

@llaz00

Description

@llaz00

Describe the Bug

It seems this bug has been closed by mistake #14801.

Adding the indexes, as suggested by you, is not enough for making it work, as the slug is still set to unique in database, so it still fails.
Dropping the index directly from the database is also not enough, as you can't use it along with the ensureIndexes option set to true, and also is not persistent as you can't deploy multiple instances of the code without making changes to the database.

Please re-consider this bug and possible fixes, such as being able to set unique to false when calling slugField() (so we can manually add the compound index), before the final fix that should be making it fully compatible with multi-tenant scenarios by default.

The referenced issue has more details of the line where the slug field is set to unique.

Link to the code that reproduces this issue

#14801

Reproduction Steps

  1. Install/configure multi tenancy plugin
  2. Create a collection with a slug field
  3. Create 2 different tenants
  4. Try to use the same slug for both tenants

Which area(s) are affected?

plugin: multi-tenant

Environment Info

Not relevant

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions