code: public static Bson pullByFilter(final Bson filter) {
          return new Bson() {
              @Override
              public <TDocument> BsonDocument toBsonDocument(final Class<TDocument> tDocumentClass, final CodecRegistry codecRegistry) {
                  BsonDocumentWriter writer = new BsonDocumentWriter(new BsonDocument());
  
                  writer.writeStartDocument();
                  writer.writeName("$pull");
  
                  encodeValue(writer, filter, codecRegistry);
  
                  writer.writeEndDocument();
  
                  return writer.getDocument();
              }
          };
      }
docs: Creates an update that removes from an array all elements that match the given filter.
  
  @param filter the query filter
  @return the update
  @mongodb.driver.manual reference/operator/update/pull/ $pull