Seven Databases in Seven Weeks: A Guide to Modern Databases and the NoSQL Movement by Eric Redmond; Jim Wilson
Author:Eric Redmond; Jim Wilson
Language: eng
Format: mobi
Tags: Pragmatic Bookshelf, Database Management, Data Modeling & Design, Computers, General, Software Development & Engineering, Databases
ISBN: 9781934356920
Publisher: Oreilly & Associates Incorporated
Published: 2012-06-05T18:30:00+00:00
db.phones.group({
initial: { prefixes : {} },
reduce: function(phone, output) {
output.prefixes[phone.components.prefix] = 1;
},
finalize: function(out) {
var ary = [];
for(var p in out.prefixes) { ary.push( parseInt( p ) ); }
out.prefixes = ary;
}
})[0].prefixes
[ 555, 556, 557, 558, 559, 560, 561, 562, 563, 564 ]
The group function is powerful—like SQL’s GROUP BY—but Mongo’s implementation has a downside, too. First, you are limited to a result of 10,000 documents. Moreover, if you shard your Mongo collection (which we will tomorrow) group won’t work. There are also much more flexible ways of crafting queries. For these and other reasons, we’ll dive into MongoDB’s version of mapreduce in just a bit. But first, we’ll touch on the boundary between client-side and server-side commands, which is a distinction that has important consequences for your applications.
Server-Side Commands
If you were to run the following function through a command line (or through a driver), the client will pull each phone locally, all 100,000 of them, and save each phone document one by one to the server.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8296)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6722)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6701)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6572)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6357)
Driving Data Quality with Data Contracts by Andrew Jones(6306)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6073)
Learning SQL by Alan Beaulieu(5994)
Weapons of Math Destruction by Cathy O'Neil(5778)
Big Data Analysis with Python by Ivan Marin(5356)
Data Engineering with dbt by Roberto Zagni(4352)
Solidity Programming Essentials by Ritesh Modi(4000)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3858)
Pandas Cookbook by Theodore Petrou(3569)
Blockchain Basics by Daniel Drescher(3292)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2905)
Feature Store for Machine Learning by Jayanth Kumar M J(2812)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2794)
Mastering Python for Finance by Unknown(2744)
