(Ebook) MongoDB for Java developers design, build, and deliver efficient Java applications using the most advanced NoSQL database by Francesco, Marchioni ISBN 9781785280276, 9781785286292, 1785280279, 1785286293 - Read the ebook online or download it as you prefer
(Ebook) MongoDB for Java developers design, build, and deliver efficient Java applications using the most advanced NoSQL database by Francesco, Marchioni ISBN 9781785280276, 9781785286292, 1785280279, 1785286293 - Read the ebook online or download it as you prefer
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312
https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT
Subject Test: Math Levels 1 & 2) by Arco ISBN 9780768923049,
0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study:
the United States, 1919-41 2nd Edition by Benjamin Harrison ISBN
9781398375147, 9781398375048, 1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044
https://ebooknice.com/product/refactoring-in-java-improving-code-
design-and-maintainability-for-java-developers-55039014
https://ebooknice.com/product/java-ee-7-development-with-
wildfly-55591790
(Ebook) MongoDB Applied Design Patterns: Practical Use Cases with the
Leading NoSQL Database by Rick Copeland ISBN 9781449340049, 1449340040
https://ebooknice.com/product/mongodb-applied-design-patterns-
practical-use-cases-with-the-leading-nosql-database-55144854
(Ebook) Introducing Maven, 2nd Edition: A Build Tool for Today’s Java
Developers by Balaji Varanasi
https://ebooknice.com/product/introducing-maven-2nd-edition-a-build-
tool-for-todays-java-developers-50195460
MongoDB for Java Developers
Francesco Marchioni
BIRMINGHAM - MUMBAI
MongoDB for Java Developers
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78528-027-6
www.packtpub.com
Credits
Reviewers Proofreader
Daniel Mühlbachler Safis Editing
Weiwei Sun
Mehdi Tazi Indexer
Tejal Soni
Commissioning Editor
Veena Pagare Production Coordinator
Aparna Bhagat
Acquisition Editors
James Jones Cover Work
Aparna Bhagat
Nadeem N. Bagban
Technical Editor
Bharat Patil
Copy Editors
Merilyn Pereira
Laxmi Subramanian
About the Author
Over the past 5 years, he has been authoring technical articles for OReilly Media and
running an IT portal focused on JBoss products (http://www.mastertheboss.com).
Daniel enjoys solving challenging problems and is always keen on working with new
technologies, especially related to the fields of big data, functional programming,
optimization, and NoSQL databases.
More detailed information about his experience , as well as his contact details, can be
found at www.muehlbachler.org and www.linkedin.com/in/danielmuehlbachler.
Weiwei Sun is a student of Southeast University, China, and also a student of
Monash University, Australia. He also has a double master's degree in computer
technology and information technology. He loves technology, programming, and
open source projects.
His research interests are database technology, data visualization, and application of
machine learning.
His core expertise involves managing agile scrum teams, as well as architecting
new solutions, and working with multiple technologies, such as JAVA/JEE, Spring,
MongoDB, Cassandra, HTML5, Bootstrap, and AngularJS.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Preface
The NoSQL movement is growing in relevance, and it is attracting more and more
developers. The MongoDB database is a well-recognized rising star in the NoSQL
world. It is a document database that allows data to persist and query data in a
nested state without any schema constraint and complex joins between documents.
Understanding when it is appropriate to use MongoDB against a relational database
and the interfaces to be used to interact with it requires some degree of experience.
This book provides all the knowledge to make MongoDB fit into your application
schema, at the best of its capabilities. It starts from a basic introduction to the driver
that can be used to perform some low level interaction with the storage. Then it
moves on to use different patterns for abstracting the persistence layer into your
applications, starting from the flexible Google JSON library, to the Hibernate OGM
framework, and finally landing on the Spring Data framework.
Chapter 2, Getting Started with Java Driver for MongoDB, introduces the Java
Driver for MongoDB using a simple Java project developed with the NetBeans
development environment.
Chapter 3, MongoDB CRUD Beyond the Basics, covers the advanced usage of the
MongoDB Java driver such as data mapping, index creation, and bulk operations.
[v]
Preface
Chapter 5, Managing Data Persistence with MongoDB and JPA, covers the development
of a Java Enterprise application using Hibernate Object/Grid Mapper (OGM), which
provides Java Persistence API (JPA) support for NoSQL databases.
Chapter 6, Building Applications for MongoDB with Spring Data, teaches you how
to use Spring Data and Spring Boot to leverage micro services using MongoDB
as the storage.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"In command prompt, navigate to the bin directory present into the mongodb
installation folder and point to the folder where data is stored."
[ vi ]
Preface
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
MongoClient mongoClient = new MongoClient( "localhost" , 27017 );
DB db = mongoClient.getDB( "test" );
System.out.println("Successfully connected to MongoDB");
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: " Now let's
add a Java class to the project. From the File menu, select Java Class under New ".
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for
us to develop titles that you really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
[ vii ]
Preface
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you would report this to us. By doing so, you can save
other readers from frustration and help us improve subsequent versions of this book.
If you find any errata, please report them by visiting http://www.packtpub.com/
submit-errata, selecting your book, clicking on the errata submission form link,
and entering the details of your errata. Once your errata are verified, your submission
will be accepted and the errata will be uploaded on our website, or added to any list
of existing errata, under the Errata section of that title. Any existing errata can be
viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[ viii ]
Chapter 1
Introduction to MongoDB
In this book, you will learn how to develop Java applications using the MongoDB
database, which is an open source document-oriented database, recognized as a
rising star in the NoSQL world. In a nutshell, MongoDB is a document database,
which allows data to persist in a nested state, and importantly, it can query that
nested data in an ad hoc fashion. It enforces no schema, so documents can optionally
contain fields or types that no other document in the collection contains.
This seems quite a generic definition of NoSQL databases; however, all databases
that fall into this category have some characteristics in common such as:
• Storing data in many formats: Almost all RDBMS databases are based on
the storage or rows in tables. NoSQL databases, on the other hand, can use
different formats such as document stores, graph databases, key-value stores
and even more.
[1]
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Roaming
Through the West Indies
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
BY
HARRY A. FRANCK
Author of “A Vagabond Journey Around the World,” “Zone Policeman 88,” “Vagabonding Down the Andes,”
etc., etc.
NEW YORK
THE CENTURY CO.
1920
Copyright, 1920, by
The Century Co.
TO
MY WIFE, RACHEL,
WITH WHOM THIS WAS THE BEGINNING
OF A FAR LONGER JOURNEY, AND
TO
MY SON, HARRY,
WHO JOINED US ON THE WAY
FOREWARNING
Some years ago I made a tramping trip around the world for my
own pleasure. Friends coaxed me to set it down on paper and new
friends were kind enough to read it. Since then they have demanded
more—at least so the publishers say—but always specifying that it
shall be on foot. Now, I refuse to be dictated to as to how I shall
travel; I will not be bullied into tramping when I wish to ride. The
journey herewith set forth is, therefore, among other things, a
physical protest against that attempted coercion, a proof that I do
not need to walk unless I choose to do so. To make broken
resolutions impossible, I picked out a trip that could not be done on
foot. It would be difficult indeed to walk through the West Indies.
Then, to make doubly sure, I took with me a newly acquired wife—
and we brought back a newly acquired son, though that has nothing
to do with the present story.
I will not go so far as to say that I abjured footing it entirely. As a
further proof of personal liberty I walked when and where the spirit
moved me—and the element underfoot was willing. But I wish it
distinctly understood from the outset that this is no “walking trip.”
Once having broken the friends who flatter me with their attention of
expecting me to confine myself to the prehistoric form of locomotion
—I shall probably take to the road again to relieve a chronic foot-itch.
The following pages do not pretend to “cover” the West Indies.
They are made up of the random pickings of an eight-months’ tour of
the Antilles, during which every island of importance was visited, but
they are put together rather for the entertainment of the armchair
traveler than for the information of the traveler in the flesh. While
the latter may find in them some points to jot down in his itinerary,
he should depend rather on the several thorough and orderly books
that have been written for his special benefit.
Harry A. Franck.
TABLE OF CONTENTS
CHAPTER PAGE
FACING
PAGE
A policeman of Havana 16
A Cuban shoemaker 56
Cuban soldiers 56
Cuban travelers 80
A Cuban milkman 80
Looking down upon the market from the cathedral platform 113
Ruins of the old French estates are to be found all over Haiti 160
The mayor, the judge, and the richest man of a Haitian town
in the bush 177
Ponce de Leon’s palace now flies the Stars and Stripes 256
The present residents of St. Pierre tuck their houses into the
corners of old stone ruins 473
The principal Dutch island is not noted for its verdure 481
MAP
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com