MongoDBCookbook-SecondEdition
Harness the latest features of MongoDB 3 with this collection of 80 recipes – from managing cloud platforms to app development, this book is a vital resourceMongoDB cookbookSecond editionCopyright C 2016 Packt PublishingAll rights reserved. No part of this book may be reproduced, stored in a retrieval system, ortransmitted in any form or by any means without the prior written permission of the publisherexcept in the case of brief quotations embedded in critical articles or reviewsEvery effort has been made in the preparation of this book to ensure the accuracy of theinformation presented. However, the information contained in this book is sold withoutwarranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealersand distributors will be held liable for any damages caused or alleged to be caused directly ordirectly by this book.Packt Publishing has endeavored to provide trademark information about all of the companiesand products mentioned in this book by the appropriate use of capitals. However, PacktPublishing cannot guarantee the accuracy of this informationFirst published: November 2014Second Edition: January 2016Production reference: 1060116Published by Packt Publishing LtdLivery Place35 Livery streetBirmingham B3 2PB, UKSBN9781785289989CreditsAuthorsProject CoordinatorCyrus dasadiaFrancina pintoAmol NayakReviewersSafis editingChristopher DambamuromoLaurence Putra FranslayIndexerJason nicholsMariamman ChettiyarGraphicsCommissioning EditorDisha hariaDipika GaonaProduction coordinatorAcquisition EditorArvindkumar guptaShaon baContent Development EditorCover workArvindkumar guptaZeeyan pinheiroTechnical editorBharat PatilEditTasneem FatehAbout the authorsCyrus Dasadia always liked tinkering with open source projects since 1996. He has beenworking as a linux system administrator and part-time programmer for over a decade Heworks at In Mobi, where he loves designing tools and platforms. His love for MongoDB startedin 2013, when he was amazed by its ease of use and stability. Since then, almost all of hisprojects are written with MongodB as the primary backend. cyrus is also the creator of anopen source alert management system called CitoEngine. He likes spending his spare timetrying to reverse engineer software, playing computer games, or increasing his sillinessquotient by watching reruns of Monty PythonTo my wife, Nilu, provider of unconditional love and support; recipient ofad jokesAmol Nayak is a MongoDB certified developer and has been working as a developer forover 8 years. He is currently employed with a leading financial data provider, working oncutting-edge technologies. He has used mongo db as a database for various systems at hiscurrent and previous workplaces to support enormous data volumes. He is an open sourceenthusiast and supports it by contributing to open source frameworks and promoting themHe has made contributions to the spring Integration project, and his contributions are theadapters for JPA, XQuery, MongoDB, Push notifications to mobile devices, and amazon WebServices (AWS). He has also made some contributions to the spring data MongoDB project.Apart from technology, he is passionate about motor sports and is a race official at BuddhInternational Circuit, India, for various motor sports events. Earlier, he was the author ofInstant MongoDB, Packt PublishingI would like to thank everyone at Packt Publishing who has been involvedwith this book. It started when Luke Presland from Packt Publishingapproached me to author a book on Mongo. I was skeptical to take up theopportunity due to other commitments and tight deadlines, but if it wasntfor my mom, friends and office colleagues who convinced me to take up theity, I would not have written this book. The chapters and contentcovered was a lot, and I had a tough time keeping up with the timelines. Aspecial thanks to Priyanka, Rebecca, Mary, and Joel with whom I interactedthe most; they were very flexible to my changes in delivery timelines. a bigthanks to douglas duncan and other reviewers of the book for reviewingthe book closely and helping improve the quality of the content drasticallyFinally, I would like to thank the other staff at Packt Publishing who wereinvolved in the book's publishing process but haven 't interacted with meAbout the reviewersChristopher Dambamuromo is a MongoDB evangelist who is an active contributorto StackOverflow on the Mongodb tag. Chris frequently engages the open sourcecommunity and foster adoption of mongoDB. He helps engineering teams build scalableand performant applications in MongoDB. He also assesses the health, scalability, andcapacity of distributed systems and advises engineering teams on the schema designarchitecture, and deployment planning. He is a passionate and proficient C#/ Bl developerith more than 10 years of experience producing code to a consistently high standard. Chrishas constantly been honing his skills in the technical aspects of software and businessintelligence engineering (JavaScript, Node js, HTML5, CSS3, Python, R, Java, ASP. NET MVC.C# Microsoft BI stack-MS SQL server, SSIS, SSRS, SSAS, Share Point, and PowerPivot), datamodeling, systems architecture, as well as business applications for bl solutions. He has anMSc degree in intelligent computer systems from the University of glamorgan(UK), an Mscdegree in mathematics and computing for finance from Swansea University, UK, and a bscdegree with honours in applied mathematics from the National University of Science andTechnology, Zimbabwe. Chris is very fond of anything closely or remotely related to data andmathematics, and as long as it can be represented as a string of ones and zeros and thenanalyzedandvisualizedyou'vegothisattentionHisgithubhandleishttp://githubcom/chrisdambaandcanbefoundonStackoverflowashttp://stackoverflow.comusers/122005/chridamLaurence Putra Franslay is a software engineer working in Singapore and runs theSingapore MongoDB user group In his free time, he hacks away on random stuff and picksup new technologies. His key interests lie in security and distributed systems. For moreinformationviewhisprofileathttp://geeksphere.netwwW PacktPub comSupport files, eBooks discount offers, and moreForsupportfilesanddownloadsrelatedtoyourbookpleasevisitwww.packtpub.comDid you know that Packt offers e Book versions of every book published, with PDF and ePubfilesavailableYoucanupgradetotheeBookversionatwww.Packtpub.comandasaprintbook customer, you are entitled to a discount on the e Book copy Get in touch with us atservice@packtpub com for more detailsAtwww.packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessignupfor a range of free newsletters and receive exclusive discounts and offers on Packt booksand e booksPIPACKTLiB°https://www2.packtpub.com/books/subscription/packtlibDo you need instant solutions to your It questions? PacktLib is Packt's online digital booklibrary. Here, you can search, access, and read packt's entire library of booksWhy Subscribe?Fully searchable across every book published by PacktCopy and paste, print, and bookmark cob On demand and accessible via a web browserree Access for packt account holdersIfyouhaveanaccountwithpacktatwww.Packtpub.comyoucanusethistoaccessPacktLib today and view 9 entirely free books Simply use your login credentials forimmediate accessTable of contentsPrefaceChapter 1: Installing and starting the server1IntroductionInstalling single node MongoDBStarting a single node instance using command-line optionsSingle node installation of Mongo DB with options from the config file22367Connecting to a single node in the mongo shell with JavaScriptConnecting to a single node using a Java client10Connecting to a single node using a Python client15Starting multiple instances as part of a replica set17Connecting to the replica set in the shell to query and insert dataConnecting to the replica set to query and insert data from a Java client24Connecting to the replica set to query and insert data using a Python client 28Starting a simple sharded environment of two shards30Connecting to a shard in the shell and performing operations35Chapter 2: command-line Operations and lndexes39Introduction39Creating test data39Performing simple querying, projections, and pagination from Mongo shell 41Updating and deleting data from the shell43Creating index and viewing plans of queries45Creating a background and foreground index in the shell51Creating and understanding sparse indexes55Expiring documents after a fixed interval using the Ttl index58Expiring documents at a given time using the TtL indexChapter 3: Programming Language drivers63Introduction63Executing query and insert operations with PyMongo64
下载地址
用户评论