From: Chris Lundquist Date: Fri, 13 Jul 2012 01:06:15 +0000 (+0000) Subject: Fix to make write_mongodb work with any version of mongo-c-driver X-Git-Tag: collectd-5.1.1~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8e50e5d967d0b5a8627ef00d37063f746b957307;p=collectd.git Fix to make write_mongodb work with any version of mongo-c-driver --- diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 8d76b608..c7b76820 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -195,7 +195,14 @@ static int wm_write (const data_set_t *ds, /* {{{ */ /* Assert if the connection has been established */ assert (mongo_is_connected (node->conn)); - status = mongo_insert (node->conn, collection_name, bson_record); + #if MONGO_MINOR >= 6 + /* There was an API change in 0.6.0 as linked below */ + /* https://github.com/mongodb/mongo-c-driver/blob/master/HISTORY.md */ + status = mongo_insert (node->conn, collection_name, bson_record, NULL); + #else + status = mongo_insert (node->conn, collection_name, bson_record); + #endif + if(status != MONGO_OK) { ERROR ( "write_mongodb plugin: error inserting record: %d", node->conn->err);