db.files.save({ _id: "root"})
db.files.save({ _id: "src", parent: "root", ancestors: ["root"] } )
db.files.save({ _id: "lib", parent: "root", ancestors: ["root"]} )
db.files.save({ _id: "config.cfg", parent: "root", ancestors: ["root"], size: 2310 })
db.files.save({ _id: "file1.js", parent: "src", ancestors: ["root","src"], size: 5039 })
db.files.save({ _id: "file2.js", parent: "src", ancestors: ["root","src"], size: 1299 })


db.files.find( { parent: "root" } )    // all files in /src directory
db.files.find( {ancestors: "root"} )   // all files under /root directory tree
db.files.aggregate([
       {$match:{ancestors:"src"}}, 
       {$group:{
           _id:   "src",
           total_size:  {$sum:"$size"}
          }
       }
]);