db.animals
{\'animal\':\'monkey\', \'quantity:3 \'id\' : 001} {\'animal\':\'pig\', \'quantity:5 \'id\' : 002} {\'animal\':\'cow\', \'quantity:3 \'id\' : 00
There are no joins in MongoDB so you have to do it in two steps.
In the shell:
var john = db.people.findOne({person: 'john'}) db.animals.find({id: {$in: john.have}})