我想在我的数据库中找到包含空值的字段。我在stackoverflow上的其他一些帖子中读到你可以尝试使用$ ne(不相等)但是没有让它为我工作,所以我认为这可能是我做错的其他事情
以下是我的数据库中的一个示例:
{ "_id" : ObjectId("5695553244aec8a25d162698"), "DBLPKey" : "journals/software/Goth08a", "LastModified" : "2011-11-07", "Authors" : [ { "Name" : "Greg Goth", "Affiliation" : null } ], "Title" : "Ultralarge Systems: Redefining Software Engineering?", "Pages" : "91-94", "Year" : "2008", "Volume" : "25", "Journal" : "IEEE Software", "Number" : "3", "ElectronicEdition" : "http://doi.ieeecomputersociety.org/10.1109/MS.2008.82", "LocalURL" : "db/journals/software/software25.html#Goth08a", "Abstracts" : "Ultra-Large-Scale Systems: The Software Challenge of the Future, a report produced by Carnegie Mellon University's Software Engineering Institute, just might be a watershed blueprint for the next generation of top-level software design. Although it's written with a distinct slant toward the US military's future requirements, its description of how the fundamental principles of software design will change in a global economy—defined by ubiquitous computing—are finding wide appeal." }
我想在这里找到的字段是作者内部称为Affiliation的字段。 我试过这个问题:
db.Articles.find({Affiliation:{ $ne: null}})
但这对我不起作用。是不是因为我不得不告诉MongodDB它是否在作者字段中?还是其他一些我误解或错过的东西?
答案 0 :(得分:2)