I am stuck with Mongo with the $ hint team. I have a collection, and I indexed this collection. But the problem is that I am requesting a collection using the Aggregate structure, but I need to temporarily disable indexing, so I use the hint command as follows:
db.runCommand( {aggregate:"MyCollectionName", pipeline:[{$match : {...somthing...}, {$project : {...somthing...}}] }, {$hint:{$natural:1}} )
Please note that I am using {$hint:{$natural:1}} to disable indexing for this query. I executed SUCCESSFULLY this command on the MongoDB command line. But I do not know how to match this command with Mongo Java Api (Java Code).
I used lib mongo-2.10.1.jar
source share