[CDRIVER-2756] mongoc_collection_replace_one missing MONGOC_EXPORT in mongoc-collection.h Created: 19/Jul/18  Updated: 28/Oct/23  Resolved: 20/Jul/18

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.9.0
Fix Version/s: 1.13.0

Type: Bug Priority: Critical - P2
Reporter: Bernie Volz Assignee: Spencer Mckenney
Resolution: Fixed Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Issue on Windows as symbol is not available in library.


Issue Links:
Related
related to CDRIVER-2761 Catch missing MONGOC_EXPORTs automati... Backlog

 Description   

The mongoc_collection_replace_one function is not available in the dynamic library for Windows because the MONGOC_EXPORT is missing from the header file ... see below:

 

MONGOC_EXPORT (bool)
mongoc_collection_update_many (mongoc_collection_t *collection,
const bson_t *selector,
const bson_t *update,
const bson_t *opts,
bson_t *reply,
bson_error_t *error);
bool
mongoc_collection_replace_one (mongoc_collection_t *collection,
const bson_t *selector,
const bson_t *replacement,
const bson_t *opts,
bson_t *reply,
bson_error_t *error);
MONGOC_EXPORT (bool)
mongoc_collection_delete (mongoc_collection_t *collection,
mongoc_delete_flags_t flags,
const bson_t *selector,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)



 Comments   
Comment by Spencer Mckenney [ 20/Jul/18 ]

Yep you're right, thanks for pointing this out Bernie. I updated the ticket to reflect that. Closing this issue now as the fix has been merged

Comment by Githook User [ 20/Jul/18 ]

Author:

{'username': 'spencemc', 'name': 'Spencer McKenney', 'email': 'spencermck@me.com'}

Message: CDRIVER-2756 add mongo export to replace one
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0d6b0285746c484ba7b5167a2c3801dded4c42f3

Comment by Bernie Volz [ 19/Jul/18 ]

I think this actually impacts 1.9.0 - 1.12:

mongo-c-driver 1.9.0
====================

...

  • New functions that accept flexible options as a BSON document. These
    accept a "sessionId" option and any future options. In addition, the
    two new "update" functions accept the "arrayFilters" option that is new
    in MongoDB 3.6:
    mongoc_collection_insert_one
    mongoc_collection_insert_many
    mongoc_collection_update_one
    mongoc_collection_update_many
    mongoc_collection_replace_one

We were using 1.9.2 and it has this issue. We are planning to upgrade, but will likely wait until issue is resolved before updating.

  • Bernie

----Original Message----
From: Spencer Mckenney (JIRA) <jira@mongodb.org>
Sent: Thursday, July 19, 2018 4:01 PM
To: Bernie Volz (volz) <volz@cisco.com>
Subject: [MongoDB-JIRA] (CDRIVER-2756) mongoc_collection_replace_one missing MONGOC_EXPORT in mongoc-collection.h

[ https://jira.mongodb.org/browse/CDRIVER-2756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Spencer Mckenney updated CDRIVER-2756:
--------------------------------------
Status: In Code Review (was: Open)

----------------------
This message was sent from MongoDB's issue tracking system. To respond to this ticket, please login to https://jira.mongodb.org using your JIRA, MongoDB Cloud Manager, or MongoDB Atlas credentials.

Comment by A. Jesse Jiryu Davis [ 19/Jul/18 ]

Can you investigate whether our ABI dump / verification tools could be configured to catch this kind of mistake? I.e., any function declared in a public header (a header that's installed, that doesn't have "private" in the filename), but not decorated with MONGOC_EXPORT / BSON_EXPORT.

Generated at Wed Feb 07 21:16:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.