Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-6241

Add support for aggregates using withQueryFn to MongoDbIO

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 2.9.0
    • Fix Version/s: 2.12.0
    • Component/s: io-java-mongodb
    • Labels:

      Description

      Adds Support to Limit Results

       

      MongoDbIO.read()
      .withUri("mongodb://localhost:" + port)
      .withDatabase(DATABASE)
      .withCollection(COLLECTION)
      .withFilter("{\"scientist\":\"Einstein\"}")
      .withLimit(5));

      Adds Support to Use Aggregates

       

      List<BsonDocument> aggregates = new ArrayList<BsonDocument>();
        aggregates.add(
          new BsonDocument(
            "$match",
            new BsonDocument("country", new BsonDocument("$eq", new BsonString("England")))));
      
      PCollection<Document> output =
        pipeline.apply(
          MongoDbIO.read()
            .withUri("mongodb://localhost:" + port)
            .withDatabase(DATABASE)
            .withCollection(COLLECTION)
            .withAggregate(aggregates));
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sandboxws Ahmed El.Hussaini
                Reporter:
                sandboxws Ahmed El.Hussaini
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 8h 20m
                  8h 20m