Mongo DB, Java API Mongo, how to add a tooltip to an aggregate command

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

+4
source share
1 answer

You cannot currently - he is lagging - vote for SERVER-7944

+6
source

Source: https://habr.com/ru/post/1489440/


All Articles