Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-679

Aggregate does not accept a bson.A as the pipeline

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.2.0
    • Affects Version/s: 0.1.0
    • Component/s: BSON
    • None

      It seems like you should be able to use a bson.A to hold several bson.D or bson.M documents to create an aggregation pipeline. But when I try I get the error "cannot transform type primitive.A to a *bsonx.Document".

      Example:

      pipeline := bson.A{
      		bson.M{"$match": bson.M{"userID": userID}},
      		bson.M{"$sort": bson.M{"date": -1}},
      		bson.M{"$limit": defaultLimit},
                      // other steps
      }
      _, err := collection.Aggregate(context.Background(), pipeline)
      err.Error() == "cannot transform type primitive.A to a *bsonx.Document"
      

            Assignee:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Reporter:
            pjt PJ Tatlow
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: