-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Server Triage
Hi Team,
I know currently MongoDB does not support having an index on the multiple array fields which is causing the implementation issue.
Consider the following example where we have 2 fields which are array and on both of them, we need the indexes.
Consider the following example where we have tags in the document and also that same document is shared among the other branches, now I want to filter the data based on branch and tag something like as follows.
{ tags: ["tech", "blog", "discussion"], branches: ["dev", "staging"] }
Fetch the document where the tag is tech, blog and belongs to dev branch
db.collection.find({tags: {$in: ["tech", "blog"]}, branches: "dev"}) in order to improve the performance I need the index on both the fields but which is not possible for now.
The only workaround which I see is to create multiple copies for each branch which will avoid https://docs.mongodb.com/manual/core/index-multikey/#compound-multikey-indexes index limitations and it will increase the data size and documents count in the collection.
Thanks,
- duplicates
-
SERVER-826 Allow indexing of several arrays
- Backlog