博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Open edX课程数据的存储方式
阅读量:5898 次
发布时间:2019-06-19

本文共 5605 字,大约阅读时间需要 18 分钟。

  hot3.png

openEDX课程数据的存储方式在官方文档中一节说明了其设计的核心思想,本文简单解释一下它的存储方式并通过查看数据库存储的内容来进一步了解它。

每个课程的数据都分三部分:

  • Course Index 课程最基本的数据,比如课程代码、单位等,其中最重要的是两个ObjectID,一个是已发布的课程Course Structures,另一个编辑中的课程Course Structures
  • Course Structures,记录着课程的主要内容和结构,包含多个block,其中默认包含course和overview两个block,所有的block都有自己的ObjectID,它指向XBlock Definitions
  • XBlock Definitions 记录block的具体数据。

下面是mongodb中的collections

root@i-7kvy76cm:/edx# mongoMongoDB shell version: 2.6.11connecting to: test> use edxappswitched to db edxapp> show collectionsfs.chunksfs.filesmodulestore.active_versions # 即是Course Indexmodulestore.definitions # 即是XBlock Definitionsmodulestore.structures # 即是Course Structuressystem.indexes

modulestore.active_versions中的数据大致是这样

{ "_id": ObjectId("5632e46950e3432ed9f51b08"), "course": "test10code", # 课程代码 "edited_on": ISODate("2015-10-30T03:30:49.380Z"), "run": "2015", "versions": { "draft-branch": ObjectId("5632e46950e3432ed9f51b07"),# 编辑版Course Structures "published-branch": ObjectId("5632e46950e3432ed9f51b09") }, # 发布版Course Structures "search_targets": { "wiki_slug": "test10org.test10code.2015" }, "org": "test10org", # 单位代码 "edited_by": NumberLong(9), "schema_version": 1, "last_update": ISODate("2015-10-30T03:30:49.564Z")}

Course Structures的json数据大致是这样:

{ "_id": ObjectId("5632e84650e3432ed9f51b0b"), "edited_by": NumberLong(9), "previous_version": ObjectId("5632e83550e3432edcf51b07"), "original_version": ObjectId("5632e46950e3432ed9f51b07"), "schema_version": 1, "edited_on": ISODate("2015-10-30T03:47:18.352Z"), "blocks": [ # blocks列表,第一个是新添加一个章节数据test-chapter1 { "definition": ObjectId("5632e83550e3432edcf51b06"), "block_type": "chapter", "block_id": "7270a053884041a2b2cc0e64065970f2", "fields": { "display_name": "test-chapter1" }, "defaults": { }, "edit_info": { "edited_by": NumberLong(9), "previous_version": ObjectId("5632e83550e3432edcf51b07"), "original_usage_version": null, "original_usage": null, "edited_on": ISODate("2015-10-30T03:47:18.352Z"), "source_version": null, "update_version": ObjectId("5632e84650e3432ed9f51b0b") } }, { # 第二是默认存在的基本course的block,它设定了课程包含哪几大块内容,比如课件、更新通知、教材、论坛、wiki等 "definition": ObjectId("5632e46950e3432ed9f51b06"), "block_type": "course", "block_id": "course", "fields": { "display_name": "test10name", "language": "en", "tabs": [ { "type": "courseware", "name": "Courseware" }, { "type": "course_info", "name": "Course Info" }, { "type": "textbooks", "name": "Textbooks" }, { "type": "discussion", "name": "Discussion" }, { "type": "wiki", "name": "Wiki" }, { "type": "progress", "name": "Progress" } ], "discussion_topics": { "一般": { "id": "course" } }, "start": ISODate("2030-01-01T00:00:00Z"), "children": [ [ "chapter", "7270a053884041a2b2cc0e64065970f2" ] ] }, "defaults": { }, "edit_info": { "edited_by": NumberLong(9), "previous_version": ObjectId("5632e46950e3432ed9f51b07"), "original_usage_version": null, "original_usage": null, "edited_on": ISODate("2015-10-30T03:47:01.568Z"), "source_version": null, "update_version": ObjectId("5632e83550e3432edcf51b07") } }, { # 默认存在overview block,它是课程介绍页面的内容 "definition": ObjectId("5632e46950e3432ed9f51b0a"), "block_type": "about", "block_id": "overview", "fields": { "display_name": "overview" }, "defaults": { }, "edit_info": { "edited_by": NumberLong(9), "previous_version": null, "original_usage_version": null, "original_usage": null, "edited_on": ISODate("2015-10-30T03:30:49.558Z"), "source_version": null, "update_version": ObjectId("5632e46950e3432ed9f51b07") } } ], "root": [ "course", "course" ]}

XBlock Definitions存储具体的block,比如:

{ "_id": ObjectId("5632e46950e3432ed9f51b06"), "fields": { "wiki_slug": "test10org.test10code.2015" }, "edit_info": { "edited_on": ISODate("2015-10-30T03:30:49.380Z"), "edited_by": NumberLong(9), "original_version": ObjectId("5632e46950e3432ed9f51b06"), "previous_version": null }, "block_type": "course", "schema_version": 1}{ "_id": ObjectId("5632e46950e3432ed9f51b0a"), "fields": { "data": "
\n

About This Course

\n

Include your long course description here. The long course description should contain 150-400 words.

\n\n

This is paragraph 2 of the long course description. Add more paragraphs as needed. Make sure to enclose them in paragraph tags.

\n
\n\n
\n

Requirements

\n

Add information about the skills and knowledge students need to take this course.

\n
\n\n
\n

Course Staff

\n
\n
\n
\"Course\n
\n\n

Staff Member #1

\n

Biography of instructor/staff member #1

\n
\n\n
\n
\n
\"Course\n
\n\n

Staff Member #2

\n

Biography of instructor/staff member #2

\n
\n
\n\n
\n
\n

Frequently Asked Questions

\n
\n

Do I need to buy a textbook?

\n

No, a free online version of Chemistry: Principles, Patterns, and Applications, First Edition by Bruce Averill and Patricia Eldredge will be available, though you can purchase a printed version (published by FlatWorld Knowledge) if you’d like.

\n
\n\n
\n

Question #2

\n

Your answer would be displayed here.

\n
\n
\n
\n" }, "edit_info": { "edited_on": ISODate("2015-10-30T03:30:49.557Z"), "edited_by": NumberLong(9), "original_version": ObjectId("5632e46950e3432ed9f51b0a"), "previous_version": null }, "block_type": "about", "schema_version": 1}

 

Mongodb操作记录:

1. 更新指定条件其中多少条记录:

db.modulestore.active_versions.find({org:"LzSH"}).limit(50).forEach(function(doc){ db.modulestore.active_versions.update({_id:doc._id},{$set:{org:"LzSouth"}})})

 

转载于:https://my.oschina.net/moks/blog/1602264

你可能感兴趣的文章
css3 -webkit-flex 布局
查看>>
大数据Benchmark
查看>>
windows server2008多用户远程登陆设置方法
查看>>
sencha touch巧妙使用请求超时提升用户体验
查看>>
15. 3Sum
查看>>
ArrayList源码解析
查看>>
基于SpringMVC、Maven以及Mybatis的环境搭建
查看>>
可见面判别算法---区域细分算法
查看>>
angularjs-paste-upload
查看>>
RXjs相关
查看>>
linux基础命令 head
查看>>
objective c:import和include的区别, ""和<>区别
查看>>
spring SchedulerFactoryBean 没有创建 Scheduler的实现类bea
查看>>
基于cobbler实现自动化安装系统
查看>>
The Shared folder with you
查看>>
BodyPaint__操作步骤
查看>>
poj 2234 Matches Game
查看>>
2018年全国多校算法寒假训练营练习比赛(第五场)
查看>>
sax方式解析XML学习笔记
查看>>
Springboot配置(上)
查看>>