Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-972

db.collections() cuts collection name when it's the same as the database

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.26
    • Affects Version/s: None
    • Component/s: None

      When using db.collections(), if the name of the collection starts with the name of the database, and then a dot, this is cut out of the results. E.g. collection "test.foo" is returned as "foo" if the database name is "test".

      I'm using the mongodb package version "^2.2.24". My underlying mongo server running locally has three collections:

      > use test
      switched to db test
      
      > show collections
      bar.movie
      foo.movie
      test.movie
      

      When I use db.collections() this is the result I get back

      bar.movie
      foo.movie
      movie
      

      Attached is the script I used to reproduce the issue (given a running mongo server with collections in it, as described above).

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            cminardi Claudia Minardi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: