内容简介:http://stackoverflow.com/questions/9312067/mongodb-queries-with-null-value本站文章除注明转载外,均为本站原创或编译转载请明显位置注明出处:MongoDB查询空值
我的收藏(MongoDB v 2.0.2)有以下记录:
db.organization.find({})
{ "_id" : 1001, "path" : [ ], "parent" : null }
{ "_id" : 1002, "path" : [ 1001 ], "parent" : NumberLong(1001) }
组织有索引:
db.organization.ensureIndex({"path":1});
db.organization.ensureIndex({"parent":1},{sparse:false});
(注意我放了awarnes sparse:false – 授予null被索引)
但是,执行:
db.organization.find({"parent":null})
返回空集.哪里不对?先谢谢你
我遇到过同样的问题.阅读以下文件后
我尝试查询不同的BSON元素类型,并发现我的null被表示为BSON元素类型6(未定义,不推荐使用),而不是预期的BSON元素类型10(null).
db.collection.find({ field: { "$type" : 6} };
http://stackoverflow.com/questions/9312067/mongodb-queries-with-null-value
本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:MongoDB查询空值
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Mybatis关联查询(嵌套查询)
- MySQL高级查询---连接查询实例
- Oracle子查询相关内容(包含TOP-N查询和分页查询)
- Laravel Query Builder 复杂查询案例:子查询实现分区查询 partition by
- 打造出色查询:如何优化SQL查询?
- SQL优化-慢查询+explain查询
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Ant Colony Optimization
Marco Dorigo、Thomas Stützle / A Bradford Book / 2004-6-4 / USD 45.00
The complex social behaviors of ants have been much studied by science, and computer scientists are now finding that these behavior patterns can provide models for solving difficult combinatorial opti......一起来看看 《Ant Colony Optimization》 这本书的介绍吧!