com.sequoiadb.exception.BaseException: errorCode:-6,Invalid Argument
Exception Detail:{ "createTime" : { "$and" : { "$gte" : 1438617600000 , "$lte" : 1439481600000}} , "places.placeId" : "029" , "tribalId" : "10232134"}
{$and:[ { createTime:{ "gte":1438617600000 } } , {createTime:{"$lte" : 1439481600000}}, {"places.placeId" : "029"}, {"tribalId" : "10232134"}]}
示例
选择集合 bar 下 age 字段值为20,price 字段值小于10的记录
db.foo.bar.find({$and:[{age:20},{price:{$lt:10}}]})
关于$and的用法详见:
http://www.sequoiadb.com/cn/index.php?a=index&m=Files&cat_id=1432190912&edition_id=0
优化一下
{$and:[ { createTime:{ "gte":1438617600000,"$lte" : 1439481600000}}, {"places.placeId" : "029"}, {"tribalId" : "10232134"}]}
成功了!!!!!!!!!!!!!!!!!!!!
为什么这样查询的效率会高一些呢?
效率上不会有很大提升,这样写更简洁清晰