mongodb多表联查的方法:
1、首先用from进行关联从表名
2、用localField写出主从表关联字段
3、用as查询结果名
4、用Aggregation进行多条件查询
5、查询结果赋给results
6、用print()输出查询结果
代码如下:
LookupOperation lookupOperation=LookupOperation.newLookup().
from("DYNC_EXT_TestInstanceItem"). //关联从表名
localField("partVersion"). //主表关联字段
foreignField("partVersion").//从表关联的字段
as("result"); //查询结果名
AggregationOperation match = Aggregation.match(criteria);
Aggregation aggregation=Aggregation.newAggregation(match, lookupOperation); //多条件
List


