1
我在Morphia创建聚合时遇到了问题,documentation真的不清楚。这是原始查询:Mongorphb Morphia聚合
db.collection('events').aggregate([
{
$match: {
"identifier": {
$in: [
userId1, userId2
]
},
$or: [
{
"info.name": "messageType",
"info.value": "Push",
"timestamp": {
$gte: newDate("2015-04-27T19:53:13.912Z"),
$lte: newDate("2015-08-27T19:53:13.912Z")
}
}
]
}{
$unwind: "$info"
},
{
$match: {
$or: [
{
"info.name": "messageType",
"info.value": "Push"
}
]
}
]);
唯一的例子在他们的文档使用并有一些例子here但我不能让它工作。
我没连上了过去的第一场比赛,这是我有:
ArrayList<String> ids = new ArrayList<>();
ids.add("199941");
ids.add("199951");
Query<Event> q = ads.getQueryFactory().createQuery(ads);
q.and(q.criteria("identifier").in(ids));
AggregationPipeline pipeline = ads.createAggregation(Event.class).match(q);
Iterator<Event> iterator = pipeline.aggregate(Event.class);
一些帮助或指导,以及如何开始与查询或者它是如何工作将是巨大的。
非常感谢,我能创建查询。我有一个问题是arrayB声明'q.criteria'中的'q'变量应该替换为'query.criteria'。如果不是为什么? – Jimmy