These are 2 different collections in a database.I am not able to figure out how to dynamically fetch the values from the collections using java .
I want to fetch the values through java program but without using the hardcoded values like "VerifyEmail.LicenseKey" & "wsf:status.arg0.age" as mentioned above in the java code.Is there a way to fetch the values without hardcoding in java.
Collection 1:
{
"_id" : ObjectId("583567ac6c85e71adc1f8bae"),
"wsf:status" : {
"arg0" : {
"name" : "James",
"phonenum" : NumberLong(9848222338),
"age" : 18
"status" : "N"
}
},
}
Query 1: Here I am using the hardcoded values to fetch the desired result from the collection 1.
db.xmlcoll1.find({"wsf:status.arg0.age":18})
Collection 2:
{
"_id" : ObjectId("582446686c85e73a70696666"),
"VerifyEmail" : {
"xmlns" : "http://ws.cdyne.com/",
"email" : "[email protected]",
"LicenseKey" : 123
} }
Query 2:
Here I am using the hardcoded value of the element "VerifyEmail" to fetch the values.
db.xmlcoll.find({"VerifyEmail.LicenseKey":123});