0
tl; dr 我的模式好吗?我的数据库模式可以与Mongo一起使用吗?
我今年的决议是要学习一些新的东西,并且我选择了解非rel数据库,即Mongo。我目前正在研究一个使用mongo作为数据库引擎的简单应用程序。
我正在使用的应用程序是一个简单的问卷应用程序:管理员创建问题,(登录)用户回答他们。所以:用户有很多答案属于问题。 这样的应用程序最合适的模式是什么?我自己创建了下一个模式(伪),但我想知道是否有任何提示/技巧可以解决这个问题。
users [
{
# some required fields to authenticate the user
email: [email protected],
password: ...
etc.
# next fields are this users answers to a question
# the key is the question's id, it's value the answer
1: 'John',
2: 'Doe',
},
]
questions [
{ # no 1 (I know id's in mongo aren't numbered this way,
# this is just for the sake of readability.
question: What is your first name?,
type: open,
required: true,
},
{ # no 2
question: What is your last name?,
type: open,
required: false,
},
# and so on.
]
不要忘记DBref的http://www.mongodb.org/display/DOCS/Database+References – Falcon 2011-01-11 10:47:01