[CDRIVER-4478] Find collection example references nonexistent error field Created: 23/Sep/22  Updated: 28/Oct/23  Resolved: 18/Oct/22

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.24.0

Type: Bug Priority: Unknown
Reporter: Oleg Pudeyev (Inactive) Assignee: Gil Alon
Resolution: Fixed Votes: 0
Labels: buildfest-2022, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-4477 Find collections example does not dec... Closed
Backwards Compatibility: Fully Compatible

 Description   

In https://mongoc.org/libmongoc/current/mongoc_database_find_collections_with_opts.html

   if (mongoc_cursor_error (cursor, &error))
      fprintf (stderr, "%s\n", error.msg);
   }

Produces

main.c:139:37: error: 'bson_error_t' {aka 'struct _bson_error_t'} has no member named 'msg'
  139 |       fprintf (stderr, "%s\n", error.msg);
      |                                     ^

Looking at definition in source, the field is called message:

typedef struct _bson_error_t {
   uint32_t domain;
   uint32_t code;
   char message[BSON_ERROR_BUFFER_SIZE];
} bson_error_t BSON_ALIGNED_END (8);



 Comments   
Comment by Githook User [ 18/Oct/22 ]

Author:

{'name': 'Gil Alon', 'email': '47804748+galon1@users.noreply.github.com', 'username': 'galon1'}

Message: CDRIVER-4478 Fix code snippet in find collection documentation (#1122)

CDRIVER-4478 fix documentation code snippet error
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/a3fb14cf344e7ab12be996e9af8e7bb130dac753

Comment by Gil Alon [ 18/Oct/22 ]

PR: https://github.com/mongodb/mongo-c-driver/pull/1122/

Comment by Oleg Pudeyev (Inactive) [ 23/Sep/22 ]

This line is also missing the opening curly brace:

   if (mongoc_cursor_error (cursor, &error))

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