Mastering MongoDB 7.0 - Marko Aleksendrić - E-Book

Mastering MongoDB 7.0 E-Book

Marko Aleksendrić

0,0
29,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Mastering MongoDB 7.0 explores the latest version of MongoDB, an exceptional NoSQL database solution that aligns with the needs of modern web applications. This book starts with an informative overview of MongoDB’s architecture and developer tools, guiding you through the process of connecting to databases seamlessly.
This MongoDB book explores advanced queries in detail, including aggregation pipelines and multi-document ACID transactions. It delves into the capabilities of the MongoDB Atlas developer data platform and the latest features, such as Atlas Vector Search, and their role in AI applications, enabling developers to build applications with the scalability and performance that today’s organizations need. It also covers the creation of resilient search functionality using MongoDB Atlas Search. Mastering MongoDB 7.0’s deep coverage of advanced techniques encompasses everything from role-based access control (RBAC) to user management, auditing practices, and encryption across data, network, and storage layers.
By the end of this book, you’ll have developed the skills necessary to create efficient, secure, and high-performing applications using MongoDB. You’ll have the confidence to undertake complex queries, integrate robust applications, and ensure data security to overcome modern data challenges.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Seitenzahl: 519

Veröffentlichungsjahr: 2024

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Mastering MongoDB 7.0

Achieve data excellence by unlocking the full potential of MongoDB

Marko Aleksendrić

Arek Borucki

Leandro Domingues

Malak Abu Hammad

Elie Hannouch

Rajesh Nair

Rachelle Palmer

Mastering MongoDB 7.0

Fourth edition

Copyright © 2024 Packt Publishing

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(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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.

Acquisition Editor: Sathya Mohan

Lead Development Editor: Siddhant Jain

Development Editors: Afzal Shaikh and Rhea Gangavkar

Content Development Editors: Asma Khan and Saba Umme Salma

Copy Editor: Safis Editing

Project Coordinator: Yash Basil

Proofreader: Safis Editing

Production Designer: Deepak Chavan

Production reference: 1190124

Published by Packt Publishing Ltd.

Grosvenor House, 11 St Paul's Square, Birmingham, B3 1RB, UK.

ISBN 978-1-83546-047-4

www.packtpub.com

Contributors

About the authors

Marko Aleksendrić is an analyst, an ex-scientist, and a freelance self-taught web developer with over 20 years of experience. Marko has authored the book Modern Web Development with the FARM Stack, published by Packt Publishing. With a keen interest in backend and frontend development, he has been an avid MongoDB user for the last 15 years for various web and data analytics-related projects, with Python and JavaScript as his main tools.

Arek Borucki, a recognized MongoDB Champion and certified database administrator, has been working with MongoDB technology since 2016. As a principal SRE database engineer, he works closely with technologies such as MongoDB, Elasticsearch, PostgreSQL, Kafka, Kubernetes, Terraform, AWS, and GCP. His extensive experience includes working with renowned companies such as Amadeus, Deutsche Bank, IBM, Nokia, and Beamery. Arek is also a Certified Kubernetes Administrator and developer, an active speaker at international conferences, and a co-author of questions for the MongoDB Associate DBA Exam.

Leandro Domingues is a MongoDB Community Champion and a Microsoft Data Platform MVP alumnus. Specializing in NoSQL databases, focusing on MongoDB, he has authored several articles and is also a speaker and organizer of events and conferences. In addition to teaching MongoDB, he was a professor at one of the largest universities in Brazil. Leandro is passionate about MongoDB and is a mentor and an inspiration to many developers and administrators. His efforts make MongoDB a more comprehensible tool for everyone.

Malak Abu Hammad is a seasoned software engineering manager at Chain Reaction, with a decade of expertise in MongoDB. She has carved a niche for herself not only in MongoDB but also in essential web app technologies. Along with conducting various online and offline workshops, Malak is a MongoDB Champion and a founding member of the MongoDB Arabic Community. Her vision for MongoDB is a future with an emphasis on Arabic localization, aimed at bridging the gap between technology and regional dialects.

Elie Hannouch is a senior software engineer and digital transformation expert. A driving force in the tech industry, he has a proven track record of delivering robust, scalable, and impactful solutions. As a start-up founder, Elie combines his extensive engineering background with strategic innovation to redefine how enterprises operate in today's digital age. Apart from being a MongoDB Champion, Elie leads the MongoDB, Google, and CNCF communities in Lebanon, and works toward empowering aspiring tech professionals by demystifying complex concepts and inspiring a new generation of tech enthusiasts.

Rajesh Nair is a software professional from Kerala, India, with over 12 years of experience working in various MNCs. He started his career as a database administrator for multiple RDBMS technologies, including Progress OpenEdge and MySQL. Rajesh also managed huge datasets for critical applications running on MongoDB as a MongoDB administrator for several years. He has worked on technologies such as MongoDB, AWS, Java, Kafka, MySQL, Progress OpenEdge, shell scripting, and Linux administration. Rajesh is currently based out of Amsterdam, Netherlands, working as a senior software engineer.

Rachelle Palmer is the Product Leader for Developer Database Experience and Developer Education at MongoDB, overseeing the driver client libraries, documentation, framework integrations, and MongoDB University. She has built sample applications for MongoDB in Java, PHP, Rust, Python, Node.js, and Ruby. Rachelle joined MongoDB in 2013 and was previously the director of the technical services engineering team, creating and managing the team that provided support and CloudOps to MongoDB Atlas.

About the reviewers

Jeff Allen is a technical writer at MongoDB. Based in the New York City area, he mainly focuses on server documentation. Before joining MongoDB, he worked in software development, specifically full-stack web development in C# and .NET. He is passionate about writing documentation that is easy to use and understand. He enjoys the challenge of documenting complex topics. Jeff regularly collaborates with Product and Engineering teams to craft examples that match real-world use cases and has been involved in large-scale improvements to the Indexes and Schema Design documentation.

Alex Bevilacqua is an advocate for open standards, as well as a passionate and enthusiastic open source developer with over 10 years of experience. He is skilled in Ruby, Python, C#, Flash, Flex, JavaScript, and others. He is the author of several Redmine extensions and plugins, two of the most popular being Redmine Knowledgebase and Redmine Dropbox Attachments. He currently works for a leading digital marketing company in Toronto where he handles process automation, data collection, and aggregation initiatives.

Nicholas Cottrell has used MongoDB as the data layer for dozens of software development projects since MongoDB 2.0, long before joining the company as a consulting engineer in 2017. He now helps technical services engineers learn about all aspects of MongoDB to support an ever-growing range of customer use cases. He holds dual Australian and Swedish citizenship and lives in Normandy, France.

Joseph Dougherty is a developer-turned-writer who has been working in tech for over 15 years. He has been a technical writer at MongoDB since 2020, contributing to the documentation of the core server product. Joseph has also worked with financial data models, built web apps, programmed guitar effects pedals, and documented it all along the way. In his spare time, he is an avid cyclist and enjoys working with open source audio production tools.

Kenneth P. J. Dyer is a Senior Technical Writer on the Server Documentation team at MongoDB. He joined MongoDB in 2021 and has 12 years of experience in documenting various content and database management systems and related products. With a background in creative writing and philology, he's passionate about language and literature and technologies that facilitate developments in these areas. He lives in Austin, Texas.

Corry Root is a Senior Technical Writer at MongoDB with 15+ years of experience. She holds an MS in Human Factors in Information Design and is passionate about innovative design and collaboration. Corry specializes in technical documentation for MongoDB's Cloud team. She covers products such as MongoDB Atlas CLI, embracing the Docs as Code approach. She believes in testing documentation for user-friendliness. Corry resides in Princeton, Massachusetts, with her family, and actively engages in the local community as the chair for the Princeton Cultural Council. She also enjoys jazz and ballet classes, her passion since childhood.

John Williams joined MongoDB in 2019 and co-leads the Cloud documentation team. His team documents MongoDB Atlas and other enterprise tools. He has more than a decade of experience in writing developer docs.

Kailie Yuan is a Technical Writer for the Cloud Enterprise team and holds a lot of knowledge regarding MongoDB drivers, Atlas Search, and MongoDB Atlas Charts. Throughout her time at the company, she worked on a handful of features and constantly strives to provide users with a great experience. Kailie loves to educate others and would like to see more people pursue roles in the technology field. She aspires to help more people understand the tech field better, which is why she took on a second job to teach at her alma mater.

Note from Author

When I joined MongoDB, our cloud engineering team was nascent, our server engineering team fit in a single room, and there were only four program managers in the entire company. At the time, I remember thinking whether joining a start-up, even a well-funded one with a big idea, was the right thing to do. Now, after working with MongoDB for almost 10 years, I have helped us grow from a big idea to a billion-dollar business.

It was a bitterly cold morning in December 2013 when I joined MongoDB; I didn't know what to expect. I certainly could not have predicted the features we would build, the IPO that would eventually happen, or that one day in the future, my job would be defining the experience of MongoDB for you—the developers around the world.

Making databases clearer and more user-friendly for developers is a necessity and something I'm constantly racking my brain over. And while there's so much that sets MongoDB apart from other databases, we've always focused on the foundation of our uniqueness—making it easier for you to work with data. Everything I find tedious about working with data, I strive to make simpler and more accessible in MongoDB.

That's the goal. That's the mission. That's the strategy.

In this book, you'll learn all about MongoDB: the major features, the use cases, the best practices, and the new functionalities we've added in MongoDB 7.0. You'll learn the tips and tricks from some of our community champions and most distinguished engineers. Since this is our first book as a company, we wanted to make it not just technically accurate, but also exciting!

I've realized that the best way to learn is by exploring, and transposing theory into practice. Look at the code, and go beyond it; access the GitHub examples, clone them, and build your own practice applications. You can create an account on MongoDB Atlas and host a production app on the free tier. By the end of this book, you will have the skills to build an application that runs at scale.

Thank you for reading, and for using MongoDB.

Rachelle Palmer

Director, Product Management

MongoDB, Inc.

Table of Contents

Preface

1

Introduction to MongoDB

Who uses MongoDB

Why developers love MongoDB

Efficiency of the inherent complexity of MongoDB databases

How is this possible?

Summary

2

The MongoDB Architecture

Replication vs sharding

Replication

Replica set elections

Replica set oplog

Replica set deployment architectures

Write concern

Read preference

Read concern

Replication methods

Sharding

Why do you need sharding?

Key elements of a sharded cluster

Microsharding

Advantages of sharding

Data distribution

Chunks

Chunk administration

Querying sharded data

Sharding methods

New sharded cluster features in MongoDB 7.0

Shard key advisor commands

AutoMerger

Command support without shard keys

Summary

3

Developer Tools

Technical requirements

Introduction to developer tools

Categories of developer tools

MongoDB Shell

Installation

Connecting to a MongoDB deployment using mongosh

mongosh vs legacy shell

Key features of mongosh

Use cases for mongosh

Best practices for using mongosh

MongoDB CLI

Installation

Configuration

Working with MongoDB CLI

mongocli auth

Key features of MongoDB CLI

Use cases for MongoDB CLI

Best practices for MongoDB CLI

MongoDB Compass

Installation

Configuration

Visually explore data using Compass

Key features of MongoDB Compass

Use cases for MongoDB Compass

Best practices for MongoDB Compass

MongoDB for VS Code

Installation

Explore data using Playground

Use Terraform to create an Atlas cluster

Key features

Use cases for the MongoDB for VS Code extension

Best practices for the MongoDB for VS Code extension

Summary

4

Connecting to MongoDB

Connecting methods

Connecting using Ruby

Connecting using Python

Connecting using PHP

Connecting using Node.js

Connecting using TypeScript

Summary

5

CRUD Operations and Basic Queries

Technical requirements

MongoDB CRUD operations

CRUD using mongosh

Scripting for mongosh

Batch inserts using mongosh

Batch operations using mongosh

CRUD using the Ruby driver

Connecting to a database

Creating documents

Reading data

Chaining operations in find()

Nested operations

Batch operations

Mongoid ODM

CRUD using the Python driver

Inserting documents

Finding documents

Updating documents

Deleting documents

Regular expressions

Administration

currentOp() and killOp()

collMod

Secure access to MongoDB

Authentication and authorization

MongoDB Stable API

Summary

6

Schema Design and Data Modeling

Schema design for relational databases

Normal forms

Schema design for MongoDB

Data modeling in MongoDB

Document structure

Embedded data

References

Denormalization

BSON and its data types

Design considerations and best practices for MongoDB modeling

Read-write ratio

Design patterns and schema design

Summary

7

Advanced Querying in MongoDB

Introduction to the aggregation framework

Benefits of aggregation in MongoDB

Aggregation stages

Query Techniques

Logical and comparison operators

Array querying and manipulation

Array field projection techniques

Indexes and query optimization

Benefits of using indexes

Types of index

Geospatial features in MongoDB

GeoJSON objects

Geospatial indexes

Geospatial operators

Summary

8

Aggregation

Technical requirements

MongoDB aggregation framework

Modularity and composability

Stages

Aggregation expressions

Basic aggregation operators

Bitwise operators in aggregation

Array expression operators

The "power" array operators: $map and $reduce

Other types of aggregations

Best practices

Code modularity

Query optimization

Streaming and blocking stages of a pipeline

Sharded cluster considerations

Summary

9

Multi-Document ACID Transactions

Why are transactions useful?

ACID properties

Atomicity

Consistency

Isolation

Durability

MongoDB implementation of ACID

Read and write concerns in transactions

Transaction limitations

Best practices

Summary

10

Index Optimization

Introduction to indexes

Creating an index

Index types

Single-field indexes and indexing embedded documents

Compound indexes

Multikey indexes

Covered queries

Hashed index

Text indexes

Atlas Search Indexes

TTL indexes

Partial indexes

Geospatial indexes

Wildcard indexes

Hidden indexes

Compound wildcard indexes

Best practices for index optimization

Summary

11

MongoDB Atlas: Powering the Future of Developer Data Platforms

Understanding MongoDB Atlas as a database-as-a-service

Hosted database

Secure by default

Monitoring and alerting

Back up, restore, and archive

Automation

Atlas developer data platform

Atlas Vector Search and its role in AI applications

What does vector search entail?

What is Atlas Vector Search?

Semantic search and vectors

KNN, ANN, and vector embeddings

How to use Atlas Vector Search

Atlas Search

Atlas Application Services

What is Atlas Application Services?

Key features

How to use Atlas Application Services

Atlas Data API

Security and authorization

Use cases

How to use the Atlas Data API

Atlas Data Lake

Data storage and optimization

How to use Atlas Data Lake

Atlas Data Federation

Data processing

Key features

How to use Atlas Data Federation

Atlas Stream Processing (preview)

Operational mechanism

Key features

Setting up a stream processor

Atlas SQL Interface

How to use the Atlas SQL Interface

MongoDB Atlas Charts

How to use Atlas Charts

Operational integrations: The Atlas Kubernetes Operator

What is the Atlas Kubernetes Operator?

How to use the Atlas Kubernetes Operator

Atlas CLI

How to use the Atlas CLI

Capabilities of the Atlas CLI

Summary

12

Monitoring and Backup in MongoDB

Monitoring in MongoDB

Monitoring clusters

Why monitor in MongoDB?

What should you monitor?

Page fault

Resident memory

Virtual and mapped memory

Working set

Track free disk space

Monitoring replication

Oplog size

Network monitoring

Cursors and connections

Document metrics

Monitoring memory usage in WiredTiger

Tracking page faults

Tracking B-tree misses

I/O wait

Read and write queues

Working set calculations

Why is the working set crucial?

Estimate the working set size

Importance of indexes in the working set

MongoDB reporting tools overview

Utilities

Commands

Hosted monitoring tools overview

Cluster backups

MongoDB backup methods

Cloud-based backup solutions

On-premises backup solutions

Using filesystem snapshots for MongoDB backups

Consistency requirements

Backups using mongodump

Backing up with cp or rsync

Backup and restore on EC2

Backup with queues

Incremental backups

Common mistakes and pitfalls in MongoDB monitoring and backup

Summary

13

Introduction to Atlas Search

MongoDB Atlas Search

Feature overview

Version requirements for Atlas Search features

Atlas Search architecture

Technical overview of Atlas Search indexes

Index creation and management

Atlas Search queries

Atlas Search query operators and collectors

Query execution in Atlas Search

Relevance scoring in Atlas Search

Atlas Search Nodes

Atlas Search index management

Search query analysis

Troubleshooting Atlas Search errors

Apache Lucene

Apache Software Foundation

Atlas Search and integration with Apache Lucene

Summary

14

Integrating Applications with MongoDB

Technical requirements

Integrating applications in MongoDB

The MongoDB Kubernetes Operator

Installation

Deploy and configure MongoDB using the Kubernetes Operator

The Atlas Kubernetes Operator

The Enterprise Kubernetes Operator

Integrating Terraform with MongoDB

Installation

Configuring a MongoDB cluster on Atlas using Terraform

Using Vercel with MongoDB

Building a web application with Vercel and MongoDB

Configuring MongoDB Atlas with Vercel

Disconnecting the Vercel integration

Integrating Datadog with MongoDB

Configuring Datadog

Integrating MongoDB Atlas with Datadog

Integrating Prometheus with MongoDB

Configuring Prometheus

Integrating MongoDB Atlas with Prometheus

Integrating webhooks with MongoDB

Configuring webhooks with MongoDB

Integrating MongoDB with alerting applications

Atlas integrations for webhooks

Microsoft Teams integration

PagerDuty integration

Slack integration

Splunk On-Call integration

Opsgenie integration

Integrating MongoDB with Confluent

Integrating MongoDB with Postman

Summary

15

Security

Authentication methods

SCRAM

x.509

LDAP

Kerberos

Role-based access control (RBAC)

Knowing about resources, actions, and roles

Role hierarchy

Managing roles

Access restrictions

Summary

16

Auditing

Auditing and logging in MongoDB

Types of auditable events

Enable auditing in MongoDB

Audit filters

Enable auditing in MongoDB Atlas

View and download MongoDB logs

Case study: The role of auditing in compliance

Troubleshoot auditing issues in MongoDB

How to identify and address issues in auditing using MongoDB

Tools for MongoDB audit record analysis

Summary

17

Encryption

Encryption types

Certificates

Encryption in-transit

How it works

Configure TLS for MongoDB

Encryption at rest

Encryption at rest in MongoDB

Configure encryption at rest for MongoDB

Client-side encryption

When is CSFLE used

How it works

Configure MongoDB

Restrictions and considerations

Queryable Encryption

Summary

Index

Why subscribe?

Other Books You May Enjoy

Packt is searching for authors like you

Download a free PDF copy of this book

Preface

Mastering MongoDB 7.0 is a technical guide for developers and database professionals wanting to implement advanced functionalities and master complex database operations in MongoDB. Exploring the latest version of MongoDB, it helps with gaining the skills necessary to create efficient, secure, and high-performing applications using MongoDB.

This book is an excellent collection of real-world examples, practical insights, and invaluable tips. It is a comprehensive guide to equip developers with the skills needed to handle the challenges of modern data management, application integration, and security.

How will this book help you?

This book provides hands-on examples that will help you become proficient in creating efficient, secure, and high-performing applications using MongoDB. You'll gain the confidence to undertake complex queries, integrate robust applications, and ensure data security to overcome modern data challenges.

Who is this book for?

This book is for developers with an intermediate skill level, who aim to become MongoDB experts. This book is not for beginners. Working knowledge of MongoDB is recommended to get the most out of this guide. Ideal for database administrators, app developers, and software engineers, this book will assist you in developing advanced skills to conquer intricate data tasks.

What does this book cover?

Chapter 1, Introduction to MongoDB, provides a quick introduction to MongoDB, the world's most versatile developer data platform, through the lens of the creators. This chapter will build your curiosity around exploring MongoDB and all its new features.

Chapter 2, The MongoDB Architecture, shows how to increase reliability and availability for your applications by implementing various methods in MongoDB, using replication and sharding. It also covers the new sharded cluster features introduced in MongoDB 7.0.

Chapter 3, Developer Tools, explores different MongoDB developer tools and shows how to use them to increase your productivity.

Chapter 4, Connecting to MongoDB, showcases the multi-language facets of MongoDB, providing a walkthrough of the direct driver methods, ODM libraries, and MongoDB integration across Ruby, PHP, Python, and Node.js.

Chapter 5, CRUD Operations and Basic Queries, demonstrates CRUD operations and basic queries in action. It provides hands-on examples of using the MongoDB Shell for database administration operations.

Chapter 6, Schema Design and Data Modeling, covers MongoDB schema design principles and techniques for effective data representation—which are essential for optimizing performance and scalability.

Chapter 7, Advanced Querying in MongoDB, offers a more profound exploration of MongoDB's capabilities, including the aggregation framework, indexing techniques, and optimization.

Chapter 8, Aggregation, delves into the aggregation framework and explores numerous stages and expression operators suitable for the most diverse problems.

Chapter 9, Multi-Document ACID Transactions, shows how MongoDB handles multi-document ACID transactions and what significance this concept has in sectors with strict requirements, such as finance, fintech, and mission-critical applications.

Chapter 10, Index Optimization, discusses and shows how MongoDB supports a plethora of indexes—from single-field to compound indexes, from geospatial to hashed and partial, as well as some recently introduced indexing types.

Chapter 11, MongoDB Atlas: Powering the Future of Developer Data Platforms, provides an in-depth walk-through of MongoDB Atlas—the most advanced cloud database service on the market.

Chapter 12, Monitoring and Backup in MongoDB, focuses on the essential aspects of monitoring the health and performance of the system, along with strategies and tools for effective data backup and recovery.

Chapter 13, Introduction to Atlas Search, shares insights on the capabilities integrated into MongoDB Atlas. It shows how to use sophisticated search functionalities for your data.

Chapter 14, Integrating Applications with MongoDB, delves into the various methods of integrating applications with MongoDB—both the native and cloud versions of MongoDB Atlas.

Chapter 15, Security, discusses the critical role of security in MongoDB, delving into robust authentication and authorization methods such as SCRAM, x.509, LDAP, and Kerberos.

Chapter 16, Auditing, provides an in-depth look at the features, benefits, and challenges of auditing in MongoDB, with an understanding of and practical guidelines for its effective implementation.

Chapter 17, Encryption, summarizes the different types of encryption and shows the practical implementation of each type in your database.

To get the most out of this book

You will require the following software:

Software/hardware covered in the book

Operating system requirements

Resources for installation steps

MongoDB version 4.4 or newer

Windows, macOS, or Linux

https://www.mongodb.com/docs/manual/installation/

MongoDB Atlas Search

Windows, macOS, or Linux

https://www.mongodb.com/docs/atlas/getting-started/

MongoDB Shell

Windows, macOS, or Linux

https://www.mongodb.com/docs/manual/administration/install-community/

MongoDB Compass

Windows, macOS, or Linux

https://www.mongodb.com/docs/compass/current/install/

After reading this book, we encourage you to check out some of the other resources available athttps://www.mongodb.com/developeror https://learn.mongodb.com/.

If you're using the digital version of this book, we advise you to type the code yourself or access the code from the book's GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Mastering-MongoDB-7.0. If there's an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database collection names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here's an example: "The mongoid gem can be added to your application by modifying the Gemfile."

A block of code is set as follows:

class Shape     include Mongoid::Document     field: x, type: Integer     field: y, type: Integer embedded_in: canvas end

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here's an example: "Click on the Schema tab to check the schema distribution of the collection."

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there's a topic that you have expertise in and you're interested in either writing or contributing to a book, please visit authors.packtpub.com.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your e-book purchase not compatible with the device of your choice?

Don't worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don't stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

Scan the QR code or visit the link below

https://packt.link/free-ebook/9781835460474

Submit your proof of purchaseThat's it! We'll send your free PDF and other benefits to your email directly