Inconsistent collection name rules regarding dots in documentation, product and python driver

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The documentation does not impose any MUST restrictions regarding the use of dots in collection names, only a SHOULD:

      Restriction on Collection Names

      Collection names should begin with an underscore or a letter character, and cannot:

      • contain the $.
      • be an empty string (e.g. "").
      • contain the null character.
      • begin with the system. prefix. (Reserved for internal use.)
      • contain .system..

       

      At the same time, the product rejects leading dots and allows trailing dots:

      Enterprise test> coll = db['.a']
      test..a
      Enterprise test> coll.insert({a:1});
      Uncaught:
      MongoBulkWriteError[InvalidNamespace]: Collection names cannot start with '.': .a
      
      Enterprise test> coll = db['b.'];
      test.b.
      Enterprise test> coll.insert({a:1});
      {
        acknowledged: true,
        insertedIds: { '0': ObjectId('693295b10e96b7c851c76a8c') }
      }
      Enterprise test> show tables
      b.

      The python driver however rejects both leading and trailing dots:

              if new_name[0] == "." or new_name[-1] == ".":
                  raise InvalidName("collection names must not start or end with '.'")
      

      So which of the three is it? Also, I think validation should only happen in a single location, in the server, and not in the driver.

            Assignee:
            Anton Korshunov
            Reporter:
            Philip Stoev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: