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 9186473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:32:12+00:00 2026-06-17T19:32:12+00:00

I still getting used to using a schema-less document oriented database and I am

  • 0

I still getting used to using a schema-less document oriented database and I am wondering what a generally accepted practice is regarding schema designs within an application model.

Specifically I’m wondering whether it is a good practice to use enforce a schema within the application model when saving to mongodb like this:

{
    _id: "foobar",
    name: "John"
    billing: {
        address: "8237 Landeau Lane",
        city: "Eden Prairie",
        state: "MN",
        postal: null
    }
    balance: null,
    last_activity: null
}

versus only storing the fields that are used like this:

{
    _id: "foobar",
    name: "John"
    billing: {
        address: "8237 Landeau Lane",
        city: "Eden Prairie",
        state: "MN"
    }
}

The former is self-descriptive which I like, while the latter makes no assumptions on the mutability of the model schema.

I like the first option because it makes it easy to see at a glance what fields are used by the model yet currently unspecified, but it seems like it would be a hassle to update every document to reflect a new schema design if I wanted to add an extra field, like favorite_color.

How do most veteran mongodb users handle this?

  • 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-17T19:32:13+00:00Added an answer on June 17, 2026 at 7:32 pm

    I would suggest second approach.

    1. You can always see the intended structure if you look at your entity class in the source code. Or do you use dynamic language, and don’t create an entity?
    2. You save a lot of space per record, because you don’t have to store null column names. This may not be expensive on small collections. But on large, with millions of records, I would even go to shorten the names of fields.
    3. As you already mentioned. By specifying optional column names, you create a pattern, which, if you want to follow, you’ll have to update all existing records when you add a new field. This is, again, a bad idea for a big DB.

    In any case it all goes down your db size. If you don’t target for many GBs or TBs of data, then both approaches are fine. But, if you predict, that your DB may grow really large, I would do anything to cut the size. Spending 30-40% of storage for column names is a bad idea.

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

Sidebar

Related Questions

I'm still getting used to SQL, so before I get to using stored procedure,
I'm still getting used to the whole Controller flow of iPhone development. I'm using
I have recently started using R and am still getting used to its data
Possible Duplicate: Consuming a Web service using Javascript Please note that I'm still getting
When using a LoaderManager, do I still manage my database writes the way I
I'm still getting used to how Core Data works and I've looked around for
I am trying to modify my coding styles and am getting used to using
I'm fairly new to ASP.NET MVC and still getting used to some of the
I'm still getting used to Indy, being a multi-threaded socket system with vast capabilities.
I'm still getting used to the sizers in wxWidgets, and as such can't seem

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.