The Definitive Guide to MongoDB

上传:LongHui_No50233 浏览: 39 推荐: 0 文件:PDF 大小:2.38MB 上传时间:2019-10-20 06:07:06 版权申诉
The Definitive Guide to MongoDBThe Definitive Guide toMongoDBThe NosQl Database for Cloudand Desktop ComputingEelco Plugge,Peter Embreyand tim HawkinsapressThe Definitive guide to MongoDB: The NosQL Database for Cloud and desktop ComputingCopyright@ 2010 by Eelco Plugge, Peter Embrey and Tim HawkinsAll rights reserved. No part of this work may be reproduced or transmitted in any form or by any meanselectronic or mechanical, including photocopying, recording, or by any information storage or retrievalsystem, without the prior written permission of the copyright owner and the publisherISBN-13(pbk):978-1-4302-3051-9ISBN-13( electronic):978-1-43023052-6Printed and bound in the united states of america 987654321Trademarked names may appear in this book. Rather than use a trademark symbol with everyoccurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit ofthe trademark owner, with no intention of infringement of the trademarkPresident and Publisher: Paul ManningLead Editors: Frank Pohlmann, Michelle lowman, james markhamTechnical Reviewer: Jonathon DrewettEditorial Board: Clay andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary CornellJonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan ParkesJeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,Matt Wade, Tom WelshCoordinating editor: Mary tobinCopy Editor: Patrick MeaderCompositor: MacPS, LLCIndexer: Potomac Indexing, llcArtist: April MilneCover Designer: Anna IshchenkoDistributed to the book trade worldwide by Springer-Verlag New York, InC, 233 Spring Street, 6th FloorNew York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm com, orvisitwww.springeronline.comForinformationontranslationspleasee-mailrightsqapress.comorvistwww.apress.compress and friends of ed books may be purchased in bulk for academic, corporate, or promotional use.eBook versions and licenses are also available for most titles. For more information reference ourSpecialBulksalesebooKlicensingwebpageatwww.apress.com/info/bulksalesThe information in this book is distributed on an"as is"basis, without warranty. Although everyprecaution has been taken in the preparation of this work, neither the author(s nor Apress shall haveany liability to any person or entity with respect to any loss or damage caused or alleged to be causeddirectly or indirectly by the information contained in this workThesourcecodeforthisbookisavailabletoreadersatwww.apress.comYouwillneedtoanswerquestions pertaining to this book in order to successfully download the codeContents at a glanceContents■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■about the authors um xviabout the technical reviewerAcknowledgments. s RRBBIISEIBIRRIBHRERRBRBIRBIRIB ERRIRIBRRRIERRIRIRIRNEIn XViiiIntroductionPart basics u1Chapter 1: Introduction to MongoDB■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■冒■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■Chapter 2: Installing MongoDB■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■19Chapter 3: The Data Model mmm m a mmm mem mta nanan. 35Chapter 4: Working with Data IBIBIBRIBIBIRIBBIBIIBIBIRIBBIIIIBRIBEIIIIIRI 47Chapter 5: GridFs mmmt83Part l: Developing ammmamtmammmmmmaameammmmmamnmm a 97Chapter 6: PHP and MongoDB99Chapter 7: Python and MongoDB IIBRIIBIBRBIRIBIBRIRRIRIBRR 137Chapter 8: Creating a blog application with the PhP Driver■■■■■■■■■■■■■■■■■■■■■■■■■■■■■167Partl:Advanced.191Chapter 9: Database Administrationn193Chapter 10: Optimization■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■225Chapter 11: Replication■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■241Chapter 12: Sharding■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■277Index293ContentsContents at a glanceAbout the authorsXVIAbout the technical reviewer mmmmm xviiAcknowledgments.Introduction m XxPart i basics■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■Chapter 1: Introduction to MongoDB■■■■■■■■■■■■■■■■■■■■■■■■國■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■Reviewing the mongoDB PhilosophyUsing the right tool for the right job3Lacking Innate Support for TransactionsDrilling Down on JSON and How It Relates to MongoDB..Adopting a Non-Relational Approach……Opting for Performance vs. FeaturesRunning the database AnywhereFitting Everything TogetherGenerating or creating a Key...sing Keys and values.......10Implementing CollectiUnderstanding databasesReviewing the Feature ListUsing document0 Orientated Storage(BS0N)….……11Supporting dynamic QuerCONTENtSIndexing Your Documents..13Leveraging Geospatial Indexes13Profiling QtUpdating Information In-Place14Storing Binary DataReplicating Data............15Implementing auto sharding .sing Map and Reduce Functions16Getting Help16Visiting the Website..Chatting with the MongoDB Developers16Cutting and Pasting MongoDB CodeFinding Solutions on Google Groups….....,.,.……17Leveraging the jiRA Tracking SystemSummary………17Chapter 2: Installing MongoDB■■■■■■■■■■■■■■E■■■■■■■19Choosing Your Version.,.,…,……,19Understanding the Version Numbers..........面B面面道日1日日正日日日面日1日1日面Installing MongoDB on Your Systen,,,,,,,,,…,,…,………,20Installing MongoDB Under LinuxInstalling MongoDB Under WindowsRunning mongodbPrerequisites2Surveying the Installation Layout.Using the MongoDB ShellInstalling Additional DriversInstalling the Php driverConfirming your php installation WorksInstalling the Python Di30Confirming your PyMongo Installation Works■C0 NTENTSSummary.ua......33Chapter 3: The Data Model tnat35Designing the database.....aneDrilling down on collections.………36Using documents…Creating the id Field.................……40Building Indexes…Impacting Performance with Indexes...a.42mplementing Geospatial IndexingQuerying Geospatial Information..Using Mongodb in the real WorldSummaryse....see366Chapter 4: Working with Data47Navigating Your DatabasesViewing available databases and collections47Inserting Data into CollectionsQuerying for Data.......,,.,,,,,,,,,,…49Ising the Dot NotationUsing the Sort, Limit, and skip Functions.Working with Capped Collections, Natural Order,Retrieving a Single Documentsing the aggregation Commands......Working with Conditional operators日日ii日面面日面日自面日自日自面1Ba面日道57Leveraging reqular expressionsUpdating Data....Updating with updatemplementing an Upsert with the save command……Updating Information AutomaticallySpecifying the position of a Matched arrayCONTENtSAtomic OperationsModifying and Returning a Document atomicallyRenaming a collection.174Removing Data74Referencing a Database………………75Referencing Data ManuallyReferencing Data with DBRefmplementing Index-Related FunctionsSurveying Index-Related commands面a11日日面1m自日自面日1日面面面i面面面日日1Forcing a Specified Index to Query DataConstraining Query Matches………Summary .eaostnamaaaeameeeuseoatestneae... 81Chapter 5: GridFS■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■国■■■■■■■■83Filling in Some Background ....83Working with GridFS84Getting Started with the Command-Line Tools.Using the id Key………286Working with FilenamesDetermining a File's lengthWorking with chunk SizesTracking the Upload DateHashing your FilesL00 king Under MongoDB'S H0d….....,….88Using the Search command90DeletingRetrieving Files from MongoDBSumming up mongofiles...量1面a正日a1日日日面量Exploiting the Power of Pythonm…91Connecting to the database92
上传资源
用户评论

sailorzero 2019-10-20 06:07:06

绝对经典,5星推荐。 适合入门和进阶。