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