如何在mongodb中查询数组中的所有项目

时间:2017-11-08 08:04:52

标签: mongodb mongodb-query aggregation-framework

如果我有一个包含多个字符串的数组,例如//1) if you can avoid using linked list use below solution List<String> words= getWordsFromDB(); //words list has nearly 120k elements //if you can avoid using linked list, use set instead Set<String> set=new HashSet<>(); for (String s:words) { if (!set.add(s)) { //do some calculations } } //2) if you can't avoid using linked list use below code List<String> words= getWordsFromDB(); //words list has nearly 120k elements List<String> tempList = new LinkedList<String>(); //empty list //if you can't avoid LinkedListv (tempList) you need to use a set Set<String> set=new HashSet<>(); for (String s:words) { if (set.add(s)) { tempList.add(s); } else { int a = tempList.indexOf(s); //do some calculations } } lineItems.0.domain等,是否有更简单的方法来了解这些lineItems.1.domain中是否包含某些domains?< / p>

不确定如何将其全部合二为一,所以只需使用大量的$或语句

searchText

0 个答案:

没有答案