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

text index unique constraint violation

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.1
    • Component/s: Index Maintenance
    • None

      I have this index setup:

      {
          "_fts" : "text",
          "_ftsx" : 1,
          "SiteId" : 1
      }
      

      unique.

      I could only create it if I dont have _fts field with values like: archive-collections-2

      When I try to:

      > db.post.update({FriendlyUrl:'archivecollections2'},{$set:{FriendlyUrl:'archive-collections-2'}})
      

      I get:

      WriteResult({
              "nMatched" : 0,
              "nUpserted" : 0,
              "nModified" : 0,
              "writeError" : {
                      "code" : 11000,
                      "errmsg" : "E11000 duplicate key error collection: BlackAndWhite
      _ROC.post index: FriendlyUrl_text_SiteId_1 dup key: { : \"2\", : 0.6666666666666
      666, : 20 }"
              }
      })
      

      Notice it's using only \"2\" and thus it violates the unique constraint.

      Is this supposed to happen?
      Why is it not using the full archive-collections-2 ?

      Thank you!

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            telmo.sa@gmail.com telmo sa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: