跳到主要内容
CNode

请教一个mongodb的模型骨架

社区
Mmengrpg1发布于 13 年前最后回复 13 年前
1250700

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

查看回复

回复 (12)

J
jiangzhuo#1213 年前
引用 yimityuser:{ 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个都给填上

M
mengrpg1#1113 年前

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

Y
yimity#413 年前

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

M
mengrpg1#313 年前
引用 mengrpg1卡了,多点了两次, 我用的是 mongoose

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

M
mengrpg1#113 年前

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

参与回复

登录后即可参与回复。登录