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

How to know the collation of a collection

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None

      I created a collection explicitly in MongoDB 3.4 in order to define the collation:

      db.createCollection("mycoll", {collation: {
        "locale": "en_US", 
        "strength": 1, 
        "caseLevel": false, 
        "numericOrdering": false, 
        "maxVariable": "punct", 
        "caseFirst": "off", 
        "alternate": "non-ignorable", 
        "normalization": false, 
        "backwards": false
      }})
      

      Now I want to check the collation associated with that collection but I can't find a command to show that information. I tested the following commands:

      db.mycoll.stats()
      db.runCommand({collStats: "mycoll"})
      

      After reviewing all the output from the last command I found the collation under the indexDetails section inside _id index but it's the index collation not the collection collation. Take in account that if collection was created with autoIndexId=false then indexDetails is missed. I also test the collection using MongoDB Compass but I can't find the collation either so:

      How to know the collation of a specific collection?

      Thanks

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            kindox Kindox
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: