private Projection addArrayIdentities(Projection p,EntityMetadata md) { // If an array is included in the projection, make sure its identity is also included Map<Path,List<Path>> arrayIdentities=md.getEntitySchema().getArrayIdentities(); List<Projection> addFields=new ArrayList<>(); for(Map.Entry<Path,List<Path>> entry:arrayIdentities.entrySet()) { Path array=entry.getKey(); List<Path> identities=new ArrayList<>(); for(Path x:entry.getValue()) identities.add(new Path(array,new Path(Path.ANYPATH,x))); if(isProjected(array,p)) { for(Path id:identities) { if(!isProjected(id,p)) { addFields.add(new FieldProjection(id,true,true)); } } } } if(!addFields.isEmpty()) { LOGGER.debug("Excluded array identities are added to projection:{}",addFields); // Need to first add the original projection, then the included fields. // This is order sensitive return Projection.add(p,new ProjectionList(addFields)); } else return p; }
DBCollection collection = db.getCollection(store.getCollectionName()); Projection combinedProjection = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find));
DBCollection collection = db.getCollection(store.getCollectionName()); Projection combinedProjection = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find));
response.setSize(finder.find(ctx, coll, mongoQuery, mongoProjection, mongoSort, from, to)); Projector projector = Projector.getInstance(Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find)), md); for (DocCtx document : ctx.getDocuments()) { document.setOutputDocument(projector.project(document, ctx.getFactory().getNodeFactory()));
: Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find)), md); ctx.setDocumentStream(DocumentStream.map(ctx.getDocumentStream(),d->{ ctx.measure.begin("projectFound");
Projection x = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find)); LOGGER.debug("Projection={}", x); projector = Projector.getInstance(x, md);
Projection x = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find)); LOGGER.debug("Projection={}", x); projector = Projector.getInstance(x, md);