I want to run raw mongoDb queries using runCommand() which takes in BSON data. Following is my code
MongoClient mongoClient = new MongoClient();
MongoDatabase database = mongoClient.getDatabase("MyDB");
MongoCollection<Document> collection = (MongoCollection<Document>)database.runCommand(??);
If my query is
db.mycol.find({"by":"tutorials point"}).
What should be BSON data that I have to pass inside runCommand() ? Is it only
{{"by":"tutorials point"}}
or
db.mycol.find({"by":"tutorials point"}).
And If instead of find() i have to use Insert() how to go about it ??