How to Search for Text with Regex using the MongoDB Shell

Introduction In this short step-by-step tutorial we’ll show you how to search for specific text within a collction of documents using regex or Regular Expressions. Regular Expressions are a super useful text pattern matching functionality that every programmer should be familiar with. The syntax is hard to remember but we hope this article will give … Continued

How to Change a Field Name using the MongoDB Shell

Introduction Maybe you misnamed a field in an entire collection or want to update so it’s more intuitive for your development team. Doing this in a relational database is a little bit simler because all you have to do is update the column name ( and update all your queries to match ) but with … Continued

How to Update a Document using the Mongo Shell

Introduction Updating a record is a basic CRUD method of any database technology and is extremely important to familiarize yourself with it. If your application needs to update the user’s address, phone, or credit card information these would all by typical examples of an update operation. An update is not creating a record but modifying … Continued

How to Customize your MongoDB Shell Prompt

Introduction Most shells in Linux, OSX, or Windows show a prompt with some info like the current user, current direcory, or computer name like so: 1ComputerName:currentFolder myuser$ But the MongoDB shell by default gives you none of this context information. All it gives you is: 1> For users working in MongoDB shell some context information … Continued

How to Set Pretty Print as Default in the MongoDB Shell

Introduction If you’re working with MongoDB through the shell you may find your eyes trying to sort through unreadable and jumbled data. You might already know but adding .pretty() command formats the results in a way that makes them much more readable. We asked ourselves how we can make this the default instead of having … Continued

How to Change the Mongo Default Database from “test”

Introduction When you start the MongoDB service it defaults to using the test database which can be an annoyance because you have to switch over to the database you are working with every time. We encountered this annoyance ourselves and wondered if there was a way that it could default to a database that we … Continued

MongoDB vs MySQL

Introduction For decades, relational database management systems such as MySQL have served as the basis for countless enterprise applications. However, today’s organizations face different challenges than their predecessors, which means they need to find better ways to store and access their data. Enter a new generation of document-oriented, or NosQL, databases, with MongoDB standing out … Continued

How to connect Python to MongoDB

Introduction If you’re working with data stored in MongoDB, you’ll probably need to access the database from Python. Luckily the MongoDB client library makes this task a simple one, allowing you to connect to MongoDB with just a few lines of code. In this step-by-step tutorial, we’ll explain how to connect Python to MongoDB using … Continued

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.