File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -762,6 +762,7 @@ mongoc_database_find_collections (mongoc_database_t *database,
762
762
mongoc_read_prefs_t * read_prefs ;
763
763
bson_t cmd = BSON_INITIALIZER ;
764
764
bson_t child ;
765
+ bson_error_t lerror ;
765
766
766
767
BSON_ASSERT (database );
767
768
@@ -785,16 +786,17 @@ mongoc_database_find_collections (mongoc_database_t *database,
785
786
if (_mongoc_cursor_cursorid_prime (cursor )) {
786
787
/* intentionally empty */
787
788
} else {
788
- if (mongoc_cursor_error (cursor , error )) {
789
- if (error -> code == MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND ) {
789
+ if (mongoc_cursor_error (cursor , & lerror )) {
790
+ if (lerror . code == MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND ) {
790
791
/* We are talking to a server that doesn' support listCollections. */
791
792
/* clear out the error. */
792
- error -> code = 0 ;
793
- error -> domain = 0 ;
793
+ memset (& lerror , 0 , sizeof lerror );
794
794
/* try again with using system.namespaces */
795
795
mongoc_cursor_destroy (cursor );
796
796
cursor = _mongoc_database_find_collections_legacy (
797
797
database , filter , error );
798
+ } else if (error ) {
799
+ memcpy (error , & lerror , sizeof * error );
798
800
}
799
801
} else {
800
802
/* TODO: remove this branch for general release. Only relevant for RC */
You can’t perform that action at this time.
0 commit comments