Я просто спрашиваю "Что означает эта ошибка"? Я здесь очень вежлив

способ отфильтровать все объекты из данногоList of Object после предоставления некоторыхconditions.

Например

Класс А
@Entity(value = "tbl_A")
public class A {

private String notes;
@Embedded
private List<SampleObject> sampleObject;

....getter and setter ...
}
Класс б
@Embedded
public class SampleObject {
    private boolean read;
    private boolean sentByBot;

   ... getter and setter ...
   }

Теперь я хочу только собратьSampleObject который имеетsentByBot параметр установлен вtrue, Я использую следующий подход:

Query<A> queryForA = datastore.find(A.class);
queryForA.field("sampleObject.sentByBot").equal(false).retrievedFields(true, "sampleObject.sentByBot");

Выше код дает мне весь списокobjects который имеетsampleObject.sentByBot правда и ложь оба.

Я тоже пробовалfilter подход то есть

 queryForA.filter("sampleObject.sentByBot", false).retrievedFields(true, "sampleObject.sentByBot");

Но не повезло. Есть ли способ получить только те поля, которые имеютsampleObject.sentByBot установить истину?

редактировать

После реализации следующего кода я получил это:

Изображение базы данных

Код
  AggregationOptions options = AggregationOptions.builder()
              .outputMode(AggregationOptions.OutputMode.CURSOR)
              .build();

  //System.out.println(options.toString());

  Projection filterProjection = Projection.projection(
              "sampleObjects",
              Projection.expression(
                      "$filter",
                      new BasicDBObject("input","$sampleObjects")
                              .append("cond",new BasicDBObject("$eq", Arrays.asList("$this.sentByBot",true)))
              )
      );

 AggregationPipeline pipeline = datastore.createAggregation(A.class)
              .match(datastore.createQuery(A.class).filter("sampleObjects.sentByBot", true))
              .project(
                      Projection.projection("fieldA"),
                      Projection.projection("fieldB"),
                      filterProjection
              );

      Iterator<A> cursor = pipeline.aggregate(A.class, options);
Выход
"Command failed with error 28646: '$filter only supports an object as its argument'. The full response is { \"ok\" : 0.0, \"errmsg\" : \"$filter only supports an object as its argument\", \"code\" : 28646 }"

Ответы на вопрос(1)

Ваш ответ на вопрос