Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32720

Field xxx of text index contains an array in document

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.0, 3.6.1, 3.6.2
    • Component/s: Index Maintenance
    • None

      Hi,

      why can't text indexes not contain an array anymore?

      Document:

      > db.employee.findOne()                             
      {                                                                                                  
              "allUnitIds" : [                            
                      "054edeaf-5efd-43b8-abe2-04164d9071a5"                                                   
              ],                                          
              "allSearchableStrings" : "..."                 
      }      
      

      Indexcreation

      > db.employee.createIndex({ "allSearchableStrings" : "text" , "allUnitIds" : 1})                         
      {                                                   
              "ok" : 0,                                   
              "errmsg" : "Field 'allUnitIds' of text index contains an array in document: { _id: \"2d937bbf-8a4f-4688-8821-a951971ba5e6\", allUnitIds: [ \"054edeaf-5efd-43b8-abe2-04164d9071a5\" ], allSearchableStrings: \"...\" }",
              "code" : 201,                               
              "codeName" : "CannotBuildIndexKeys"         
      }  
      

      It was at least possible with 3.4.x

            Assignee:
            mark.agarunov Mark Agarunov
            Reporter:
            pwirth Phillip Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: