mongodb对存储数据的格式要求比较严格,比如在对Integer字段做匹配查询时如果把参数写成"1", 那么是匹配不到的,特别是用惯MySQL等关系数据库的同学更要注意了,
在mongodb的console中对时间范围进行匹配:
>var start = new Date(2010, 10, 1, 0, 0, 0);
>var end = new Date(2010, 10, 1, 10, 0, 0);
>db.table.distince("username", {created: {$gte: start, $lte: end}});
上面是统计在置顶时间段内唯一的用户名数
参考文档:
Query for a Date Range
MongoDB Administration
2010-08-19 13:26:47, 6962 reviews, comment
send to mailbox
MongoDB入门
Mochichat新版本上线
Erlang OOP
MongoDB Schema Design
MongoDB删除map_reduce生成的tmp collection
Mongo Beijing开发者聚会
MongoDB Beijing 2011
少年,不点下广告吗!
all by shitou
blog comments powered by Disqus