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

Add support for aggregates using withQueryFn to MongoDbIO

Details

    • Improvement
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • 2.9.0
    • 2.12.0
    • io-java-mongodb

    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

              sandboxws Ahmed El.Hussaini
              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