OpenStreetMap is an open project, which means it's free and everyone can use it and edit as they like. OpenStreetMap is direct competitor of Google Maps. How OpenStreetMap can compete with the giant you ask? It's depend completely on crowd sourcing. There's lot of people willingly update the map around the world, most of them fix their map country.

Openstreetmap is so powerful, and rely heavily on the human input. But its strength also the downfall. Everytime there's human input, there's always be human error.It's very error prone.

Take the name of the street for example. People like to abbreviate the type of the street. Street become St. but in Ireland Saint is also mapped to ST.

Line few example Saint Stephen's Green will be written as ST Stephen's Green

This project tends to fix that, it fix abbreviate name, so it can use more generalize type. Not only it's benefit for professional, But we can also can see more structured words.

In this project, i want to show you to fix one type of error, that is the address of the street. I choose whole places of Ireland.


In [1]:
OSM_FILE = 'data/map.osm'

To audit the osm file, first we need to know the overview of the data. To get an overview of the data, we count the tag content of the data.


In [2]:
# %%writefile mapparser.py
#!/usr/bin/env python

import xml.etree.ElementTree as ET
import pprint

def count_tags(filename):
    """count tags in filename.
    
    Init 1 in dict if the key not exist, increment otherwise."""
    tags = {}
    for ev,elem in ET.iterparse(filename):
        tag = elem.tag
        if tag not in tags.keys():
            tags[tag] = 1
        else:
            tags[tag]+=1
    return tags
def test():
    tags = count_tags(OSM_FILE)
    pprint.pprint(len(tags))

if __name__ == "__main__":
    test()


10

In [3]:
# %load tags.py
import xml.etree.ElementTree as ET
import pprint
import re


lower = re.compile(r'^([a-z]|_)*$')
lower_colon = re.compile(r'^([a-z]|_)*:([a-z]|_)*$')
problemchars = re.compile(r'[=\+/&<>;\'"\?%#$@\,\. \t\r\n]')


def key_type(element, keys):
    """ 
    Count the criteria in dictionary for the content of the tag.
    """
    if element.tag == "tag":
        if lower.search(element.attrib['k']):
            keys['lower'] +=1
        elif lower_colon.search(element.attrib['k']):
            keys['lower_colon']+=1
        elif problemchars.search(element.attrib['k']):
            keys['problemchars']+=1
        else:
            keys['other']+=1
        
    return keys

def process_map(filename):
    keys = {"lower": 0, "lower_colon": 0, "problemchars": 0, "other": 0}
    for _, element in ET.iterparse(filename):
        keys = key_type(element, keys)
    return keys

def test():
    keys = process_map(OSM_FILE)
    pprint.pprint(keys)

if __name__ == "__main__":
    test()


{'lower': 620194, 'lower_colon': 261523, 'other': 42120, 'problemchars': 0}

In [ ]:
Find all Unique user In OSM File

In [4]:
# %load users.py

# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
import pprint
import re
"""
Your task is to explore the data a bit more.
The first task is a fun one - find out how many unique users
have contributed to the map in this particular area!

The function process_map should return a set of unique user IDs ("uid")
"""

def get_user(element):
    return


def process_map(filename):
    """
    Count the user id in the filename.
    """
    users = set()
    for _, element in ET.iterparse(filename):
        try:
            users.add(element.attrib['uid'])
        except KeyError:
            continue
   
    return users


def test():

     users = process_map(OSM_FILE)
     print ' No of user found in file ' , len( users)




if __name__ == "__main__":
    test()


 No of user found in file  1318

In [4]:
import xml.etree.cElementTree as ET

Update file data with few abbrivate and create a new file With updated data.


In [5]:
# %load audit.py

import xml.etree.cElementTree as ET
from collections import defaultdict
import re
import pprint
from optparse import OptionParser

street_type_re = re.compile(r'^\b\S+\.?', re.IGNORECASE)


expected = ["Street", "Avenue", "Boulevard", "Drive", "Court", "Place", "Square", "Lane", "Road", 
             "Trail", "Parkway", "Commons"]

mapping = { 
             "Ave":"Avenue",
             "Rd." : "Road",
             "N.":"North",
             }


def audit_street_type(street_types, street_name):
    m = street_type_re.search(street_name)
    if m:
        street_type = m.group()
        if street_type not in expected:
            street_types[street_type].add(street_name)
            #return True if need to be updated
            return True
    return False


def is_street_name(elem):
    """
    Perhaps the addr:full should also included to be fixed  
    """
    return (elem.attrib['k'] == "addr:street") or (elem.attrib['k'] == "addr:full")

def is_name_is_street(elem):
    """Some people fill the name of the street in k=name.
    
    Should change this"""
    s = street_type_re.search(elem.attrib['v'])
    #print s
    return (elem.attrib['k'] == "name") and s and s.group() in mapping.keys()

def audit(osmfile):
    osm_file = open(osmfile, "r")
    street_types = defaultdict(set)
#     tree = ET.parse(osm_file, events=("start",))
    tree = ET.parse(osm_file)
    
    listtree = list(tree.iter())
    for elem in listtree:
        if elem.tag == "node" or elem.tag == "way":
            n_add = None
            
            for tag in elem.iter("tag"):
                if is_street_name(tag):
                    if audit_street_type(street_types, tag.attrib['v']):
                        #Update the tag attribtue
                        tag.attrib['v'] = update_name(tag.attrib['v'],mapping)
                elif is_name_is_street(tag):
                    tag.attrib['v'] = update_name(tag.attrib['v'],mapping)
                    n_add = tag.attrib['v']
                   
            if n_add:
                elem.append(ET.Element('tag',{'k':'addr:street', 'v':n_add}))

            
                
    #write the to the file we've been audit
    tree.write(osmfile[:osmfile.find('.osm')]+'_audit.osm')
    return street_types


def update_name(name, mapping):
    """
    Fixed abreviate name so the name can be uniform.
    The reason why mapping in such particular order, is to prevent the shorter keys get first.
    """
    dict_map = sorted(mapping.keys(), key=len, reverse=True)
    for key in dict_map:
        
        if name.find(key) != -1:          
            name = name.replace(key,mapping[key])
            return name
    return  name


def test():
    st_types = audit(OSM_FILE)
    pprint.pprint(dict(st_types))
    for st_type, ways in st_types.iteritems():
        for name in ways:
            better_name = update_name(name, mapping)
            print name, "=>", better_name

if __name__ == '__main__':
    #test()
     st_types = audit(OSM_FILE)

This will save the Ireland osm that has been audited into map_audit.osm Not let's prepare the audited file to be input to the MongoDB instance.


In [12]:
OSM_FILE = "data/map_audit.osm"

In [14]:
# %%writefile data.py
import xml.etree.ElementTree as ET
import pprint
import re
import codecs
import json


lower = re.compile(r'^([a-z]|_)*$')
lower_colon = re.compile(r'^([a-z]|_)*:([a-z]|_)*$')
problemchars = re.compile(r'[=\+/&<>;\'"\?%#$@\,\. \t\r\n]')
addresschars = re.compile(r'addr:(\w+)')
CREATED = [ "version", "changeset", "timestamp", "user", "uid"]

def shape_element(element):
    #node = defaultdict(set)
    node = {}
    if element.tag == "node" or element.tag == "way" :
        #create the dictionary based on exaclty the value in element attribute.
        node = {'created':{}, 'type':element.tag}
        for k in element.attrib:
            try:
                v = element.attrib[k]
            except KeyError:
                continue
            if k == 'lat' or k == 'lon':
                continue
            if k in CREATED:
                node['created'][k] = v
            else:
                node[k] = v
        try:
            node['pos']=[float(element.attrib['lat']),float(element.attrib['lon'])]
        except KeyError:
            pass
        
        if 'address' not in node.keys():
            node['address'] = {}
        #Iterate the content of the tag
        for stag in element.iter('tag'):
            #Init the dictionry

            k = stag.attrib['k']
            v = stag.attrib['v']
            #Checking if indeed prefix with 'addr' and no ':' afterwards
            if k.startswith('addr:'):
                if len(k.split(':')) == 2:
                    content = addresschars.search(k)
                    if content:
                        node['address'][content.group(1)] = v
            else:
                node[k]=v
        if not node['address']:
            node.pop('address',None)
        #Special case when the tag == way,  scrap all the nd key
        if element.tag == "way":
            node['node_refs'] = []
            for nd in element.iter('nd'):
                node['node_refs'].append(nd.attrib['ref'])
#         if  'address' in node.keys():
#             pprint.pprint(node['address'])
        return node
    else:
        return None


def process_map(file_in, pretty = False):
    """
    Process the osm file to json file to be prepared for input file to monggo
    """
    file_out = "{0}.json".format(file_in)
    data = []
    with codecs.open(file_out, "w") as fo:
        for _, element in ET.iterparse(file_in):
            el = shape_element(element)
            if el:
                data.append(el)
                if pretty:
                    fo.write(json.dumps(el, indent=2)+"\n")
                else:
                    fo.write(json.dumps(el) + "\n")
    return data

def test():
     data = process_map(OSM_FILE)
#    pprint.pprint(data[500])
#      if __name__ == "__main__":
#          data = process_map(OSM_FILE)

The processed map has ben saved to map_audit.osm.json Now that we have process the audited map file into array of JSON, let's put it into mongodb instance. this will take the map that we have been audited. First we load the script to insert the map


In [15]:
from data import *
import pprint

In [16]:
data = process_map('data/map_audit.osm')

Okay let's test if the data is something that we expect


In [21]:
pprint.pprint(data[0:1])


[{'_id': ObjectId('55eeb9bda6d73408481412b5'),
  'created': {'changeset': '666506',
              'timestamp': '2008-11-03T17:03:37Z',
              'uid': '35560',
              'user': 'Peilscheibe',
              'version': '4'},
  'id': '384087',
  'pos': [53.1497533, -6.988381],
  'type': 'node'}]

The data seems about right. After we verified the data is ready, let's put it into MongoDB


In [18]:
from pymongo import MongoClient

In [19]:
client  = MongoClient('mongodb://localhost:3160')
db = client.examples

In [20]:
[db.ireland.insert(e) for e in data]


Out[20]:
[ObjectId('55eeb9bda6d73408481412b5'),
 ObjectId('55eeb9bea6d73408481412b6'),
 ObjectId('55eeb9bea6d73408481412b7'),
 ObjectId('55eeb9bea6d73408481412b8'),
 ObjectId('55eeb9bea6d73408481412b9'),
 ObjectId('55eeb9bea6d73408481412ba'),
 ObjectId('55eeb9bea6d73408481412bb'),
 ObjectId('55eeb9bea6d73408481412bc'),
 ObjectId('55eeb9bea6d73408481412bd'),
 ObjectId('55eeb9bea6d73408481412be'),
 ObjectId('55eeb9bea6d73408481412bf'),
 ObjectId('55eeb9bea6d73408481412c0'),
 ObjectId('55eeb9bea6d73408481412c1'),
 ObjectId('55eeb9bea6d73408481412c2'),
 ObjectId('55eeb9bea6d73408481412c3'),
 ObjectId('55eeb9bea6d73408481412c4'),
 ObjectId('55eeb9bea6d73408481412c5'),
 ObjectId('55eeb9bea6d73408481412c6'),
 ObjectId('55eeb9bea6d73408481412c7'),
 ObjectId('55eeb9bea6d73408481412c8'),
 ObjectId('55eeb9bea6d73408481412c9'),
 ObjectId('55eeb9bea6d73408481412ca'),
 ObjectId('55eeb9bea6d73408481412cb'),
 ObjectId('55eeb9bea6d73408481412cc'),
 ObjectId('55eeb9bea6d73408481412cd'),
 ObjectId('55eeb9bea6d73408481412ce'),
 ObjectId('55eeb9bea6d73408481412cf'),
 ObjectId('55eeb9bea6d73408481412d0'),
 ObjectId('55eeb9bea6d73408481412d1'),
 ObjectId('55eeb9bea6d73408481412d2'),
 ObjectId('55eeb9bea6d73408481412d3'),
 ObjectId('55eeb9bea6d73408481412d4'),
 ObjectId('55eeb9bea6d73408481412d5'),
 ObjectId('55eeb9bea6d73408481412d6'),
 ObjectId('55eeb9bea6d73408481412d7'),
 ObjectId('55eeb9bea6d73408481412d8'),
 ObjectId('55eeb9bea6d73408481412d9'),
 ObjectId('55eeb9bea6d73408481412da'),
 ObjectId('55eeb9bea6d73408481412db'),
 ObjectId('55eeb9bea6d73408481412dc'),
 ObjectId('55eeb9bea6d73408481412dd'),
 ObjectId('55eeb9bea6d73408481412de'),
 ObjectId('55eeb9bea6d73408481412df'),
 ObjectId('55eeb9bea6d73408481412e0'),
 ObjectId('55eeb9bea6d73408481412e1'),
 ObjectId('55eeb9bea6d73408481412e2'),
 ObjectId('55eeb9bea6d73408481412e3'),
 ObjectId('55eeb9bea6d73408481412e4'),
 ObjectId('55eeb9bea6d73408481412e5'),
 ObjectId('55eeb9bea6d73408481412e6'),
 ObjectId('55eeb9bea6d73408481412e7'),
 ObjectId('55eeb9bea6d73408481412e8'),
 ObjectId('55eeb9bea6d73408481412e9'),
 ObjectId('55eeb9bea6d73408481412ea'),
 ObjectId('55eeb9bea6d73408481412eb'),
 ObjectId('55eeb9bea6d73408481412ec'),
 ObjectId('55eeb9bea6d73408481412ed'),
 ObjectId('55eeb9bea6d73408481412ee'),
 ObjectId('55eeb9bea6d73408481412ef'),
 ObjectId('55eeb9bea6d73408481412f0'),
 ObjectId('55eeb9bea6d73408481412f1'),
 ObjectId('55eeb9bea6d73408481412f2'),
 ObjectId('55eeb9bea6d73408481412f3'),
 ObjectId('55eeb9bea6d73408481412f4'),
 ObjectId('55eeb9bea6d73408481412f5'),
 ObjectId('55eeb9bea6d73408481412f6'),
 ObjectId('55eeb9bea6d73408481412f7'),
 ObjectId('55eeb9bea6d73408481412f8'),
 ObjectId('55eeb9bea6d73408481412f9'),
 ObjectId('55eeb9bea6d73408481412fa'),
 ObjectId('55eeb9bea6d73408481412fb'),
 ObjectId('55eeb9bea6d73408481412fc'),
 ObjectId('55eeb9bea6d73408481412fd'),
 ObjectId('55eeb9bea6d73408481412fe'),
 ObjectId('55eeb9bea6d73408481412ff'),
 ObjectId('55eeb9bea6d7340848141300'),
 ObjectId('55eeb9bea6d7340848141301'),
 ObjectId('55eeb9bea6d7340848141302'),
 ObjectId('55eeb9bea6d7340848141303'),
 ObjectId('55eeb9bea6d7340848141304'),
 ObjectId('55eeb9bea6d7340848141305'),
 ObjectId('55eeb9bea6d7340848141306'),
 ObjectId('55eeb9bea6d7340848141307'),
 ObjectId('55eeb9bea6d7340848141308'),
 ObjectId('55eeb9bea6d7340848141309'),
 ObjectId('55eeb9bea6d734084814130a'),
 ObjectId('55eeb9bea6d734084814130b'),
 ObjectId('55eeb9bea6d734084814130c'),
 ObjectId('55eeb9bea6d734084814130d'),
 ObjectId('55eeb9bea6d734084814130e'),
 ObjectId('55eeb9bea6d734084814130f'),
 ObjectId('55eeb9bea6d7340848141310'),
 ObjectId('55eeb9bea6d7340848141311'),
 ObjectId('55eeb9bea6d7340848141312'),
 ObjectId('55eeb9bea6d7340848141313'),
 ObjectId('55eeb9bea6d7340848141314'),
 ObjectId('55eeb9bea6d7340848141315'),
 ObjectId('55eeb9bea6d7340848141316'),
 ObjectId('55eeb9bea6d7340848141317'),
 ObjectId('55eeb9bea6d7340848141318'),
 ObjectId('55eeb9bea6d7340848141319'),
 ObjectId('55eeb9bea6d734084814131a'),
 ObjectId('55eeb9bea6d734084814131b'),
 ObjectId('55eeb9bea6d734084814131c'),
 ObjectId('55eeb9bea6d734084814131d'),
 ObjectId('55eeb9bea6d734084814131e'),
 ObjectId('55eeb9bea6d734084814131f'),
 ObjectId('55eeb9bea6d7340848141320'),
 ObjectId('55eeb9bea6d7340848141321'),
 ObjectId('55eeb9bea6d7340848141322'),
 ObjectId('55eeb9bea6d7340848141323'),
 ObjectId('55eeb9bea6d7340848141324'),
 ObjectId('55eeb9bea6d7340848141325'),
 ObjectId('55eeb9bea6d7340848141326'),
 ObjectId('55eeb9bea6d7340848141327'),
 ObjectId('55eeb9bea6d7340848141328'),
 ObjectId('55eeb9bea6d7340848141329'),
 ObjectId('55eeb9bea6d734084814132a'),
 ObjectId('55eeb9bea6d734084814132b'),
 ObjectId('55eeb9bea6d734084814132c'),
 ObjectId('55eeb9bea6d734084814132d'),
 ObjectId('55eeb9bea6d734084814132e'),
 ObjectId('55eeb9bea6d734084814132f'),
 ObjectId('55eeb9bea6d7340848141330'),
 ObjectId('55eeb9bea6d7340848141331'),
 ObjectId('55eeb9bea6d7340848141332'),
 ObjectId('55eeb9bea6d7340848141333'),
 ObjectId('55eeb9bea6d7340848141334'),
 ObjectId('55eeb9bea6d7340848141335'),
 ObjectId('55eeb9bea6d7340848141336'),
 ObjectId('55eeb9bea6d7340848141337'),
 ObjectId('55eeb9bea6d7340848141338'),
 ObjectId('55eeb9bea6d7340848141339'),
 ObjectId('55eeb9bea6d734084814133a'),
 ObjectId('55eeb9bea6d734084814133b'),
 ObjectId('55eeb9bea6d734084814133c'),
 ObjectId('55eeb9bea6d734084814133d'),
 ObjectId('55eeb9bea6d734084814133e'),
 ObjectId('55eeb9bea6d734084814133f'),
 ObjectId('55eeb9bea6d7340848141340'),
 ObjectId('55eeb9bea6d7340848141341'),
 ObjectId('55eeb9bea6d7340848141342'),
 ObjectId('55eeb9bea6d7340848141343'),
 ObjectId('55eeb9bea6d7340848141344'),
 ObjectId('55eeb9bea6d7340848141345'),
 ObjectId('55eeb9bea6d7340848141346'),
 ObjectId('55eeb9bea6d7340848141347'),
 ObjectId('55eeb9bea6d7340848141348'),
 ObjectId('55eeb9bea6d7340848141349'),
 ObjectId('55eeb9bea6d734084814134a'),
 ObjectId('55eeb9bea6d734084814134b'),
 ObjectId('55eeb9bea6d734084814134c'),
 ObjectId('55eeb9bea6d734084814134d'),
 ObjectId('55eeb9bea6d734084814134e'),
 ObjectId('55eeb9bea6d734084814134f'),
 ObjectId('55eeb9bea6d7340848141350'),
 ObjectId('55eeb9bea6d7340848141351'),
 ObjectId('55eeb9bea6d7340848141352'),
 ObjectId('55eeb9bea6d7340848141353'),
 ObjectId('55eeb9bea6d7340848141354'),
 ObjectId('55eeb9bea6d7340848141355'),
 ObjectId('55eeb9bea6d7340848141356'),
 ObjectId('55eeb9bea6d7340848141357'),
 ObjectId('55eeb9bea6d7340848141358'),
 ObjectId('55eeb9bea6d7340848141359'),
 ObjectId('55eeb9bea6d734084814135a'),
 ObjectId('55eeb9bea6d734084814135b'),
 ObjectId('55eeb9bea6d734084814135c'),
 ObjectId('55eeb9bea6d734084814135d'),
 ObjectId('55eeb9bea6d734084814135e'),
 ObjectId('55eeb9bea6d734084814135f'),
 ObjectId('55eeb9bea6d7340848141360'),
 ObjectId('55eeb9bea6d7340848141361'),
 ObjectId('55eeb9bea6d7340848141362'),
 ObjectId('55eeb9bea6d7340848141363'),
 ObjectId('55eeb9bea6d7340848141364'),
 ObjectId('55eeb9bea6d7340848141365'),
 ObjectId('55eeb9bea6d7340848141366'),
 ObjectId('55eeb9bea6d7340848141367'),
 ObjectId('55eeb9bea6d7340848141368'),
 ObjectId('55eeb9bea6d7340848141369'),
 ObjectId('55eeb9bea6d734084814136a'),
 ObjectId('55eeb9bea6d734084814136b'),
 ObjectId('55eeb9bea6d734084814136c'),
 ObjectId('55eeb9bea6d734084814136d'),
 ObjectId('55eeb9bea6d734084814136e'),
 ObjectId('55eeb9bea6d734084814136f'),
 ObjectId('55eeb9bea6d7340848141370'),
 ObjectId('55eeb9bea6d7340848141371'),
 ObjectId('55eeb9bea6d7340848141372'),
 ObjectId('55eeb9bea6d7340848141373'),
 ObjectId('55eeb9bea6d7340848141374'),
 ObjectId('55eeb9bea6d7340848141375'),
 ObjectId('55eeb9bea6d7340848141376'),
 ObjectId('55eeb9bea6d7340848141377'),
 ObjectId('55eeb9bea6d7340848141378'),
 ObjectId('55eeb9bea6d7340848141379'),
 ObjectId('55eeb9bea6d734084814137a'),
 ObjectId('55eeb9bea6d734084814137b'),
 ObjectId('55eeb9bea6d734084814137c'),
 ObjectId('55eeb9bea6d734084814137d'),
 ObjectId('55eeb9bea6d734084814137e'),
 ObjectId('55eeb9bea6d734084814137f'),
 ObjectId('55eeb9bea6d7340848141380'),
 ObjectId('55eeb9bea6d7340848141381'),
 ObjectId('55eeb9bea6d7340848141382'),
 ObjectId('55eeb9bea6d7340848141383'),
 ObjectId('55eeb9bea6d7340848141384'),
 ObjectId('55eeb9bea6d7340848141385'),
 ObjectId('55eeb9bea6d7340848141386'),
 ObjectId('55eeb9bea6d7340848141387'),
 ObjectId('55eeb9bea6d7340848141388'),
 ObjectId('55eeb9bea6d7340848141389'),
 ObjectId('55eeb9bea6d734084814138a'),
 ObjectId('55eeb9bea6d734084814138b'),
 ObjectId('55eeb9bea6d734084814138c'),
 ObjectId('55eeb9bea6d734084814138d'),
 ObjectId('55eeb9bea6d734084814138e'),
 ObjectId('55eeb9bea6d734084814138f'),
 ObjectId('55eeb9bea6d7340848141390'),
 ObjectId('55eeb9bea6d7340848141391'),
 ObjectId('55eeb9bea6d7340848141392'),
 ObjectId('55eeb9bea6d7340848141393'),
 ObjectId('55eeb9bea6d7340848141394'),
 ObjectId('55eeb9bea6d7340848141395'),
 ObjectId('55eeb9bea6d7340848141396'),
 ObjectId('55eeb9bea6d7340848141397'),
 ObjectId('55eeb9bea6d7340848141398'),
 ObjectId('55eeb9bea6d7340848141399'),
 ObjectId('55eeb9bea6d734084814139a'),
 ObjectId('55eeb9bea6d734084814139b'),
 ObjectId('55eeb9bea6d734084814139c'),
 ObjectId('55eeb9bea6d734084814139d'),
 ObjectId('55eeb9bea6d734084814139e'),
 ObjectId('55eeb9bea6d734084814139f'),
 ObjectId('55eeb9bea6d73408481413a0'),
 ObjectId('55eeb9bea6d73408481413a1'),
 ObjectId('55eeb9bea6d73408481413a2'),
 ObjectId('55eeb9bea6d73408481413a3'),
 ObjectId('55eeb9bea6d73408481413a4'),
 ObjectId('55eeb9bea6d73408481413a5'),
 ObjectId('55eeb9bea6d73408481413a6'),
 ObjectId('55eeb9bea6d73408481413a7'),
 ObjectId('55eeb9bea6d73408481413a8'),
 ObjectId('55eeb9bea6d73408481413a9'),
 ObjectId('55eeb9bea6d73408481413aa'),
 ObjectId('55eeb9bea6d73408481413ab'),
 ObjectId('55eeb9bea6d73408481413ac'),
 ObjectId('55eeb9bea6d73408481413ad'),
 ObjectId('55eeb9bea6d73408481413ae'),
 ObjectId('55eeb9bea6d73408481413af'),
 ObjectId('55eeb9bea6d73408481413b0'),
 ObjectId('55eeb9bea6d73408481413b1'),
 ObjectId('55eeb9bea6d73408481413b2'),
 ObjectId('55eeb9bea6d73408481413b3'),
 ObjectId('55eeb9bea6d73408481413b4'),
 ObjectId('55eeb9bea6d73408481413b5'),
 ObjectId('55eeb9bea6d73408481413b6'),
 ObjectId('55eeb9bea6d73408481413b7'),
 ObjectId('55eeb9bea6d73408481413b8'),
 ObjectId('55eeb9bea6d73408481413b9'),
 ObjectId('55eeb9bea6d73408481413ba'),
 ObjectId('55eeb9bea6d73408481413bb'),
 ObjectId('55eeb9bea6d73408481413bc'),
 ObjectId('55eeb9bea6d73408481413bd'),
 ObjectId('55eeb9bea6d73408481413be'),
 ObjectId('55eeb9bea6d73408481413bf'),
 ObjectId('55eeb9bea6d73408481413c0'),
 ObjectId('55eeb9bea6d73408481413c1'),
 ObjectId('55eeb9bea6d73408481413c2'),
 ObjectId('55eeb9bea6d73408481413c3'),
 ObjectId('55eeb9bea6d73408481413c4'),
 ObjectId('55eeb9bea6d73408481413c5'),
 ObjectId('55eeb9bea6d73408481413c6'),
 ObjectId('55eeb9bea6d73408481413c7'),
 ObjectId('55eeb9bea6d73408481413c8'),
 ObjectId('55eeb9bea6d73408481413c9'),
 ObjectId('55eeb9bea6d73408481413ca'),
 ObjectId('55eeb9bea6d73408481413cb'),
 ObjectId('55eeb9bea6d73408481413cc'),
 ObjectId('55eeb9bea6d73408481413cd'),
 ObjectId('55eeb9bea6d73408481413ce'),
 ObjectId('55eeb9bea6d73408481413cf'),
 ObjectId('55eeb9bea6d73408481413d0'),
 ObjectId('55eeb9bea6d73408481413d1'),
 ObjectId('55eeb9bea6d73408481413d2'),
 ObjectId('55eeb9bea6d73408481413d3'),
 ObjectId('55eeb9bea6d73408481413d4'),
 ObjectId('55eeb9bea6d73408481413d5'),
 ObjectId('55eeb9bea6d73408481413d6'),
 ObjectId('55eeb9bea6d73408481413d7'),
 ObjectId('55eeb9bea6d73408481413d8'),
 ObjectId('55eeb9bea6d73408481413d9'),
 ObjectId('55eeb9bea6d73408481413da'),
 ObjectId('55eeb9bea6d73408481413db'),
 ObjectId('55eeb9bea6d73408481413dc'),
 ObjectId('55eeb9bea6d73408481413dd'),
 ObjectId('55eeb9bea6d73408481413de'),
 ObjectId('55eeb9bea6d73408481413df'),
 ObjectId('55eeb9bea6d73408481413e0'),
 ObjectId('55eeb9bea6d73408481413e1'),
 ObjectId('55eeb9bea6d73408481413e2'),
 ObjectId('55eeb9bea6d73408481413e3'),
 ObjectId('55eeb9bea6d73408481413e4'),
 ObjectId('55eeb9bea6d73408481413e5'),
 ObjectId('55eeb9bea6d73408481413e6'),
 ObjectId('55eeb9bea6d73408481413e7'),
 ObjectId('55eeb9bea6d73408481413e8'),
 ObjectId('55eeb9bea6d73408481413e9'),
 ObjectId('55eeb9bea6d73408481413ea'),
 ObjectId('55eeb9bea6d73408481413eb'),
 ObjectId('55eeb9bea6d73408481413ec'),
 ObjectId('55eeb9bea6d73408481413ed'),
 ObjectId('55eeb9bea6d73408481413ee'),
 ObjectId('55eeb9bea6d73408481413ef'),
 ObjectId('55eeb9bea6d73408481413f0'),
 ObjectId('55eeb9bea6d73408481413f1'),
 ObjectId('55eeb9bea6d73408481413f2'),
 ObjectId('55eeb9bea6d73408481413f3'),
 ObjectId('55eeb9bea6d73408481413f4'),
 ObjectId('55eeb9bea6d73408481413f5'),
 ObjectId('55eeb9bea6d73408481413f6'),
 ObjectId('55eeb9bea6d73408481413f7'),
 ObjectId('55eeb9bea6d73408481413f8'),
 ObjectId('55eeb9bea6d73408481413f9'),
 ObjectId('55eeb9bea6d73408481413fa'),
 ObjectId('55eeb9bea6d73408481413fb'),
 ObjectId('55eeb9bea6d73408481413fc'),
 ObjectId('55eeb9bea6d73408481413fd'),
 ObjectId('55eeb9bea6d73408481413fe'),
 ObjectId('55eeb9bea6d73408481413ff'),
 ObjectId('55eeb9bea6d7340848141400'),
 ObjectId('55eeb9bea6d7340848141401'),
 ObjectId('55eeb9bea6d7340848141402'),
 ObjectId('55eeb9bea6d7340848141403'),
 ObjectId('55eeb9bea6d7340848141404'),
 ObjectId('55eeb9bea6d7340848141405'),
 ObjectId('55eeb9bea6d7340848141406'),
 ObjectId('55eeb9bea6d7340848141407'),
 ObjectId('55eeb9bea6d7340848141408'),
 ObjectId('55eeb9bea6d7340848141409'),
 ObjectId('55eeb9bea6d734084814140a'),
 ObjectId('55eeb9bea6d734084814140b'),
 ObjectId('55eeb9bea6d734084814140c'),
 ObjectId('55eeb9bea6d734084814140d'),
 ObjectId('55eeb9bea6d734084814140e'),
 ObjectId('55eeb9bea6d734084814140f'),
 ObjectId('55eeb9bea6d7340848141410'),
 ObjectId('55eeb9bea6d7340848141411'),
 ObjectId('55eeb9bea6d7340848141412'),
 ObjectId('55eeb9bea6d7340848141413'),
 ObjectId('55eeb9bea6d7340848141414'),
 ObjectId('55eeb9bea6d7340848141415'),
 ObjectId('55eeb9bea6d7340848141416'),
 ObjectId('55eeb9bea6d7340848141417'),
 ObjectId('55eeb9bea6d7340848141418'),
 ObjectId('55eeb9bea6d7340848141419'),
 ObjectId('55eeb9bea6d734084814141a'),
 ObjectId('55eeb9bea6d734084814141b'),
 ObjectId('55eeb9bea6d734084814141c'),
 ObjectId('55eeb9bea6d734084814141d'),
 ObjectId('55eeb9bea6d734084814141e'),
 ObjectId('55eeb9bea6d734084814141f'),
 ObjectId('55eeb9bea6d7340848141420'),
 ObjectId('55eeb9bea6d7340848141421'),
 ObjectId('55eeb9bea6d7340848141422'),
 ObjectId('55eeb9bea6d7340848141423'),
 ObjectId('55eeb9bea6d7340848141424'),
 ObjectId('55eeb9bea6d7340848141425'),
 ObjectId('55eeb9bea6d7340848141426'),
 ObjectId('55eeb9bea6d7340848141427'),
 ObjectId('55eeb9bea6d7340848141428'),
 ObjectId('55eeb9bea6d7340848141429'),
 ObjectId('55eeb9bea6d734084814142a'),
 ObjectId('55eeb9bea6d734084814142b'),
 ObjectId('55eeb9bea6d734084814142c'),
 ObjectId('55eeb9bea6d734084814142d'),
 ObjectId('55eeb9bea6d734084814142e'),
 ObjectId('55eeb9bea6d734084814142f'),
 ObjectId('55eeb9bea6d7340848141430'),
 ObjectId('55eeb9bea6d7340848141431'),
 ObjectId('55eeb9bea6d7340848141432'),
 ObjectId('55eeb9bea6d7340848141433'),
 ObjectId('55eeb9bea6d7340848141434'),
 ObjectId('55eeb9bea6d7340848141435'),
 ObjectId('55eeb9bea6d7340848141436'),
 ObjectId('55eeb9bea6d7340848141437'),
 ObjectId('55eeb9bea6d7340848141438'),
 ObjectId('55eeb9bea6d7340848141439'),
 ObjectId('55eeb9bea6d734084814143a'),
 ObjectId('55eeb9bea6d734084814143b'),
 ObjectId('55eeb9bea6d734084814143c'),
 ObjectId('55eeb9bea6d734084814143d'),
 ObjectId('55eeb9bea6d734084814143e'),
 ObjectId('55eeb9bea6d734084814143f'),
 ObjectId('55eeb9bea6d7340848141440'),
 ObjectId('55eeb9bea6d7340848141441'),
 ObjectId('55eeb9bea6d7340848141442'),
 ObjectId('55eeb9bea6d7340848141443'),
 ObjectId('55eeb9bea6d7340848141444'),
 ObjectId('55eeb9bea6d7340848141445'),
 ObjectId('55eeb9bea6d7340848141446'),
 ObjectId('55eeb9bea6d7340848141447'),
 ObjectId('55eeb9bea6d7340848141448'),
 ObjectId('55eeb9bea6d7340848141449'),
 ObjectId('55eeb9bea6d734084814144a'),
 ObjectId('55eeb9bea6d734084814144b'),
 ObjectId('55eeb9bea6d734084814144c'),
 ObjectId('55eeb9bea6d734084814144d'),
 ObjectId('55eeb9bea6d734084814144e'),
 ObjectId('55eeb9bea6d734084814144f'),
 ObjectId('55eeb9bea6d7340848141450'),
 ObjectId('55eeb9bea6d7340848141451'),
 ObjectId('55eeb9bea6d7340848141452'),
 ObjectId('55eeb9bea6d7340848141453'),
 ObjectId('55eeb9bea6d7340848141454'),
 ObjectId('55eeb9bea6d7340848141455'),
 ObjectId('55eeb9bea6d7340848141456'),
 ObjectId('55eeb9bea6d7340848141457'),
 ObjectId('55eeb9bea6d7340848141458'),
 ObjectId('55eeb9bea6d7340848141459'),
 ObjectId('55eeb9bea6d734084814145a'),
 ObjectId('55eeb9bea6d734084814145b'),
 ObjectId('55eeb9bea6d734084814145c'),
 ObjectId('55eeb9bea6d734084814145d'),
 ObjectId('55eeb9bea6d734084814145e'),
 ObjectId('55eeb9bea6d734084814145f'),
 ObjectId('55eeb9bea6d7340848141460'),
 ObjectId('55eeb9bea6d7340848141461'),
 ObjectId('55eeb9bea6d7340848141462'),
 ObjectId('55eeb9bea6d7340848141463'),
 ObjectId('55eeb9bea6d7340848141464'),
 ObjectId('55eeb9bea6d7340848141465'),
 ObjectId('55eeb9bea6d7340848141466'),
 ObjectId('55eeb9bea6d7340848141467'),
 ObjectId('55eeb9bea6d7340848141468'),
 ObjectId('55eeb9bea6d7340848141469'),
 ObjectId('55eeb9bea6d734084814146a'),
 ObjectId('55eeb9bea6d734084814146b'),
 ObjectId('55eeb9bea6d734084814146c'),
 ObjectId('55eeb9bea6d734084814146d'),
 ObjectId('55eeb9bea6d734084814146e'),
 ObjectId('55eeb9bea6d734084814146f'),
 ObjectId('55eeb9bea6d7340848141470'),
 ObjectId('55eeb9bea6d7340848141471'),
 ObjectId('55eeb9bea6d7340848141472'),
 ObjectId('55eeb9bea6d7340848141473'),
 ObjectId('55eeb9bea6d7340848141474'),
 ObjectId('55eeb9bea6d7340848141475'),
 ObjectId('55eeb9bea6d7340848141476'),
 ObjectId('55eeb9bea6d7340848141477'),
 ObjectId('55eeb9bea6d7340848141478'),
 ObjectId('55eeb9bea6d7340848141479'),
 ObjectId('55eeb9bea6d734084814147a'),
 ObjectId('55eeb9bea6d734084814147b'),
 ObjectId('55eeb9bea6d734084814147c'),
 ObjectId('55eeb9bea6d734084814147d'),
 ObjectId('55eeb9bea6d734084814147e'),
 ObjectId('55eeb9bea6d734084814147f'),
 ObjectId('55eeb9bea6d7340848141480'),
 ObjectId('55eeb9bea6d7340848141481'),
 ObjectId('55eeb9bea6d7340848141482'),
 ObjectId('55eeb9bea6d7340848141483'),
 ObjectId('55eeb9bea6d7340848141484'),
 ObjectId('55eeb9bea6d7340848141485'),
 ObjectId('55eeb9bea6d7340848141486'),
 ObjectId('55eeb9bea6d7340848141487'),
 ObjectId('55eeb9bea6d7340848141488'),
 ObjectId('55eeb9bea6d7340848141489'),
 ObjectId('55eeb9bea6d734084814148a'),
 ObjectId('55eeb9bea6d734084814148b'),
 ObjectId('55eeb9bea6d734084814148c'),
 ObjectId('55eeb9bea6d734084814148d'),
 ObjectId('55eeb9bea6d734084814148e'),
 ObjectId('55eeb9bea6d734084814148f'),
 ObjectId('55eeb9bea6d7340848141490'),
 ObjectId('55eeb9bea6d7340848141491'),
 ObjectId('55eeb9bea6d7340848141492'),
 ObjectId('55eeb9bea6d7340848141493'),
 ObjectId('55eeb9bea6d7340848141494'),
 ObjectId('55eeb9bea6d7340848141495'),
 ObjectId('55eeb9bea6d7340848141496'),
 ObjectId('55eeb9bea6d7340848141497'),
 ObjectId('55eeb9bea6d7340848141498'),
 ObjectId('55eeb9bea6d7340848141499'),
 ObjectId('55eeb9bea6d734084814149a'),
 ObjectId('55eeb9bea6d734084814149b'),
 ObjectId('55eeb9bea6d734084814149c'),
 ObjectId('55eeb9bea6d734084814149d'),
 ObjectId('55eeb9bea6d734084814149e'),
 ObjectId('55eeb9bea6d734084814149f'),
 ObjectId('55eeb9bea6d73408481414a0'),
 ObjectId('55eeb9bea6d73408481414a1'),
 ObjectId('55eeb9bea6d73408481414a2'),
 ObjectId('55eeb9bea6d73408481414a3'),
 ObjectId('55eeb9bea6d73408481414a4'),
 ObjectId('55eeb9bea6d73408481414a5'),
 ObjectId('55eeb9bea6d73408481414a6'),
 ObjectId('55eeb9bea6d73408481414a7'),
 ObjectId('55eeb9bea6d73408481414a8'),
 ObjectId('55eeb9bea6d73408481414a9'),
 ObjectId('55eeb9bea6d73408481414aa'),
 ObjectId('55eeb9bea6d73408481414ab'),
 ObjectId('55eeb9bea6d73408481414ac'),
 ObjectId('55eeb9bea6d73408481414ad'),
 ObjectId('55eeb9bea6d73408481414ae'),
 ObjectId('55eeb9bea6d73408481414af'),
 ObjectId('55eeb9bea6d73408481414b0'),
 ObjectId('55eeb9bea6d73408481414b1'),
 ObjectId('55eeb9bea6d73408481414b2'),
 ObjectId('55eeb9bea6d73408481414b3'),
 ObjectId('55eeb9bea6d73408481414b4'),
 ObjectId('55eeb9bea6d73408481414b5'),
 ObjectId('55eeb9bea6d73408481414b6'),
 ObjectId('55eeb9bea6d73408481414b7'),
 ObjectId('55eeb9bea6d73408481414b8'),
 ObjectId('55eeb9bea6d73408481414b9'),
 ObjectId('55eeb9bea6d73408481414ba'),
 ObjectId('55eeb9bea6d73408481414bb'),
 ObjectId('55eeb9bea6d73408481414bc'),
 ObjectId('55eeb9bea6d73408481414bd'),
 ObjectId('55eeb9bea6d73408481414be'),
 ObjectId('55eeb9bea6d73408481414bf'),
 ObjectId('55eeb9bea6d73408481414c0'),
 ObjectId('55eeb9bea6d73408481414c1'),
 ObjectId('55eeb9bea6d73408481414c2'),
 ObjectId('55eeb9bea6d73408481414c3'),
 ObjectId('55eeb9bea6d73408481414c4'),
 ObjectId('55eeb9bea6d73408481414c5'),
 ObjectId('55eeb9bea6d73408481414c6'),
 ObjectId('55eeb9bea6d73408481414c7'),
 ObjectId('55eeb9bea6d73408481414c8'),
 ObjectId('55eeb9bea6d73408481414c9'),
 ObjectId('55eeb9bea6d73408481414ca'),
 ObjectId('55eeb9bea6d73408481414cb'),
 ObjectId('55eeb9bea6d73408481414cc'),
 ObjectId('55eeb9bea6d73408481414cd'),
 ObjectId('55eeb9bea6d73408481414ce'),
 ObjectId('55eeb9bea6d73408481414cf'),
 ObjectId('55eeb9bea6d73408481414d0'),
 ObjectId('55eeb9bea6d73408481414d1'),
 ObjectId('55eeb9bea6d73408481414d2'),
 ObjectId('55eeb9bea6d73408481414d3'),
 ObjectId('55eeb9bea6d73408481414d4'),
 ObjectId('55eeb9bea6d73408481414d5'),
 ObjectId('55eeb9bea6d73408481414d6'),
 ObjectId('55eeb9bea6d73408481414d7'),
 ObjectId('55eeb9bea6d73408481414d8'),
 ObjectId('55eeb9bea6d73408481414d9'),
 ObjectId('55eeb9bea6d73408481414da'),
 ObjectId('55eeb9bea6d73408481414db'),
 ObjectId('55eeb9bea6d73408481414dc'),
 ObjectId('55eeb9bea6d73408481414dd'),
 ObjectId('55eeb9bea6d73408481414de'),
 ObjectId('55eeb9bea6d73408481414df'),
 ObjectId('55eeb9bea6d73408481414e0'),
 ObjectId('55eeb9bea6d73408481414e1'),
 ObjectId('55eeb9bea6d73408481414e2'),
 ObjectId('55eeb9bea6d73408481414e3'),
 ObjectId('55eeb9bea6d73408481414e4'),
 ObjectId('55eeb9bea6d73408481414e5'),
 ObjectId('55eeb9bea6d73408481414e6'),
 ObjectId('55eeb9bea6d73408481414e7'),
 ObjectId('55eeb9bea6d73408481414e8'),
 ObjectId('55eeb9bea6d73408481414e9'),
 ObjectId('55eeb9bea6d73408481414ea'),
 ObjectId('55eeb9bea6d73408481414eb'),
 ObjectId('55eeb9bea6d73408481414ec'),
 ObjectId('55eeb9bea6d73408481414ed'),
 ObjectId('55eeb9bea6d73408481414ee'),
 ObjectId('55eeb9bea6d73408481414ef'),
 ObjectId('55eeb9bea6d73408481414f0'),
 ObjectId('55eeb9bea6d73408481414f1'),
 ObjectId('55eeb9bea6d73408481414f2'),
 ObjectId('55eeb9bea6d73408481414f3'),
 ObjectId('55eeb9bea6d73408481414f4'),
 ObjectId('55eeb9bea6d73408481414f5'),
 ObjectId('55eeb9bea6d73408481414f6'),
 ObjectId('55eeb9bea6d73408481414f7'),
 ObjectId('55eeb9bea6d73408481414f8'),
 ObjectId('55eeb9bea6d73408481414f9'),
 ObjectId('55eeb9bea6d73408481414fa'),
 ObjectId('55eeb9bea6d73408481414fb'),
 ObjectId('55eeb9bea6d73408481414fc'),
 ObjectId('55eeb9bea6d73408481414fd'),
 ObjectId('55eeb9bea6d73408481414fe'),
 ObjectId('55eeb9bea6d73408481414ff'),
 ObjectId('55eeb9bea6d7340848141500'),
 ObjectId('55eeb9bea6d7340848141501'),
 ObjectId('55eeb9bea6d7340848141502'),
 ObjectId('55eeb9bea6d7340848141503'),
 ObjectId('55eeb9bea6d7340848141504'),
 ObjectId('55eeb9bea6d7340848141505'),
 ObjectId('55eeb9bea6d7340848141506'),
 ObjectId('55eeb9bea6d7340848141507'),
 ObjectId('55eeb9bea6d7340848141508'),
 ObjectId('55eeb9bea6d7340848141509'),
 ObjectId('55eeb9bea6d734084814150a'),
 ObjectId('55eeb9bea6d734084814150b'),
 ObjectId('55eeb9bea6d734084814150c'),
 ObjectId('55eeb9bea6d734084814150d'),
 ObjectId('55eeb9bea6d734084814150e'),
 ObjectId('55eeb9bea6d734084814150f'),
 ObjectId('55eeb9bea6d7340848141510'),
 ObjectId('55eeb9bea6d7340848141511'),
 ObjectId('55eeb9bea6d7340848141512'),
 ObjectId('55eeb9bea6d7340848141513'),
 ObjectId('55eeb9bea6d7340848141514'),
 ObjectId('55eeb9bea6d7340848141515'),
 ObjectId('55eeb9bea6d7340848141516'),
 ObjectId('55eeb9bea6d7340848141517'),
 ObjectId('55eeb9bfa6d7340848141518'),
 ObjectId('55eeb9bfa6d7340848141519'),
 ObjectId('55eeb9bfa6d734084814151a'),
 ObjectId('55eeb9bfa6d734084814151b'),
 ObjectId('55eeb9bfa6d734084814151c'),
 ObjectId('55eeb9bfa6d734084814151d'),
 ObjectId('55eeb9bfa6d734084814151e'),
 ObjectId('55eeb9bfa6d734084814151f'),
 ObjectId('55eeb9bfa6d7340848141520'),
 ObjectId('55eeb9bfa6d7340848141521'),
 ObjectId('55eeb9bfa6d7340848141522'),
 ObjectId('55eeb9bfa6d7340848141523'),
 ObjectId('55eeb9bfa6d7340848141524'),
 ObjectId('55eeb9bfa6d7340848141525'),
 ObjectId('55eeb9bfa6d7340848141526'),
 ObjectId('55eeb9bfa6d7340848141527'),
 ObjectId('55eeb9bfa6d7340848141528'),
 ObjectId('55eeb9bfa6d7340848141529'),
 ObjectId('55eeb9bfa6d734084814152a'),
 ObjectId('55eeb9bfa6d734084814152b'),
 ObjectId('55eeb9bfa6d734084814152c'),
 ObjectId('55eeb9bfa6d734084814152d'),
 ObjectId('55eeb9bfa6d734084814152e'),
 ObjectId('55eeb9bfa6d734084814152f'),
 ObjectId('55eeb9bfa6d7340848141530'),
 ObjectId('55eeb9bfa6d7340848141531'),
 ObjectId('55eeb9bfa6d7340848141532'),
 ObjectId('55eeb9bfa6d7340848141533'),
 ObjectId('55eeb9bfa6d7340848141534'),
 ObjectId('55eeb9bfa6d7340848141535'),
 ObjectId('55eeb9bfa6d7340848141536'),
 ObjectId('55eeb9bfa6d7340848141537'),
 ObjectId('55eeb9bfa6d7340848141538'),
 ObjectId('55eeb9bfa6d7340848141539'),
 ObjectId('55eeb9bfa6d734084814153a'),
 ObjectId('55eeb9bfa6d734084814153b'),
 ObjectId('55eeb9bfa6d734084814153c'),
 ObjectId('55eeb9bfa6d734084814153d'),
 ObjectId('55eeb9bfa6d734084814153e'),
 ObjectId('55eeb9bfa6d734084814153f'),
 ObjectId('55eeb9bfa6d7340848141540'),
 ObjectId('55eeb9bfa6d7340848141541'),
 ObjectId('55eeb9bfa6d7340848141542'),
 ObjectId('55eeb9bfa6d7340848141543'),
 ObjectId('55eeb9bfa6d7340848141544'),
 ObjectId('55eeb9bfa6d7340848141545'),
 ObjectId('55eeb9bfa6d7340848141546'),
 ObjectId('55eeb9bfa6d7340848141547'),
 ObjectId('55eeb9bfa6d7340848141548'),
 ObjectId('55eeb9bfa6d7340848141549'),
 ObjectId('55eeb9bfa6d734084814154a'),
 ObjectId('55eeb9bfa6d734084814154b'),
 ObjectId('55eeb9bfa6d734084814154c'),
 ObjectId('55eeb9bfa6d734084814154d'),
 ObjectId('55eeb9bfa6d734084814154e'),
 ObjectId('55eeb9bfa6d734084814154f'),
 ObjectId('55eeb9bfa6d7340848141550'),
 ObjectId('55eeb9bfa6d7340848141551'),
 ObjectId('55eeb9bfa6d7340848141552'),
 ObjectId('55eeb9bfa6d7340848141553'),
 ObjectId('55eeb9bfa6d7340848141554'),
 ObjectId('55eeb9bfa6d7340848141555'),
 ObjectId('55eeb9bfa6d7340848141556'),
 ObjectId('55eeb9bfa6d7340848141557'),
 ObjectId('55eeb9bfa6d7340848141558'),
 ObjectId('55eeb9bfa6d7340848141559'),
 ObjectId('55eeb9bfa6d734084814155a'),
 ObjectId('55eeb9bfa6d734084814155b'),
 ObjectId('55eeb9bfa6d734084814155c'),
 ObjectId('55eeb9bfa6d734084814155d'),
 ObjectId('55eeb9bfa6d734084814155e'),
 ObjectId('55eeb9bfa6d734084814155f'),
 ObjectId('55eeb9bfa6d7340848141560'),
 ObjectId('55eeb9bfa6d7340848141561'),
 ObjectId('55eeb9bfa6d7340848141562'),
 ObjectId('55eeb9bfa6d7340848141563'),
 ObjectId('55eeb9bfa6d7340848141564'),
 ObjectId('55eeb9bfa6d7340848141565'),
 ObjectId('55eeb9bfa6d7340848141566'),
 ObjectId('55eeb9bfa6d7340848141567'),
 ObjectId('55eeb9bfa6d7340848141568'),
 ObjectId('55eeb9bfa6d7340848141569'),
 ObjectId('55eeb9bfa6d734084814156a'),
 ObjectId('55eeb9bfa6d734084814156b'),
 ObjectId('55eeb9bfa6d734084814156c'),
 ObjectId('55eeb9bfa6d734084814156d'),
 ObjectId('55eeb9bfa6d734084814156e'),
 ObjectId('55eeb9bfa6d734084814156f'),
 ObjectId('55eeb9bfa6d7340848141570'),
 ObjectId('55eeb9bfa6d7340848141571'),
 ObjectId('55eeb9bfa6d7340848141572'),
 ObjectId('55eeb9bfa6d7340848141573'),
 ObjectId('55eeb9bfa6d7340848141574'),
 ObjectId('55eeb9bfa6d7340848141575'),
 ObjectId('55eeb9bfa6d7340848141576'),
 ObjectId('55eeb9bfa6d7340848141577'),
 ObjectId('55eeb9bfa6d7340848141578'),
 ObjectId('55eeb9bfa6d7340848141579'),
 ObjectId('55eeb9bfa6d734084814157a'),
 ObjectId('55eeb9bfa6d734084814157b'),
 ObjectId('55eeb9bfa6d734084814157c'),
 ObjectId('55eeb9bfa6d734084814157d'),
 ObjectId('55eeb9bfa6d734084814157e'),
 ObjectId('55eeb9bfa6d734084814157f'),
 ObjectId('55eeb9bfa6d7340848141580'),
 ObjectId('55eeb9bfa6d7340848141581'),
 ObjectId('55eeb9bfa6d7340848141582'),
 ObjectId('55eeb9bfa6d7340848141583'),
 ObjectId('55eeb9bfa6d7340848141584'),
 ObjectId('55eeb9bfa6d7340848141585'),
 ObjectId('55eeb9bfa6d7340848141586'),
 ObjectId('55eeb9bfa6d7340848141587'),
 ObjectId('55eeb9bfa6d7340848141588'),
 ObjectId('55eeb9bfa6d7340848141589'),
 ObjectId('55eeb9bfa6d734084814158a'),
 ObjectId('55eeb9bfa6d734084814158b'),
 ObjectId('55eeb9bfa6d734084814158c'),
 ObjectId('55eeb9bfa6d734084814158d'),
 ObjectId('55eeb9bfa6d734084814158e'),
 ObjectId('55eeb9bfa6d734084814158f'),
 ObjectId('55eeb9bfa6d7340848141590'),
 ObjectId('55eeb9bfa6d7340848141591'),
 ObjectId('55eeb9bfa6d7340848141592'),
 ObjectId('55eeb9bfa6d7340848141593'),
 ObjectId('55eeb9bfa6d7340848141594'),
 ObjectId('55eeb9bfa6d7340848141595'),
 ObjectId('55eeb9bfa6d7340848141596'),
 ObjectId('55eeb9bfa6d7340848141597'),
 ObjectId('55eeb9bfa6d7340848141598'),
 ObjectId('55eeb9bfa6d7340848141599'),
 ObjectId('55eeb9bfa6d734084814159a'),
 ObjectId('55eeb9bfa6d734084814159b'),
 ObjectId('55eeb9bfa6d734084814159c'),
 ObjectId('55eeb9bfa6d734084814159d'),
 ObjectId('55eeb9bfa6d734084814159e'),
 ObjectId('55eeb9bfa6d734084814159f'),
 ObjectId('55eeb9bfa6d73408481415a0'),
 ObjectId('55eeb9bfa6d73408481415a1'),
 ObjectId('55eeb9bfa6d73408481415a2'),
 ObjectId('55eeb9bfa6d73408481415a3'),
 ObjectId('55eeb9bfa6d73408481415a4'),
 ObjectId('55eeb9bfa6d73408481415a5'),
 ObjectId('55eeb9bfa6d73408481415a6'),
 ObjectId('55eeb9bfa6d73408481415a7'),
 ObjectId('55eeb9bfa6d73408481415a8'),
 ObjectId('55eeb9bfa6d73408481415a9'),
 ObjectId('55eeb9bfa6d73408481415aa'),
 ObjectId('55eeb9bfa6d73408481415ab'),
 ObjectId('55eeb9bfa6d73408481415ac'),
 ObjectId('55eeb9bfa6d73408481415ad'),
 ObjectId('55eeb9bfa6d73408481415ae'),
 ObjectId('55eeb9bfa6d73408481415af'),
 ObjectId('55eeb9bfa6d73408481415b0'),
 ObjectId('55eeb9bfa6d73408481415b1'),
 ObjectId('55eeb9bfa6d73408481415b2'),
 ObjectId('55eeb9bfa6d73408481415b3'),
 ObjectId('55eeb9bfa6d73408481415b4'),
 ObjectId('55eeb9bfa6d73408481415b5'),
 ObjectId('55eeb9bfa6d73408481415b6'),
 ObjectId('55eeb9bfa6d73408481415b7'),
 ObjectId('55eeb9bfa6d73408481415b8'),
 ObjectId('55eeb9bfa6d73408481415b9'),
 ObjectId('55eeb9bfa6d73408481415ba'),
 ObjectId('55eeb9bfa6d73408481415bb'),
 ObjectId('55eeb9bfa6d73408481415bc'),
 ObjectId('55eeb9bfa6d73408481415bd'),
 ObjectId('55eeb9bfa6d73408481415be'),
 ObjectId('55eeb9bfa6d73408481415bf'),
 ObjectId('55eeb9bfa6d73408481415c0'),
 ObjectId('55eeb9bfa6d73408481415c1'),
 ObjectId('55eeb9bfa6d73408481415c2'),
 ObjectId('55eeb9bfa6d73408481415c3'),
 ObjectId('55eeb9bfa6d73408481415c4'),
 ObjectId('55eeb9bfa6d73408481415c5'),
 ObjectId('55eeb9bfa6d73408481415c6'),
 ObjectId('55eeb9bfa6d73408481415c7'),
 ObjectId('55eeb9bfa6d73408481415c8'),
 ObjectId('55eeb9bfa6d73408481415c9'),
 ObjectId('55eeb9bfa6d73408481415ca'),
 ObjectId('55eeb9bfa6d73408481415cb'),
 ObjectId('55eeb9bfa6d73408481415cc'),
 ObjectId('55eeb9bfa6d73408481415cd'),
 ObjectId('55eeb9bfa6d73408481415ce'),
 ObjectId('55eeb9bfa6d73408481415cf'),
 ObjectId('55eeb9bfa6d73408481415d0'),
 ObjectId('55eeb9bfa6d73408481415d1'),
 ObjectId('55eeb9bfa6d73408481415d2'),
 ObjectId('55eeb9bfa6d73408481415d3'),
 ObjectId('55eeb9bfa6d73408481415d4'),
 ObjectId('55eeb9bfa6d73408481415d5'),
 ObjectId('55eeb9bfa6d73408481415d6'),
 ObjectId('55eeb9bfa6d73408481415d7'),
 ObjectId('55eeb9bfa6d73408481415d8'),
 ObjectId('55eeb9bfa6d73408481415d9'),
 ObjectId('55eeb9bfa6d73408481415da'),
 ObjectId('55eeb9bfa6d73408481415db'),
 ObjectId('55eeb9bfa6d73408481415dc'),
 ObjectId('55eeb9bfa6d73408481415dd'),
 ObjectId('55eeb9bfa6d73408481415de'),
 ObjectId('55eeb9bfa6d73408481415df'),
 ObjectId('55eeb9bfa6d73408481415e0'),
 ObjectId('55eeb9bfa6d73408481415e1'),
 ObjectId('55eeb9bfa6d73408481415e2'),
 ObjectId('55eeb9bfa6d73408481415e3'),
 ObjectId('55eeb9bfa6d73408481415e4'),
 ObjectId('55eeb9bfa6d73408481415e5'),
 ObjectId('55eeb9bfa6d73408481415e6'),
 ObjectId('55eeb9bfa6d73408481415e7'),
 ObjectId('55eeb9bfa6d73408481415e8'),
 ObjectId('55eeb9bfa6d73408481415e9'),
 ObjectId('55eeb9bfa6d73408481415ea'),
 ObjectId('55eeb9bfa6d73408481415eb'),
 ObjectId('55eeb9bfa6d73408481415ec'),
 ObjectId('55eeb9bfa6d73408481415ed'),
 ObjectId('55eeb9bfa6d73408481415ee'),
 ObjectId('55eeb9bfa6d73408481415ef'),
 ObjectId('55eeb9bfa6d73408481415f0'),
 ObjectId('55eeb9bfa6d73408481415f1'),
 ObjectId('55eeb9bfa6d73408481415f2'),
 ObjectId('55eeb9bfa6d73408481415f3'),
 ObjectId('55eeb9bfa6d73408481415f4'),
 ObjectId('55eeb9bfa6d73408481415f5'),
 ObjectId('55eeb9bfa6d73408481415f6'),
 ObjectId('55eeb9bfa6d73408481415f7'),
 ObjectId('55eeb9bfa6d73408481415f8'),
 ObjectId('55eeb9bfa6d73408481415f9'),
 ObjectId('55eeb9bfa6d73408481415fa'),
 ObjectId('55eeb9bfa6d73408481415fb'),
 ObjectId('55eeb9bfa6d73408481415fc'),
 ObjectId('55eeb9bfa6d73408481415fd'),
 ObjectId('55eeb9bfa6d73408481415fe'),
 ObjectId('55eeb9bfa6d73408481415ff'),
 ObjectId('55eeb9bfa6d7340848141600'),
 ObjectId('55eeb9bfa6d7340848141601'),
 ObjectId('55eeb9bfa6d7340848141602'),
 ObjectId('55eeb9bfa6d7340848141603'),
 ObjectId('55eeb9bfa6d7340848141604'),
 ObjectId('55eeb9bfa6d7340848141605'),
 ObjectId('55eeb9bfa6d7340848141606'),
 ObjectId('55eeb9bfa6d7340848141607'),
 ObjectId('55eeb9bfa6d7340848141608'),
 ObjectId('55eeb9bfa6d7340848141609'),
 ObjectId('55eeb9bfa6d734084814160a'),
 ObjectId('55eeb9bfa6d734084814160b'),
 ObjectId('55eeb9bfa6d734084814160c'),
 ObjectId('55eeb9bfa6d734084814160d'),
 ObjectId('55eeb9bfa6d734084814160e'),
 ObjectId('55eeb9bfa6d734084814160f'),
 ObjectId('55eeb9bfa6d7340848141610'),
 ObjectId('55eeb9bfa6d7340848141611'),
 ObjectId('55eeb9bfa6d7340848141612'),
 ObjectId('55eeb9bfa6d7340848141613'),
 ObjectId('55eeb9bfa6d7340848141614'),
 ObjectId('55eeb9bfa6d7340848141615'),
 ObjectId('55eeb9bfa6d7340848141616'),
 ObjectId('55eeb9bfa6d7340848141617'),
 ObjectId('55eeb9bfa6d7340848141618'),
 ObjectId('55eeb9bfa6d7340848141619'),
 ObjectId('55eeb9bfa6d734084814161a'),
 ObjectId('55eeb9bfa6d734084814161b'),
 ObjectId('55eeb9bfa6d734084814161c'),
 ObjectId('55eeb9bfa6d734084814161d'),
 ObjectId('55eeb9bfa6d734084814161e'),
 ObjectId('55eeb9bfa6d734084814161f'),
 ObjectId('55eeb9bfa6d7340848141620'),
 ObjectId('55eeb9bfa6d7340848141621'),
 ObjectId('55eeb9bfa6d7340848141622'),
 ObjectId('55eeb9bfa6d7340848141623'),
 ObjectId('55eeb9bfa6d7340848141624'),
 ObjectId('55eeb9bfa6d7340848141625'),
 ObjectId('55eeb9bfa6d7340848141626'),
 ObjectId('55eeb9bfa6d7340848141627'),
 ObjectId('55eeb9bfa6d7340848141628'),
 ObjectId('55eeb9bfa6d7340848141629'),
 ObjectId('55eeb9bfa6d734084814162a'),
 ObjectId('55eeb9bfa6d734084814162b'),
 ObjectId('55eeb9bfa6d734084814162c'),
 ObjectId('55eeb9bfa6d734084814162d'),
 ObjectId('55eeb9bfa6d734084814162e'),
 ObjectId('55eeb9bfa6d734084814162f'),
 ObjectId('55eeb9bfa6d7340848141630'),
 ObjectId('55eeb9bfa6d7340848141631'),
 ObjectId('55eeb9bfa6d7340848141632'),
 ObjectId('55eeb9bfa6d7340848141633'),
 ObjectId('55eeb9bfa6d7340848141634'),
 ObjectId('55eeb9bfa6d7340848141635'),
 ObjectId('55eeb9bfa6d7340848141636'),
 ObjectId('55eeb9bfa6d7340848141637'),
 ObjectId('55eeb9bfa6d7340848141638'),
 ObjectId('55eeb9bfa6d7340848141639'),
 ObjectId('55eeb9bfa6d734084814163a'),
 ObjectId('55eeb9bfa6d734084814163b'),
 ObjectId('55eeb9bfa6d734084814163c'),
 ObjectId('55eeb9bfa6d734084814163d'),
 ObjectId('55eeb9bfa6d734084814163e'),
 ObjectId('55eeb9bfa6d734084814163f'),
 ObjectId('55eeb9bfa6d7340848141640'),
 ObjectId('55eeb9bfa6d7340848141641'),
 ObjectId('55eeb9bfa6d7340848141642'),
 ObjectId('55eeb9bfa6d7340848141643'),
 ObjectId('55eeb9bfa6d7340848141644'),
 ObjectId('55eeb9bfa6d7340848141645'),
 ObjectId('55eeb9bfa6d7340848141646'),
 ObjectId('55eeb9bfa6d7340848141647'),
 ObjectId('55eeb9bfa6d7340848141648'),
 ObjectId('55eeb9bfa6d7340848141649'),
 ObjectId('55eeb9bfa6d734084814164a'),
 ObjectId('55eeb9bfa6d734084814164b'),
 ObjectId('55eeb9bfa6d734084814164c'),
 ObjectId('55eeb9bfa6d734084814164d'),
 ObjectId('55eeb9bfa6d734084814164e'),
 ObjectId('55eeb9bfa6d734084814164f'),
 ObjectId('55eeb9bfa6d7340848141650'),
 ObjectId('55eeb9bfa6d7340848141651'),
 ObjectId('55eeb9bfa6d7340848141652'),
 ObjectId('55eeb9bfa6d7340848141653'),
 ObjectId('55eeb9bfa6d7340848141654'),
 ObjectId('55eeb9bfa6d7340848141655'),
 ObjectId('55eeb9bfa6d7340848141656'),
 ObjectId('55eeb9bfa6d7340848141657'),
 ObjectId('55eeb9bfa6d7340848141658'),
 ObjectId('55eeb9bfa6d7340848141659'),
 ObjectId('55eeb9bfa6d734084814165a'),
 ObjectId('55eeb9bfa6d734084814165b'),
 ObjectId('55eeb9bfa6d734084814165c'),
 ObjectId('55eeb9bfa6d734084814165d'),
 ObjectId('55eeb9bfa6d734084814165e'),
 ObjectId('55eeb9bfa6d734084814165f'),
 ObjectId('55eeb9bfa6d7340848141660'),
 ObjectId('55eeb9bfa6d7340848141661'),
 ObjectId('55eeb9bfa6d7340848141662'),
 ObjectId('55eeb9bfa6d7340848141663'),
 ObjectId('55eeb9bfa6d7340848141664'),
 ObjectId('55eeb9bfa6d7340848141665'),
 ObjectId('55eeb9bfa6d7340848141666'),
 ObjectId('55eeb9bfa6d7340848141667'),
 ObjectId('55eeb9bfa6d7340848141668'),
 ObjectId('55eeb9bfa6d7340848141669'),
 ObjectId('55eeb9bfa6d734084814166a'),
 ObjectId('55eeb9bfa6d734084814166b'),
 ObjectId('55eeb9bfa6d734084814166c'),
 ObjectId('55eeb9bfa6d734084814166d'),
 ObjectId('55eeb9bfa6d734084814166e'),
 ObjectId('55eeb9bfa6d734084814166f'),
 ObjectId('55eeb9bfa6d7340848141670'),
 ObjectId('55eeb9bfa6d7340848141671'),
 ObjectId('55eeb9bfa6d7340848141672'),
 ObjectId('55eeb9bfa6d7340848141673'),
 ObjectId('55eeb9bfa6d7340848141674'),
 ObjectId('55eeb9bfa6d7340848141675'),
 ObjectId('55eeb9bfa6d7340848141676'),
 ObjectId('55eeb9bfa6d7340848141677'),
 ObjectId('55eeb9bfa6d7340848141678'),
 ObjectId('55eeb9bfa6d7340848141679'),
 ObjectId('55eeb9bfa6d734084814167a'),
 ObjectId('55eeb9bfa6d734084814167b'),
 ObjectId('55eeb9bfa6d734084814167c'),
 ObjectId('55eeb9bfa6d734084814167d'),
 ObjectId('55eeb9bfa6d734084814167e'),
 ObjectId('55eeb9bfa6d734084814167f'),
 ObjectId('55eeb9bfa6d7340848141680'),
 ObjectId('55eeb9bfa6d7340848141681'),
 ObjectId('55eeb9bfa6d7340848141682'),
 ObjectId('55eeb9bfa6d7340848141683'),
 ObjectId('55eeb9bfa6d7340848141684'),
 ObjectId('55eeb9bfa6d7340848141685'),
 ObjectId('55eeb9bfa6d7340848141686'),
 ObjectId('55eeb9bfa6d7340848141687'),
 ObjectId('55eeb9bfa6d7340848141688'),
 ObjectId('55eeb9bfa6d7340848141689'),
 ObjectId('55eeb9bfa6d734084814168a'),
 ObjectId('55eeb9bfa6d734084814168b'),
 ObjectId('55eeb9bfa6d734084814168c'),
 ObjectId('55eeb9bfa6d734084814168d'),
 ObjectId('55eeb9bfa6d734084814168e'),
 ObjectId('55eeb9bfa6d734084814168f'),
 ObjectId('55eeb9bfa6d7340848141690'),
 ObjectId('55eeb9bfa6d7340848141691'),
 ObjectId('55eeb9bfa6d7340848141692'),
 ObjectId('55eeb9bfa6d7340848141693'),
 ObjectId('55eeb9bfa6d7340848141694'),
 ObjectId('55eeb9bfa6d7340848141695'),
 ObjectId('55eeb9bfa6d7340848141696'),
 ObjectId('55eeb9bfa6d7340848141697'),
 ObjectId('55eeb9bfa6d7340848141698'),
 ObjectId('55eeb9bfa6d7340848141699'),
 ObjectId('55eeb9bfa6d734084814169a'),
 ObjectId('55eeb9bfa6d734084814169b'),
 ObjectId('55eeb9bfa6d734084814169c'),
 ...]

Okay, it seems that we have sucessfully insert all of our data into MongoDB instance. Let's test this


In [10]:
pipeline = [{'$limit' : 3}]
for doc in db.ireland.aggregate((pipeline)):
    print(doc)


{u'created': {u'changeset': u'666506', u'version': u'4', u'user': u'Peilscheibe', u'timestamp': u'2008-11-03T17:03:37Z', u'uid': u'35560'}, u'_id': ObjectId('55c79d1075e308318bd32b8e'), u'type': u'node', u'pos': [53.1497533, -6.988381], u'id': u'384087'}
{u'created': {u'changeset': u'666506', u'version': u'4', u'user': u'Peilscheibe', u'timestamp': u'2008-11-03T17:03:23Z', u'uid': u'35560'}, u'_id': ObjectId('55c79d1075e308318bd32b8f'), u'type': u'node', u'pos': [53.1518123, -6.9735323], u'id': u'384128'}
{u'created': {u'changeset': u'666506', u'version': u'3', u'user': u'Peilscheibe', u'timestamp': u'2008-11-03T17:01:56Z', u'uid': u'35560'}, u'_id': ObjectId('55c79d1075e308318bd32b90'), u'type': u'node', u'pos': [53.1533969, -6.962295], u'id': u'384149'}

Show 5 data that have street


In [22]:
pipeline = [
            {'$match': {'address.street':{'$exists':1}}},
            {'$limit' : 5}
]
for doc in db.ireland.aggregate((pipeline)):
    print(doc)


{u'name:ga': u'Cill Easra', u'name:en': u'Killester', u'name': u'Killester', u'created': {u'changeset': u'32726151', u'version': u'10', u'user': u'VictorIE', u'timestamp': u'2015-07-19T02:15:28Z', u'uid': u'2008037'}, u'layer': u'1', u'pos': [53.3727894, -6.2049888], u'address': {u'city': u'Dublin 3', u'street': u'Middle Third'}, u'operator': u'Irish Rail', u'railway': u'station', u'_id': ObjectId('55eeb9bfa6d734084814178d'), u'type': u'node', u'id': u'661448', u'network': u'DART'}
{u'name:ga': u'Gleann na Caorach', u'name:en': u'Glenageary', u'name': u'Glenageary', u'created': {u'changeset': u'28368450', u'version': u'9', u'user': u'VictorIE', u'timestamp': u'2015-01-24T09:58:45Z', u'uid': u'2008037'}, u'pos': [53.2812258, -6.1231165], u'address': {u'city': u'Glenageary', u'street': u'Station Road'}, u'operator': u'Irish Rail', u'railway': u'station', u'_id': ObjectId('55eeb9bfa6d73408481417bc'), u'type': u'node', u'id': u'661999'}
{u'name:ga': u'Seanchill', u'name:en': u'Shankill', u'name': u'Shankill', u'created': {u'changeset': u'28051232', u'version': u'8', u'user': u'VictorIE', u'timestamp': u'2015-01-10T22:14:15Z', u'uid': u'2008037'}, u'pos': [53.2365133, -6.1170128], u'address': {u'city': u'Shankill', u'street': u'Shanganagh Wood'}, u'operator': u'Irish Rail', u'railway': u'station', u'_id': ObjectId('55eeb9bfa6d73408481417ff'), u'type': u'node', u'id': u'664528'}
{u'cuisine': u'indian', u'amenity': u'restaurant', u'name': u'Indian Summer', u'created': {u'changeset': u'16798930', u'version': u'6', u'user': u'mackerski', u'timestamp': u'2013-07-02T23:03:21Z', u'uid': u'6367'}, u'pos': [53.2884983, -6.2057489], u'address': {u'street': u'Kilmacud Road Lower'}, u'_id': ObjectId('55eeb9caa6d7340848148000'), u'type': u'node', u'id': u'31901640'}
{u'amenity': u'atm', u'name': u'Ulster Bank', u'created': {u'changeset': u'19549655', u'version': u'3', u'user': u'GoldCircle', u'timestamp': u'2013-12-20T13:09:42Z', u'uid': u'1840776'}, u'pos': [53.2922445, -6.1358094], u'address': {u'street': u'Georges Street Upper'}, u'operator': u'Ulster Bank', u'_id': ObjectId('55eeb9d0a6d734084814b596'), u'type': u'node', u'id': u'82650553'}

Show the top 5 of contributed users


In [23]:
pipeline = [
            {'$match': {'created.user':{'$exists':1}}},
            {'$group': {'_id':'$created.user',
                        'count':{'$sum':1}}},
            {'$sort': {'count':-1}},
            {'$limit' : 5}
]
for doc in db.ireland.aggregate((pipeline)):
    print(doc)


{u'count': 293778, u'_id': u'Dafo43'}
{u'count': 278158, u'_id': u'Nick Burrett'}
{u'count': 244050, u'_id': u'mackerski'}
{u'count': 153912, u'_id': u'brianh'}
{u'count': 91255, u'_id': u'Ignobilis'}

Show the restaurant's name, the food they serve, and contact number


In [31]:
pipeline = [
            {'$match': {'amenity':'pub',
                        'name':{'$exists':1}}},
            {'$project':{'_id':'$name',
                         'cuisine':'$cuisine',
                         'contact':'$phone'}}
]
doc= db.ireland.aggregate((pipeline)):
print(len(doc))


{u'_id': u'The Harbourmaster'}
{u'_id': u'Le Monde'}
{u'_id': u"MacTurcaill's"}
{u'_id': u'The Lombard'}
{u'_id': u'Palmerstown House'}
{u'_id': u'Silver Granite'}
{u'_id': u'The Barge Bar'}
{u'_id': u'The George'}
{u'_id': u'S\xf6der + Ko', u'contact': u'+353 1 4781590'}
{u'_id': u'J.W. Sweetman', u'contact': u'+353 1 6705777'}
{u'_id': u'The Front Lounge'}
{u'_id': u'The Auld Dubliner'}
{u'_id': u'The Temple Bar'}
{u'_id': u"Ha'penny Bridge Inn"}
{u'_id': u'The Portobello'}
{u'_id': u'The Lower Deck'}
{u'_id': u'Knightsbridge Bar'}
{u'_id': u'The Quill (Closed)'}
{u'_id': u"Fallon's"}
{u'_id': u'The Wind Jammer'}
{u'_id': u'The Baggot Inn', u'contact': u'+353 1 6618758'}
{u'_id': u"Leonard's Corner"}
{u'_id': u'The Gingerman'}
{u'_id': u"Thomas Read's"}
{u'_id': u'The Old Harbour'}
{u'_id': u'Padraig Pearse'}
{u'_id': u'The Czech Inn'}
{u'_id': u'Sin \xc9', u'contact': u'+353 1 555 4036'}
{u'_id': u'Sub Lounge'}
{u'_id': u'Bull & Castle'}
{u'_id': u'The Woolshed'}
{u'_id': u'Gin Palace'}
{u'_id': u'Tap House'}
{u'_id': u'Bridge Inn'}
{u'_id': u'Mullingar House'}
{u'_id': u'Villager Inn'}
{u'_id': u'The Black Lion'}
{u'_id': u'Croughs Pub'}
{u'_id': u'Lowes Bar'}
{u'_id': u'The Bird Flanagan'}
{u'_id': u"Whelan's"}
{u'_id': u"Hogan's Bar"}
{u'_id': u"McGarry's Bar"}
{u'_id': u'E. McGraths'}
{u'_id': u'4 Dame Lane'}
{u'_id': u'The Swan Bar (Lynch)'}
{u'_id': u'Opium'}
{u'_id': u'Anseo'}
{u'_id': u'The Homestead'}
{u'_id': u'Dice Bar'}
{u'_id': u"Frank Ryan's"}
{u'_id': u'J Walshes'}
{u'_id': u'The Hogan Stand'}
{u'_id': u"Turk's Head"}
{u'_id': u"O'Shea's Merchant"}
{u'_id': u'Brazen Head'}
{u'_id': u"Gill's Corner House"}
{u'_id': u'Madigans'}
{u'_id': u"Madigan's"}
{u'_id': u"Brogan's Bar"}
{u'_id': u'The Celt'}
{u'_id': u'The Old Storehouse'}
{u'_id': u'Big Tree Tavern'}
{u'_id': u'Hill 16'}
{u'_id': u'The Cobblestone'}
{u'_id': u'Beerhouse'}
{u'_id': u'The Village Inn'}
{u'_id': u"Coffey's"}
{u'_id': u'The Black Sheep'}
{u'_id': u'The Red Parrott'}
{u'_id': u"Smith's of Phibsborough"}
{u'_id': u'J.J. Smyth'}
{u'_id': u'Solas'}
{u'_id': u"Murray's Bar"}
{u'_id': u'The Hut (Mohans)'}
{u'_id': u'McSorleys'}
{u'_id': u'The Back Lounge'}
{u'_id': u'Sin'}
{u'_id': u'The Quays Bar'}
{u'_id': u'The Globe'}
{u'_id': u'Martin B. Slattery'}
{u'_id': u"Mother Kelly's"}
{u'_id': u'Corrigans'}
{u'_id': u"Jack Birchall's Ranelagh House"}
{u'_id': u'The Black Horse'}
{u'_id': u'Kate McAuley'}
{u'_id': u'The Secret Bar / The Bar With No Name'}
{u'_id': u'Odeon'}
{u'_id': u'Shearys'}
{u'_id': u'The Lotts'}
{u'_id': u"Hourican's"}
{u'_id': u"Hartigan's"}
{u'_id': u'Delaney'}
{u'_id': u'McGettigans'}
{u'_id': u'Hynes'}
{u'_id': u'The Capel'}
{u'_id': u"O'Reilly Bros."}
{u'cuisine': u'regional', u'_id': u'Madigans Bar & Restaurant'}
{u'_id': u'The Tap'}
{u'_id': u"Flannery's"}
{u'_id': u'The Waxie Dargle (closed)'}
{u'_id': u'Foggy Dew'}
{u'_id': u'River Bar'}
{u'_id': u'Robert Reade'}
{u'_id': u"McGowan's"}
{u'_id': u"Phibsborough House (Clarke's)"}
{u'_id': u'The Glen of Aherlow'}
{u'_id': u'The Brew Dock'}
{u'_id': u'L Mulligan Grocer'}
{u'_id': u"Tommy O'Gara"}
{u'_id': u'The Glimmer Man'}
{u'_id': u"Cassidy's"}
{u'_id': u'The Cusack Stand  (Devitts)'}
{u'_id': u'Against The Grain'}
{u'_id': u'Krystle'}
{u'_id': u'The Bridge House'}
{u'_id': u'Ardee House (Closed)'}
{u'_id': u'Break for the Border'}
{u'_id': u'The Exchequer'}
{u'_id': u"Sinnott's"}
{u'_id': u'Bia Bar'}
{u'_id': u"McCauley's"}
{u'_id': u'The Tram'}
{u'_id': u'The Richmond'}
{u'_id': u"Ryan's"}
{u'_id': u"Nancy Hand's"}
{u'_id': u'D-Two'}
{u'_id': u"J. O'Connell"}
{u'_id': u"Downey's"}
{u'_id': u'The Grange Inn'}
{u'_id': u'Carvery Bar'}
{u'_id': u'The Gate Bar'}
{u'_id': u'Barn House'}
{u'_id': u"Cleary's"}
{u'_id': u'Karma Stone Bar'}
{u'_id': u"Ryan's"}
{u'_id': u'The house that Jack built'}
{u'_id': u'Francis McKenna'}
{u'_id': u'The Harold House'}
{u'_id': u'The Dean Swift'}
{u'_id': u'John Doyle', u'contact': u'+353 86 7787484'}
{u'_id': u'The Bohemian (McGeoughs)'}
{u'_id': u'The Clock'}
{u'_id': u'Cop\xe1n'}
{u'_id': u'The Confession Box'}
{u'_id': u'The Malt House'}
{u'_id': u'Dame Tavern'}
{u'_id': u'Boomers'}
{u'_id': u'Button & Coin', u'contact': u'+353 89 2153317'}
{u'_id': u'Noel Leonards (Closed)'}
{u'_id': u'The Millenium'}
{u'_id': u'The Temple'}
{u'_id': u'The Hill Top'}
{u'_id': u'The Fountain'}
{u'_id': u'The Lamplighter'}
{u'_id': u'The Liberty Belle'}
{u'_id': u"Tom Kennedy's"}
{u'_id': u'The Thomas House'}
{u'_id': u'The Lark Inn'}
{u'_id': u'The Liberty Bar'}
{u'_id': u'The Pimlico Tavern'}
{u'_id': u"Shanahan's"}
{u'_id': u'Richmond House'}
{u'_id': u'The Snug Bar'}
{u'_id': u'Citi Bar'}
{u'_id': u"Bad Bob's"}
{u'_id': u'The Bernard Shaw'}
{u'_id': u'The Hill'}
{u'_id': u'The Irish House Pub'}
{u'_id': u"Morrissey's"}
{u'_id': u'Pifko Bar'}
{u'_id': u"Fitzsimon's"}
{u'_id': u'The Bridge Tavern'}
{u'_id': u'Forum Bar'}
{u'_id': u"The Workman's Club"}
{u'_id': u'The Sunset House'}
{u'_id': u"McGrath's"}
{u'_id': u"Quinn's"}
{u'_id': u'The Hideout House'}
{u'_id': u'Brewery Bar'}
{u'_id': u"Kavanagh's"}
{u'_id': u'M. Hughes'}
{u'_id': u"McGowan's of Harold's Cross", u'contact': u'+353 1 497 8618'}
{u'_id': u"Matt's of Cabra"}
{u'_id': u"Stoney's"}
{u'_id': u'W. J. Kavanagh'}
{u'_id': u"O'Shea's"}
{u'_id': u'The Black and Amber - closed'}
{u'_id': u'The Longmile Inn'}
{u'_id': u'The Halfway House'}
{u'_id': u'The Garage Bar'}
{u'_id': u'Marble Arch Bar'}
{u'_id': u'Hacienda Bar'}
{u'_id': u'The Legal Eagle'}
{u'_id': u"Eleanora's"}
{u'_id': u'The Blackforge Inn'}
{u'_id': u"Burke's Bar (Closed)"}
{u'_id': u"Bodkin's"}
{u'_id': u'The Old County'}
{u'_id': u'The Strand House'}
{u'_id': u"Mullet's Pub"}
{u'_id': u"Cumiskey's"}
{u'_id': u'The Berkeley'}
{u'_id': u'Bison bar'}
{u'_id': u'Parnell Heritage Pub'}
{u'_id': u"Darkey Kelly's"}
{u'_id': u"The King's Inn"}
{u'_id': u'The Long Island Bar'}
{u'_id': u"Glynn's"}
{u'_id': u"Delahunty's"}
{u'_id': u'The Findlater'}
{u'_id': u"Peadar Kearney's"}
{u'_id': u"Sweeney's"}
{u'_id': u'Buskers Bar'}
{u'_id': u'McCanns', u'contact': u'+353 1 679 0526'}
{u'_id': u'Aurora'}
{u'_id': u'The Blarney Inn'}
{u'_id': u'The Laurence Lounge'}
{u'_id': u"Downey's"}
{u'_id': u'The Sackville Lounge'}
{u'_id': u"Madigan's"}
{u'_id': u"O'Donoghue's"}
{u'_id': u"O'Neills"}
{u'_id': u"Molloy's"}
{u'_id': u"Grace's"}
{u'_id': u'Tramco Brewery (closed)'}
{u'_id': u"Murphy's"}
{u'_id': u'Delaneys'}
{u'_id': u'The Red Windmill'}
{u'_id': u"Peggy Kelly's", u'contact': u'+353 1 4978935'}
{u'_id': u'Man of Aran'}
{u'_id': u"Rody Boland's"}
{u'_id': u'Scholars Bar (closed)'}
{u'_id': u'Mc Gruders'}
{u'_id': u"C\xfa Chulainn's at Croke Park"}
{u'_id': u'The Lombard'}
{u'_id': u'Fibbers Rock Bar'}
{u'_id': u'Clifton Court Bar'}
{u'_id': u"Sweeney's", u'contact': u'+353 1 6350056'}
{u'_id': u'Lanigans'}
{u'_id': u"Lowry's"}
{u'_id': u"Branigan's"}
{u'_id': u"Peter's Pub"}
{u'_id': u'Porterhouse North'}
{u'_id': u'The Church', u'contact': u'+353 1 8280102'}
{u'_id': u'Leeson Lounge'}
{u'_id': u"The Sussex Bar (M. O'Brien)"}
{u'_id': u'The Wellington'}
{u'_id': u'The Four Roads', u'contact': u'+353 1 4542463'}
{u'_id': u'The Patriot Inn'}
{u'_id': u'The Royal Oak'}
{u'_id': u'The Brian Boru (P. Hedigan)'}
{u'_id': u"Fitzgerald's"}
{u'_id': u'Bachelor Inn'}
{u'_id': u"O'Connell's"}
{u'_id': u'The Long Stone'}
{u'_id': u'The Workshop'}
{u'_id': u"Mulligan's"}
{u'_id': u'Dark Horse Inn'}
{u'_id': u"Chaplin's"}
{u'_id': u"Cassidy's"}
{u'_id': u'Bowes', u'contact': u'+353 1 6714038'}
{u'_id': u"O'Donohoe's"}
{u'_id': u"Doyle's"}
{u'_id': u'Panti Bar'}
{u'_id': u'Jack Nealon'}
{u'_id': u"The Stag's Head"}
{u'_id': u'J. McNeill'}
{u'_id': u"Slattery's"}
{u'_id': u"The Boar's Head"}
{u'_id': u"J. Grogan's"}
{u'_id': u"Arthur's"}
{u'_id': u"Baker's Bar & Irish Restaurant"}
{u'_id': u'Porterhouse'}
{u'_id': u"Peter's Pub"}
{u'_id': u"Neary's"}
{u'_id': u'The Clarendon Bar'}
{u'_id': u"Sheehan's"}
{u'_id': u"Kehoe's"}
{u'_id': u"Foley's"}
{u'_id': u"Lincoln's Inn"}
{u'_id': u"Kennedy's"}
{u'_id': u"McGrattan's Caf\xe9 Bar"}
{u'_id': u'T.P.Smiths', u'contact': u'+353 1 878 2067'}
{u'_id': u'H. Mathews'}
{u'_id': u'The Grand Central Bar'}
{u'_id': u'The Pint'}
{u'_id': u'The Grand Social'}
{u'_id': u"Larry Murphy's"}
{u'_id': u"O'Neill's of Pearse Street"}
{u'_id': u'The Trinity Inn'}
{u'_id': u'The Flowing Tide'}
{u'_id': u"Ned's"}
{u'_id': u'James Toner'}
{u'_id': u'Bruxelles'}
{u'_id': u'The Bankers'}
{u'_id': u'Matt the Thresher'}
{u'_id': u'The Oval'}
{u'_id': u"Maye's"}
{u'_id': u'The Vat House'}
{u'_id': u'The Auld Triangle'}
{u'_id': u"O'Reilley's - The Deer's Head"}
{u'_id': u'The Shakespeare'}
{u'_id': u'The International'}
{u'_id': u'The Headline Bar'}
{u'_id': u"O' Shea's 79 Inn"}
{u'_id': u'The Hairy Lemon'}
{u'_id': u'Hole in the Wall'}
{u'_id': u'The Mercantile'}
{u'_id': u'Caf\xe9 en Seine'}
{u'_id': u'Caf\xe9 en Seine'}
{u'_id': u'The Bailey'}
{u'_id': u'The Bailey'}
{u'_id': u"Davy Byrne's"}
{u'_id': u"The Duke (Gilligan's)"}
{u'_id': u"The Duke (Gilligan's)"}
{u'_id': u'The Palace Bar'}
{u'_id': u'Blackbird'}
{u'_id': u'Porterhouse Central'}
{u'_id': u"McDaid's"}
{u'cuisine': u'coffee_shop', u'_id': u"O'Sullivan's", u'contact': u'+353 1 6773242'}
{u'_id': u'The Oliver St John Gogarty'}
{u'_id': u'The Old Stand'}
{u'_id': u"Alfie Mulligan's"}
{u'_id': u"Hartigan's"}
{u'_id': u'Doheny and Nesbitt'}
{u'_id': u"O'Donoghue's"}
{u'_id': u'The Mezz'}
{u'_id': u'The Norseman'}
{u'_id': u'The Oak'}
{u'_id': u'Foggy Dew'}
{u'_id': u"Merchant's Arch"}
{u'_id': u'The Bleeding Horse'}
{u'_id': u"Cumiskey's"}
{u'_id': u'Botanic House'}
{u'_id': u"Ruby Finnegan's"}
{u'_id': u"Lloyd's"}
{u'_id': u"Grainger's"}
{u'_id': u"Hanlon's"}
{u'_id': u"Clarke's City Arms"}
{u'_id': u"Kavanagh's"}
{u'_id': u"Judge Darley's"}
{u'_id': u'Parnell Heritage Pub'}
{u'_id': u'The Long Hall'}
{u'_id': u'Bodkins'}