Open
Description
On the Mongoid 6+ and MongoDB 3.2+ its possible to do the following index:
index({ _slugs: 1 }, { unique: true, partial_filter_expression: { _slugs: { '$type' => 'string' } } })
This has an advantage over sparse: true
because it won't consider empty array [ ]
as a duplicate value (i.e. if two or more docs have _slugs: [ ]
), and we could remove some unset
related hacks we have.
Metadata
Assignees
Labels
No labels