passing options to aggregate

Issue #14 new
Torsten Scholak
created an issue

I had a look at the code, and atm it doesn't seem possible to pass options like "allowDiskUse" to mongodb. I wonder, will this feature be implemented?

Comments (2)

  1. Torsten Scholak reporter

    As a very quick&dirty hack, I changed line 980 in monary/cmonary.c to

    bson_t opts;
    bson_init(&opts);
    BSON_APPEND_BOOL (&opts, "allowDiskUse", true);
    mcursor = mongoc_collection_aggregate(collection,
                                          MONGOC_QUERY_NONE,
                                          &pl_bson, &opts, NULL);
    bson_destroy(&opts);
    
  2. A. Jesse Jiryu Davis

    Good point, thanks for filing the report. I think the Python "aggregate" function should take **kwargs and BSON-encode the kwargs dict to "opts". That will permit "allowDiskUse" and any future options that are added to "aggregate".

  3. Log in to comment