首页 新闻 搜索 专区 学院

对MongoDB的Gridfs.Chunks分片后上传文件异常

0
悬赏园豆:10 [待解决问题]

对MongoDB的Gridfs.Chunks分片:

> use admin
> db.runCommand({addshard:"localhost:27020",allowLocal:true})
> db.runCommand({addshard:"localhost:27021",allowLocal:true})

> db.runCommand({shardcollection:"mydb.fs.chunks",key:{ files_id:1}})

UploadFileTest : Failed

Test method MongoTests.TestDataTest.UploadFileTest threw exception:
MongoDB.Driver.MongoQueryException: QueryFailure flag was unrecognized command: $readPreference (response was { "$err" : "unrecognized command: $readPreference", "code" : 13390 }).
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoReplyMessage.cs: line 99
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage(BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoConnection.cs: line 475
at MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 296
at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 251
at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs: line 141
at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source)
at MongoDB.Driver.MongoCollection.FindOneAs(IMongoQuery query) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 557
at MongoDB.Driver.MongoCollection`1.FindOne(IMongoQuery query) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 1734
at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoDatabase.cs: line 973
at MongoDB.Driver.MongoDatabase.RunCommandAs(IMongoCommand command) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoDatabase.cs: line 950
at MongoDB.Driver.MongoDatabase.RunCommand(IMongoCommand command) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoDatabase.cs: line 928
at MongoDB.Driver.MongoCollection.Count(IMongoQuery query) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 158
at MongoDB.Driver.MongoCollection.Count() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs: line 143
at MongoDB.Driver.GridFS.MongoGridFS.EnsureIndexes(Int32 maxFiles) in C:\work\rstam\mongo-csharp-driver\Driver\GridFS\MongoGridFS.cs: line 437
at MongoDB.Driver.GridFS.MongoGridFS.Upload(Stream stream, String remoteFileName, MongoGridFSCreateOptions createOptions) in C:\work\rstam\mongo-csharp-driver\Driver\GridFS\MongoGridFS.cs: line 761
at MongoDB.Driver.GridFS.MongoGridFS.Upload(Stream stream, String remoteFileName) in C:\work\rstam\mongo-csharp-driver\Driver\GridFS\MongoGridFS.cs: line 744
at MongoDB.Driver.GridFS.MongoGridFS.Upload(String localFileName, String remoteFileName) in C:\work\rstam\mongo-csharp-driver\Driver\GridFS\MongoGridFS.cs: line 880
at MongoTests.TestDataTest.UploadFileTest() in TestDataTest.cs: line 171
wangjg的主页 wangjg | 初学一级 | 园豆:192
提问于:2012-09-05 16:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册