I did a find on my mongodb and i can do this also in pymongo.
db.myTest.find({"cell":"k12p125"})
{ "_id" : ObjectId("5425194479df354955015855"), "cell" : "k12p125",
"fileInfo" : { "t50%" : 95, "fName" : "file1", "25%" : 67, "min" : 0, "50%" : 70, "std" : 23.155629597455047, "max" : 204, "75%" : 93, "count" : 42484, "mean" : 78.01871292721965 } }{ "_id" : ObjectId("5425197d79df3549550161e9"), "cell" : "k12p125", "fileInfo" : { "t50%" : 92, "fName" : "file2", "25%" : 69, "min" : 0, "50%" : 71, "std" : 21.696940348452337, "max" : 204, "75%" : 90, "count" : 42484, "mean" : 78.14659636569061 } }
{ "_id" : ObjectId("542519b679df354955016b7d"), "cell" : "k12p125", "fileInfo" : { "t50%" : 95, "fName" : "file3", "25%" : 66, "min" : 0, "50%" : 70, "std" : 23.58083230514195, "max" : 205, "75%" : 94, "count" : 42484, "mean" : 77.98015723566519 } }
What I want to do is access embedded document. So I have a key called "cell" and the value i was looking for "k12p125". What I want to do is look for cell k12p125 and then pull out all the "std" key for each file and also the name of each file. So the information I would want is
cell:k12p125
fName:"file1",std:23.155629597455047
fName:"file2",std:21.696940348452337
fName:"file3",std:23.58083230514195
and be able to retrieve that information using pymongo. I would also like to know if there is a way to get the "std" of each file directly as long the file is sorted. I would want
cell:k12p125
std:23.155629597455047
std:21.696940348452337
std:23.58083230514195
The std that comes out will be in the sorted order of the files (std order as file1,file2,file3). Please let me know if you need more clarification. I am having hard time conceptualizing how to access embedded documents, so any help would be great. thanks!