Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

3 Tips for SQL Users New To MongoDB

Posted on: 14/02/2020 (last updated: 10/08/2021) by Kathryn Vargas

Looking to migrate your SQL databases to MongoDB? This tool might be for you. 

As the digital world continues to store data that’s exponentially growing in amount and complexity, the advantages of using a NoSQL database such as MongoDB become crystal clear.

NoSQL databases are easier to scale. No schema or a predefined structure means more flexibility in data handling, especially if you have variable data. But companies still need a data model, that only if carefully thought-out, will translate to better and faster query performance.

Developers and database admins (DBAs) recognize these advantages. DB Engines ranks MongoDB as the 5th most popular database among all SQL and NoSQL databases. It is far and away the most widely deployed NoSQL database.

The move from SQL to MongoDB is happening, but it doesn’t necessarily mean it’s absolute. In our recent survey of Studio 3T users, around 80% still use a SQL database in their daily work, painting a reality that’s not as clear-cut as expected. Developers are dabbling in NoSQL land, but with one foot still firmly in SQL territory.

With this trend in mind, here are our top 3 tips for SQL users new to MongoDB that should help ease the transition – or database coexistence.

1. No Schema ≠ No Database Design

Many companies have decided MongoDB is the way to go, while others still question if the switch from SQL to NoSQL is worth it.

Square one for developers should always be to fully understand the database requirements. Only then can they can appropriately decide if SQL, NoSQL, or a hybrid approach best suits their project.

Companies like Wanderu opted to go for a NoSQL database completely from the get-go. They needed maximum flexibility to address their diverse set of train and bus travel data, which MongoDB sufficiently addressed.

But they also understood that this solution would be even better if they fused two NoSQL database types: one acting as a document store (MongoDB) and the other for graphs (Neo4j).

The result? A “docugraph” hybrid solution that syncs both MongoDB and Neo4j.

Wanderu's data pipeline
Screenshot from Wanderu’s presentation, “Wanderu – Lessons from Building a Travel Site with Neo4j”

Wanderu is a perfect example of a database design process done well. They understood their data’s complexity and volume, which made NoSQL the irrefutable choice. And they pulled off a hybrid NoSQL approach in-house, knowing that this would further optimize data management.

Instead of combining two NoSQL databases, other companies have gone for a hybrid SQL + NoSQL approach.

MongoDB cites Craigslist as an example:

“For much of the history of Craigslist, MySQL was the only option for data storage, including its massive archive of classified posts. These posts are retained for years after they were initially posted for access by users (e.g., reposting an old job listing). The original Craigslist archive application simply copied the existing live database. If the live database schema changed, those changes needed to be propagated to the archive system.

This result was a hodgepodge schema and lengthy delays in making simple changes. For example, each ALTER TABLE statement took months to complete on the MySQL archive. When making changes to billions of rows in their MySQL cluster, Craigslist could not move data to the archive. Archive-ready data would pile up in the production database. During these periods, performance on the live database deteriorated.

Craigslist migrated their archive to MongoDB, keeping the live listings on MySQL. MongoDB’s flexible data model could easily accommodate changes to the schema, without affecting the performance of the live site.”

Main takeaway: Understand and anticipate your database requirements before making any major changes.

Consider especially how your reporting needs might be likely to evolve: a relational database is always going to be hard to beat for fast and efficient analytics.

But, as your needs change over time, MongoDB allows you to be agile, as seen in companies that have addressed problems by implementing hybrid approaches.

2. Master the MongoDB Query Language
(Or Use an IDE)

MongoDB uses BSON (Binary JSON), which is based on JSON (JavaScript Object Notation). If you know JavaScript, congratulations: you’ll breeze through writing those command lines.

But knowing JSON or JavaScript is not the whole story.

The mongo shell interface is quite cumbersome to navigate. And while MongoDB has excellent documentation, there’s a lot to learn, especially as queries can get pretty complex and time-consuming, pretty quickly.

Take a look at the db.collection.findAndModify(document) command, which is used for modifying and returning a single document.

A MongoDB GUI turned IDE like Studio 3T can serve as the ideal leg-up in such instances, especially when exploring collections and querying data.

Instead of writing out the entire shell script manually – with the inevitable typos, dropped brackets, and other bugs creeping in – you can simply locate the document to modify through an intuitive drag-and-drop visual query builder:

Studio 3T's Visual Query Builder has an intuitive drag-and-drop interface

And edit the data in-place:

In-place data editing on Studio 3T

Studio 3T also has convenient tools to help beginners get accustomed to the MongoDB query language.

Take for example Query Code, which is an in-tool driver code generator that converts any query done through drag-and-drop to one of five languages: Java, JavaScript, C#, Python, and the mongo shell language (PHP was also recently added).

Query Code converts your MongoDB query to one of five target languages, including BSON

Or SQL Query, which benefits users two-fold. It allows them to use SQL to query MongoDB collections, while simultaneously showing how it translates to the MongoDB query language, as well as Java, JavaScript, C#, Python, and PHP.

Main takeaway: You will probably need to master BSON and the MongoDB query language to be an expert. And if you’re already there, congrats.

But for the rest of us data mortals, a purpose-built MongoDB IDE like Studio 3T can get you moving a lot faster through the somewhat alien NoSQL data landscape.

3. Get to Know How SQL Maps to MongoDB

As you transition from SQL to MongoDB, it’s important to familiarize yourself with how your SQL knowledge transfers to MongoDB.

MongoDB has compiled a helpful SQL to MongoDB Mapping Chart which outlines all the corresponding terms and statements.

SQL users might recognize MongoDB features like the Aggregation Pipeline which mimics the aggregation capabilities in SQL. But it will pay off to get accustomed to how aggregate operations map between SQL and MongoDB, so that you can take full advantage of MongoDB’s aggregation pipeline.

The Aggregation Pipeline is recommended for most MongoDB aggregate operations, but MongoDB also provides another aggregation method called Map-Reduce.

Unlike the aggregation pipeline which filters results as you apply operators at various stages, the map-process matches the data based on your query and emits them in key-value pairs, which are then further condensed and aggregated in the reduce-process.

The use cases for map-reduce are diminishing among MongoDB users, but the map-reduce feature might still be familiar to users of certain SQL databases like Oracle, where the functionality can be easily implemented.

If you’re still working on your MongoDB query language fluency, don’t worry. You can still get aggregate queries done easily with tools like Studio 3T.

Tools like the visual Aggregation Editor (above) and Map-Reduce make the querying process actually fun, while taking only half the time.

Main takeaway: Harness your SQL knowledge and find out precisely how that translates to MongoDB using their comprehensive documentation.

MongoDB features like Aggregation Pipeline and Map-Reduce might ring a bell among SQL users. But, as with related human languages, beware of false friends and mistaken assumptions, especially as you’re working your way towards MongoDB query language fluency.

Use a MongoDB IDE like Studio 3T to bridge the knowledge gap in the short-term, and save time on complex querying in the long-term. Try it free for 30 days and download the latest version today.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • MongoDB Atlas Pricing & Tips to Help Manage Costs
  • 5 MongoDB Security Tips to Help Keep the Cats Away
  • SQL Migration: MongoDB and SQL, Coexistence Made Easy
  • SQL Migration: MongoDB and SQL, Coexistence Made Easy
  • Moving from SQL to MongoDB? Studio 3T’s SQL Migration feature makes it simple

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected