Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4035758
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:08:19+00:00 2026-05-20T12:08:19+00:00

Good day dear colleagues, I decided to move some projects from MySQL to MongoDB

  • 0

Good day dear colleagues, I decided to move some projects from MySQL to MongoDB and faced several difficulties:

For example there are two tables in MySQL:

Users:

CREATE TABLE `testdb`.`users` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 55 ) NOT NULL ,
`password` VARCHAR( 32 ) NOT NULL
) ENGINE = MYISAM

Rules:

CREATE TABLE `testdb`.`rules` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL ,
`title` VARCHAR( 155 ) NOT NULL ,
`points` INT NOT NULL
) ENGINE = MYISAM 

Now to chose all “rules”, which belong to a paticular user I can make SQL request:

SELECT r.`title`, r.`points` FROM `rules` r, `users` u WHERE r.`uid` = u.`id` AND u.`id` = '123'

By now, I can’t figure out how to do the same in MongoDB, can you please explain and provide an example.

P.S. I make implementation in Python with the help of pymongo
P.P.S. I also wanted to see the alternative ways of solving this problem with the help of ORM mongoengine or mongokit.

Thank you in advance:)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:08:20+00:00Added an answer on May 20, 2026 at 12:08 pm

    MongoDB does not support joins, unlike RDBMS’s like mysql. And that’s because MongoDB is not a relational database. Modelling data in MongoDB in the same way as you do in an RDBMS is therefore generally a bad idea – you have to design your schemas in a whole different mindset.

    In this case for example, in MongoDB you could have 1 document per User, with the Rules belonging each user nested inside.

    e.g.

    {
        "ID" : 1,
        "name" : "John",
        "password" : "eek hope this is secure",
        "rules": [
            {
                "ID" : 1,
                "Title" : "Rule 1",
                "Points" : 100   
            },
            {
                "ID" : 2,
                "Title" : "Rule 2",
                "Points" : 200
            }
        ]
    }
    

    This means, you only need a single read to pull back a user and all their rules.

    A good starting point is the Mongodb.org reference on Schema Design – what I’m talking about above is embedding objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day, I receive data from a communication channel and display it. Parallel, I
Good day, I have a gen_server process which does some long-running state-updating tasks periodically
good day dear php-fans at stackoverflow. i want to use imagegrabscreen — to get
Good day, I was playing with the example found here on SO: PHP Socket
A good day dear developers. My name is Danny. This is my first post
Good day my dear community. I'm working on dynamic shadows for a game I
Good day dear users, I have to edit a Report in Infor PM Application
Good Day, We have migrated our web application to ASP.NET 2.0 from ASP.NET 1.1.
Good day, friends. I have a PreferenceActivity, it is filled from XML file. When
hello and good day dear xml-friends, i am new to xml so do not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.