# MongoDB table relations

**URL:** <https://discuss.openedx.org/t/mongodb-table-relations/15162>\
**Category:** Architecture\
**Tags:** how-to\
**Created:** [March 5, 2025, 10:45am UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162 "2025-03-05T10:45:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KTB](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/ktb/32/4720_2.png) [@KTB](https://discuss.openedx.org/u/KTB)\
**Post date:** [March 5, 2025, 10:45am UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/1 "2025-03-05T10:45:36Z")

</div>

Can someone explain to me the three tables in MongoDB: `modulestore.structures`, `modulestore.definitions`, and `modulestore.active_versions`? I can link `structures` with `definitions`, but I do not understand what data `active_versions` stores and how it relates to the other two tables. (I am trying to link content blocks with course codes.)

---

<div class="post-metadata">

**Author:** ![sarina](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sarina/32/2308_2.png) [@sarina](https://discuss.openedx.org/u/sarina)\
**Post date:** [March 5, 2025, 1:27pm UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/2 "2025-03-05T13:27:24Z")

</div>

Hi @KTB and welcome back!

I admit I worked on this ages and ages ago and could not explain it but I’m wondering if this wiki article would help: [edx-platform-wiki/Split:-the-versioning,-structure-saving-DAO.md at master · openedx-unsupported/edx-platform-wiki · GitHub](https://github.com/openedx-unsupported/edx-platform-wiki/blob/master/Split%3A-the-versioning%2C-structure-saving-DAO.md)

---

<div class="post-metadata">

**Author:** ![dave](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/dave/32/263_2.png) [@dave](https://discuss.openedx.org/u/dave)\
**Post date:** [March 5, 2025, 3:23pm UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/3 "2025-03-05T15:23:12Z")

</div>

Please also see this recent thread, as it’s relevant to this part of the system: [500 errors accessing an older course in our LMS, modulestore values out of sync? - Development - Open edX discussions](https://discuss.openedx.org/t/500-errors-accessing-an-older-course-in-our-lms-modulestore-values-out-of-sync/15155)

That being said, this is a very low-level representation of the content data. Depending on your use case, you might be better off using the [Course Blocks API](https://openedx.atlassian.net/wiki/spaces/AC/pages/29688043/Course+Blocks+API) or doing queries in modulestore. Our longer term goal is to get rid of MongoDB from the system and to change how we store this content on the backend.

---

<div class="post-metadata">

**Author:** ![KTB](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/ktb/32/4720_2.png) [@KTB](https://discuss.openedx.org/u/KTB)\
**Post date:** [March 6, 2025, 4:48am UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/4 "2025-03-06T04:48:42Z")

</div>

“Thank you for your response. I have tried this method, but it only returns the list within the course block, while the API for block content is not yet available.”

---

<div class="post-metadata">

**Author:** ![KTB](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/ktb/32/4720_2.png) [@KTB](https://discuss.openedx.org/u/KTB)\
**Post date:** [March 11, 2025, 1:36am UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/5 "2025-03-11T01:36:22Z")

</div>

@sarina Thank you. I have completed checking all the links in my LMS. The document link you provided has helped me resolve the issue I was facing.

---

<div class="post-metadata">

**Author:** ![sarina](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sarina/32/2308_2.png) [@sarina](https://discuss.openedx.org/u/sarina)\
**Post date:** [March 11, 2025, 4:23pm UTC](https://discuss.openedx.org/t/mongodb-table-relations/15162/6 "2025-03-11T16:23:30Z")

</div>

@KTB thanks for the feedback and I’m glad you got things working 😃
