Q:

Parsing Pymongo

I am trying to put together a program that wil parse through mongodb and get each page (eventually I will want to graph it) but I don't know what I am doing wrong here.   I have been through the tutorial http://api.mongodb.org/python/2.0/tutorial.html
but it I don't know how to query dynamically (looping through).  My guess is that it has something to do with results being returned in unicode but i'm not sure.   Here is my code. 
import pymonogo
from pymongo import Connection
c = Connection()
dbs = c.database_names()
for db in dbs:
  print db
  for col in c[db].collection_names():
    print '\t', col
    for pag in c[db].col.find():
      print pag

I'm just doing some analytics on an existing databases. ( I have about 5 dbs that each have 1-20 collections, each collection has from 0 - 1500 pages.  I am hoping to graph the pages, but I haven't gotten far enough into the graphing library yet to see exactly how that will work out. 
If you can help thanks. 

A:

If you just want to get all of the data from all dbs and all collections, then your code was almost right.  Here's the code with a small fix (c[db][col] instead of c[db].col):
from pymongo import MongoClient

c = MongoClient()
dbs = c.database_names()
for db in dbs:
    print db
    for col in c[db].collection_names():
        print '\t', col
        for pag in c[db][col].find():
            print pag

