SlideShare a Scribd company logo
1 of 69
Download to read offline
Data Mangling with mongoDB
Alexander C. S. Hendorf
@hendorf
Alexander C. S. Hendorf
CTO Königsweg GmbH
Always love data and new ideas
mongoDB master 2016, MUG Orga.
EuroPython organizer + program chair
speaker mongoDB world NYC, CEBIT,…
@hendorf
Agenda
1. Map Reduce
2. Aggregation framework
a. Pipeline model
b. Pipeline stages
c. Accumulators & Expression Operators
d. Boosting performance
3. Redemption & summary
Terminology
json-like object
{"_id": 1,
"say": "Hello"}
no schema
enforced
documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument
collection
dododododododododododo
dododododododododododo
dododododododododododo
dododododododododododo
document database
By Moumou82 (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
{'_id': ObjectId('5215d7f3ee6da1070d5cb88a'), 'adamId': 573885160, 'added': {'epoch_time': 1377163251.691398, 'human_time': 'Thu 22.08.2013 09:20:51 UTC'}, 'headers': {'dict': {'apple-timing-app': '222 ms', 'cache-control': 'no-transform,
max-age=60', 'connection': 'close', 'content-encoding': 'gzip', 'content-length': '17404', 'content-type': 'text/html; charset=UTF-8', 'date': 'Thu, 22 Aug 2013 09:20:51 GMT', 'last-modified': 'Thu, 22 Aug 2013 09:20:51 GMT', 'vary':
'Accept-Encoding', 'x-apple-aka-ttl': 'Generated Thu Aug 22 02:20:51 PDT 2013, Expires Thu Aug 22 02:21:51 PDT 2013, TTL 60s', 'x-apple-application-instance': '1009514', 'x-apple-application-site': 'NWK', 'x-apple-jingle-correlation-key':
'VASQDI34SJY5G', 'x-apple-lok-response-date': 'Thu Aug 22 02:20:51 PDT 2013', 'x-apple-orig-url': 'https://itunes.apple.com/co/album/id573885160', 'x-apple-partner': 'origin.0', 'x-apple-translated-wo-url': '/WebObjects/MZStore.woa/wa/
viewAlbum?id=573885160&cc=co', 'x-webobjects-loadaverage': '0'}, 'encodingheader': None, 'fp': None, 'headers': {'Cache-Control': 'no-transform, max-age=60', 'Connection': 'close', 'Content-Encoding': 'gzip', 'Content-Length': '17404',
'Content-Type': 'text/html; charset=UTF-8', 'Date': 'Thu, 22 Aug 2013 09:20:51 GMT', 'Last-Modified': 'Thu, 22 Aug 2013 09:20:51 GMT', 'Vary': 'Accept-Encoding', 'X-Apple-Partner': 'origin.0', 'apple-timing-app': '222 ms', 'x-apple-aka-
ttl': 'Generated Thu Aug 22 02:20:51 PDT 2013, Expires Thu Aug 22 02:21:51 PDT 2013, TTL 60s', 'x-apple-application-instance': '1009514', 'x-apple-application-site': 'NWK', 'x-apple-jingle-correlation-key': 'VASQDI34SJY5G', 'x-apple-lok-
response-date': 'Thu Aug 22 02:20:51 PDT 2013', 'x-apple-orig-url': 'https://itunes.apple.com/co/album/id573885160', 'x-apple-translated-wo-url': '/WebObjects/MZStore.woa/wa/viewAlbum?id=573885160&cc=co', 'x-webobjects-loadaverage': '0'},
'maintype': 'text', 'plist': ['charset=UTF-8'], 'plisttext': '; charset=UTF-8', 'seekable': 0, 'startofbody': None, 'startofheaders': None, 'status': '', 'subtype': 'html', 'type': 'text/html', 'typeheader': 'text/html; charset=UTF-8',
'unixfrom': ''}, 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'artwork': [[200, 'http://a1.mzstatic.com/
us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover200x200.jpeg'], [100, 'http://a5.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover100x100.jpeg'], [250, 'http://a2.mzstatic.com/us/r30/
Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover250x250.jpeg'], [130, 'http://a4.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover130x130.jpeg'], [400, 'http://a3.mzstatic.com/us/r30/Music/v4/9a/
ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover400x400.jpeg'], [1400, 'http://a2.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover1400x1400.jpeg'], [1200, 'http://a4.mzstatic.com/us/r30/Music/v4/9a/ce/
66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover1200x1200.jpeg']], 'children': [{'adamId': 573885322, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/
imagine-dragons/id358714030?l=en', 'bookletType': 'pdf', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'description': None, 'discNumber': None, 'genres': [20, 21, 1144], 'id': 573885322, 'kind': 'booklet', 'name': 'Digital
Booklet - Night Visions', 'nameRaw': 'Digital Booklet - Night Visions', 'offers': [{'assets': [{'flavor': 'booklet', 'size': 2705648}], 'price': None, 'priceFormatted': '', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None,
'popularity': 0, 'releaseDate': '2003-04-28', 'releaseDateEpoch': datetime.datetime(2003, 4, 28, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885322', 'trackNumber': None, 'url': 'https://itunes.apple.com/co/album/digital-booklet-
night-visions/id573885160?i=573885322&l=en'}, {'adamId': 573885272, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en',
'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser', 'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating':
{'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885272, 'kind': 'song', 'name': 'Radioactive', 'nameRaw': 'Radioactive', 'offers': [{'assets': [{'duration': 186, 'flavor': 'plusAudio', 'preview': {'duration':
90, 'url': 'http://a840.phobos.apple.com/us/r2000/019/Music2/v4/4f/0d/30/4f0d30e9-ffa3-695c-44c8-d915f9e3fe98/mzaf_5753162857555111697.aac.m4a'}, 'size': 6830469}], 'buyParams':
'productType=S&price=1290&salableAdamId=573885272&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 1, 'releaseDate': '2013-02-01',
'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885272', 'trackNumber': 1, 'url': 'https://itunes.apple.com/co/album/radioactive/id573885160?i=573885272&l=en'}, {'adamId': 573885274,
'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions',
'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885274, 'kind':
'song', 'name': 'Tiptoe', 'nameRaw': 'Tiptoe', 'offers': [{'assets': [{'duration': 194, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1623.phobos.apple.com/us/r2000/020/Music2/v4/5d/6c/3a/5d6c3a3c-7ea0-7f71-d100-
cf90dc9e8433/mzaf_5720461395889014325.aac.m4a'}, 'size': 7244474}], 'buyParams': 'productType=S&price=990&salableAdamId=573885274&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}],
'pieceId': None, 'popularity': 0.009765625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885274', 'trackNumber': 2, 'url': 'https://itunes.apple.com/co/
album/tiptoe/id573885160?i=573885274&l=en'}, {'adamId': 573885275, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en',
'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'},
'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885275, 'kind': 'song', 'name': "It's Time", 'nameRaw': "It's Time", 'offers': [{'assets': [{'duration': 240, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://
a1557.phobos.apple.com/us/r2000/006/Music2/v4/8b/c6/d9/8bc6d932-6ef4-166d-20fb-7cd5cba4c79a/mzaf_6099651544288202212.aac.m4a'}, 'size': 8452717}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885275&pricingParameters=PLUS',
'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.41357421875, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://
itun.es/co/ORmnI?i=573885275', 'trackNumber': 3, 'url': 'https://itunes.apple.com/co/album/its-time/id573885160?i=573885275&l=en'}, {'adamId': 573885278, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons',
'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser',
'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885278, 'kind': 'song', 'name': 'Demons', 'nameRaw': 'Demons', 'offers':
[{'assets': [{'duration': 177, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a174.phobos.apple.com/us/r2000/016/Music/v4/e8/cb/a1/e8cba109-26ad-f7ea-f648-4a4bffd595f1/mzaf_6503879570199009699.aac.m4a'}, 'size':
6346043}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885278&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.1343994140625,
'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885278', 'trackNumber': 4, 'url': 'https://itunes.apple.com/co/album/demons/id573885160?i=573885278&l=en'},
{'adamId': 573885280, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName':
'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee & Alex Da Kid', 'url': 'https://itunes.apple.com/co/composer/id202856766?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21,
1144], 'id': 573885280, 'kind': 'song', 'name': 'On Top of the World', 'nameRaw': 'On Top of the World', 'offers': [{'assets': [{'duration': 192, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1825.phobos.apple.com/us/
r2000/015/Music2/v4/e1/36/20/e13620e1-31a2-5f9a-7766-769c97399b81/mzaf_7878115814185165018.aac.m4a'}, 'size': 6940151}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885280&pricingParameters=PLUS', 'price': 1.29,
'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.1343994140625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/
ORmnI?i=573885280', 'trackNumber': 5, 'url': 'https://itunes.apple.com/co/album/on-top-of-the-world/id573885160?i=573885280&l=en'}, {'adamId': 573885281, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons',
'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://
itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885281, 'kind': 'song', 'name': 'Amsterdam', 'nameRaw': 'Amsterdam', 'offers': [{'assets':
[{'duration': 241, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a80.phobos.apple.com/us/r2000/007/Music/v4/28/35/bc/2835bc7f-c8e2-8a8b-7cd3-aae132bd43f2/mzaf_8850126300550805333.aac.m4a'}, 'size': 8516981}],
'buyParams': 'productType=S&price=990&salableAdamId=573885281&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.003662109375, 'releaseDate':
'2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885281', 'trackNumber': 6, 'url': 'https://itunes.apple.com/co/album/amsterdam/id573885160?i=573885281&l=en'}, {'adamId':
573885283, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night
Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885283,
'kind': 'song', 'name': 'Hear Me', 'nameRaw': 'Hear Me', 'offers': [{'assets': [{'duration': 235, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a157.phobos.apple.com/us/r2000/019/Music/v4/cf/6e/5d/cf6e5d87-
fb86-55e2-2a9e-b62e94a2c4ea/mzaf_3208300556053684171.aac.m4a'}, 'size': 9043466}], 'buyParams': 'productType=S&price=990&salableAdamId=573885283&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy',
'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00439453125, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885283', 'trackNumber': 7, 'url':
'https://itunes.apple.com/co/album/hear-me/id573885160?i=573885283&l=en'}, {'adamId': 573885284, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/
imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'},
'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885284, 'kind': 'song', 'name': 'Every Night', 'nameRaw': 'Every Night', 'offers': [{'assets': [{'duration': 217, 'flavor': 'plusAudio',
'preview': {'duration': 90, 'url': 'http://a962.phobos.apple.com/us/r2000/003/Music2/v4/ac/72/44/ac7244de-f1ee-4116-f494-acf5243a6e8f/mzaf_8514226465678986156.aac.m4a'}, 'size': 7730368}], 'buyParams':
'productType=S&price=990&salableAdamId=573885284&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.000732421875, 'releaseDate': '2013-02-01',
'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885284', 'trackNumber': 8, 'url': 'https://itunes.apple.com/co/album/every-night/id573885160?i=573885284&l=en'}, {'adamId': 573885288,
'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions',
'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser', 'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144],
'id': 573885288, 'kind': 'song', 'name': 'Bleeding Out', 'nameRaw': 'Bleeding Out', 'offers': [{'assets': [{'duration': 223, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1694.phobos.apple.com/us/r2000/007/Music/
v4/6c/a1/1d/6ca11d2b-deb3-2afb-964b-7377f92ab57f/mzaf_6333841192228218638.aac.m4a'}, 'size': 7895431}], 'buyParams': 'productType=S&price=990&salableAdamId=573885288&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99',
'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0108642578125, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885288', 'trackNumber':
9, 'url': 'https://itunes.apple.com/co/album/bleeding-out/id573885160?i=573885288&l=en'}, {'adamId': 573885309, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/
co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'},
'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885309, 'kind': 'song', 'name': 'Underdog', 'nameRaw': 'Underdog', 'offers': [{'assets': [{'duration': 209, 'flavor': 'plusAudio', 'preview':
{'duration': 90, 'url': 'http://a1948.phobos.apple.com/us/r2000/008/Music2/v4/03/27/1f/03271f66-9dc2-4a43-894b-ec8dbb9cab84/mzaf_2556941019434400323.aac.m4a'}, 'size': 7569963}], 'buyParams':
'productType=S&price=990&salableAdamId=573885309&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00146484375, 'releaseDate': '2013-02-01',
'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885309', 'trackNumber': 10, 'url': 'https://itunes.apple.com/co/album/underdog/id573885160?i=573885309&l=en'}, {'adamId': 573885311,
'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions',
'composer': {'name': None, 'url': 'https://itunes.apple.com/co/composer?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885311, 'kind': 'song', 'name': 'Nothing Left to Say / Rocks',
'nameRaw': 'Nothing Left to Say / Rocks', 'offers': [{'assets': [{'duration': 539, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1480.phobos.apple.com/us/r2000/010/Music2/v4/f9/4e/65/
f94e651a-1713-9288-6e73-0f9aba83cf76/mzaf_4695219378617698238.aac.m4a'}, 'size': 18730805.0}], 'buyParams': 'productType=S&price=990&salableAdamId=573885311&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type':
'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00146484375, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885311', 'trackNumber': 11, 'url':
'https://itunes.apple.com/co/album/nothing-left-to-say-rocks/id573885160?i=573885311&l=en'}, {'adamId': 573885312, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://
itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee & Clint Holgate', 'url': 'https://itunes.apple.com/co/
composer/id573885315?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885312, 'kind': 'song', 'name': 'Cha-Ching (Till We Grow Older)', 'nameRaw': 'Cha-Ching (Till We Grow Older)',
'offers': [{'assets': [{'duration': 248, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1093.phobos.apple.com/us/r2000/006/Music/v4/c4/ea/59/c4ea59fb-598c-703a-0bbe-0e01bda208e3/mzaf_6664089561292583747.aac.m4a'},
'size': 9052299}], 'buyParams': 'productType=S&price=990&salableAdamId=573885312&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0025634765625,
'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885312', 'trackNumber': 12, 'url': 'https://itunes.apple.com/co/album/cha-ching-till-we-grow-older/
id573885160?i=573885312&l=en'}, {'adamId': 573885318, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId':
573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres':
[20, 34, 21, 1144], 'id': 573885318, 'kind': 'song', 'name': 'Working Man', 'nameRaw': 'Working Man', 'offers': [{'assets': [{'duration': 235, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a2.phobos.apple.com/us/
r2000/000/Music2/v4/3b/c6/8e/3bc68e6c-0d26-6385-7155-37467fbafc22/mzaf_8488610176120965913.aac.m4a'}, 'size': 8608037}], 'buyParams': 'productType=S&price=990&salableAdamId=573885318&pricingParameters=PLUS', 'price': 0.99,
'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0047607421875, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/
ORmnI?i=573885318', 'trackNumber': 13, 'url': 'https://itunes.apple.com/co/album/working-man/id573885160?i=573885318&l=en'}, {'adamId': 573885320, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons',
'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://
itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885320, 'kind': 'song', 'name': 'Fallen', 'nameRaw': 'Fallen', 'offers': [{'assets':
[{'duration': 179, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1415.phobos.apple.com/us/r2000/018/Music/v4/7c/dd/5a/7cdd5ad1-5df0-2797-01d2-dde46d790daf/mzaf_1820141309047882775.aac.m4a'}, 'size': 6891212}],
'buyParams': 'productType=S&price=990&salableAdamId=573885320&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0274658203125, 'releaseDate':
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'}],
}
Map Reduce
or
The Mother of Big Data
Map Reduce in 15 sec
documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument
filter and sort
e.g.
(hello, 1)
(world, 1)
(hello, 1)
(peter, 1)
(parker, 1)
input
emit (key, value) pairs
reducer
sum up count for
each key
e.g.
(hello, 2)
(world, 1)
(peter, 1)
map reduce
Map Reduce in 15 sec
documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument
input map reduce
1
n
2
3
1
2
3
(hello, 1)
(hello, 1)
(hello, 2)
// map
function () {
var artist = this.info.artistName;
emit(artist, 1);
}
// reduce
function (key, values) {
var total = 0;
for (var i = 0; i < values.length; i++) {
total += values[i];
}
return total;
}
}
DEMO
run map reduce in mongoDB
mapReduce in mongoDB
• provides
map and reduce

+ finalize phase.
query, sort and limit documents
• output:
inline
or to a collection
Map Reduce was designed for parallelization.
Single Node or Replica-Sets can not do this.
Map Reduce
or: The Evil Step-Mother.
Aggregation Framework
db.collection.aggregate()
• introduced with mongoDB 2.2 in 2012
• framework for data aggregation
• it's designed 'straight-forward'
• documents enter a 

multi-stage pipeline that transforms the documents 

into an aggregated results
• all operations have an optimization phase 

which attempts to reshape the pipeline for improved
performance
get the baton
Pipeline is like a relay race
$match $group
something smart
$project
present nicely
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'}],
}
pipeline = [
# find in aggregation is $match, sql: WHERE
{"$match": {"info.artistName": artist}},
# $project, sql: SELECT
{"$project": {"release": "$info.name", "_id": 0}},
{"$sort": {"release": ASCENDING}}
]
DEMO
aggregation pipeline
stages:
$match -> $project -> $sort
Caveat
• mongoDB returns a cursor
• after complete iteration the cursor is empty.
• save the result to a variable if you want to re-use it
Aggregation stages
$match
$sort
$limit
$project
$group
$unwind
$lookup
WHERE | HAVING
ORDER BY
LIMIT
SELECT
GROUP BY
(JOIN)
LEFT OUTER JOIN
$redact • $skip • $geoNear • $out
SQL
*added in 3.2 + $sample • $indexStats
*
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'}],
}
pipeline = [
# find in aggregation is $match, sql: WHERE
{"$match": {"info.artistName": artist}},
# GROUP BY & COUNT()
{"$group": {
"_id": "$info.name",
"count": {"$sum": 1}}},
# $project, sql: SELECT
{"$project": {"release": "$_id", "_id": 0}},
{"$sort": {"release": ASCENDING}}
]
DEMO
$group
$sort by multiple attributes
Caveat
• Python dicts are not ordered!
• mind the right execution order -> use a datatype
maintaining the order
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'},
.......
],
}
working with listed sub-documents
pipeline = [
{"$match": {"info.artistName": artist}},
# "explode" list
{"$unwind": "$info.children"},
{"$group": {
"_id": "$info.children.name"}},
{"$project": {"song": "$_id", "_id": 0}},
{"$sort": {"release": ASCENDING}}
]
{ "mother": "Dorothea",
children: [
{"born": 1785, "name": "Jacob Ludwig Karl"},
{"born": 1786, "name": "Wilhelm Carl"},
{"born": 1787, "name": "Carl Friedrich"},
{"born": 1788, "name": "Ferdinand Philipp"},
{"born": 1790, "name": "Ludwig Emil"},
{"born": 1793, "name": "Charlotte Amalie"},
]}
{ "mother": "Dorothea", 

children: {"born": 1785, "name": "Jacob Ludwig Karl"}]}
{ "mother": "Dorothea", 

children: {"born": 1786, "name": "Wilhelm Carl"}}
{ "mother": "Dorothea", 

children: {"born": 1787, "name": "Carl Friedrich"}]}
{ "mother": "Dorothea", 

children: {"born": 1788, "name": "Ferdinand Philipp"}}
{ "mother": "Dorothea", 

children: {"born": 1790, "name": "Ludwig Emil"}}
{ "mother": "Dorothea", 

children: {"born": 1793, "name": "Charlotte Amalie"}}
$unwind
DEMO
$skip
skip documents in found set
$out
write the resulting documents of the aggregation pipeline to a
collection, also incremental.
$geoNear
returns an ordered stream of documents 

based on the proximity to a geospatial point
$redact
reshapes each document in the stream by restricting the content for
each document based on information stored in the documents
themselves
$lookup
left outer join with another collection.
new in 3.2
$indexStats
statistics on index usage (an actual performance metric)
$sample
select some random documents from a collection
DEMO
Aggregation Framework
Accumulators
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'},
.......
],
}
accumulators: $min / $max $first / $last
pipeline = [
{"$match": {"info.artistName": artist}},
{"$group": {
"_id": "",
"minDate": {"$min": "$info.releaseDateEpoch"},
"maxDate": {"$max": "$info.releaseDateEpoch"}}},
{"$project": {"_id": 0, "minDate": 1, "maxDate": 1}},
]
ISO Date
$min / $max
pipeline = [
{"$match": {"info.artistName": artist}},
{"$group": {
"_id": "",
"minDate": {"$first": "$info.releaseDate"},
"maxDate": {"$last": "$info.releaseDate"}}},
{"$project": {"_id": 0, "minDate": 1, "maxDate": 1}},
]
String
$first / $last
date operators
pipeline = [
{"$match": {"info.artistName": artist}},
{"$sort": SON([("info.releaseDate", ASCENDING)])},
{"$group": {
"_id": {"$year": "$info.releaseDateEpoch"},
"count": {"$sum": "1}}},
{"$project": {"year": "$_id.year", "_id": 0, "count": 1}}},
]
ISO Date
date operators / multikey groups
pipeline = [
{"$match": {"info.artistName": artist}},
{"$sort": SON([("info.releaseDate", ASCENDING)])},
{"$group": {
"_id": { "year": {"$year": "$info.releaseDateEpoch",
"month": {"$month": "$info.releaseDateEpoch"}}},
"count": {"$sum": "1},
{"$project": {"year": "$_id.year","month": "$_id.month", "_id": 0, "count": 1}}},
]
ISO Date
DEMO
Accumulators
Date Operator
The Nemesis. Google say
# By Katy_Perry_-_MTV_VMA_2011.jpg: Philip Nelson from San Antonio, TX, USA derivative work: Truu (Katy_Perry_-_MTV_VMA_2011.jpg) [CC BY-SA 2.0 (http://creativecommons.org/licenses/by-sa/2.0)], via Wikimedia Commons
$in / $in vs. $or
pipeline = [
{"$match": {"info.artistName": {"$in": [artist,
nemesis]}},
.....,
]
{"$match": {"$or": ["info.artistName": artist,
"info.artistName": nemesis]}},
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'},
.......
],
}
$in & $un-un-unwind & $avg
sub-sub-documents / $avg
pipeline = [
{"$match": {"info.artistName": {"$in": [artist, nemesis]}}},
{"$unwind": "$info.children"},
{"$unwind": "$info.children.offers"},
{"$unwind": "$info.children.offers.assets"}
{"$group": {"_id": "$info.children.name",
"playtime": {"$avg": "$info.children.offers.assets.duration"},
}},
{"$project":......
]
DEMO
$in
$avg
$unwind*3
Queries
use
db.collection.aggregate().explain()
to get a better understanding of queries
Tip
{'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)',
'adamId': 573885160,
//release: album / single / playlist
'info': {'artistId': 358714030,
'artistIdsIndex': 358714030,
'artistName': 'Imagine Dragons',
'name': 'Night Visions',
'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}],
'releaseDate': '2013-02-01',
'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')",
'userRating': {'ratingCount': 8, 'value': 5}}
// songs
'children': [{'artistId': 358714030,
'kind': 'song',
'name': 'Amsterdam',
'offers': [{'assets': [{'duration': 194}],
'price': 0.99,
'priceFormatted': 'USDxa00.99'}],
'releaseDate': '2013-02-01'},
.......
],
}
working with text
pipeline = [ {"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, {"$unwind": "$info.offers"},
{"$project": { "info.offers.price": 1, "info.offers.priceFormatted": 1,
"artist": "$info.artistName", "product": "$info.name",
"isUSD": {"$cmp": [{"$toLower": {
"$substr": ["$info.offers.priceFormatted", 0, 3]}}, "usd"]}}},
{"$match": {"isUSD": 0}},
{"$sort": {"info.offers.price": DESCENDING}},
{"$group": {
"_id": {"artist": "$artist"},
"releases": {"$push": {"price": "$info.offers.price", "product": "$product"}}
}}, {"$project":......]
string operations / $cmp
DEMO
$in
$avg
$unwind*3
Accumulators
$sum
$count
$min / $max
$first / $last
$push / $addToSet
$stdDevPop / $stdDevSamp
Boolean Operators
Set Operators
Comparison Operators
Arithmetic Operators
String Operators
Text Search Operators
Array Operators
Variable Operators
Literal Operators
Date Operators
Conditional Expressions
Expression Operators
$and, $or, $not
$setEquals, $setUnion, $anyElementTrue,…
$cmp, $eq, $lt, &lte,…
$add, $abs, $ceil, $floor, $log, $mod, $pow, $exp,…
$concat, $substring, $toLower,…
$meta
$size, $isArray, $concatArrays, $arrayElemAt, $slice.
$let, $,map
$literal
$dateOfYear, $year, $dateToString,…
$cond, $ifNull
pipeline = [ 

{"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, 

{"$unwind": "$info.offers"}, 

{"$project": { "info.offers.price": 1, "info.offers.priceFormatted": 1, "artist": "$info.artistName",
"product": "$info.name", "isUSD": {"$cmp": [{"$toLower": { "$substr": ["$info.offers.priceFormatted",
0, 3]}}, "usd"]}}},{"$match": {"isUSD": 0}},{"$group": { "_id": "$artist", "pricing": {"$push":
"$info.offers.price"}}},
{"$project": {
"pricing": {"$map": {"input": "$pricing",
"as": "value",
"in": {"$multiply": ["$$value",
eur_dollar_exchange_rate ]}}}}}]
$map
DEMO
$map
pipeline = [
{"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, {"$unwind": "$info.offers"},
{"$project": {"info.offers.price": 1, "info.offers.priceFormatted": 1, "artist": "$info.artistName", "product": "$info.name",
"currency": {"$toUpper": {"$substr": ["$info.offers.priceFormatted", 0, 3]}}}},
{"$lookup": {
"from": "exchangerates",
"localField": "currency",
"foreignField": "_id",
"as": "exchangeRate" }},
{"$match": {"exchangeRate": {"$size": 1}}},
{"$group": {
"_id": {"artist": "$artist", "currency": "$currency"}, "pricing": {"$push": "$info.offers.price"},
"rate": {"$first": "$exchangeRate.rate"}}},
{"$project": { "_id": "$_id.artist", "currency": "$_id.currency", "pricing": {"$map": {"input": "$pricing", "as": "value", "in":
{"$multiply": ["$$value", {"$arrayElemAt": ["$rate", 0]}]}}} }}]
$lookup (mongoDB 3.2+)
Tip
Infastructure
work with dedicated server for aggregation
e.g. a (hidden/delayed) member of replica set or standalone copy
especially useful if you primary is busy with writes
DEMO
Aggregation Framework
Boosting Performance
Collection
Shard1 Shard2 Shard3 Shard4
server-1 server-2 server-3 server-4
server
CollectionCollection
server server
Replica-Set
horizontal scaling
one primary + copies
Sharding
vertical scaling
split the data across nodes
one server - utilize multiple cpu + IO
"Micro-Sharding"
Shard1 Shard2 … ShardN
"Micro-Sharding"
1 2 … N
1 2 N…
CPUs
High IOPS
RAM
"Micro-Sharding"
Performance Plus ~= N * Shard
DEMO
Map Reduce in mongoDB
Boosting Performance
DEMO
boosting!
2nd Call for Proposals
reserved for Hot Topics
~first week of June
ADVERTISEMENT
Alexander C. S. Hendorf
@hendorf
self.Slides: https://goo.gl/VbzFrc
John Page's Tutorial Micro-Sharding:
https://gist.github.com/johnlpage/e0bb9971f4f1c4ed3a09

More Related Content

What's hot

Dropping ACID with MongoDB
Dropping ACID with MongoDBDropping ACID with MongoDB
Dropping ACID with MongoDBkchodorow
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview민태 김
 
Connecting XForms to Databases: An Extension to the XForms Markup Language
Connecting XForms to Databases: An Extension to the XForms Markup LanguageConnecting XForms to Databases: An Extension to the XForms Markup Language
Connecting XForms to Databases: An Extension to the XForms Markup LanguageMarkku Laine
 
1024+ Seconds of JS Wizardry - JSConf.eu 2013
1024+ Seconds of JS Wizardry - JSConf.eu 20131024+ Seconds of JS Wizardry - JSConf.eu 2013
1024+ Seconds of JS Wizardry - JSConf.eu 2013Martin Kleppe
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shellady36
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2ady36
 
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...MongoDB
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...doughellmann
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helperslicejack
 
Ch1(introduction to php)
Ch1(introduction to php)Ch1(introduction to php)
Ch1(introduction to php)Chhom Karath
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤Takahiro Inoue
 

What's hot (20)

Dropping ACID with MongoDB
Dropping ACID with MongoDBDropping ACID with MongoDB
Dropping ACID with MongoDB
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview
 
Connecting XForms to Databases: An Extension to the XForms Markup Language
Connecting XForms to Databases: An Extension to the XForms Markup LanguageConnecting XForms to Databases: An Extension to the XForms Markup Language
Connecting XForms to Databases: An Extension to the XForms Markup Language
 
Wsomdp
WsomdpWsomdp
Wsomdp
 
Ae internals
Ae internalsAe internals
Ae internals
 
Tabledown
TabledownTabledown
Tabledown
 
1024+ Seconds of JS Wizardry - JSConf.eu 2013
1024+ Seconds of JS Wizardry - JSConf.eu 20131024+ Seconds of JS Wizardry - JSConf.eu 2013
1024+ Seconds of JS Wizardry - JSConf.eu 2013
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
 
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
 
Canvas - The Cure
Canvas - The CureCanvas - The Cure
Canvas - The Cure
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
 
Delta5 Summary
Delta5 SummaryDelta5 Summary
Delta5 Summary
 
Daily notes
Daily notesDaily notes
Daily notes
 
Speeding up Red Team engagements with carnivorall
Speeding up Red Team engagements with carnivorallSpeeding up Red Team engagements with carnivorall
Speeding up Red Team engagements with carnivorall
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helper
 
Ch1(introduction to php)
Ch1(introduction to php)Ch1(introduction to php)
Ch1(introduction to php)
 
MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤MongoDBで作るソーシャルデータ新解析基盤
MongoDBで作るソーシャルデータ新解析基盤
 

Similar to Data Mangling with mongoDB the Right Way [PyData London] 2016]

Data mangling with mongo db the right way [pyconit 2016]
Data mangling with mongo db the right way [pyconit 2016]Data mangling with mongo db the right way [pyconit 2016]
Data mangling with mongo db the right way [pyconit 2016]Alexander Hendorf
 
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageNoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageAlexander Hendorf
 
Data analysis and visualization with mongo db [mongodb world 2016]
Data analysis and visualization with mongo db [mongodb world 2016]Data analysis and visualization with mongo db [mongodb world 2016]
Data analysis and visualization with mongo db [mongodb world 2016]Alexander Hendorf
 
odoo json rpc.docx
odoo json rpc.docxodoo json rpc.docx
odoo json rpc.docxloufgxrtvct
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...doughellmann
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 WebFrameworks
 
The things browsers can do! SAE Alumni Convention 2014
The things browsers can do! SAE Alumni Convention 2014The things browsers can do! SAE Alumni Convention 2014
The things browsers can do! SAE Alumni Convention 2014Christian Heilmann
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than WebHeiko Behrens
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Hidenori Fujimura
 
Fighting fraud: finding duplicates at scale
Fighting fraud: finding duplicates at scaleFighting fraud: finding duplicates at scale
Fighting fraud: finding duplicates at scaleAlexey Grigorev
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02PL dream
 
Repaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webRepaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webPablo Garaizar
 
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Amazon Web Services
 
Viki Big Data Meetup 2013_10
Viki Big Data Meetup 2013_10Viki Big Data Meetup 2013_10
Viki Big Data Meetup 2013_10ishanagrawal90
 
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...IT Event
 

Similar to Data Mangling with mongoDB the Right Way [PyData London] 2016] (20)

Data mangling with mongo db the right way [pyconit 2016]
Data mangling with mongo db the right way [pyconit 2016]Data mangling with mongo db the right way [pyconit 2016]
Data mangling with mongo db the right way [pyconit 2016]
 
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageNoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
 
Data analysis and visualization with mongo db [mongodb world 2016]
Data analysis and visualization with mongo db [mongodb world 2016]Data analysis and visualization with mongo db [mongodb world 2016]
Data analysis and visualization with mongo db [mongodb world 2016]
 
odoo json rpc.docx
odoo json rpc.docxodoo json rpc.docx
odoo json rpc.docx
 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 Essentials
 
Api vortrag
Api vortragApi vortrag
Api vortrag
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
The things browsers can do! SAE Alumni Convention 2014
The things browsers can do! SAE Alumni Convention 2014The things browsers can do! SAE Alumni Convention 2014
The things browsers can do! SAE Alumni Convention 2014
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
 
SAKHIB HUSSAIN PPT 2.pptx
SAKHIB HUSSAIN PPT 2.pptxSAKHIB HUSSAIN PPT 2.pptx
SAKHIB HUSSAIN PPT 2.pptx
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性
 
HTML5 - Pedro Rosa
HTML5 - Pedro RosaHTML5 - Pedro Rosa
HTML5 - Pedro Rosa
 
Fighting fraud: finding duplicates at scale
Fighting fraud: finding duplicates at scaleFighting fraud: finding duplicates at scale
Fighting fraud: finding duplicates at scale
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Repaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares webRepaso rápido a los nuevos estándares web
Repaso rápido a los nuevos estándares web
 
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
 
Viki Big Data Meetup 2013_10
Viki Big Data Meetup 2013_10Viki Big Data Meetup 2013_10
Viki Big Data Meetup 2013_10
 
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
 

More from Alexander Hendorf

Deep Learning for Fun and Profit [PyConDE 2018]
Deep Learning for Fun and Profit [PyConDE 2018]Deep Learning for Fun and Profit [PyConDE 2018]
Deep Learning for Fun and Profit [PyConDE 2018]Alexander Hendorf
 
Agile Datenanalsyse - der schnelle Weg zum Mehrwert
Agile Datenanalsyse - der schnelle Weg zum MehrwertAgile Datenanalsyse - der schnelle Weg zum Mehrwert
Agile Datenanalsyse - der schnelle Weg zum MehrwertAlexander Hendorf
 
Einführung Datenanalyse mit Pandas [data2day]
Einführung Datenanalyse mit Pandas [data2day]Einführung Datenanalyse mit Pandas [data2day]
Einführung Datenanalyse mit Pandas [data2day]Alexander Hendorf
 
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]Introduction to Pandas and Time Series Analysis [Budapest BI Forum]
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]Alexander Hendorf
 
Introduction to Pandas and Time Series Analysis [PyCon DE]
Introduction to Pandas and Time Series Analysis [PyCon DE]Introduction to Pandas and Time Series Analysis [PyCon DE]
Introduction to Pandas and Time Series Analysis [PyCon DE]Alexander Hendorf
 
Introduction to Data Analtics with Pandas [PyCon Cz]
Introduction to Data Analtics with Pandas [PyCon Cz]Introduction to Data Analtics with Pandas [PyCon Cz]
Introduction to Data Analtics with Pandas [PyCon Cz]Alexander Hendorf
 
Neat Analytics with Pandas 4 3 [PyParis]
Neat Analytics with Pandas 4 3 [PyParis]Neat Analytics with Pandas 4 3 [PyParis]
Neat Analytics with Pandas 4 3 [PyParis]Alexander Hendorf
 
Time travel and time series analysis with pandas + statsmodels
Time travel and time series analysis with pandas + statsmodelsTime travel and time series analysis with pandas + statsmodels
Time travel and time series analysis with pandas + statsmodelsAlexander Hendorf
 

More from Alexander Hendorf (9)

Deep Learning for Fun and Profit [PyConDE 2018]
Deep Learning for Fun and Profit [PyConDE 2018]Deep Learning for Fun and Profit [PyConDE 2018]
Deep Learning for Fun and Profit [PyConDE 2018]
 
Databases for Data Science
Databases for Data ScienceDatabases for Data Science
Databases for Data Science
 
Agile Datenanalsyse - der schnelle Weg zum Mehrwert
Agile Datenanalsyse - der schnelle Weg zum MehrwertAgile Datenanalsyse - der schnelle Weg zum Mehrwert
Agile Datenanalsyse - der schnelle Weg zum Mehrwert
 
Einführung Datenanalyse mit Pandas [data2day]
Einführung Datenanalyse mit Pandas [data2day]Einführung Datenanalyse mit Pandas [data2day]
Einführung Datenanalyse mit Pandas [data2day]
 
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]Introduction to Pandas and Time Series Analysis [Budapest BI Forum]
Introduction to Pandas and Time Series Analysis [Budapest BI Forum]
 
Introduction to Pandas and Time Series Analysis [PyCon DE]
Introduction to Pandas and Time Series Analysis [PyCon DE]Introduction to Pandas and Time Series Analysis [PyCon DE]
Introduction to Pandas and Time Series Analysis [PyCon DE]
 
Introduction to Data Analtics with Pandas [PyCon Cz]
Introduction to Data Analtics with Pandas [PyCon Cz]Introduction to Data Analtics with Pandas [PyCon Cz]
Introduction to Data Analtics with Pandas [PyCon Cz]
 
Neat Analytics with Pandas 4 3 [PyParis]
Neat Analytics with Pandas 4 3 [PyParis]Neat Analytics with Pandas 4 3 [PyParis]
Neat Analytics with Pandas 4 3 [PyParis]
 
Time travel and time series analysis with pandas + statsmodels
Time travel and time series analysis with pandas + statsmodelsTime travel and time series analysis with pandas + statsmodels
Time travel and time series analysis with pandas + statsmodels
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Data Mangling with mongoDB the Right Way [PyData London] 2016]

  • 1. Data Mangling with mongoDB Alexander C. S. Hendorf @hendorf
  • 2. Alexander C. S. Hendorf CTO Königsweg GmbH Always love data and new ideas mongoDB master 2016, MUG Orga. EuroPython organizer + program chair speaker mongoDB world NYC, CEBIT,… @hendorf
  • 3. Agenda 1. Map Reduce 2. Aggregation framework a. Pipeline model b. Pipeline stages c. Accumulators & Expression Operators d. Boosting performance 3. Redemption & summary
  • 4. Terminology json-like object {"_id": 1, "say": "Hello"} no schema enforced documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument collection dododododododododododo dododododododododododo dododododododododododo dododododododododododo document database
  • 5. By Moumou82 (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
  • 6. {'_id': ObjectId('5215d7f3ee6da1070d5cb88a'), 'adamId': 573885160, 'added': {'epoch_time': 1377163251.691398, 'human_time': 'Thu 22.08.2013 09:20:51 UTC'}, 'headers': {'dict': {'apple-timing-app': '222 ms', 'cache-control': 'no-transform, max-age=60', 'connection': 'close', 'content-encoding': 'gzip', 'content-length': '17404', 'content-type': 'text/html; charset=UTF-8', 'date': 'Thu, 22 Aug 2013 09:20:51 GMT', 'last-modified': 'Thu, 22 Aug 2013 09:20:51 GMT', 'vary': 'Accept-Encoding', 'x-apple-aka-ttl': 'Generated Thu Aug 22 02:20:51 PDT 2013, Expires Thu Aug 22 02:21:51 PDT 2013, TTL 60s', 'x-apple-application-instance': '1009514', 'x-apple-application-site': 'NWK', 'x-apple-jingle-correlation-key': 'VASQDI34SJY5G', 'x-apple-lok-response-date': 'Thu Aug 22 02:20:51 PDT 2013', 'x-apple-orig-url': 'https://itunes.apple.com/co/album/id573885160', 'x-apple-partner': 'origin.0', 'x-apple-translated-wo-url': '/WebObjects/MZStore.woa/wa/ viewAlbum?id=573885160&cc=co', 'x-webobjects-loadaverage': '0'}, 'encodingheader': None, 'fp': None, 'headers': {'Cache-Control': 'no-transform, max-age=60', 'Connection': 'close', 'Content-Encoding': 'gzip', 'Content-Length': '17404', 'Content-Type': 'text/html; charset=UTF-8', 'Date': 'Thu, 22 Aug 2013 09:20:51 GMT', 'Last-Modified': 'Thu, 22 Aug 2013 09:20:51 GMT', 'Vary': 'Accept-Encoding', 'X-Apple-Partner': 'origin.0', 'apple-timing-app': '222 ms', 'x-apple-aka- ttl': 'Generated Thu Aug 22 02:20:51 PDT 2013, Expires Thu Aug 22 02:21:51 PDT 2013, TTL 60s', 'x-apple-application-instance': '1009514', 'x-apple-application-site': 'NWK', 'x-apple-jingle-correlation-key': 'VASQDI34SJY5G', 'x-apple-lok- response-date': 'Thu Aug 22 02:20:51 PDT 2013', 'x-apple-orig-url': 'https://itunes.apple.com/co/album/id573885160', 'x-apple-translated-wo-url': '/WebObjects/MZStore.woa/wa/viewAlbum?id=573885160&cc=co', 'x-webobjects-loadaverage': '0'}, 'maintype': 'text', 'plist': ['charset=UTF-8'], 'plisttext': '; charset=UTF-8', 'seekable': 0, 'startofbody': None, 'startofheaders': None, 'status': '', 'subtype': 'html', 'type': 'text/html', 'typeheader': 'text/html; charset=UTF-8', 'unixfrom': ''}, 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'artwork': [[200, 'http://a1.mzstatic.com/ us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover200x200.jpeg'], [100, 'http://a5.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover100x100.jpeg'], [250, 'http://a2.mzstatic.com/us/r30/ Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover250x250.jpeg'], [130, 'http://a4.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover130x130.jpeg'], [400, 'http://a3.mzstatic.com/us/r30/Music/v4/9a/ ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover400x400.jpeg'], [1400, 'http://a2.mzstatic.com/us/r30/Music/v4/9a/ce/66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover1400x1400.jpeg'], [1200, 'http://a4.mzstatic.com/us/r30/Music/v4/9a/ce/ 66/9ace66e1-f14f-4981-ac6f-8acfcd591960/cover1200x1200.jpeg']], 'children': [{'adamId': 573885322, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/ imagine-dragons/id358714030?l=en', 'bookletType': 'pdf', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'description': None, 'discNumber': None, 'genres': [20, 21, 1144], 'id': 573885322, 'kind': 'booklet', 'name': 'Digital Booklet - Night Visions', 'nameRaw': 'Digital Booklet - Night Visions', 'offers': [{'assets': [{'flavor': 'booklet', 'size': 2705648}], 'price': None, 'priceFormatted': '', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0, 'releaseDate': '2003-04-28', 'releaseDateEpoch': datetime.datetime(2003, 4, 28, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885322', 'trackNumber': None, 'url': 'https://itunes.apple.com/co/album/digital-booklet- night-visions/id573885160?i=573885322&l=en'}, {'adamId': 573885272, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser', 'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885272, 'kind': 'song', 'name': 'Radioactive', 'nameRaw': 'Radioactive', 'offers': [{'assets': [{'duration': 186, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a840.phobos.apple.com/us/r2000/019/Music2/v4/4f/0d/30/4f0d30e9-ffa3-695c-44c8-d915f9e3fe98/mzaf_5753162857555111697.aac.m4a'}, 'size': 6830469}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885272&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 1, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885272', 'trackNumber': 1, 'url': 'https://itunes.apple.com/co/album/radioactive/id573885160?i=573885272&l=en'}, {'adamId': 573885274, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885274, 'kind': 'song', 'name': 'Tiptoe', 'nameRaw': 'Tiptoe', 'offers': [{'assets': [{'duration': 194, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1623.phobos.apple.com/us/r2000/020/Music2/v4/5d/6c/3a/5d6c3a3c-7ea0-7f71-d100- cf90dc9e8433/mzaf_5720461395889014325.aac.m4a'}, 'size': 7244474}], 'buyParams': 'productType=S&price=990&salableAdamId=573885274&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.009765625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885274', 'trackNumber': 2, 'url': 'https://itunes.apple.com/co/ album/tiptoe/id573885160?i=573885274&l=en'}, {'adamId': 573885275, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885275, 'kind': 'song', 'name': "It's Time", 'nameRaw': "It's Time", 'offers': [{'assets': [{'duration': 240, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http:// a1557.phobos.apple.com/us/r2000/006/Music2/v4/8b/c6/d9/8bc6d932-6ef4-166d-20fb-7cd5cba4c79a/mzaf_6099651544288202212.aac.m4a'}, 'size': 8452717}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885275&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.41357421875, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https:// itun.es/co/ORmnI?i=573885275', 'trackNumber': 3, 'url': 'https://itunes.apple.com/co/album/its-time/id573885160?i=573885275&l=en'}, {'adamId': 573885278, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser', 'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885278, 'kind': 'song', 'name': 'Demons', 'nameRaw': 'Demons', 'offers': [{'assets': [{'duration': 177, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a174.phobos.apple.com/us/r2000/016/Music/v4/e8/cb/a1/e8cba109-26ad-f7ea-f648-4a4bffd595f1/mzaf_6503879570199009699.aac.m4a'}, 'size': 6346043}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885278&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.1343994140625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885278', 'trackNumber': 4, 'url': 'https://itunes.apple.com/co/album/demons/id573885160?i=573885278&l=en'}, {'adamId': 573885280, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee & Alex Da Kid', 'url': 'https://itunes.apple.com/co/composer/id202856766?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885280, 'kind': 'song', 'name': 'On Top of the World', 'nameRaw': 'On Top of the World', 'offers': [{'assets': [{'duration': 192, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1825.phobos.apple.com/us/ r2000/015/Music2/v4/e1/36/20/e13620e1-31a2-5f9a-7766-769c97399b81/mzaf_7878115814185165018.aac.m4a'}, 'size': 6940151}], 'buyParams': 'productType=S&price=1290&salableAdamId=573885280&pricingParameters=PLUS', 'price': 1.29, 'priceFormatted': 'USDxa01.29', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.1343994140625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ ORmnI?i=573885280', 'trackNumber': 5, 'url': 'https://itunes.apple.com/co/album/on-top-of-the-world/id573885160?i=573885280&l=en'}, {'adamId': 573885281, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https:// itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885281, 'kind': 'song', 'name': 'Amsterdam', 'nameRaw': 'Amsterdam', 'offers': [{'assets': [{'duration': 241, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a80.phobos.apple.com/us/r2000/007/Music/v4/28/35/bc/2835bc7f-c8e2-8a8b-7cd3-aae132bd43f2/mzaf_8850126300550805333.aac.m4a'}, 'size': 8516981}], 'buyParams': 'productType=S&price=990&salableAdamId=573885281&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.003662109375, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885281', 'trackNumber': 6, 'url': 'https://itunes.apple.com/co/album/amsterdam/id573885160?i=573885281&l=en'}, {'adamId': 573885283, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885283, 'kind': 'song', 'name': 'Hear Me', 'nameRaw': 'Hear Me', 'offers': [{'assets': [{'duration': 235, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a157.phobos.apple.com/us/r2000/019/Music/v4/cf/6e/5d/cf6e5d87- fb86-55e2-2a9e-b62e94a2c4ea/mzaf_3208300556053684171.aac.m4a'}, 'size': 9043466}], 'buyParams': 'productType=S&price=990&salableAdamId=573885283&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00439453125, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885283', 'trackNumber': 7, 'url': 'https://itunes.apple.com/co/album/hear-me/id573885160?i=573885283&l=en'}, {'adamId': 573885284, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/ imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885284, 'kind': 'song', 'name': 'Every Night', 'nameRaw': 'Every Night', 'offers': [{'assets': [{'duration': 217, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a962.phobos.apple.com/us/r2000/003/Music2/v4/ac/72/44/ac7244de-f1ee-4116-f494-acf5243a6e8f/mzaf_8514226465678986156.aac.m4a'}, 'size': 7730368}], 'buyParams': 'productType=S&price=990&salableAdamId=573885284&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.000732421875, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885284', 'trackNumber': 8, 'url': 'https://itunes.apple.com/co/album/every-night/id573885160?i=573885284&l=en'}, {'adamId': 573885288, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee, Alex Da Kid & Josh Mosser', 'url': 'https://itunes.apple.com/co/composer/id499982942?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885288, 'kind': 'song', 'name': 'Bleeding Out', 'nameRaw': 'Bleeding Out', 'offers': [{'assets': [{'duration': 223, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1694.phobos.apple.com/us/r2000/007/Music/ v4/6c/a1/1d/6ca11d2b-deb3-2afb-964b-7377f92ab57f/mzaf_6333841192228218638.aac.m4a'}, 'size': 7895431}], 'buyParams': 'productType=S&price=990&salableAdamId=573885288&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0108642578125, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885288', 'trackNumber': 9, 'url': 'https://itunes.apple.com/co/album/bleeding-out/id573885160?i=573885288&l=en'}, {'adamId': 573885309, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/ co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885309, 'kind': 'song', 'name': 'Underdog', 'nameRaw': 'Underdog', 'offers': [{'assets': [{'duration': 209, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1948.phobos.apple.com/us/r2000/008/Music2/v4/03/27/1f/03271f66-9dc2-4a43-894b-ec8dbb9cab84/mzaf_2556941019434400323.aac.m4a'}, 'size': 7569963}], 'buyParams': 'productType=S&price=990&salableAdamId=573885309&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00146484375, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885309', 'trackNumber': 10, 'url': 'https://itunes.apple.com/co/album/underdog/id573885160?i=573885309&l=en'}, {'adamId': 573885311, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': None, 'url': 'https://itunes.apple.com/co/composer?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885311, 'kind': 'song', 'name': 'Nothing Left to Say / Rocks', 'nameRaw': 'Nothing Left to Say / Rocks', 'offers': [{'assets': [{'duration': 539, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1480.phobos.apple.com/us/r2000/010/Music2/v4/f9/4e/65/ f94e651a-1713-9288-6e73-0f9aba83cf76/mzaf_4695219378617698238.aac.m4a'}, 'size': 18730805.0}], 'buyParams': 'productType=S&price=990&salableAdamId=573885311&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.00146484375, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885311', 'trackNumber': 11, 'url': 'https://itunes.apple.com/co/album/nothing-left-to-say-rocks/id573885160?i=573885311&l=en'}, {'adamId': 573885312, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https:// itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon, Ben McKee & Clint Holgate', 'url': 'https://itunes.apple.com/co/ composer/id573885315?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885312, 'kind': 'song', 'name': 'Cha-Ching (Till We Grow Older)', 'nameRaw': 'Cha-Ching (Till We Grow Older)', 'offers': [{'assets': [{'duration': 248, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1093.phobos.apple.com/us/r2000/006/Music/v4/c4/ea/59/c4ea59fb-598c-703a-0bbe-0e01bda208e3/mzaf_6664089561292583747.aac.m4a'}, 'size': 9052299}], 'buyParams': 'productType=S&price=990&salableAdamId=573885312&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0025634765625, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ORmnI?i=573885312', 'trackNumber': 12, 'url': 'https://itunes.apple.com/co/album/cha-ching-till-we-grow-older/ id573885160?i=573885312&l=en'}, {'adamId': 573885318, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https://itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885318, 'kind': 'song', 'name': 'Working Man', 'nameRaw': 'Working Man', 'offers': [{'assets': [{'duration': 235, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a2.phobos.apple.com/us/ r2000/000/Music2/v4/3b/c6/8e/3bc68e6c-0d26-6385-7155-37467fbafc22/mzaf_8488610176120965913.aac.m4a'}, 'size': 8608037}], 'buyParams': 'productType=S&price=990&salableAdamId=573885318&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0047607421875, 'releaseDate': '2013-02-01', 'releaseDateEpoch': datetime.datetime(2013, 2, 1, 0, 0), 'shortUrl': 'https://itun.es/co/ ORmnI?i=573885318', 'trackNumber': 13, 'url': 'https://itunes.apple.com/co/album/working-man/id573885160?i=573885318&l=en'}, {'adamId': 573885320, 'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'artistUrl': 'https://itunes.apple.com/co/artist/imagine-dragons/id358714030?l=en', 'collectionId': 573885160, 'collectionName': 'Night Visions', 'composer': {'name': 'Dan Reynolds, Wayne Sermon & Ben McKee', 'url': 'https:// itunes.apple.com/co/composer/id499982939?l=en'}, 'contentRating': {'system': 'RIAA'}, 'discNumber': 1, 'genres': [20, 34, 21, 1144], 'id': 573885320, 'kind': 'song', 'name': 'Fallen', 'nameRaw': 'Fallen', 'offers': [{'assets': [{'duration': 179, 'flavor': 'plusAudio', 'preview': {'duration': 90, 'url': 'http://a1415.phobos.apple.com/us/r2000/018/Music/v4/7c/dd/5a/7cdd5ad1-5df0-2797-01d2-dde46d790daf/mzaf_1820141309047882775.aac.m4a'}, 'size': 6891212}], 'buyParams': 'productType=S&price=990&salableAdamId=573885320&pricingParameters=PLUS', 'price': 0.99, 'priceFormatted': 'USDxa00.99', 'type': 'buy', 'variant': 'PLUS'}], 'pieceId': None, 'popularity': 0.0274658203125, 'releaseDate':
  • 7. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}], }
  • 9. Map Reduce in 15 sec documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument filter and sort e.g. (hello, 1) (world, 1) (hello, 1) (peter, 1) (parker, 1) input emit (key, value) pairs reducer sum up count for each key e.g. (hello, 2) (world, 1) (peter, 1) map reduce
  • 10. Map Reduce in 15 sec documentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocumentdocument input map reduce 1 n 2 3 1 2 3 (hello, 1) (hello, 1) (hello, 2)
  • 11. // map function () { var artist = this.info.artistName; emit(artist, 1); } // reduce function (key, values) { var total = 0; for (var i = 0; i < values.length; i++) { total += values[i]; } return total; } }
  • 12. DEMO run map reduce in mongoDB
  • 13. mapReduce in mongoDB • provides map and reduce
 + finalize phase. query, sort and limit documents • output: inline or to a collection
  • 14. Map Reduce was designed for parallelization. Single Node or Replica-Sets can not do this.
  • 15. Map Reduce or: The Evil Step-Mother.
  • 17. • introduced with mongoDB 2.2 in 2012 • framework for data aggregation • it's designed 'straight-forward' • documents enter a 
 multi-stage pipeline that transforms the documents 
 into an aggregated results • all operations have an optimization phase 
 which attempts to reshape the pipeline for improved performance
  • 18.
  • 19. get the baton Pipeline is like a relay race $match $group something smart $project present nicely
  • 20. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}], }
  • 21. pipeline = [ # find in aggregation is $match, sql: WHERE {"$match": {"info.artistName": artist}}, # $project, sql: SELECT {"$project": {"release": "$info.name", "_id": 0}}, {"$sort": {"release": ASCENDING}} ]
  • 22.
  • 24. Caveat • mongoDB returns a cursor • after complete iteration the cursor is empty. • save the result to a variable if you want to re-use it
  • 25. Aggregation stages $match $sort $limit $project $group $unwind $lookup WHERE | HAVING ORDER BY LIMIT SELECT GROUP BY (JOIN) LEFT OUTER JOIN $redact • $skip • $geoNear • $out SQL *added in 3.2 + $sample • $indexStats *
  • 26. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}], }
  • 27. pipeline = [ # find in aggregation is $match, sql: WHERE {"$match": {"info.artistName": artist}}, # GROUP BY & COUNT() {"$group": { "_id": "$info.name", "count": {"$sum": 1}}}, # $project, sql: SELECT {"$project": {"release": "$_id", "_id": 0}}, {"$sort": {"release": ASCENDING}} ]
  • 29. Caveat • Python dicts are not ordered! • mind the right execution order -> use a datatype maintaining the order
  • 30. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}, ....... ], } working with listed sub-documents
  • 31. pipeline = [ {"$match": {"info.artistName": artist}}, # "explode" list {"$unwind": "$info.children"}, {"$group": { "_id": "$info.children.name"}}, {"$project": {"song": "$_id", "_id": 0}}, {"$sort": {"release": ASCENDING}} ]
  • 32. { "mother": "Dorothea", children: [ {"born": 1785, "name": "Jacob Ludwig Karl"}, {"born": 1786, "name": "Wilhelm Carl"}, {"born": 1787, "name": "Carl Friedrich"}, {"born": 1788, "name": "Ferdinand Philipp"}, {"born": 1790, "name": "Ludwig Emil"}, {"born": 1793, "name": "Charlotte Amalie"}, ]}
  • 33. { "mother": "Dorothea", 
 children: {"born": 1785, "name": "Jacob Ludwig Karl"}]} { "mother": "Dorothea", 
 children: {"born": 1786, "name": "Wilhelm Carl"}} { "mother": "Dorothea", 
 children: {"born": 1787, "name": "Carl Friedrich"}]} { "mother": "Dorothea", 
 children: {"born": 1788, "name": "Ferdinand Philipp"}} { "mother": "Dorothea", 
 children: {"born": 1790, "name": "Ludwig Emil"}} { "mother": "Dorothea", 
 children: {"born": 1793, "name": "Charlotte Amalie"}}
  • 34.
  • 36. DEMO
  • 37. $skip skip documents in found set $out write the resulting documents of the aggregation pipeline to a collection, also incremental.
  • 38. $geoNear returns an ordered stream of documents 
 based on the proximity to a geospatial point $redact reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves
  • 39. $lookup left outer join with another collection. new in 3.2 $indexStats statistics on index usage (an actual performance metric) $sample select some random documents from a collection
  • 41. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}, ....... ], } accumulators: $min / $max $first / $last
  • 42. pipeline = [ {"$match": {"info.artistName": artist}}, {"$group": { "_id": "", "minDate": {"$min": "$info.releaseDateEpoch"}, "maxDate": {"$max": "$info.releaseDateEpoch"}}}, {"$project": {"_id": 0, "minDate": 1, "maxDate": 1}}, ] ISO Date $min / $max
  • 43. pipeline = [ {"$match": {"info.artistName": artist}}, {"$group": { "_id": "", "minDate": {"$first": "$info.releaseDate"}, "maxDate": {"$last": "$info.releaseDate"}}}, {"$project": {"_id": 0, "minDate": 1, "maxDate": 1}}, ] String $first / $last
  • 44. date operators pipeline = [ {"$match": {"info.artistName": artist}}, {"$sort": SON([("info.releaseDate", ASCENDING)])}, {"$group": { "_id": {"$year": "$info.releaseDateEpoch"}, "count": {"$sum": "1}}}, {"$project": {"year": "$_id.year", "_id": 0, "count": 1}}}, ] ISO Date
  • 45. date operators / multikey groups pipeline = [ {"$match": {"info.artistName": artist}}, {"$sort": SON([("info.releaseDate", ASCENDING)])}, {"$group": { "_id": { "year": {"$year": "$info.releaseDateEpoch", "month": {"$month": "$info.releaseDateEpoch"}}}, "count": {"$sum": "1}, {"$project": {"year": "$_id.year","month": "$_id.month", "_id": 0, "count": 1}}}, ] ISO Date
  • 47. The Nemesis. Google say # By Katy_Perry_-_MTV_VMA_2011.jpg: Philip Nelson from San Antonio, TX, USA derivative work: Truu (Katy_Perry_-_MTV_VMA_2011.jpg) [CC BY-SA 2.0 (http://creativecommons.org/licenses/by-sa/2.0)], via Wikimedia Commons
  • 48. $in / $in vs. $or pipeline = [ {"$match": {"info.artistName": {"$in": [artist, nemesis]}}, ....., ] {"$match": {"$or": ["info.artistName": artist, "info.artistName": nemesis]}},
  • 49. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}, ....... ], } $in & $un-un-unwind & $avg
  • 50. sub-sub-documents / $avg pipeline = [ {"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, {"$unwind": "$info.children"}, {"$unwind": "$info.children.offers"}, {"$unwind": "$info.children.offers.assets"} {"$group": {"_id": "$info.children.name", "playtime": {"$avg": "$info.children.offers.assets.duration"}, }}, {"$project":...... ]
  • 52. Queries use db.collection.aggregate().explain() to get a better understanding of queries Tip
  • 53. {'_id': 'ObjectId(5215d7f3ee6da1070d5cb88a)', 'adamId': 573885160, //release: album / single / playlist 'info': {'artistId': 358714030, 'artistIdsIndex': 358714030, 'artistName': 'Imagine Dragons', 'name': 'Night Visions', 'offers': [{'price': 9.99, 'priceFormatted': 'USDxa09.99'}], 'releaseDate': '2013-02-01', 'releaseDateEpoch': "ISODate('2013-02-01T00:00:00Z')", 'userRating': {'ratingCount': 8, 'value': 5}} // songs 'children': [{'artistId': 358714030, 'kind': 'song', 'name': 'Amsterdam', 'offers': [{'assets': [{'duration': 194}], 'price': 0.99, 'priceFormatted': 'USDxa00.99'}], 'releaseDate': '2013-02-01'}, ....... ], } working with text
  • 54. pipeline = [ {"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, {"$unwind": "$info.offers"}, {"$project": { "info.offers.price": 1, "info.offers.priceFormatted": 1, "artist": "$info.artistName", "product": "$info.name", "isUSD": {"$cmp": [{"$toLower": { "$substr": ["$info.offers.priceFormatted", 0, 3]}}, "usd"]}}}, {"$match": {"isUSD": 0}}, {"$sort": {"info.offers.price": DESCENDING}}, {"$group": { "_id": {"artist": "$artist"}, "releases": {"$push": {"price": "$info.offers.price", "product": "$product"}} }}, {"$project":......] string operations / $cmp
  • 56. Accumulators $sum $count $min / $max $first / $last $push / $addToSet $stdDevPop / $stdDevSamp
  • 57. Boolean Operators Set Operators Comparison Operators Arithmetic Operators String Operators Text Search Operators Array Operators Variable Operators Literal Operators Date Operators Conditional Expressions Expression Operators $and, $or, $not $setEquals, $setUnion, $anyElementTrue,… $cmp, $eq, $lt, &lte,… $add, $abs, $ceil, $floor, $log, $mod, $pow, $exp,… $concat, $substring, $toLower,… $meta $size, $isArray, $concatArrays, $arrayElemAt, $slice. $let, $,map $literal $dateOfYear, $year, $dateToString,… $cond, $ifNull
  • 58. pipeline = [ 
 {"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, 
 {"$unwind": "$info.offers"}, 
 {"$project": { "info.offers.price": 1, "info.offers.priceFormatted": 1, "artist": "$info.artistName", "product": "$info.name", "isUSD": {"$cmp": [{"$toLower": { "$substr": ["$info.offers.priceFormatted", 0, 3]}}, "usd"]}}},{"$match": {"isUSD": 0}},{"$group": { "_id": "$artist", "pricing": {"$push": "$info.offers.price"}}}, {"$project": { "pricing": {"$map": {"input": "$pricing", "as": "value", "in": {"$multiply": ["$$value", eur_dollar_exchange_rate ]}}}}}] $map
  • 60. pipeline = [ {"$match": {"info.artistName": {"$in": [artist, nemesis]}}}, {"$unwind": "$info.offers"}, {"$project": {"info.offers.price": 1, "info.offers.priceFormatted": 1, "artist": "$info.artistName", "product": "$info.name", "currency": {"$toUpper": {"$substr": ["$info.offers.priceFormatted", 0, 3]}}}}, {"$lookup": { "from": "exchangerates", "localField": "currency", "foreignField": "_id", "as": "exchangeRate" }}, {"$match": {"exchangeRate": {"$size": 1}}}, {"$group": { "_id": {"artist": "$artist", "currency": "$currency"}, "pricing": {"$push": "$info.offers.price"}, "rate": {"$first": "$exchangeRate.rate"}}}, {"$project": { "_id": "$_id.artist", "currency": "$_id.currency", "pricing": {"$map": {"input": "$pricing", "as": "value", "in": {"$multiply": ["$$value", {"$arrayElemAt": ["$rate", 0]}]}}} }}] $lookup (mongoDB 3.2+)
  • 61. Tip Infastructure work with dedicated server for aggregation e.g. a (hidden/delayed) member of replica set or standalone copy especially useful if you primary is busy with writes
  • 63. Collection Shard1 Shard2 Shard3 Shard4 server-1 server-2 server-3 server-4 server CollectionCollection server server Replica-Set horizontal scaling one primary + copies Sharding vertical scaling split the data across nodes one server - utilize multiple cpu + IO "Micro-Sharding"
  • 64. Shard1 Shard2 … ShardN "Micro-Sharding" 1 2 … N 1 2 N… CPUs High IOPS RAM
  • 66. DEMO Map Reduce in mongoDB Boosting Performance
  • 68. 2nd Call for Proposals reserved for Hot Topics ~first week of June ADVERTISEMENT
  • 69. Alexander C. S. Hendorf @hendorf self.Slides: https://goo.gl/VbzFrc John Page's Tutorial Micro-Sharding: https://gist.github.com/johnlpage/e0bb9971f4f1c4ed3a09