how to search the array with no empty value from mongodb in java?
问题 I would like to get the data tags from mongodb whose data is not null "tags" : [ ] I tried doing $ne but no chance. BasicDBObject searchQuery = new BasicDBObject(); searchQuery.put("tags", new BasicDBObject("$ne", [])); Any help would be appreciated. 回答1: I solved this by using this query searchQuery.put("tags.1", new BasicDBObject("$exists", true)); 来源: https://stackoverflow.com/questions/42099824/how-to-search-the-array-with-no-empty-value-from-mongodb-in-java