Aggregate does not accept a bson.A as the pipeline

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 0.2.0
    • Affects Version/s: 0.1.0
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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:
            Kristofer Brandow (Inactive)
            Reporter:
            PJ Tatlow
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: