By Amol Nayak

Harness the most recent positive aspects of MongoDB three with this number of eighty recipes – from dealing with cloud structures to app improvement, this e-book is a crucial resource

About This Book

  • Get to grips with the most recent good points of MongoDB 3
  • Interact with the MongoDB server and practice quite a lot of question operations from the shell
  • From management to automation, this cookbook retains you brand new with the world's prime NoSQL database

Who This booklet Is For

This booklet is engineered for someone who's drawn to handling information in a simple and effective approach utilizing MongoDB. you don't want any previous wisdom of MongoDB, however it will be useful in case you have a few programming adventure in both Java or Python.

What you are going to Learn

  • Install, configure, and administer MongoDB sharded clusters and copy sets
  • Begin writing purposes utilizing MongoDB in Java and Python languages
  • Initialize the server in 3 diversified modes with quite a few configurations
  • Perform cloud deployment and introduce PaaS for Mongo
  • Discover frameworks and items equipped to enhance developer productiveness utilizing Mongo
  • Take an in-depth examine the Mongo programming motive force APIs in Java and Python
  • Set up company classification tracking and backups of MongoDB

In Detail

MongoDB is a high-performance and feature-rich NoSQL database that kinds the spine of the structures that energy many alternative firms – it is simple to work out why it is the hottest NoSQL database out there. full of many gains that experience develop into crucial for lots of forms of software program execs and exceedingly effortless to exploit, this cookbook comprises many options to the standard demanding situations of MongoDB, in addition to information on powerful thoughts to increase your talents and capabilities.

This booklet starts off with the best way to initialize the server in 3 diverse modes with quite a few configurations. you are going to then be brought to programming language drivers in either Java and Python. a brand new function in MongoDB three is for you to connect with a unmarried node utilizing Python, set to make MongoDB much more well liked by somebody operating with Python. you are going to then research quite a number extra subject matters together with complex question operations, tracking and backup utilizing MMS, in addition to a few very necessary management recipes together with SCRAM-SHA-1 Authentication. past that, additionally, you will locate recipes on cloud deployment, together with tips on how you can paintings with Docker packing containers along MongoDB, integrating the database with Hadoop, and assistance for making improvements to developer productivity.

Created as either an available instructional and a straightforward to take advantage of source, available everytime you have to remedy an issue, MongoDB Cookbook can assist you deal with every little thing from management to automation with MongoDB extra successfully than ever before.

Style and approach

Every recipe is defined in a very easy set-by-step demeanour but is intensely comprehensive.

Show description

Read or Download MongoDB Cookbook - Second Edition PDF

Similar Programming books

Embedded C

For those who are approximately to write down their first embedded software - or were suffering to benefit approximately this significant quarter - this ebook will shop weeks of attempt.

Cocoa Design Patterns

“Next time a few child indicates up at my door soliciting for a code assessment, this can be the booklet that i'm going to throw at him. ”   –Aaron Hillegass, founding father of great Nerd Ranch, Inc. , and writer of Cocoa Programming for Mac OS X   Unlocking the secrets and techniques of Cocoa and Its Object-Oriented Frameworks   Mac and iPhone builders are usually beaten through the breadth and class of the Cocoa frameworks.

C++ Primer (5th Edition)

Bestselling Programming instructional and Reference thoroughly Rewritten for the recent C++11 regular   totally up-to-date and recast for the newly published C++11 average, this authoritative and complete advent to C++ can help you to benefit the language speedy, and to exploit it in smooth, powerful methods.

Operating System Concepts

Continue velocity with the fast-developing global of working structures Open-source working structures, digital machines, and clustered computing are one of the best fields of working structures and networking which are swiftly altering. With monstrous revisions and organizational adjustments, Silberschatz, Galvin, and Gagne’s working procedure recommendations, 8th variation continues to be as present and suitable as ever, supporting you grasp the basic suggestions of working structures whereas getting ready your self for today’s rising advancements.

Extra resources for MongoDB Cookbook - Second Edition

Show sample text content

Getting ready For this recipe, we will create a collection called userDetails. We will need the server to be up and running. Refer to the Single node installation of MongoDB recipe in Chapter 1, Installing and Starting the MongoDB Server, to learn how to start the server. Also, start the shell with the UniqueIndexData. js script loaded. This script will be available on the book's website for download. To find out how to start the shell with a script reloaded, refer to the Connecting to a single node from the Mongo shell with a preloaded JavaScript recipe in Chapter 1, Installing and Starting the MongoDB Server. How to do it… 1. Load the required data in the collection using the loadUserDetailsData method. 2. Execute the following command on the Mongo shell: > loadUserDetailsData() three. See the count of the documents in the collection using the following query (it should be 100): > db. userDetails. count() four. Now, try to create a unique index on the login field on the userDetails assortment: > db. userDetails. ensureIndex({login:1}, {unique:true}) 5. This will not be successful and something like the following error will be seen on the console: { "err" : "E11000 duplicate key error index: attempt. userDetails. $login_1 dup key: { : \"bander\" }", "code" : 11000, "n" : 0, "connectionId" : 6, "ok" : 1 } 6. Next, we will try to create an index on this collection by eliminating the duplicates: > db. userDetails. ensureIndex({login:1}, {unique:true, dropDups:true}) 7. This will throw no errors and find the count in the collection again (take a note of the count and compare it with the count seen earlier, prior to index creation): > db. userDetails. count() eight. Check whether the index is being used by viewing the plan of the query: > db. userDetails. find({login:'mtaylo'}). explain() How it works… We initially loaded our collection with 100 documents using the loadUserDetailsData function from the UniqueIndexData. js file. We looped 100 times and loaded the same data over and over again. Thus, we got duplicate documents. We will then try to create a unique index on the login field in the userDetails collection as follows: > db. userDetails. ensureIndex({login:1}, {unique:true}) This creation fails and indicates the duplicate key it first encountered on index production. It is bander in this case. Can you guess why an error was first encountered for this user ID? This is not even the first ID we saw in the loaded data. Tip When specifying 1 in index creation, we mean to convey that the order of the values is ascending. Try creating a unique index using {login:-1} and see if the user ID for which the error is encountered is different. In such a scenario, we are left with two options: Manually pick the data to be deleted/fixed and ensure that the field on which the index is to be created has unique data across collection. This can either be done manually or programmatically, but it is outside the scope of Mongo and done by the end user on a case-to-case basis. Alternatively, if we don't care much about the data as it is genuinely duplicated and we need to retain just one copy of it, Mongo provides a brilliant way to handle this.

Rated 4.19 of 5 – based on 9 votes