How to improve query performance by two and more array fields in MongoDB? -


i have collection of objects have multiple array fields. like:

{     sponsors: {       lead_sponsor: {          name: "mark",          type: "individual"       }       collaborators: [          {name: "company ltd.", type: "company"},          {name: "industry company ltd.", type: "company"}       ]     },     terms: ["some term", "some term 2", "some term 3"],     keywords: ["word1", "word2", "word3", "word4"],     description: "here might big text detailed description",     status: "active", } 

how can optimize query next one?

{   status: "active",    $or: [     {"lead_sponsor.name": /company/i},      {"collaborators.name": /company/i},     {"terms": /phrase/i},     {"keywords": /phrase/i},     {"description": /phrase/i},   ] } 

compound indexes cannot have more 1 array field. if copy data array fields new field searcharray , add compound index includes array? approach?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -