我正在尝试获取 Oject 值的数组,但它给出了空值。我需要 从下面的文档中获取结果值。
电子邮件系统-->结果
{
"_id" : ObjectId("5f0890e870e631865877e"),
"user" : "testuser",
"Email" : "testuser@sample.com",
"Batch Systems" : [
"STAR",
"STORY",
"ITEMS",
],
"Email Systems" : [
{
"System1" : {
"System" : "Backend",
**"result"** : true
}
},
{
"System2" : {
"System" : "Backend",
"result" : true
}
}
],
下面是代码片段:
@RequestMapping(value = "/search", method = RequestMethod.GET)
public Object getClaimsBySearchCriteria(@RequestParam(value = "userId") String userId){
MongoDatabase database = this.mongoClient.getDatabase(test);
MongoCollection<Document> users = database.getCollection(Systems);
List<? extends Bson> pipelinesVal = Arrays.asList(
new Document()
.append("$unwind", "$Email Systems"),
new Document()
.append("$match", new Document().append("Email Systems","$Email Systems")),
new Document()
.append("$project", new Document()
.append("_id", 1)
.append("items", 1)
));
List<Document> Val = new ArrayList<>();
List values=users.aggregate(pipelinesVal).into(Val);
Document docSourceSystem =new Document();
List<Document> aggregate = new ArrayList<>();
LOG.info("pipelinesVal: " + pipelinesVal.toString());
LOG.info("values: " + values.toString());
}
上面的代码结果值是空的,而不是 true 或 false。任何人都可以帮我解决这个问题。上面的代码出了什么问题