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

  • SEARCH
  • Home
  • 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 7832685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:21:12+00:00 2026-06-02T12:21:12+00:00

I am considering to move to mongoDB but I lack some certain basic understanding

  • 0

I am considering to move to mongoDB but I lack some certain basic understanding of the thing. My main question is “How do the stored objects are affected by model changes?”. Here is a scenario to better understand what I want to know :

  1. I create a “User” model with first_name, last_name, email attributes.
  2. I create 25 users in my application that are stored in mongo (so they get stored as {first_name: “xxx”, last_name: “yyy”, email: “zzz”})
  3. I add an attribute to my “User” model : username
  4. I create 25 new users in my application (so they get stored as {first_name: “xxx”, last_name: “yyy”, email: “zzz”, username: “xyz”})
  5. I remove the “first_name” and “last_name” attributes from the “User” model.
  6. I update the email address of 5 of the first 25 users.

So here are my questions :

  1. After adding the “username” attribute to “User” model, what happens to the first 25 objects? Do they receive the “username” attribute in their BSON definition with an empty value? My understanding is they are simply left unnafected.
  2. When I remove the “first_name” and “last_name” attributes from the “User” model, what happens to the existing 50 users? I guess the same answers as #1 applies.
  3. After I updated the email addresses of the 10 records, what happens to the 5 firsts? Do they get the “username” added, “first_name” and “last_name” removed and their email addresses updated? Or simply their email addresses updated?
  • 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-06-02T12:21:14+00:00Added an answer on June 2, 2026 at 12:21 pm

    Your intuition is correct. MongoDB requires you to create and enforce the data model in your application (i.e., outside the database).. I think this is one of the biggest mental hurdles to get over when making the switch from SQL databases.

    So to answer your questions

    1. The original 25 User objects will not automatically receive a “username” attribute. You will either need to manually update the existing users to add a username or update the model to handle the case where no username exists.

    2. Same as above. You will either need to manually update the existing records to remove the first_name and last_name attributes or wait until the object is updated to a future version that doesn’t include them.

    3. It depends on how you do the update. You can either update by replacing the entire record or by using modifiers to change individual fields. If you replace the entire record, then the current version of the model will be saved. If you modify the “email” attribute directly, then the other fields will not be changed.

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

Sidebar

Related Questions

We are considering a move from SVN to Mercurial, and have encountered a stumbling
I am considering to move frome Microsoft languages to PHP (just for web dev)
Like many others on this site I am considering a move to ASP.NET MVC
I was considering what would it take (technologically) to move all the web traffic
I know, I am crazy, considering I am literally just learning HTML. But I
I'm working on an android game and have been considering my main game loop.
I'm considering to move parts of a .Net application to other computers. The obvious
We are currently considering to move away from CVSNT, very probably to Subversion (because
Well we are considering to move from WinForms to WPF, what pitfalls does WPF
Considering this is only for my homework I don't expect much help but I

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.