首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐工具
›
RoboMongo
推荐书目
›
50 Tips and Tricks for MongoDB Developers
Related Blogs
›
Snail in a Turtleneck
V2EX
›
MongoDB
MongoDB中没有值的字段是设成null好呢还是干脆没有这个key好?
love
·
2013-10-25 17:46:17 +08:00
· 6889 次点击
这是一个创建于 3842 天前的主题,其中的信息可能已经有所发展或是发生改变。
三个选择:
1. 保留key,值为null
2. 没有key(稍微省点内存)
3. 随意混用
对于字符串值呢, None和空串怎么存好?
key
null
空串
1 条回复
•
1970-01-01 08:00:00 +08:00
1
ccdjh
2013-10-25 18:42:14 +08:00
看应用场景吧。
你看livid的json。
http://www.v2ex.com/api/members/show.json?username=Livid
是使用没有key
http://v2ex.com/api/nodes/all.json
保留key,值为null
当你使用json.loads的时候,是会帮你转换null的.
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
我们的愿景
·
实用小工具
·
745 人在线
最高记录 6543
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms ·
UTC 21:14
·
PVG 05:14
·
LAX 14:14
·
JFK 17:14
Developed with
CodeLauncher
♥ Do have faith in what you're doing.