嗨,有人可以帮我将它映射到 Rails 和 Mongo,我有两天时间研究这个主题,但我似乎无法弄清楚,我的意思是在 Mongoid 或 MongoMapper 中为这两个集合制作模型。
Users collection
{ "_id" : ObjectId( "4fa883e45ddddbb60c4a6970" ),
"username" : "joedoe",
"name" : "joe",
"created" : "2010-01-15 00:00:00",
"suscribers" : [
{ "suscribe_id" : ObjectId( "4fa884a35ddddbb60c4a6971" ),
"name" : "Mashable",
"tags" : ['Tech', 'News'],
"sort" : 0
},
{ "suscribe_id" : ObjectId( "4fa884a35ddddbb60c4a6972" ),
"name" : "Joe",
"tags" : ['Tech'],
"sort" : 1
}
] }
Suscribers collection
{ "_id" : ObjectId( "4fa884a35ddddbb60c4a6971" ),
"name" : "Dan",
"suscribers_count" : 0,
"latest" : "2010-01-15 00:00:00" },
{ "_id" : ObjectId( "4fa884a35ddddbb60c4a6972" ),
"name" : "Fer",
"suscribers_count" : 0,
"latest" : "2010-01-15 00:00:00" }
谢谢!