MongoDB
 sql >> Base de Dados >  >> NoSQL >> MongoDB

como usar $lookup stage em java com spring data mongodb?


O suporte de pesquisa existe desde a versão 1.9.
LookupOperation lookupOperation = LookupOperation.newLookup().
                                   from("inventory").
                                   localField("item").
                                   foreignField("sku").
                                   as("inventory_docs");
Aggregation aggregation = Aggregation.newAggregation(lookupOperation);
List<BasicDBObject> results = mongoOperations.aggregate(aggregation, "orders", BasicDBObject.class).getMappedResults();