请教一个mongodb的模型骨架
发布于 11 年前 作者 mengrpg1 4179 次浏览 最后一次编辑是 8 年前

我想设计一个用户,有 name password 等,关键是 这个帐号有个背包,背包中有目前想是 物品,物品数量,比如 石头 3个 ;苹果 5个; 水瓶 1个;关键是有什么东西不是确定的,当然有上限,大概50项,某个物品的上限不考虑, 各位大侠 这该如何设计好呢

12 回复

卡了,多点了两次, 我用的是 mongoose

简单,放数组里

@inosqlorg 谢谢,不知道什么定义, arrOfString:[String], arrOfNumber:[Number], arrOfDate:[Date], 你看这几个数组,我的数组每个元素是成对的,也可能一个元素3个, 可以这样写吗 arrOfGoods[String,Number…], 我比较新手,求教一下

user:{ username:xxx, password:xxx, good :[ {apple:2}, {stone:5} ] }

好的 谢谢呀

好的 谢谢呀

好的 谢谢呀

好的 谢谢呀

好的 谢谢呀

好的 谢谢呀

今天网络有点问题 重复了上面的回复

user:{ username:xxx, password:xxx, good :[ {apple:2}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5}, {stone:5} . . . . . . . . . . . . . ] }

应该是一次把50个都给填上

回到顶部