@@ -727,6 +727,43 @@ test_cursor_new_tailable_await (void)
727727}
728728
729729
730+ static void
731+ test_cursor_new_ignores_fields (void )
732+ {
733+ mock_server_t * server ;
734+ mongoc_client_t * client ;
735+ mongoc_cursor_t * cursor ;
736+ bson_error_t error ;
737+
738+ server = mock_server_with_autoismaster (WIRE_VERSION_FIND_CMD );
739+ mock_server_run (server );
740+
741+ client = mongoc_client_new_from_uri (mock_server_get_uri (server ));
742+ cursor = mongoc_cursor_new_from_command_reply (
743+ client ,
744+ bson_copy (tmp_bson ("{'ok': 1,"
745+ " 'cursor': {"
746+ " 'id': 0,"
747+ " 'ns': 'test.foo',"
748+ " 'firstBatch': []"
749+ " },"
750+ " 'operationTime' : {},"
751+ " '$clusterTime': {},"
752+ " '$gleStats': {},"
753+ " 'batchSize': 10"
754+ "}" )),
755+ 0 );
756+
757+ ASSERT_OR_PRINT (!mongoc_cursor_error (cursor , & error ), error );
758+
759+ ASSERT_MATCH (& cursor -> opts , "{'batchSize': 10}" );
760+
761+ mongoc_cursor_destroy (cursor );
762+ mongoc_client_destroy (client );
763+ mock_server_destroy (server );
764+ }
765+
766+
730767static void
731768test_cursor_new_invalid_filter (void )
732769{
@@ -1673,6 +1710,8 @@ test_cursor_install (TestSuite *suite)
16731710 TestSuite_AddLive (suite , "/Cursor/new_invalid" , test_cursor_new_invalid );
16741711 TestSuite_AddMockServerTest (
16751712 suite , "/Cursor/new_tailable_await" , test_cursor_new_tailable_await );
1713+ TestSuite_AddMockServerTest (
1714+ suite , "/Cursor/new_ignores_fields" , test_cursor_new_ignores_fields );
16761715 TestSuite_AddLive (
16771716 suite , "/Cursor/new_invalid_filter" , test_cursor_new_invalid_filter );
16781717 TestSuite_AddLive (
0 commit comments