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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:38:54+00:00 2026-06-02T08:38:54+00:00

I have a document layout like this: Program = { ‘_id’:ObjectId(‘4321…’), ‘Title’:’The Title’, ‘Episodes’:[

  • 0

I have a document layout like this:

Program = {
    '_id':ObjectId('4321...'),
    'Title':'The Title',
    'Episodes':[
              {
              'Ep_ID':'234122',  # this is unique
              'Title': 'Ep1',
              'Duration':45.2 },
              'Ep_ID':'342343' # unique
              'Title': 'Ep2',
              'Duration':32.3 }
                ]
            }

What I would like to do is at another embedded doc within each Episode, like this:

Program = {
        '_id':ObjectId('4321...'),
        'Title':'The Title',
        'Episodes':[
                {
                'Ep_ID':'234122'  # this is unique
                'Title': 'Ep1',
                'Duration':45.2,
                'FileAssets':[
                          { 'FileName':'video1.mov', 'FileSize':2348579234 },
                          { 'FileName':'video2.mov', 'FileSize':32343233 }
                             ]
                },
                {
                'Ep_ID':'342343' # unique
                'Title': 'Ep2',
                'Duration':32.3,
                'FileAssets':[
                          { 'FileName':'video1.mov', 'FileSize':12423773 },
                          { 'FileName':'video2.mov', 'FileSize':456322 }
                             ]
                }
                  ]
            }

However, I can’t figure out how to add/mod/del a doc at that ‘3rd’ level. Is it possible or even good design? I would dearly love to have all the data in one doc, but managing is starting to seem too complex.

The other thought I had was to use the unique values that happen to exist for the sub-docs as keys. I’ve thought about my sub-docs and they all have some kind of unique value. So I could do this:

Program = {
        '_id':ObjectId('4321...'),
        'Title':'The Title',
        'Ep_ID_234122':{episode data},
        'Ep_ID_342343':{episode data},
        'FileAsset_BigRaid_Video1.mov':{'Ep_ID_234122', + other file asset data},
        'FileAsset_BigRaid_video2.mov':{'Ep_ID_234122', + other file asset data}
        }

Any thoughts would be great!

  • 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-02T08:38:55+00:00Added an answer on June 2, 2026 at 8:38 am

    Yes, you can definitely structure your data to have that kind of nesting. Whats more, you definitely shouldn’t need to do anything special to accomplish it (at least using pymongo). just get your docs with an update cursor if you need to update existing documents, if that’s your problem?

    at least, for your first idea. your second idea for a schema is not at all a nice way to structure that data. for one, it’ll be impossible for you to easily iterate over subsets of a Program document without doing string matching on the keys, and that will get expensive.

    That said, I’m currently dealing with some major MongoDB performance issues, so I would probably recommend you keep your file assets in a separate collection. it will make it easier for you to scale later, if you plan for this data set to become large.

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

Sidebar

Related Questions

I have a document, something like this: <root> <A node=1/> <B node=2/> <A node=3/>
I have a view file like this : <html> <head> <meta name=layout content=main />
I have an html form like this: <form id=boxy action=layout.html method=get accept-charset=utf-8> <input type=text
i have a page layout like this <input id=name class=mandotary type=text> <label for=name>Name must
I have a document that looks something like <root> <element> <subelement1 /> <subelement2 />
I have a VBScript script that looks like this: Const ForAppending = 8 Set
I have a form + layout like so: <form ...> <div id=editor> [form html]
I'm trying to achieve a layout in html that looks exactly like this when
I have a top-level _Layout.cshtml that looks something like this: <html> <head> @RenderSection(Header, required:
I have no containers, no wrappers. I simply have a layout like so... <body>

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.