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
- is duplicated by
-
SERVER-5121 while profile level is 2, auth using a user not exists in the db will lost connection
-
- Closed
-