In this edition of "Best of DZone," we take a look at one of the most popular NoSQL databases currently on the market, MongoDB. Whether you're just starting out and aren't quite sure what a document is or are a NoSQL pro, we've got you covered with some of our best articles and tutorials on subjects ranging from getting started with the database, indexing and query optimization, visualizing MongoDB data, all the way to implementing security best-practices.
Before we begin, we'd like need to thank those who were a part of this article. DZone has and continues to be a community powered by contributors like you who are eager and passionate to share what they know with the rest of the world.
Let's get started!
What Is MongoDB?
In this brief, introductory tutorial, learn about MongoDB, one of the most powerful NoSQL databases.
For a comprehensive of getting started with Mongo, check out this Refcard by Vlad Mihalcea, CEO of Hypersistance, which covers configuration options, shell functions, types of cursors, sharding, and more!
Still struggling to know if Mongo is right for your current project? Check out this article by Prashanth Jayaram in which he explains when and when not to use MongoDB.
See the good, the bad, and the ugly of MondoDB with this quick cheat sheet by Darel Lasrado.
Get a handle on data types in MongoDB with this quick tutorial by Anoop Kumar Sharma.
MongoDB vs SQL
There are so many database management systems in the market to choose from. Let's dive into this hot debate between NoSQL and SQL with MongoDB vs MySQL by Mihir Shah. For a comparison of indexing in both databases, see this article by Anders Karisson.
In this article, Junal Sethi explains why he prefers MongoDB to Relational Database Management Systems like SQL.
- For all-things installation and configuration, look no further than Starting MongoDB Database Software by Adamo Tonete, as he walks readers through beginning to use Mongo on Windows, Linux, and MacOS.
In this comprehensive, three-part series by Sibeesh Venu, check out how to get started with MongoDB. In part one, write your first query and see how to use indexes to reduce query execution time. In part two, learn how to perform basic CRUD operations within Mongo shells. Finally, in part three, go in-depth on MongoDB indexes.
Are you a Java developer looking to get started with Mongo? Look no further than this series by Trish Gee and this article by Atish A. Parts one and two of Gee's can be found here and here, respectively.
If Python's your language of choice, see this tutorial by MVB, Robert Walters, as he explains how to get started with Python and MongoDB.
See how pipelines work in MongoDB in this article by Aditya C S, as he gives readers in-depth analysis on how to write queries with pipelines.
Need to connect MongoDB to your Node.js application but don't want to use Mongoose for one reason or another? See this tutorial by Nagappan Subramanian, as he explains how to use Native Driver to connect these two elements in the MEAN stack.
Learn how to connect Apache Kafka and MongoDB with this article by MVB, Robert Walters.
Fall in love with MongoDB
MongoDB and all its Friends
In this article, MVB, Bill Ward, compares MongoDB and Apache Cassandra in order to give readers a better understanding of which distributed database is best for their particular needs. If you're looking for more comparisons to Cassandra and Mongo, check out this article by Brian O'Neil, in which he brings CouchDB, Riak, and HBase into the conversation.
Gazanfaur Ali Mohammed walks through ACID properties, CAP attributes, and other features among Cassandra, MongoDB, and MySQL databases to help readers choose the right database for your applications in How to Choose the Right Database.
Still debating between Firebase and MongoDB as your application's database of choice? Check out Presh Sagar's article, Firebase vs MongoDB: Which Database to Use for Your App Development.
- Still a little rusty with expressive arrays in MongoDB? Check out Expressive Query Language in MongoDB 3.6 by Atish A, in which he walks readers through using fully expressive arrays, updating all elements in an array with the
$operator, and comparing fields in the find query with
- Need a quick guide on building complex queries in MongoDB? Look no further than Rishav Rohit's article, Writing Complex MongoDB Queries Using QueryBuilder, to master writing queries in Java.
In Covered Queries in MongoDB, developer Vijaykishan Shyamsundar shows readers how to use covered queries in MongoDB so that all fields of a query and the results returned are part of the index.
Find out how to better trace MongoDB queries with cursor comments in Tim Vaillencout's article, Tracing MongoDB Queries to Code With Cursor Comments.
Follow along with MVB, Norberto Leite, in this article, as he explains how to perform random queries on MongoDB.
See how to perform multi-document transactions in MongoDB and how ACID plays a role in the larger process in this article by Leona Zhang.
Indexing and Query Optimization
- Get started with optimizing queries with this article by Guy Harrison, as he demonstrates how to begin optimizing queries and using the
explainmethod. For more on the explain method, check out this series by Corrado Pandiani.
- Need to know how your queries are performing? See this article by Ajitesh Kumar, as he shows readers how to evaluate query performance by better managing indexes.
- Check out four simple tips to optimize MongoDB query performance in this article by MVB, Adamo Tonete.
- For more on optimizing queries with Spring, see this tutorial by Dan Newton, in which he explains how indexes can be applied to a class to create indexes that have been specified within that class.
Check out how to feed a heatmap display with MongoDB data and explore grouping documents to return a daily aggregation query in Kevin Hooke's article, MongoDB Aggregation Queries for "Counts Per Day" (Part 1).
If you're using MongoDB, take a look at Compass, a GUI designed to help you get a better look at your data without getting lost. Jason Ma shows readers how to begin using the tool in Visualizing Your Data With MongoDB Compass.
If, like me, you're on a budget, and the Enterprise version of Compass is a little expensive for your needs, check out this article by Adamo Tonete, as he explains how to get the most out of the community version of Compass.
Find the best GUI for working with MongoDB in Dharshan Rangegowda's article, Which Is the Best MongoDB GUI — 2019 Update.
Looking for a better wat to work with data from IoT device's? Look no further than Rathnadevi Manivannan's article, Visualize IoT Data With Kaa and MongoDB Compass.
Still haven't found the right GUI for you? Check out this tutorial by Vaibhaw Pandey, as he explains how to connect MongoDB deployments to the Robo ET GUI at ScaleGrid.
Thinking of migrating to MongoDB Atlas? Follow along with Mat Keep, as he shows readers how to prepare for migration, optimize query performance, and avoid common pitfalls in this four-part series. Part one, two, three, and four can be found here, here, here, and here, respectively.
In this article by Rishab Aggarawi and Rito Chakraborty, see how to upload master data in MongoDB Atlas efficiently.
See how to programmatically launch MongoDB clusters with your existing toolset without writing extra code in Jay Gordon's article, DevOps Automation With MongoDB Atlas.
Need more on working with Atlas? Check out this article, also by Jay Gordon, on importing MongoDB data to AWS with Atlas.
Prepare for the worst in this article, as Jay Gordon explains how to implement chaos engineering in your testing in order to better handle potentially crippling situations like running out of disk space or failing to connect to a network in his article, Planning for Chaos With MongoDB Atlas: Using the "Test Failure" Button.
On a similar note, check out how to restore Atlas backups from AWS in Gordon's last contribution to this compilation, Restoring MongoDB Atlas Database Backups in AWS.
In MongoDB, Security, and How Not to Get Stung, follow along with Dave Avery, as he explains how a Microsoft database security leak sheds light on security best practices for MongoDB.
In part one of his four-part series on preventing vulnerabilities in the MEAN stack, David Bohannon goes deep on some tips and tricks on better securing your MongoDB clusters.
In this two-part series by MongoDB advocate, Jay Gordon, learn how to build a Node.js Application with MongoDB Atlas and AWS' Elastic Container Service. Parts one and two can be found here and here, respectively.
Learn how to create a Reactive application with MongoDB and Spring Boot in this tutorial by Andrew Hughes.
In this article by Anis Hajri, put on your data mining hats and check out some Python code that can calculate similarity of an indexed field between all documents of a MongoDB collection.
Learn about using PyMongo and the Python MongoDB driver by testing failover in a Python application in Vaibhaw Pandey's article, PyMongo Tutorial: Testing MongoDB Failover in Your Python App.
Bonus: MongoDB Cheat Sheet
New to MongoDB? This command cheat sheet will come in handy. (Even if you aren't a Mongo-rookie, this sheet is nice to have around just in case!
Be a Part of the Conversation!
Think we missed something? Want to contribute? Let us know in the comments below... or, join the conversation by becoming a member of our community of thousands of developers eager to share their knowledge and passion for programming with others.