Does this look correct?
MongoDB shell version: 1.8.1
connecting to: test
rs:PRIMARY> db.fs.chunks.getIndexes()
[
{
"name" : "_id_",
"ns" : "test.fs.chunks",
"key" : {
"_id" : 1
},
"v" : 0
},
{
"_id" : ObjectId("4e15b6a36bc1a5b9c1b845c4"),
"ns" : "test.fs.chunks",
"key" : {
"files_id" : 1,
"n" : 1
},
"name" : "files_id_1_n_1",
"unique" : true,
"v" : 0
}
]
rs:PRIMARY>
I'm still getting the error....I am replicating if that makes any
difference.
Digging deeper into the driver it is here:
public virtual CommandResult RunCommandAs(
Type commandResultType,
IMongoCommand command
) {
var response = CommandCollection.FindOne(command); <--
*** THIS FAILS ***
if (response == null) {
var commandName =
command.ToBsonDocument().GetElement(0).Name;
var message = string.Format("Command '{0}' failed. No
response returned.", commandName);
throw new MongoCommandException(message);
}
var commandResult = (CommandResult)
Activator.CreateInstance(commandResultType); // constructor can't have
arguments
commandResult.Initialize(command, response); // so two
phase construction required
if (!commandResult.Ok) {
if (commandResult.ErrorMessage == "not master") {
server.Disconnect();
}
throw new MongoCommandException(commandResult);
}
return commandResult;
}
The response is:
response = { "errmsg" : "exception: best guess plan requested, but
scan and order required: query: { files_id:
ObjectId('4e15ba69905ad41e0c4a10c9') } order: { files_id: 1, n: 1 }
choices: { $natural: 1 } ", "code" : 13284, "ok" : 0.0 }
The stack looks like:
> MongoDB.Driver.dll!MongoDB.Driver.MongoDatabase.RunCommandAs(System.Type commandResultType = {Name = "CommandResult" FullName = "MongoDB.Driver.CommandResult"}, MongoDB.Driver.IMongoCommand command = {MongoDB.Driver.CommandDocument}) Line 826 C#
MongoDB.Driver.dll!
MongoDB.Driver.MongoDatabase.RunCommandAs<MongoDB.Driver.CommandResult>(MongoDB.Driver.IMongoCommand
command = {MongoDB.Driver.CommandDocument}) Line 801 + 0x47 bytes C#
MongoDB.Driver.dll!
MongoDB.Driver.MongoDatabase.RunCommand(MongoDB.Driver.IMongoCommand
command = {MongoDB.Driver.CommandDocument}) Line 779 + 0x2e bytes C#
MongoDB.Driver.dll!
MongoDB.Driver.GridFS.MongoGridFS.Upload(System.IO.Stream stream =
{System.IO.FileStream}, string remoteFileName = "h:\\images\\abbie -
Copy (9).jpg", MongoDB.Driver.GridFS.MongoGridFSCreateOptions
createOptions = {MongoDB.Driver.GridFS.MongoGridFSCreateOptions}) Line
855 + 0x2d bytes C#
MongoDB.Driver.dll!
MongoDB.Driver.GridFS.MongoGridFS.Upload(System.IO.Stream stream =
{System.IO.FileStream}, string remoteFileName = "h:\\images\\abbie -
Copy (9).jpg") Line 784 + 0x22 bytes C#
MongoViewer.exe!MongoViewer.Form1.storeFile(string fileName = "h:\
\images\\abbie - Copy (9).jpg") Line 65 + 0x3a bytes C#
MongoViewer.exe!MongoViewer.Form1.OnChanged(object source =
{System.IO.FileSystemWatcher}, System.IO.FileSystemEventArgs e =
{System.IO.FileSystemEventArgs}) Line 366 + 0x57 bytes C#
System.dll!System.IO.FileSystemWatcher.CompletionStatusChanged(uint
errorCode, uint numBytes, System.Threading.NativeOverlapped*
overlappedPointer = 0x0000000002646300) + 0x2e2 bytes
mscorlib.dll!
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(uint
errorCode = 0, uint numBytes = 52, System.Threading.NativeOverlapped*
pOVERLAP = 0x0000000002646300) + 0x96 bytes
[Native to Managed Transition]