[SERVER-54950] Allow wildcard indices with unique constraint Created: 04/Mar/21  Updated: 30/Mar/23

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: NOVALUE Mitar Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: query-product-scope-3, query-product-urgency-3, query-product-value-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

We are storing documents where users can provide extra metadata. One case of this extra metadata are IDs in their own systems for those documents. This is then used to sync data between multiple systems when federating. For example, document can be like:

 

{
 
  _id: <MongoDB ID>
 
  ids: {
    system1: "abc",
    system2: 123
  }
 
}

We would like to use wildcard index on "ids" field, but also require that any value for any field with same name inside the field has to be unique. For the example above, there should be no other document which has for "system1" field value equal to "abc".

The issue is that we do not know in advance field names inside "ids" and different users might have different field names.



 Comments   
Comment by Xiaochen Wu [ 22/Mar/23 ]

Since the wildcard index is not wildly used at this point, we suggest to move this to backlog. We can revisit it when we fixed other issues in wildcard index and get more usage. 

Comment by NOVALUE Mitar [ 24/Feb/23 ]

Yes. Both of those restrictions would be in effect.

Comment by Asya Kamsky [ 23/Feb/23 ]

mitar in the example you give, the implication is that no other document would be allowed to have system2 value of 123 is that part of the request?

Comment by Dmitry Agranat [ 08/Mar/21 ]

Hi mitar,

Thank you for the detailed example. We're assigning this ticket to the appropriate team to be evaluated against our currently planned work. Updates will be posted on this ticket as they happen.

Thanks,
Dima

Generated at Thu Feb 08 05:35:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.