I am using MongoDB and have collection in the below format .
db.options.find({ "undersymbol" : "UBSC"}).pretty()
{
"finalsymbol" : "UBSC",
"option_exp" : [
{
"expiration_dt" : "2015-01-17",
"days_to_expire" : 638,
"low_strike" : 120,
"high_strike" : 190,
"no_of_strikes" : 86,
"options" : [
{
"strikeprice" : "120.0",
"chain_type" : "call",
"symbol" : "UBSC"
}
]
},
"expiration_dt" : "2015-01-18",
"days_to_expire" : 656,
"low_strike" : 34,
"high_strike" : 455,
"no_of_strikes" : 67,
"options" : [
{
"strikeprice" : "420.0",
"chain_type" : "call",
"symbol" : "UBSC"
}
]
}
}
]
}
Right now I am using the folllowing query to extract the Data from my collection
BasicDBObject query = new BasicDBObject();
query.put("finalsymbol", "UBSC");
OptionsData ocd = (OptionsData) coll.findOne(query);
The query that is being formed is
{ "finalsymbol" : "UBSC"}
Is it possible to that can i include the expiration_dt
also along with finalsymbol
in the query , so that the performance will be increased ??