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

Database with auth turned on and profile = 2 on the command line does not allow "show dbs" to be run from driver

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.1
    • Affects Version/s: 2.0.2
    • Component/s: Security
    • Labels:
      None
    • Environment:
      mongod standalone on win7 x64.
    • Fully Compatible
    • ALL

      Start mongod with auth turned on and --profile set to 2

      mongod.exe --auth --dbpath c:\mongo\data\db  --profile 2 -logpath c:\mongo\logs -vvvvv
      

      now from the shell login to the admin db and create 1 admin user.
      The following code in pymongo 2.1.1 throws and exception

      >>> conn = pymongo.Connection("mongodb://admin:admin@localhost/?safe=true")
      

      Traceback (most recent call last):
      File "<pyshell#21>", line 1, in <module>
      conn = pymongo.Connection("mongodb://admin:admin@localhost/?safe=true")
      File "C:\Python27\lib\site-packages\pymongo\connection.py", line 381, in _init_
      self.__find_node()
      File "C:\Python27\lib\site-packages\pymongo\connection.py", line 659, in __find_node
      raise AutoReconnect(', '.join(errors))
      AutoReconnect: connection closed

      Also the following code from the c# driver 1.3.1 throws an exception

                  var server = MongoServer.Create("mongodb://admin:admin@localhost/?safe=true");
                  foreach (var databaseName in server.GetDatabaseNames())
                  {
                      Console.WriteLine(databaseName);
                  }
      

      c:\Users\Sridhar\Documents\Visual Studio 2010\Projects\ConsoleApplication5\bin\Debug>ConsoleApplication5.exe
      MongoDB.Driver.MongoConnectionException: Unable to connect to server localhost:27017: Attempted to read past the end of the stream.. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
      at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream, Int32 count) in C:\source\mongo-csharp-driver\Bson\IO\BsonBuffer.cs:line 297
      at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream) in C:\source\mongo-csharp-driver\Bson\IO\BsonBuffer.cs:line 267
      at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\source\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 435
      at MongoDB.Driver.Internal.MongoConnection.RunCommand(String collectionName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError) in C:\source\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 393
      at MongoDB.Driver.MongoServerInstance.VerifyState(MongoConnection connection) in C:\source\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 417

            Assignee:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            sridhar Sridhar Nanjundeswaran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: