I want to query my Mongodb collection (name: wrappers) and retrieve all documents that have field ‘urls’ that end with ‘.com’
I am not sure on how to query nested documents and also using regex for queries.
I am actually coding it in perl. However queries to run on the mongo shell would also be fine.
Thanks in advance!
Sample Data:
{ "_id" : ObjectId("4e7a34932cd4b16704000000"), "lastArray" : { "desc" : "google", "url" : "google.com", "data" : [
{
"name" : "1",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
},
{
"name" : "2",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
}
{ "_id" : ObjectId("4e7a34932cd4b16704000001"), "lastArray" : { "desc" : "yahoo", "url" : "yahoo.com", "data" : [
{
"name" : "1",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
},
{
"name" : "2",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
}
1 Answer