"命令失败,错误 168 (InvalidPipelineOperator): '无法识别的表达式 '$match' [英] "Command failed with error 168 (InvalidPipelineOperator): 'Unrecognized expression '$match'
本文介绍了"命令失败,错误 168 (InvalidPipelineOperator): '无法识别的表达式 '$match'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
获取异常
命令失败,错误 168 (InvalidPipelineOperator): '无法识别的表达式 '$match
Command failed with error 168 (InvalidPipelineOperator): 'Unrecognized expression '$match
我的语法有什么问题?
String searchString = new String(sourceSystem);
AggregateIterable<Document> aggregateIterable = users.aggregate(Arrays.asList(new Document("$project", new Document("Email Systems", new Document("$match", new Document("Email Systems.Bob", searchString))))));
Iterator iterator = aggregateIterable.iterator();
ArrayList<Document> documents = new ArrayList();
while (iterator.hasNext()) {
documents.add((Document) iterator.next());
}
推荐答案
问题是你在project
应该是stage的array list
.第一个元素应该是 match
或 project
.
It should be array list
of stages. First element should be either match
or project
.
Document matchDoc = new Document(\*matching condition*/);
Document projectDoc = new Document(/*project doc*/);
传递这两个数组列表.
这篇关于"命令失败,错误 168 (InvalidPipelineOperator): '无法识别的表达式 '$match'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文