Mastering MongoDB 7.0, 4th Edition: Achieve data excellence by unlocking the full potential of MongoDB / Oсваиваем MongoDB 7.0, 4-е издание: Достигните высокого качества обработки данных, полностью раскрывая потенциал MongoDB Год издания: 2024 Автор: Aleksendric Marko, Borucki Arek and others / Алексендрик Марко, Боруцки Арек и другие Издательство: Packt Publishing ISBN: 978-1-83546-047-4 Язык: Английский Формат: PDF, EPUB Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 447 Описание: Gain MongoDB expertise and discover advanced queries and Atlas insights with this ultimate guide to version 7.0 Key Features Enhance your proficiency in advanced queries, aggregation, and optimized indexing to achieve peak MongoDB performance Monitor, back up, and integrate applications effortlessly with MongoDB Atlas Implement security thorough RBAC, auditing, and encryption to ensure comprehensive data protection and privacy Book Description 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. What you will learn Execute advanced MongoDB queries for intricate data insights Harness the power of aggregation pipelines to transform data Ensure data integrity with multi-document ACID transactions Optimize query performance using strategic indexing techniques Navigate MongoDB Atlas seamlessly for monitoring and backups Enable robust search functionality with Atlas Search Master RBAC, user management, and data encryption for security Implement auditing practices for transparency and accountability Who this book is for This book is for developers with an intermediate skill level who aim to become MongoDB experts. Working knowledge of MongoDB is recommended to gain the most from 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. Получите опыт работы с MongoDB и ознакомьтесь с расширенными запросами и аналитическими данными Atlas с помощью этого окончательного руководства по версии 7.0 Kлючевые функции Улучшите свои навыки работы с расширенными запросами, агрегацией и оптимизированной индексацией для достижения максимальной производительности MongoDB С помощью MongoDB Atlas можно легко отслеживать, создавать резервные копии и интегрировать приложения Внедрите систему безопасности RBAC, аудит и шифрование, чтобы обеспечить всестороннюю защиту данных и конфиденциальность Описание книги При освоении MongoDB 7.0 используется последняя версия MongoDB, исключительного решения для баз данных NoSQL, которое соответствует потребностям современных веб-приложений. Эта книга начинается с информативного обзора архитектуры MongoDB и инструментов разработчика, которые помогут вам легко подключиться к базам данных. В этой книге MongoDB подробно рассматриваются расширенные запросы, включая конвейеры агрегации и транзакции ACID с несколькими документами. В нем рассматриваются возможности платформы данных для разработчиков MongoDB Atlas и новейшие функции, такие как векторный поиск Atlas, а также их роль в приложениях искусственного интеллекта, позволяющие разработчикам создавать приложения с масштабируемостью и производительностью, которые необходимы современным организациям. В нем также рассказывается о создании функциональности устойчивого поиска с использованием MongoDB Atlas Search. Освоение передовых технологий MongoDB 7.0 включает в себя все: от контроля доступа на основе ролей (RBAC) до управления пользователями, аудита и шифрования на всех уровнях данных, сети и хранилища. К концу прочтения этой книги вы овладеете навыками, необходимыми для создания эффективных, безопасных и высокопроизводительных приложений с использованием MongoDB. Вы будете уверены в том, что сможете выполнять сложные запросы, интегрировать надежные приложения и обеспечивать безопасность данных для решения современных задач обработки данных. Чему вы научитесь Выполняйте расширенные запросы MongoDB для получения подробной информации о данных Используйте возможности конвейеров агрегации для преобразования данных Обеспечьте целостность данных с помощью многодокументных транзакций ACID Оптимизируйте производительность запросов, используя стратегические методы индексации Легко перемещайтесь по базе данных MongoDB Atlas для мониторинга и резервного копирования Включите надежные функции поиска с помощью Atlas Search Освоите RBAC, управление пользователями и шифрование данных для обеспечения безопасности Внедрите методы аудита для обеспечения прозрачности и подотчетности Для кого предназначена эта книга Эта книга предназначена для разработчиков со средним уровнем квалификации, которые стремятся стать экспертами в MongoDB. Рекомендуется ознакомиться с MongoDB на практике, чтобы извлечь максимальную пользу из этого руководства. Эта книга, идеально подходящая для администраторов баз данных, разработчиков приложений и инженеров-программистов, поможет вам развить продвинутые навыки решения сложных задач с данными.
Примеры страниц (скриншоты)
Оглавление
Preface xix 1 Introduction to MongoDB 1 Who uses MongoDB? 1 Why developers love MongoDB? 2 Efficiency of the inherent complexity of MongoDB databases 4 How is this possible? 5 Summary 6 2 The MongoDB Architecture 7 Replication vs sharding 8 Replication 8 Replica set elections 9 Replica set oplog 11 Replica set deployment architectures 12 Write concern 13 Read preference 14 Read concern 15 Replication methods 16 Sharding 17 Why do you need sharding? 17 Key elements of a sharded cluster 18 Microsharding 20 Advantages of sharding 21 Data distribution 22 Chunks 24 Chunk administration 25 Querying sharded data 27 Sharding methods 30 New sharded cluster features in MongoDB 7.0 32 Shard key advisor commands 32 AutoMerger 32 Command support without shard keys 33 Summary 33 3 Developer Tools 35 Technical requirements 36 Introduction to developer tools 36 Categories of developer tools 36 MongoDB Shell 38 Installation 38 Connecting to a MongoDB deployment using mongosh 38 mongosh vs legacy shell 41 Key features of mongosh 41 Use cases for mongosh 43 Best practices for using mongosh 43 MongoDB CLI 44 Installation 44 Configuration 44 Working with MongoDB CLI 45 mongocli auth 46 Key features of MongoDB CLI 47 Use cases for MongoDB CLI 47 Best practices for MongoDB CLI 48 MongoDB Compass 48 Installation 48 Configuration 49 Visually explore data using Compass 50 Key features of MongoDB Compass 52 Use cases for MongoDB Compass 52 Best practices for MongoDB Compass 53 MongoDB for VS Code 53 Installation 53 Explore data using Playground 54 Use Terraform to create an Atlas cluster 54 Key features 55 Use cases for the MongoDB for VS Code extension 55 Best practices for the MongoDB for VS Code extension 55 Summary 56 4 Connecting to MongoDB 57 Connecting methods 57 Connecting using Ruby 58 Connecting using Python 64 Connecting using PHP 66 Connecting using Node.js 69 Connecting using TypeScript 71 Summary 73 5 CRUD Operations and Basic Queries 75 Technical requirements 76 MongoDB CRUD operations 76 CRUD using mongosh 76 Scripting for mongosh 80 Batch inserts using mongosh 83 Batch operations using mongosh 85 CRUD using the Ruby driver 87 Connecting to a database 88 Creating documents 88 Reading data 89 Chaining operations in find() 90 Nested operations 91 Batch operations 92 Mongoid ODM 93 CRUD using the Python driver 95 Inserting documents 96 Finding documents 97 Updating documents 101 Deleting documents 102 Regular expressions 102 Administration 104 currentOp() and killOp() 105 collMod 105 Secure access to MongoDB 107 Authentication and authorization 107 MongoDB Stable API 109 Summary 111 6 Schema Design and Data Modeling 113 Schema design for relational databases 114 Normal forms 115 Schema design for MongoDB 115 Data modeling in MongoDB 116 Document structure 116 Embedded data 118 References 118 Denormalization 119 BSON and its data types 120 Design considerations and best practices for MongoDB modeling 121 Read-write ratio 121 Design patterns and schema design 122 Summary 128 7 Advanced Querying in MongoDB 129 Introduction to the aggregation framework 130 Benefits of aggregation in MongoDB 131 Aggregation stages 132 Query Techniques 146 Logical and comparison operators 146 Array querying and manipulation 152 Array field projection techniques 159 Indexes and query optimization 161 Benefits of using indexes 161 Types of index 162 Geospatial features in MongoDB 164 GeoJSON objects 164 Geospatial indexes 164 Geospatial operators 165 Summary 166 8 Aggregation 167 Technical requirements 168 MongoDB aggregation framework 168 Modularity and composability 169 Stages 171 Aggregation expressions 172 Basic aggregation operators 172 Bitwise operators in aggregation 172 Array expression operators 173 The "power" array operators: $map and $reduce 174 Other types of aggregations 179 Best practices 183 Code modularity 183 Query optimization 184 Streaming and blocking stages of a pipeline 184 Sharded cluster considerations 185 Summary 185 9 Multi-Document ACID Transactions 187 Why are transactions useful? 188 ACID properties 188 Atomicity 189 Consistency 189 Isolation 190 Durability 191 MongoDB implementation of ACID 191 Read and write concerns in transactions 192 Transaction limitations 193 Best practices 202 Summary 203 10 Index Optimization 205 Introduction to indexes 206 Creating an index 206 Index types 211 Single-field indexes and indexing embedded documents 211 Compound indexes 212 Multikey indexes 216 Covered queries 217 Hashed index 218 Text indexes 219 Atlas Search Indexes 220 TTL indexes 220 Partial indexes 221 Geospatial indexes 222 Wildcard indexes 224 Hidden indexes 225 Compound wildcard indexes 226 Best practices for index optimization 227 Summary 227 11 MongoDB Atlas: Powering the Future of Developer Data Platforms 229 Understanding MongoDB Atlas as a database-as-a-service 230 Hosted database 231 Secure by default 233 Monitoring and alerting 237 Back up, restore, and archive 238 Automation 239 Atlas developer data platform 239 Atlas Vector Search and its role in AI applications 240 What does vector search entail? 240 What is Atlas Vector Search? 240 Semantic search and vectors 242 KNN, ANN, and vector embeddings 242 How to use Atlas Vector Search 242 Atlas Search 243 Atlas Application Services 243 What is Atlas Application Services? 243 Key features 245 How to use Atlas Application Services 246 Atlas Data API 246 Security and authorization 247 Use cases 247 How to use the Atlas Data API 248 Atlas Data Lake 248 Data storage and optimization 248 How to use Atlas Data Lake 249 Atlas Data Federation 249 Data processing 250 Key features 250 How to use Atlas Data Federation 251 Atlas Stream Processing (preview) 251 Operational mechanism 251 Key features 252 Setting up a stream processor 253 Atlas SQL Interface 254 How to use the Atlas SQL Interface 256 MongoDB Atlas Charts 256 How to use Atlas Charts 258 Operational integrations: The Atlas Kubernetes Operator 259 What is the Atlas Kubernetes Operator? 259 How to use the Atlas Kubernetes Operator 260 Atlas CLI 261 How to use the Atlas CLI 261 Capabilities of the Atlas CLI 261 Summary 262 12 Monitoring and Backup in MongoDB 263 Monitoring in MongoDB 264 Monitoring clusters 264 Why monitor in MongoDB? 265 What should you monitor? 265 Page fault 265 Resident memory 266 Virtual and mapped memory 266 Working set 266 Track free disk space 266 Monitoring replication 267 Oplog size 267 Network monitoring 268 Cursors and connections 268 Document metrics 268 Monitoring memory usage in WiredTiger 268 Tracking page faults 269 Tracking B-tree misses 269 I/O wait 269 Read and write queues 269 Working set calculations 270 Why is the working set crucial? 270 Estimate the working set size 270 Importance of indexes in the working set 270 MongoDB reporting tools overview 271 Utilities 271 Commands 271 Hosted monitoring tools overview 272 Cluster backups 273 MongoDB backup methods 273 Cloud-based backup solutions 273 On-premises backup solutions 274 Using filesystem snapshots for MongoDB backups 274 Consistency requirements 274 Backups using mongodump 275 Backing up with cp or rsync 275 Backup and restore on EC2 275 Backup with queues 276 Incremental backups 276 Common mistakes and pitfalls in MongoDB monitoring and backup 277 Summary 278 13 Introduction to Atlas Search 279 MongoDB Atlas Search 280 Feature overview 281 Version requirements for Atlas Search features 282 Atlas Search architecture 282 Technical overview of Atlas Search indexes 283 Index creation and management 283 Atlas Search queries 285 Atlas Search query operators and collectors 290 Query execution in Atlas Search 291 Relevance scoring in Atlas Search 292 Atlas Search Nodes 292 Atlas Search index management 294 Search query analysis 295 Troubleshooting Atlas Search errors 296 Apache Lucene 298 Apache Software Foundation 299 Atlas Search and integration with Apache Lucene 299 Summary 301 14 Integrating Applications with MongoDB 303 Technical requirements 304 Integrating applications in MongoDB 304 The MongoDB Kubernetes Operator 307 Installation 307 Deploy and configure MongoDB using the Kubernetes Operator 308 The Atlas Kubernetes Operator 310 The Enterprise Kubernetes Operator 310 Integrating Terraform with MongoDB 311 Installation 311 Configuring a MongoDB cluster on Atlas using Terraform 312 Using Vercel with MongoDB 314 Building a web application with Vercel and MongoDB 314 Configuring MongoDB Atlas with Vercel 315 Disconnecting the Vercel integration 317 Integrating Datadog with MongoDB 318 Configuring Datadog 320 Integrating MongoDB Atlas with Datadog 322 Integrating Prometheus with MongoDB 323 Configuring Prometheus 324 Integrating MongoDB Atlas with Prometheus 326 Integrating webhooks with MongoDB 327 Configuring webhooks with MongoDB 328 Integrating MongoDB with alerting applications 330 Atlas integrations for webhooks 330 Microsoft Teams integration 330 PagerDuty integration 332 Slack integration 332 Splunk On-Call integration 333 Opsgenie integration 333 Integrating MongoDB with Confluent 333 Integrating MongoDB with Postman 334 Summary 335 15 Security 337 Authentication methods 338 SCRAM 338 x.509 343 LDAP 345 Kerberos 349 Role-based access control (RBAC) 352 Knowing about resources, actions, and roles 353 Role hierarchy 357 Managing roles 359 Access restrictions 360 Summary 361 16 Auditing 363 Auditing and logging in MongoDB 364 Types of auditable events 367 Enable auditing in MongoDB 368 Audit filters 369 Enable auditing in MongoDB Atlas 372 View and download MongoDB logs 375 Case study: The role of auditing in compliance 377 Troubleshoot auditing issues in MongoDB 378 How to identify and address issues in auditing using MongoDB 379 Tools for MongoDB audit record analysis 379 Summary 380 Table of Contents xvii 17 Encryption 381 Encryption types 382 Certificates 382 Encryption in-transit 383 How it works 383 Configure TLS for MongoDB 384 Encryption at rest 387 Encryption at rest in MongoDB 387 Configure encryption at rest for MongoDB 388 Client-side encryption 392 When is CSFLE used 392 How it works 394 Configure MongoDB 395 Restrictions and considerations 396 Queryable Encryption 397 Summary 397 Index 399 Other Books You May Enjoy 418
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum