diff --git a/.gitignore b/.gitignore index 4f33460..463ee22 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ # C extensions *.so +*.o # Distribution / packaging .Python @@ -102,3 +103,47 @@ database.config ### vim # *.swp +compile_commands.json + +### Scons +# +.sconsign.dblite + +### Kdevelop +# +*.kdev4 + +### C++ +# +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6300379 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "contrib/mongocxx/mongo-cxx-driver"] + path = contrib/mongocxx/mongo-cxx-driver + url = https://github.com/mongodb/mongo-cxx-driver.git + branch = releases/stable + +[submodule "contrib/iniParser/inih"] + path = contrib/iniParser/inih + url = https://github.com/benhoyt/inih.git diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..4fb3b68 --- /dev/null +++ b/SConstruct @@ -0,0 +1,124 @@ +import os + +globalEnv = Environment() + +globalEnv["ROOTPATH"] = os.path.abspath('.') + +basicBuildPath = os.path.join(globalEnv['ROOTPATH'], 'build') +globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'release') + +globalEnv['CONTRIBPATH'] = os.path.join(globalEnv['ROOTPATH'], 'contrib') +globalEnv['MONGOCPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongoc') +globalEnv['MONGOCXXPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongocxx') +globalEnv["INIHSRC"] = os.path.join( + os.path.join(globalEnv["CONTRIBPATH"], + "iniParser"), + "inih") +globalEnv["INIHCPPSRC"] = os.path.join(globalEnv["INIHSRC"], "cpp") +globalEnv["MINISATSRC"] = os.path.join( + os.path.join(globalEnv["CONTRIBPATH"], + "minisat"), + "src") + + +#compiler option +AddOption('--dbg', action='store_true', dest='DEBUG') + +if GetOption('DEBUG'): + globalEnv.Append(CCFLAGS="-g") + globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'debug') + +globalEnv.Append(CXXFLAGS='-std=c++11') +AddOption("--init", action="store_true", dest="INIT") + +#build libs +# + +globalEnv['LIB_BUILD_PATH'] = os.path.join(globalEnv['BUILDPATH'], 'libs') + +#build mongoc +globalEnv['MONGOC_LIB_PATH'] = os.path.join(globalEnv['LIB_BUILD_PATH'], 'mongoc') + +if GetOption("INIT"): + globalEnv.SConscript(os.path.join( + os.path.join(globalEnv['CONTRIBPATH'], + 'mongoc'), + 'SConscript'), + variant_dir=globalEnv['MONGOC_LIB_PATH'], + duplicate=0, + exports='globalEnv') + +#build mongocxx +globalEnv["MONGOCXX_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "mongocxx") + +if GetOption("INIT"): + globalEnv.SConscript(os.path.join( + os.path.join(globalEnv["CONTRIBPATH"], + "mongocxx"), + "SConscript"), + variant_dir=globalEnv["MONGOCXX_LIB_PATH"], + duplicate=0, + exports="globalEnv") + +#build inih +globalEnv["INIH_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "inih") + +globalEnv.SConscript(os.path.join( + os.path.join(globalEnv["CONTRIBPATH"], + "iniParser"), + "SConscript"), + variant_dir=globalEnv["INIH_LIB_PATH"], + duplicate=0, + exports="globalEnv") + +#build minisat +globalEnv["MINISAT_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "minisat") + +globalEnv.SConscript(os.path.join( + os.path.join(globalEnv["CONTRIBPATH"], + "minisat"), + "SConscript"), + variant_dir=globalEnv["MINISAT_LIB_PATH"], + duplicate=0, + exports="globalEnv") + + +mongocxxIncludeDir = os.path.join( + os.path.join( + os.path.join(globalEnv["MONGOCXX_LIB_PATH"], + "include"), + "mongocxx"), + "v_noabi") + +bsoncxxIncludeDir = os.path.join( + os.path.join( + os.path.join(globalEnv["MONGOCXX_LIB_PATH"], + "include"), + "bsoncxx"), + "v_noabi") + +inihIncludeDir = globalEnv["INIHSRC"] +inihcppIncludeDir = globalEnv["INIHCPPSRC"] + +minisatIncludeDir = globalEnv["MINISATSRC"] + +globalEnv.Append(CPPPATH=[mongocxxIncludeDir, + bsoncxxIncludeDir, + inihIncludeDir, + inihcppIncludeDir, + minisatIncludeDir]) + +globalEnv.Append(LIBPATH=[os.path.join(globalEnv["MONGOCXX_LIB_PATH"], "lib"), + globalEnv["INIH_LIB_PATH"], + globalEnv["MINISAT_LIB_PATH"]]) + + +#build runMinisat +globalEnv.SConscript(os.path.join( + os.path.join(globalEnv['ROOTPATH'], + 'src'), + 'SConscript'), + variant_dir=globalEnv['BUILDPATH'], + duplicate=0, + exports='globalEnv') + diff --git a/contrib/iniParser/SConscript b/contrib/iniParser/SConscript new file mode 100644 index 0000000..9e57b57 --- /dev/null +++ b/contrib/iniParser/SConscript @@ -0,0 +1,12 @@ +import os + +Import("globalEnv") + +env = globalEnv.Clone() + +env.Append(CPPPATH=[env["INIHCPPSRC"], env["INIHSRC"]]) + +files = Glob(os.path.join(env["INIHCPPSRC"], "*.cpp")) +files.append(Glob(os.path.join(env["INIHSRC"], "*.c"))) + +env.Library(target="inihcpp", source=files) diff --git a/contrib/iniParser/inih b/contrib/iniParser/inih new file mode 160000 index 0000000..2023872 --- /dev/null +++ b/contrib/iniParser/inih @@ -0,0 +1 @@ +Subproject commit 2023872dfffb38b6a98f2c45a0eb25652aaea91f diff --git a/contrib/minisat/SConscript b/contrib/minisat/SConscript new file mode 100644 index 0000000..4cb4e84 --- /dev/null +++ b/contrib/minisat/SConscript @@ -0,0 +1,24 @@ +import os + +Import("globalEnv") + +env = globalEnv.Clone() + +env.Append(CPPPATH=[env["MINISATSRC"]]) + +files = Glob(os.path.join( + os.path.join(env["MINISATSRC"], + "core"), + "*.cc")) + +files.append(Glob(os.path.join( + os.path.join(env["MINISATSRC"], + "simp"), + "*.cc"))) + +files.append(Glob(os.path.join( + os.path.join(env["MINISATSRC"], + "util"), + "*.cc"))) + +env.Library(target="minisat", source=files) diff --git a/minisat/LICENSE b/contrib/minisat/src/LICENSE similarity index 100% rename from minisat/LICENSE rename to contrib/minisat/src/LICENSE diff --git a/minisat/README b/contrib/minisat/src/README similarity index 100% rename from minisat/README rename to contrib/minisat/src/README diff --git a/minisat/core/Dimacs.h b/contrib/minisat/src/core/Dimacs.h similarity index 100% rename from minisat/core/Dimacs.h rename to contrib/minisat/src/core/Dimacs.h diff --git a/minisat/core/Main.cc b/contrib/minisat/src/core/Main.cc similarity index 100% rename from minisat/core/Main.cc rename to contrib/minisat/src/core/Main.cc diff --git a/minisat/core/Makefile b/contrib/minisat/src/core/Makefile similarity index 100% rename from minisat/core/Makefile rename to contrib/minisat/src/core/Makefile diff --git a/minisat/core/Solver.cc b/contrib/minisat/src/core/Solver.cc similarity index 100% rename from minisat/core/Solver.cc rename to contrib/minisat/src/core/Solver.cc diff --git a/minisat/core/Solver.h b/contrib/minisat/src/core/Solver.h similarity index 100% rename from minisat/core/Solver.h rename to contrib/minisat/src/core/Solver.h diff --git a/minisat/core/SolverTypes.h b/contrib/minisat/src/core/SolverTypes.h similarity index 100% rename from minisat/core/SolverTypes.h rename to contrib/minisat/src/core/SolverTypes.h diff --git a/minisat/doc/ReleaseNotes-2.2.0.txt b/contrib/minisat/src/doc/ReleaseNotes-2.2.0.txt similarity index 100% rename from minisat/doc/ReleaseNotes-2.2.0.txt rename to contrib/minisat/src/doc/ReleaseNotes-2.2.0.txt diff --git a/minisat/mtl/Alg.h b/contrib/minisat/src/mtl/Alg.h similarity index 100% rename from minisat/mtl/Alg.h rename to contrib/minisat/src/mtl/Alg.h diff --git a/minisat/mtl/Alloc.h b/contrib/minisat/src/mtl/Alloc.h similarity index 100% rename from minisat/mtl/Alloc.h rename to contrib/minisat/src/mtl/Alloc.h diff --git a/minisat/mtl/Heap.h b/contrib/minisat/src/mtl/Heap.h similarity index 100% rename from minisat/mtl/Heap.h rename to contrib/minisat/src/mtl/Heap.h diff --git a/minisat/mtl/IntTypes.h b/contrib/minisat/src/mtl/IntTypes.h similarity index 100% rename from minisat/mtl/IntTypes.h rename to contrib/minisat/src/mtl/IntTypes.h diff --git a/minisat/mtl/Map.h b/contrib/minisat/src/mtl/Map.h similarity index 100% rename from minisat/mtl/Map.h rename to contrib/minisat/src/mtl/Map.h diff --git a/minisat/mtl/Queue.h b/contrib/minisat/src/mtl/Queue.h similarity index 100% rename from minisat/mtl/Queue.h rename to contrib/minisat/src/mtl/Queue.h diff --git a/minisat/mtl/Sort.h b/contrib/minisat/src/mtl/Sort.h similarity index 100% rename from minisat/mtl/Sort.h rename to contrib/minisat/src/mtl/Sort.h diff --git a/minisat/mtl/Vec.h b/contrib/minisat/src/mtl/Vec.h similarity index 100% rename from minisat/mtl/Vec.h rename to contrib/minisat/src/mtl/Vec.h diff --git a/minisat/mtl/XAlloc.h b/contrib/minisat/src/mtl/XAlloc.h similarity index 100% rename from minisat/mtl/XAlloc.h rename to contrib/minisat/src/mtl/XAlloc.h diff --git a/minisat/mtl/config.mk b/contrib/minisat/src/mtl/config.mk similarity index 100% rename from minisat/mtl/config.mk rename to contrib/minisat/src/mtl/config.mk diff --git a/minisat/mtl/template.mk b/contrib/minisat/src/mtl/template.mk similarity index 100% rename from minisat/mtl/template.mk rename to contrib/minisat/src/mtl/template.mk diff --git a/minisat/simp/Main.cc b/contrib/minisat/src/simp/Main.cc similarity index 100% rename from minisat/simp/Main.cc rename to contrib/minisat/src/simp/Main.cc diff --git a/minisat/simp/Makefile b/contrib/minisat/src/simp/Makefile similarity index 100% rename from minisat/simp/Makefile rename to contrib/minisat/src/simp/Makefile diff --git a/minisat/simp/SimpSolver.cc b/contrib/minisat/src/simp/SimpSolver.cc similarity index 100% rename from minisat/simp/SimpSolver.cc rename to contrib/minisat/src/simp/SimpSolver.cc diff --git a/minisat/simp/SimpSolver.h b/contrib/minisat/src/simp/SimpSolver.h similarity index 100% rename from minisat/simp/SimpSolver.h rename to contrib/minisat/src/simp/SimpSolver.h diff --git a/minisat/utils/Makefile b/contrib/minisat/src/utils/Makefile similarity index 100% rename from minisat/utils/Makefile rename to contrib/minisat/src/utils/Makefile diff --git a/minisat/utils/Options.cc b/contrib/minisat/src/utils/Options.cc similarity index 100% rename from minisat/utils/Options.cc rename to contrib/minisat/src/utils/Options.cc diff --git a/minisat/utils/Options.h b/contrib/minisat/src/utils/Options.h similarity index 100% rename from minisat/utils/Options.h rename to contrib/minisat/src/utils/Options.h diff --git a/minisat/utils/ParseUtils.h b/contrib/minisat/src/utils/ParseUtils.h similarity index 100% rename from minisat/utils/ParseUtils.h rename to contrib/minisat/src/utils/ParseUtils.h diff --git a/minisat/utils/System.cc b/contrib/minisat/src/utils/System.cc similarity index 100% rename from minisat/utils/System.cc rename to contrib/minisat/src/utils/System.cc diff --git a/minisat/utils/System.h b/contrib/minisat/src/utils/System.h similarity index 100% rename from minisat/utils/System.h rename to contrib/minisat/src/utils/System.h diff --git a/contrib/mongoc/SConscript b/contrib/mongoc/SConscript new file mode 100644 index 0000000..ec82d2a --- /dev/null +++ b/contrib/mongoc/SConscript @@ -0,0 +1,36 @@ +import os +import subprocess + +Import('globalEnv') + +env = globalEnv.Clone() + +env['MONGOC_1_13_1_PATH'] = os.path.join(env['MONGOCPATH'], 'mongo-c-driver-1.13.1') + +cmake_build_path = os.path.join(env['MONGOC_LIB_PATH'], 'cmake_build') + +if not os.path.exists(cmake_build_path): + os.makedirs(cmake_build_path) + +if not os.path.exists(env["MONGOC_LIB_PATH"]): + os.makedirs(env["MONGOC_LIB_PATH"]) + +cwd = os.getcwd() + +os.chdir(cmake_build_path) + +cmakeCall = "cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF " +cmakeCall += "-DCMAKE_INSTALL_PREFIX=" + env["MONGOC_LIB_PATH"] + " " +cmakeCall += env["MONGOC_1_13_1_PATH"] + +print(cmakeCall) + +os.system(cmakeCall) + +os.system("make") + +os.system("make install") + +os.chdir(cwd) + + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/CMakeLists.txt new file mode 100644 index 0000000..9f315df --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/CMakeLists.txt @@ -0,0 +1,361 @@ +cmake_minimum_required (VERSION 3.1) + +# Used in MaintainerFlags.cmake to silence errors while testing configs. +set (MESSAGES_ENABLED 1) + +function (message) + list (GET ARGV 0 MessageType) + if (MESSAGES_ENABLED) + list (REMOVE_AT ARGV 0) + _message (${MessageType} "${ARGV}") + endif () +endfunction () + +set (ENABLE_SSL AUTO CACHE STRING + "Enable TLS connections and SCRAM-SHA-1 authentication. Options are + \"DARWIN\" to use Apple's Secure Transport, \"WINDOWS\" to use Windows + Secure Channel, \"OPENSSL\", \"LIBRESSL\", \"AUTO\",\ or \"OFF\". These options are + case-sensitive. The default is \"AUTO\". Note\ that SCRAM-SHA-1 is + required for authenticating to MongoDB 3.0 and later.") + +set (ENABLE_SASL AUTO CACHE STRING + "Enable SASL authentication (Kerberos). Options are \"CYRUS\" to use Cyrus + SASL, \"SSPI\" to use Windows Native SSPI, \"GSSAPI\" to use macOS Native GSS, + \"AUTO\",\ or \"OFF\". These options are case-sensitive.") + +set (ENABLE_STATIC AUTO CACHE STRING "Build static libmongoc. Set to ON/AUTO/OFF, default AUTO.") +option (ENABLE_TESTS "Build MongoDB C Driver tests." ON) +option (ENABLE_EXAMPLES "Build MongoDB C Driver examples." ON) +set (ENABLE_SRV AUTO CACHE STRING "Support mongodb+srv URIs. Set to ON/AUTO/OFF, default AUTO.") +option (ENABLE_MAINTAINER_FLAGS "Use strict compiler checks" OFF) +option (ENABLE_AUTOMATIC_INIT_AND_CLEANUP "Enable automatic init and cleanup (GCC only)" ON) +option (ENABLE_CRYPTO_SYSTEM_PROFILE "Use system crypto profile (OpenSSL only)" OFF) +option (ENABLE_TRACING "Turn on verbose debug output" OFF) +option (ENABLE_COVERAGE "Turn on compile options for lcov" OFF) +set (ENABLE_SHM_COUNTERS AUTO CACHE STRING "Enable memory performance counters that use shared memory on Linux. Set to ON/AUTO/OFF, default AUTO.") +set (ENABLE_MONGOC ON CACHE STRING "Whether to build libmongoc. Set to ON/OFF, default ON.") +set (ENABLE_BSON AUTO CACHE STRING "Whether to build libbson. Set to ON/AUTO/SYSTEM, default AUTO.") +set (ENABLE_SNAPPY AUTO CACHE STRING "Enable snappy support. Set to ON/AUTO/OFF, default AUTO.") +set (ENABLE_ZLIB AUTO CACHE STRING "Enable zlib support") +option (ENABLE_MAN_PAGES "Build MongoDB C Driver manual pages." OFF) +option (ENABLE_HTML_DOCS "Build MongoDB C Driver HTML documentation." OFF) +option (ENABLE_EXTRA_ALIGNMENT + "Turn on extra alignment of libbson types. Set to ON/OFF, default ON.\ + Required for the 1.0 ABI but better disabled." + ON +) +option (ENABLE_RDTSCP + "Fast performance counters on Intel using the RDTSCP instruction" + OFF +) +option (ENABLE_APPLE_FRAMEWORK "Build libraries as frameworks on darwin platforms" OFF) +set (ENABLE_ICU AUTO CACHE STRING "Enable ICU support, necessary to use non-ASCII usernames or passwords, default AUTO.") +option (ENABLE_UNINSTALL "Enable creation of uninstall script and associate uninstall build target." ON) + +project (mongo-c-driver C) + +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE "RelWithDebInfo") + message ( + STATUS "No CMAKE_BUILD_TYPE selected, defaulting to ${CMAKE_BUILD_TYPE}" + ) +endif () + +set (CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/build/cmake + ${PROJECT_SOURCE_DIR}/build/cmake/make_dist +) + +include (InstallRequiredSystemLibraries) +include (GNUInstallDirs) + +# Set MONGOC_MAJOR_VERSION, MONGOC_MINOR_VERSION, etc. +include (LoadVersion) +LoadVersion (${PROJECT_SOURCE_DIR}/VERSION_CURRENT MONGOC) +LoadVersion (${PROJECT_SOURCE_DIR}/VERSION_RELEASED MONGOC_RELEASED) + +include (MaintainerFlags) + +if ( (ENABLE_BUILD_DEPENDECIES STREQUAL OFF) AND (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) ) + set (ENABLE_BUILD_DEPENDECIES ON) +endif () + +if (ENABLE_EXTRA_ALIGNMENT STREQUAL ON) + set (BSON_EXTRA_ALIGN 1) +else () + set (BSON_EXTRA_ALIGN 0) +endif () + +if (ENABLE_RDTSCP) + set (MONGOC_ENABLE_RDTSCP 1) +else () + set (MONGOC_ENABLE_RDTSCP 0) +endif () + +if (NOT ENABLE_MONGOC MATCHES "ON|OFF") + message (FATAL_ERROR "ENABLE_MONGOC option must be ON or OFF") +endif () + +if (NOT ENABLE_BSON MATCHES "ON|AUTO|SYSTEM") + message (FATAL_ERROR "ENABLE_BSON option must be ON, AUTO, or SYSTEM") +endif () + +if (ENABLE_BSON STREQUAL SYSTEM) + # The input variable BSON_ROOT_DIR is respected for backwards compatibility, + # but you should use the standard CMAKE_PREFIX_PATH instead. + message (STATUS "Searching for libbson CMake packages") + find_package (libbson-1.0 + "${MONGOC_MAJOR_VERSION}.${MONGOC_MINOR_VERSION}.${MONGOC_MICRO_VERSION}" + HINTS + ${BSON_ROOT_DIR}) + + if (ENABLE_BSON STREQUAL SYSTEM AND NOT BSON_LIBRARIES) + message (FATAL_ERROR "System libbson not found") + endif () + + if (BSON_LIBRARIES) + message ("-- libbson found version \"${BSON_VERSION}\"") + message ("-- libbson include path \"${BSON_INCLUDE_DIRS}\"") + message ("-- libbson libraries \"${BSON_LIBRARIES}\"") + message ("-- disabling test-libmongoc since using system libbson") + SET (ENABLE_TESTS OFF) + + if (ENABLE_STATIC MATCHES "ON|AUTO") + find_package (libbson-static-1.0 + "${MONGOC_MAJOR_VERSION}.${MONGOC_MINOR_VERSION}.${MONGOC_MICRO_VERSION}" + HINTS + ${BSON_ROOT_DIR}) + + if (ENABLE_STATIC STREQUAL ON AND NOT BSON_STATIC_LIBRARY) + message (FATAL_ERROR "Static libbson not found. Pass -DENABLE_STATIC=OFF") + endif () + + if (BSON_STATIC_LIBRARY) + set (MONGOC_ENABLE_STATIC ON) + endif () + + message ("-- libbson-static found version \"${BSON_STATIC_VERSION}\"") + message ("-- libbson-static include path \"${BSON_STATIC_INCLUDE_DIRS}\"") + message ("-- libbson-static libraries \"${BSON_STATIC_LIBRARIES}\"") + endif () + endif () +endif () + +unset (dist_generated CACHE) +unset (dist_generated_depends CACHE) + +set (BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) + +include (MakeDistFiles) + +# Ensure the default behavior: don't ignore RPATH settings. +set (CMAKE_SKIP_BUILD_RPATH OFF) + +# Ensure the default behavior: don't use the final install destination as the +# temporary RPATH for executables (ensure we can run tests and programs from +# the build directory). +set (CMAKE_BUILD_WITH_INSTALL_RPATH OFF) + +# Include any custom library paths in the final RPATH. +set (CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) + +# Install libs with names like @rpath/libmongoc-1.0.0.dylib, not bare names. +set (CMAKE_MACOSX_RPATH ON) + +# https://cmake.org/cmake/help/v3.11/policy/CMP0042.html +# Enable a CMake 3.0+ policy that sets CMAKE_MACOSX_RPATH by default, and +# silence a CMake 3.11 warning that the old behavior is deprecated. +cmake_policy (SET CMP0042 NEW) + +if (NOT BSON_LIBRARIES) + message (" -- Using bundled libbson") + if (ENABLE_STATIC MATCHES "ON|AUTO") + set (MONGOC_ENABLE_STATIC ON) + endif () + add_subdirectory (src/libbson) + # Defined in src/libbson/CMakeLists.txt + set (BSON_STATIC_LIBRARIES bson_static) + set (BSON_LIBRARIES bson_shared) + set (BSON_STATIC_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/libbson/src" "${PROJECT_BINARY_DIR}/src/libbson/src") + set (BSON_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/libbson/src" "${PROJECT_BINARY_DIR}/src/libbson/src") + set (BSON_STATIC_DEFINITIONS "BSON_STATIC") +endif () + +if (MSVC) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) +endif () + +add_definitions (-D_GNU_SOURCE) +add_definitions (-D_BSD_SOURCE) +add_definitions (-D_DEFAULT_SOURCE) + +if (ENABLE_MONGOC) + + if (ENABLE_TESTS AND NOT MONGOC_ENABLE_STATIC) + message (FATAL_ERROR "ENABLE_TESTS requires ENABLE_STATIC") + endif () + + if (NOT ENABLE_SSL MATCHES "DARWIN|WINDOWS|OPENSSL|LIBRESSL|AUTO|OFF") + message (FATAL_ERROR + "ENABLE_SSL option must be DARWIN, WINDOWS, OPENSSL, LIBRESSL, AUTO, or OFF") + endif () + + set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/") + + set (ZLIB_SOURCES + ${SOURCE_DIR}/src/zlib-1.2.11/adler32.c + ${SOURCE_DIR}/src/zlib-1.2.11/crc32.c + ${SOURCE_DIR}/src/zlib-1.2.11/deflate.c + ${SOURCE_DIR}/src/zlib-1.2.11/infback.c + ${SOURCE_DIR}/src/zlib-1.2.11/inffast.c + ${SOURCE_DIR}/src/zlib-1.2.11/inflate.c + ${SOURCE_DIR}/src/zlib-1.2.11/inftrees.c + ${SOURCE_DIR}/src/zlib-1.2.11/trees.c + ${SOURCE_DIR}/src/zlib-1.2.11/zutil.c + ${SOURCE_DIR}/src/zlib-1.2.11/compress.c + ${SOURCE_DIR}/src/zlib-1.2.11/uncompr.c + ${SOURCE_DIR}/src/zlib-1.2.11/gzclose.c + ${SOURCE_DIR}/src/zlib-1.2.11/gzlib.c + ${SOURCE_DIR}/src/zlib-1.2.11/gzread.c + ${SOURCE_DIR}/src/zlib-1.2.11/gzwrite.c + ) + + set (MONGOC_ENABLE_ICU 0) + + set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING") + + include (CPack) + + # Ensure the default behavior: don't ignore RPATH settings. + set (CMAKE_SKIP_BUILD_RPATH OFF) + + if (APPLE) + # Until CDRIVER-520. + add_definitions (-Wno-deprecated-declarations) + endif () + + add_subdirectory (src/libmongoc) + + if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) + find_package (Sphinx REQUIRED) + add_custom_target (doc + ALL + DEPENDS + $<$:bson-doc> + $<$:mongoc-doc> + ) + endif () + + # Implement 'dist' and 'distcheck' targets + # + # CMake does not implement anything like 'dist' and 'distcheck' from autotools. + # This implementation is based on the one in GnuCash. + + add_subdirectory (build) + # sub-directory 'doc' was already included above + add_subdirectory (orchestration_configs) + add_subdirectory (src) + # 'src/libbson' was already included, so 'src' will not include it directly + # 'src/libmongoc' was already included, so 'src' will not include it directly + + set (PACKAGE_PREFIX "mongo-c-driver-${MONGOC_VERSION}") + set (DIST_FILE "${PACKAGE_PREFIX}.tar.gz") + + set (top_DIST_local + CMakeLists.txt + CONTRIBUTING.md + COPYING + NEWS + README.rst + THIRD_PARTY_NOTICES + VERSION_CURRENT + VERSION_RELEASED + # This sub-directory is added later, so manually include here + generate_uninstall/CMakeLists.txt + ) + + set_local_dist (top_DIST ${top_DIST_local}) + + set (ALL_DIST + ${top_DIST} + ${build_DIST} + ${orchestration_configs_DIST} + ${src_DIST} + ${src_libbson_DIST} + ${src_libmongoc_DIST} + ) + + # Write a dist manifest + string (REPLACE ";" "\n" ALL_DIST_LINES "${ALL_DIST}") + file (WRITE ${CMAKE_BINARY_DIR}/dist_manifest.txt ${ALL_DIST_LINES}) + + # This is the command that produces the distribution tarball + add_custom_command (OUTPUT ${DIST_FILE} + COMMAND ${CMAKE_COMMAND} + -D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/build/cmake/make_dist + -D PACKAGE_PREFIX=${PACKAGE_PREFIX} + -D MONGOC_SOURCE_DIR=${CMAKE_SOURCE_DIR} + -D BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR} + -D SHELL=${SHELL} + "-Ddist_generated=\"${dist_generated}\"" + -P ${PROJECT_SOURCE_DIR}/build/cmake/make_dist/MakeDist.cmake + + DEPENDS + ${ALL_DIST} ${dist_generated_depends} + ) + + if (ENABLE_BSON MATCHES "ON|AUTO" AND ENABLE_MAN_PAGES STREQUAL ON AND ENABLE_HTML_DOCS STREQUAL ON) + # Since our 'dist' implementation does not add top-level targets for every + # file to be included, we declare a dependency on the 'mongo-doc' target so + # that documentation is built before the distribution tarball is generated. + add_custom_target (dist DEPENDS doc ${DIST_FILE}) + + add_custom_target (distcheck DEPENDS dist + COMMAND ${CMAKE_COMMAND} + -D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/build/cmake/make_dist + -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -D PACKAGE_PREFIX=${PACKAGE_PREFIX} + -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -P ${PROJECT_SOURCE_DIR}/build/cmake/make_dist/MakeDistCheck.cmake + ) + else () + string (CONCAT DISTERRMSG + "The dist and distcheck targets disabled. Set ENABLE_BSON=ON, " + "ENABLE_MAN_PAGES=ON, and ENABLE_HTML_DOCS=ON to enable." + ) + + add_custom_target (dist + COMMAND ${CMAKE_COMMAND} -E echo "${DISTERRMSG}" + ) + + add_custom_target (distcheck + COMMAND ${CMAKE_COMMAND} -E echo "${DISTERRMSG}" + ) + endif () + +endif () + +if (ENABLE_UNINSTALL) + if (WIN32) + if (ENABLE_MONGOC) + set (UNINSTALL_PROG "uninstall.cmd") + else () + set (UNINSTALL_PROG "uninstall-bson.cmd") + endif () + else () + if (ENABLE_MONGOC) + set (UNINSTALL_PROG "uninstall.sh") + else () + set (UNINSTALL_PROG "uninstall-bson.sh") + endif () + endif () + set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR}/mongo-c-driver") + + # Create uninstall program and associated uninstall target + # + # This needs to be last (after all other add_subdirectory calls) to ensure that + # the generated uninstall program is complete and correct + add_subdirectory (generate_uninstall) +endif () diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/CONTRIBUTING.md b/contrib/mongoc/mongo-c-driver-1.13.1/CONTRIBUTING.md new file mode 100644 index 0000000..c8abbef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/CONTRIBUTING.md @@ -0,0 +1,258 @@ +# Contributing to mongo-c-driver + +Thanks for considering contributing to the mongo-c-driver! + +This document intends to be a short guide to helping you contribute to the codebase. +It expects a familiarity with the C programming language and writing portable software. +Whenever in doubt, feel free to ask others that have contributed or look at the existing body of code. + + +## Guidelines + +The mongo-c-driver has a few guidelines that help direct the process. + + +### Portability + +mongo-c-driver is portable software. It needs to run on a multitude of +operating systems and architectures. + + * Linux (RHEL 5 and newer) + * FreeBSD (10 and newer) + * Windows (Vista and newer) + * macOS (10.8 and newer) + * ARM/SPARC/x86/x86_64 + + +### Licensing + +Some of the mongo-c-driver users embed the library statically in their +products. Therefore, the driver and all contributions must be liberally +licensed. As a policy, we have chosen Apache 2.0 as the license for the +project. + + +### Coding Style + +We try not to be pedantic with taking contributions that are not properly +formatted, but we will likely perform a followup commit that cleans things up. +The basics are, in vim: + +``` + : set ts=3 sw=3 et +``` + +3 space tabs, insert spaces instead of tabs. + +For all the gory details, see [.clang-format](.clang-format) + +### Adding a new error code or domain + +When adding a new error code or domain, you must do the following. This is most +applicable if you are adding a new symbol with a bson_error_t as a parameter, +and the existing codes or domains are inappropriate. + + - Add the domain to `mongoc_error_domain_t` in `src/mongoc/mongoc-error.h` + - Add the code to `mongoc_error_code_t` in `src/mongoc/mongoc-error.h` + - Add documentation for the domain or code to the table in `doc/mongoc_errors.rst` + +### Adding a new symbol + +This should be done rarely but there are several things that you need to do +when adding a new symbol. + + - Add documentation for the new symbol in `doc/mongoc_your_new_symbol_name.rst` + +### Documentation + +We strive to document all symbols. See doc/ for documentation examples. If you +add a new public function, add a new .rst file describing the function so that +we can generate man pages and HTML for it. + +For complex internal functions, comment above the function definition with +a block comment like the following: + +``` +/*-------------------------------------------------------------------------- + * + * mongoc_cmd_parts_append_read_write -- + * + * Append user-supplied options to @parts->command_extra, taking the + * selected server's max wire version into account. + * + * Return: + * True if the options were successfully applied. If any options are + * invalid, returns false and fills out @error. In that case @parts is + * invalid and must not be used. + * + * Side effects: + * May partly apply options before returning an error. + * + *-------------------------------------------------------------------------- + */ +``` + +Public functions do not need these comment blocks, since they are documented in +the .rst files. + + +### Testing + +To run the entire test suite, including authentication tests, +start `mongod` with auth enabled: + +``` +$ mongod --auth +``` + +In another terminal, use the `mongo` shell to create a user: + +``` +$ mongo --eval "db.createUser({user: 'admin', pwd: 'pass', roles: ['root']})" admin +``` + +Authentication in MongoDB 3.0 and later uses SCRAM-SHA-1, which in turn +requires a driver built with SSL. + +Set the user and password environment variables, then build and run the tests: + +``` +$ export MONGOC_TEST_USER=admin +$ export MONGOC_TEST_PASSWORD=pass +$ ./test-libmongoc +``` + +Additional environment variables: + +* `MONGOC_TEST_HOST`: default `localhost`, the host running MongoDB. +* `MONGOC_TEST_PORT`: default 27017, MongoDB's listening port. +* `MONGOC_TEST_URI`: override both host and port with a full connection string, + like "mongodb://server1,server2". +* `MONGOC_TEST_SERVER_LOG`: set to `stdout` or `stderr` for wire protocol + logging from tests that use `mock_server_t`. Set to `json` to include these + logs in the test framework's JSON output, in a format compatible with + [Evergreen](https://github.com/evergreen-ci/evergreen). +* `MONGOC_TEST_MONITORING_VERBOSE`: set to `on` for verbose output from + Application Performance Monitoring tests. +* `MONGOC_TEST_COMPRESSORS=snappy,zlib`: wire protocol compressors to use + +If you start `mongod` with SSL, set these variables to configure how +`test-libmongoc` connects to it: + +* `MONGOC_TEST_SSL`: set to `on` to connect to the server with SSL. +* `MONGOC_TEST_SSL_PEM_FILE`: path to a client PEM file. +* `MONGOC_TEST_SSL_PEM_PWD`: the PEM file's password. +* `MONGOC_TEST_SSL_CA_FILE`: path to a certificate authority file. +* `MONGOC_TEST_SSL_CA_DIR`: path to a certificate authority directory. +* `MONGOC_TEST_SSL_CRL_FILE`: path to a certificate revocation list. +* `MONGOC_TEST_SSL_WEAK_CERT_VALIDATION`: set to `on` to relax the client's + validation of the server's certificate. + +The SASL / GSSAPI / Kerberos tests are skipped by default. To run them, set up a +separate `mongod` with Kerberos and set its host and Kerberos principal name +as environment variables: + +* `MONGOC_TEST_GSSAPI_HOST` +* `MONGOC_TEST_GSSAPI_USER` + +URI-escape the username, for example write "user@realm" as "user%40realm". +The user must be authorized to query `kerberos.test`. + +MongoDB 3.2 adds support for readConcern, but does not enable support for +read concern majority by default. mongod must be launched using +`--enableMajorityReadConcern`. +The test framework does not (and can't) automatically discover if this option was +provided to MongoDB, so an additional variable must be set to enable these tests: + +* `MONGOC_ENABLE_MAJORITY_READ_CONCERN` + +Set this environment variable to `on` if MongoDB has enabled majority read concern. + +Some tests require Internet access, e.g. to check the error message when failing +to open a MongoDB connection to example.com. Skip them with: + +* `MONGOC_TEST_OFFLINE=on` + +Some tests require a running MongoDB server. Skip them with: + +* `MONGOC_TEST_SKIP_LIVE=on` + +For quick checks during development, disable long-running tests: + +* `MONGOC_TEST_SKIP_SLOW=on` + +Some tests run against a local mock server, these can be skipped with: + +* `MONGOC_TEST_SKIP_MOCK=on` + +If you have started with MongoDB with `--ipv6`, you can test IPv6 with: + +* `MONGOC_CHECK_IPV6=on` + +The tests for mongodb+srv:// connection strings require some setup, see the +Initial DNS Seedlist Discovery Spec. By default these connection strings are +NOT tested, enable them with: + +* `MONGOC_TEST_DNS=on` + +The mock server timeout threshold for future functions can be set with: + +* `MONGOC_TEST_FUTURE_TIMEOUT_MS=` + +This is useful for debugging, so future calls don't timeout when stepping through code. + +All tests should pass before submitting a patch. + +## Configuring the test runner + +The test runner can be configured with command-line options. Run `test-libmongoc +--help` for details. + +To run just a specific portion of the test suite use the -l option like so: + +``` +$ ./test-libmongoc -l "/server_selection/*" +``` + +The full list of tests is shown in the help. + +## Creating and checking a distribution tarball + +The `make distcheck` command can be used to confirm that any modifications are +able to be packaged into the distribution tarball and that the resulting +distribution tarball can be used to successfully build the project. + +A failure of the `make distcheck` target is an indicator of an oversight in the +modification to the project. For example, if a new source file is added to the +project but it is not added to the proper distribution list, it is possible that +the distribution tarball will be created without that file. An attempt to build +the project without the file is likely to fail. + +When `make distcheck` is invoked, several things happen. The `dist` target is +executed to create a distribution tarball. Then the tarball is unpacked, +configured (with an invocation of `cmake`), built (by calling `make`), installed +(by calling `make install`), and tested (by calling `make check`). Three +environment variables can be used to modify these steps. + +To adjust the options passed to `make` during the build step, set: + +* `DISTCHECK_BUILD_OPTS` + +If this variable is not set, then `make` is called with a default of "-j 8". + +To adjust the options passed to `make install` during the installation step, +set: + +* `DISTCHECK_INSTALL_OPTS` + +To adjust the options passed to `make check` during the test step, set: + +* `DISTCHECK_CHECK_OPTS` + +Remember, if you want to modify the top-level `make` invocation, you will need +to pass options on the command line as normal. + +For example, the command `make -j 6 distcheck DISTCHECK_BUILD_OPTS="-j 4"` will +call the standard sequence of targets depended upon by `distcheck` with a +parallelism level of 6, while the build step that is later called by the +`distcheck` target will be executed with a parallelism level of 4. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/COPYING b/contrib/mongoc/mongo-c-driver-1.13.1/COPYING new file mode 100644 index 0000000..f433b1a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/COPYING @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/NEWS b/contrib/mongoc/mongo-c-driver-1.13.1/NEWS new file mode 100644 index 0000000..22d752b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/NEWS @@ -0,0 +1,2413 @@ +mongo-c-driver 1.13.1 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.13.1. + +Bug fixes: + + * mongoc_collection_update_many and mongoc_collection_delete_many would fail + with the URI option retryWrites=true. + * Remove timestamp from uninstall scripts to permit reproducible build. + * Add missing header files to the release tarball to fix compilation when + configuring with ENABLE_SASL=GSSAPI. + * Separate libmongoc and libbson uninstall scripts so they do not overwrite + each other. + * Fix running make install with DESTDIR. + +Thanks to everyone who contributed to the development of this release. + + * Kevin Albertson + * A. Jesse Jiryu Davis + * Henrik Edin + +Peace, + + Kevin Albertson + + +mongo-c-driver 1.13.0 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.13.0. + +Features: + + * Report a new error code, MONGOC_ERROR_GRIDFS_CORRUPT, when a chunk larger + than chunkSize is detected. Before, the driver had crashed with an assert. + * Restructure of install directory. All mongoc headers are under mongoc/ + and all bson headers are under bson/. The preferred way of including the + headers are mongoc/mongoc.h and bson/bson.h respectively. + Forwarding headers in the root are provided for backwards compatibility. + * The default CMake build type had been unspecified, now it is RelWithDebInfo. + * Support LibreSSL 2.7+. + +Bug fixes: + + * mongoc_collection_replace_one is now a correctly exported symbol. + * Fix multiple issues with readConcern and writeConcern inheritance. + * Fix rare crash with mongodb+srv URIs on Windows. + * mongoc_gridfs_create_file_from_stream ignored errors while writing chunks + to the server. + * The following functions should not have taken a "bypassDocumentValidation" + option in bson_t *opts, the option is now prohibited: + - mongoc_bulk_operation_insert_with_opts + - mongoc_bulk_operation_update_one_with_opts + - mongoc_bulk_operation_update_many_with_opts + - mongoc_bulk_operation_replace_one_with_opts + * The heartbeat-succeeded and heartbeat-failed events (part of SDAM + Monitoring) had uninitialized "duration" fields, they are now set correctly. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Roberto C. Sánchez + * Kevin Albertson + * Henrik Edin + * Spencer McKenney + * Jeremy Mikola + * Evgeni Dobranov + * Tomas Mozes + * Derick Rethans + * Gustaf Neumann + * Jeroen + * Jeroen Ooms + * Kaitlin Mahar + +Peace, + + Kevin Albertson + + +mongo-c-driver 1.12.0 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.12.0. + +Features: + + * New function mongoc_client_session_in_transaction to check if a multi- + document transaction is started. + * New examples for change streams and transactions, improved guide for + migrating from mongoc_collection_count to mongoc_collection_count_documents + +Bug fixes: + + * Fix occasional crash in sharded queries + * Retry all retryable write concern errors + * mongoc_client_session_commit_transaction sets the correct error label when + the primary is unavailable + * mongoc_collection_find_with_opts had prohibited read preference "primary" + in a transaction + * mongoc_collection_aggregate had not inherited its mongoc_collection_t's + read preference; only an explicitly provided read preference was used. + * Allow unencoded delimiters in username/password if unambiguous + +Thanks to everyone who contributed to the development of this release. + + * Roberto C. Sánchez + * A. Jesse Jiryu Davis + * Kevin Albertson + * Spencer McKenney + * Evgeni Dobranov + * Jeremy Mikola + * 平民·寻梦(Pingmin Fenlly Liu) + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.11.0 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.11.0. This release adds +support for MongoDB 4.0 features. It includes the following additions and +improvements: + + * Multi-document transactions, see mongoc_client_session_start_transaction + * New function mongoc_error_has_label to check for specific error labels such + as "TransientTransactionError" or "UnknownTransactionCommitResult" in + error replies. + * New functions to subscribe to changes on an entire client or database: + - mongoc_client_watch + - mongoc_database_watch + * New option for change streams, "startAtOperationTime". + * mongoc_collection_count_with_opts is deprecated for two new functions: + - mongoc_collection_count_documents + - mongoc_collection_estimated_document_count + * Support for SCRAM-SHA-256 authentication, including support for non-ASCII + passwords using libicu is an optional dependency. + * Faster mongoc_database_get_collection_names_with_opts fetches only names, + not the entire collection metadata. + +Additional changes not specific to MongoDB 4.0: + + * All "destroy" functions such as mongoc_collection_destroy now ignore a NULL + argument. + * The driver now returns an error if you attempt to use "arrayFilters" in an + update with a MongoDB server older than 3.6. + * Update functions include a new "upsertedCount" field in the reply document. + * Replace MD5 with FNV-1a hash to generate ObjectIds (for FIPS compliance). + +Bug fixes: + + * Functions incorrectly marked with the "const" compiler attribute are now + marked as "pure", fixes build error when link-time optimization is enabled. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + * Evgeni Dobranov + * Spencer McKenney + * Jeremy Mikola + * Roberto C. Sánchez + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.10.3 +===================== + +No change since 1.10.2; released to keep pace with libbson's version. + +-- A. Jesse Jiryu Davis + + +mongo-c-driver 1.10.2 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.10.2. This release fixes +the libbson and libmongoc installed library filenames and SONAMEs on Linux. +They had changed unintentionally with the switch to CMake in 1.10.0; they are +now consistent with 1.9.x and previous releases. Thanks to Roberto C. Sánchez +for the fix. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.10.1 +===================== + +It is my pleasure to announce the MongoDB C Driver 1.10.1. This release fixes +the following bugs introduced in version 1.10.0: + + * Client sessions were not prohibited with unacknowledged write concern and + mongoc_bulk_operation_execute; now they are prohibited. Client sessions have + been prohibited with all other unacknowledged writes since 1.10. + * The "arrayFilters" update option, new in MongoDB 3.6 and supported since + libmongoc 1.9.0, was inadvertently prohibited by + mongoc_bulk_operation_update_one_with_opts and + mongoc_bulk_operation_update_many_with_opts in 1.10. The option is now + permitted again. + * The mongoc-stat tool for displaying shared counters was disabled on Linux + and not installed; it is now restored. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Jeremy Mikola + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.10.0 +===================== + +It is my pleasure to announce MongoDB C Driver 1.10.0. This version drops +support for MongoDB 2.6 and adds the following features and bugfixes: + + * libbson and libmongoc are now maintained in the mongo-c-driver repository, + although they are still built as separate libraries, and libbson can still + be used without libmongoc. + * Building libbson and libmongoc now requires CMake on all platforms. The + Autotools build scripts ("configure" and related scripts) have been deleted. + See the "installing" page for updated instructions, including the new + ENABLE_MONGOC option and changes to the ENABLE_BSON option. + * IPv6 is now fully supported and conforms to RFC-6555. If a hostname has both + IPv4 and IPv6 DNS records, the driver tries connecting with IPv6 first. If a + connection can't be established after 250ms then IPv4 is tried in parallel. + Whichever succeeds connection first cancels the other. The successful DNS + result is cached for 10 minutes. + * If CMake is configured with ENABLE_SSL=AUTO (the default), libmongoc now + uses native TLS libraries on Mac and Windows, and OpenSSL everywhere else. + Before, it would search for OpenSSL on all platforms and only use native + TLS on Mac and Windows as a fallback. + * The driver now handshakes SSL connections to multiple servers in a replica + set or sharded cluster in parallel, so long as it uses OpenSSL or Windows + SChannel. (SSL handshakes with Apple's Secure Transport are still serial.) + A larger receive buffer with SChannel increases performance over slow + connections. + * All functions that accept read concern now prohibit it, if MongoDB is too + old to support it (MongoDB 3.0). + * Client sessions are now prohibited with unacknowledged writes. + * mongoc_collection_find_and_modify_with_opts now prohibits write concern if + MongoDB is too old to support it (MongoDB 3.0). + * Other helper functions for commands that write, now prohibit write concern + if MongoDB is too old to support it (pre-3.4): + mongoc_client_read_write_command_with_opts + mongoc_client_write_command_with_opts + mongoc_collection_read_write_command_with_opts + mongoc_collection_write_command_with_opts + mongoc_database_read_write_command_with_opts + mongoc_database_write_command_with_opts + mongoc_collection_aggregate with $out + mongoc_collection_drop_index_with_opts + mongoc_collection_drop_with_opts + mongoc_collection_rename_with_opts + mongoc_database_drop_with_opts + Write concern behavior is unchanged for regular CRUD functions. + * Setting a negative writeConcern level of -2 or smaller, via the "opts" + parameter to functions that accept BSON options, is now prohibited. The + special "w" values -2 through -4 are only used internally. The deprecated + "w=-1" is still allowed, as a synonym for "w=0". + * The Kerberos URI option authMechanismProperties=CANONICALIZE_HOST_NAME:true + is now implemented with the Windows Kerberos provider, SSPI. + * This repository now includes GDB and LLDB customizations for pretty-printing + bson_t structs as JSON while debugging. See the "debugging" page. + * The internal preprocessor symbol HAVE_STRINGS_H has been renamed + BSON_HAVE_STRINGS_H. If you maintain a handwritten bson-config.h you must + rename this symbol. + * The following helper functions do not work with mongoc_client_session_t, + they are deprecated in favor of running MongoDB commands directly with a + function like mongoc_client_read_command_with_opts: + mongoc_client_get_server_status + mongoc_collection_stats + mongoc_collection_validate + * mongoc_cursor_is_alive is now deprecated for mongoc_cursor_more, which is + functionally equivalent. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + * Roberto C. Sánchez + * Jeremy Mikola + * Xiangyu Yao + * Jeroen Ooms + * Derick Rethans + * Kaitlin Mahar + * Pavithra Vetriselvan + * NotSpooky + * Iulian Rotaru + * Katherine Walker + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.5 +==================== + +It is my pleasure to announce mongo-c-driver 1.9.5. This release fixes the following bugs: + + * New change streams API functions were not marked extern "C" + * mongoc_collection_watch now accepts a pipeline argument as a BSON array, in + addition to accepting a BSON document with a "pipeline" array field + * Crashes in several change stream error handling paths + * Commands could return false with an empty bson_error_t after a replica set + reconfig + * Network error messages omitted the command name when using OP_MSG + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.4 +==================== + +It is my pleasure to announce mongo-c-driver 1.9.4. This release offers +compatibility with Sphinx 1.7.0 and above and fixes two bugs: + + * Ensure a change stream uses the proper session id while iterating + * Fix a rare crash in pooled mode when a replica set member was disconnected + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.3 +==================== + +It is my pleasure to announce mongo-c-driver 1.9.3. This version fixes a +session-management bug that could cause an authentication error while connected +to MongoDB 3.6+ and iterating a cursor, and it permits the $gleStats modifier +with mongoc_collection_aggregate. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.2 +==================== + +No change since 1.9.1; released to keep pace with libbson's version number. + +-- A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.1 +==================== + +It is my pleasure to announce mongo-c-driver 1.9.1. This release fixes a bug +that caused session ID to be included in authentication and server monitoring +commands. Thanks to Jeremy Mikola for finding and fixing the issue. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.9.0 +==================== + +It is my pleasure to announce mongo-c-driver 1.9.0. This version drops support +for MongoDB 2.4 and adds support for MongoDB 3.6 features: + + * New struct mongoc_change_stream_t to watch a collection for changes. + * New struct mongoc_client_session_t represents a MongoDB 3.6 session, + which supports causal consistency: you are guaranteed to read your writes + and to perform monotonic reads, even when reading from secondaries or in + a sharded cluster. + * 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 + mongoc_collection_delete_one + mongoc_collection_delete_many + mongoc_client_command_with_opts + mongoc_database_command_with_opts + mongoc_collection_command_with_opts + mongoc_client_find_databases_with_opts + mongoc_client_get_database_names_with_opts + mongoc_collection_create_bulk_operation_with_opts + mongoc_collection_find_indexes_with_opts + mongoc_database_find_collections_with_opts + mongoc_database_get_collection_names_with_opts + * New URI option "retryWrites=true" safely and automatically retries certain + write operations if the server is a MongoDB 3.6 replica set or sharded + cluster. + * Support for MongoDB OP_MSG wire protocol. + +Additional changes not specific to MongoDB 3.6: + + * Support for mongodb+srv URIs to query DNS for SRV and TXT records that + configure the connection to MongoDB. + * Support LibreSSL with CMake build + * The "minPoolSize" URI option is deprecated: it's confusing and not useful. + +Bug fixes: + + * mongoc_bulk_operation_execute did not always initialize "reply". + * Fix C99 pedantic warnings. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jeremy Mikola + * Kevin Albertson + * Jeroen Ooms + * Iulian Rotaru + * Derick Rethans + * Graham Whitted + * Brian Moss + * Alex Masterov + * Michael Kuhn + * Sriharsha Vardhan + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.8.2 +==================== + +It is my pleasure to announce mongo-c-driver 1.8.2. This release fixes the +following bugs: + + * Remove option to bundle the Snappy compression library, it caused issues + for programs linking to libmongoc + * Fix pkg-config and CMake config file flags for programs that statically + link to libmongoc when libmongoc is statically linked to zLib + * The configure flag "--with-zlib=no" was ignored + Crash in authentication when username is NULL + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Derick Rethans + * Hannes Magnusson + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.8.1 +==================== + +It is my pleasure to announce mongo-c-driver 1.8.1. This release fixes the +following bugs: + + * Remove a syntax error in the configure script that affects some shells. + * The configure script respects --with-zlib=system and --with-snappy=system. + * The internal mongoc_server_description_t struct is properly reinitialized + after a network error. + * Fix the encoding of this NEWS file. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.8.0 +==================== + + * The zLib and Snappy compression libraries are bundled if not available. + Wire protocol compression is enabled on Windows. + * mongoc_collection_find_and_modify_with_opts now respects a "writeConcern" + field in the "extra" BSON document in its mongoc_find_and_modify_opts_t. + * The command functions mongoc_client_read_write_command_with_opts, + mongoc_database_read_write_command_with_opts, and + mongoc_collection_read_write_command_with_opts now ignore the "read_prefs" + parameter. + * mongoc_collection_create_index and mongoc_collection_create_index_with_opts + are both now deprecated. Use mongoc_database_write_command_with_opts + instead; a guide to creating an index using that function has been added. + * Use select, not WSAPoll, on Windows. + * Always mark a server "Unknown" after a network error (besides a timeout). + * mongoc_client_pool_t sends platform metadata to the server; before, only a + single mongoc_client_t did. + * New stream method mongoc_stream_timed_out. + * Wire version checks introduced in 1.8.0 will prevent the driver from + connecting to a future MongoDB server version if its wire protocol is + incompatible. + * New CMake option ENABLE_MAINTAINER_FLAGS. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.7.0 +==================== + +It is my pleasure to announce mongo-c-driver 1.7.0. + +New features and bug fixes: + + * CMake build now installs .pc files for programs that link to libmongoc using + pkg-config. Both the CMake and Autotools build systems now install .cmake + files for programs that link to libmongoc using CMake. Linking to libmongoc + statically or dynamically is now much more convenient. See the new tutorial + section "Include and link libmongoc in your C program". + * New CMake option ENABLE_STATIC can be ON, OFF, or AUTO (the default) + * Minimum required CMake version has been increased to 3.1. + * CMake remains experimental on non-Windows platforms and issues a warning now + * Support for wire compression. + * Support for snappy and zlib. MongoDB 3.4 only supports snappy, while zlib + support is expected in MongoDB 3.6. + The enable, configure mongoc like so: + ./configure --with-snappy --with-zlib + * New functions: mongoc_uri_get_compressors & mongoc_uri_set_compressors, to + get and set compressor configuration on mongoc_uri_t + * Added support for comma separated "compressors" connection string option (e.g. + mongodb://localhost/?compressors=snappy,zlib) + * Added support for configuring zlib compression level in the connection string + (e.g. mongodb://localhost/?compressors=zlib&zlibcompressionlevel=8) + * Now requires the use of CMake config files for libbson to build libmongoc + with CMake + * Added pkg-config support for libressl. + * New function mongoc_uri_set_auth_mechanism to update the authentication + mechanism of a mongoc_uri_t after it is created from a string. + * New function mongoc_bulk_operation_insert_with_opts provides immediate + error checking. + * New function mongoc_uri_new_with_error provides a way to parse a connection + string, and retrieve the failure reason, if any. + * Support for MongoDB Connection String specification + * All connection string options are now represented by MONGOC_URI_xxx macros + * Paths to Unix Domain Sockets must be url encoded + * Repeated options now issue warnings + * Special characters in username, password and other values must be url encoded + * Unsupported connection string options now issue warnings + * Boolean values can now be represented as true/yes/y/t/1 and false/no/n/f/0. + * Case is now preserved in Unix domain paths. + * New function mongoc_cursor_error_document provides access to server's error + reply if a query or command fails. + * New function mongoc_write_concern_is_default determines whether any write + concern options have been set, and mongoc_read_concern_is_default checks if + read concern options are set. + * mongoc_gridfs_find_one_with_opts optimized to use limit 1. + +Thanks to everyone who contributed to the development of this release. + + * Hannes Magnusson + * A. Jesse Jiryu Davis + * David Golden + * Jeremy Mikola + * Bernard Spil + * Aleksander Melnikov + * Adam Seering + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.6.0 +==================== + +It is my pleasure to announce mongo-c-driver 1.6.0. + +New features and bug fixes: + + * Enterprise authentication on Windows now uses the native GSSAPI library; + Cyrus SASL is no longer required for enterprise auth on Windows. + * BSON documents are more thoroughly validated before insert or update. + * New function mongoc_uri_set_mechanism_properties to replace all the + authMechanismProperties on an existing URI. + * mongoc_uri_get_mechanism_properties asserts its inputs are not NULL. + * For consistency with other MongoDB drivers, mongoc_collection_save is + deprecated in favor of mongoc_collection_insert or mongoc_collection_update. + * The driver is now built and continuously tested with MinGW-W64 on Windows. + * Experimental support for HPUX. + * The correct operation ids are now passed to Command Monitoring callbacks. + * Fix a crash if the driver couldn't connect to the server to create an index. + * The documentation is ported from Mallard XML to ReStructured Text, the + HTML documentation is restyled, and numerous man page syntax errors fixed. + * Getter functions for options in mongoc_find_and_modify_opts_t: + * mongoc_find_and_modify_opts_get_bypass_document_validation + * mongoc_find_and_modify_opts_get_fields + * mongoc_find_and_modify_opts_get_flags + * mongoc_find_and_modify_opts_get_max_time_ms + * mongoc_find_and_modify_opts_get_sort + * mongoc_find_and_modify_opts_get_update + * All public functions now have the __cdecl calling convention on Windows. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Aleksander Melnikov + * Jeroen Ooms + * Brian McCarthy + * Jonathan Wang + * Peter Beckman + * Remi Collet + * Rockford Wei + * Alexey Ponomarev + * Christopher Wang + * David Golden + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.5.5 +==================== + +It is my pleasure to announce mongo-c-driver 1.5.5. This release fixes bugs +parsing the localThresholdMS option from the MongoDB URI, and a crash in +mongoc_cursor_destroy if "query" or "filter" are invalid. Thanks to Jeremy +Mikola. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.5.4 +==================== + +It is my pleasure to announce mongo-c-driver 1.5.4. This release fixes an error +in cursor iteration when a readConcern is set. Thanks to Jeremy Mikola and +Hannes Magnusson. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.5.3 +==================== + +This release fixes a bug that prevented connecting to IPv4-only MongoDB servers +by hostname. + +https://jira.mongodb.org/browse/CDRIVER-1988 + +The driver has reverted to its 1.5.1 behavior: it connects to MongoDB over IPv6 +if given an IPv6 connection string like "mongodb://[::1]", and requires an IPv4 +connection when given a hostname like "mongodb://localhost". + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.5.2 +==================== + +It is my pleasure to announce mongo-c-driver 1.5.2. + +Thanks to everyone who contributed to the development of this release. + +New bug fixes: + * CDRIVER-1975 allow mixed $ and non-$ query ops. + * CDRIVER-1972 Support for ipv6 hostnames. + * CDRIVER-1971 Missing exports of mongoc_gridfs_file_set_*() functions. + * CDRIVER-1970 update define constants for "find" opts to be unique. + * CDRIVER-1964 Windows CA stores should be opened with read-only flag. + +Thanks to everyone who contributed to the development of this release. + + * Hannes Magnusson + * A. Jesse Jiryu Davis + * Alexey Ponomarev + * Peter Beckman + * Rockford Wei + +Peace, + + Hannes Magnusson + + +mongo-c-driver 1.5.1 +==================== + +It is my pleasure to announce mongo-c-driver 1.5.1. This is a bugfix release: + + * Fix SEGFAULT with performance counters on NUMA (thanks to Jonathan Wang). + * Prevent rare assertion error in mongoc_cluster_stream_for_server. + * Improve error messages from auth failure. + * Escape quotes when appending CFLAGS to handshake metadata. + * Fix OpenSSL header lookups in non-default paths. + * Fix build failure with LibreSSL. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jeroen Ooms + * Jonathan Wang + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.5.0 +==================== + +It is my pleasure to announce mongo-c-driver 1.5.0. + +New features and bug fixes: + * MongoDB 3.4 Support + * New URI and read preference option, "maxStalenessSeconds" + * MongoDB Handshake + * writeConcern and readConcern enhancements + * Collation allows users to specify language-specific rules for string + comparison when sorting documents. See the code examples for + mongoc_client_read_command_with_opts, mongoc_collection_count_with_opts, + mongoc_collection_find_with_opts, and mongoc_index_opt_t, as well as the + "Setting Collation Order" section of the "Bulk Write Operations" guide. + * mongoc_collection_count_with_opts uses the collection's read preference if + none is passed in + * Improved TLS support + * Fixed LibreSSL (libssl) support + * Added LibreSSL (libtls) support + * Fixed Secure Channel build on VS 2010 + * OpenSSL now supports SNI (all others already do) + * Additional features for Application Performance Monitoring: + * mongoc_topology_description_has_writable_server + * mongoc_topology_description_has_readable_server + * New functions accept flexible options as a BSON document: + * mongoc_collection_find_with_opts + * mongoc_client_read_command_with_opts + * mongoc_client_write_command_with_opts + * mongoc_client_read_write_command_with_opts + * mongoc_database_read_command_with_opts + * mongoc_database_write_command_with_opts + * mongoc_database_read_write_command_with_opts + * mongoc_collection_read_command_with_opts + * mongoc_collection_write_command_with_opts + * mongoc_collection_read_write_command_with_opts + * mongoc_gridfs_find_with_opts + * mongoc_gridfs_find_one_with_opts + * mongoc_collection_find is now deprecated in favor of + mongoc_collection_find_with_opts. + * New helper function to include read concern in one of the above function's + options parameter: mongoc_read_concern_append. + * mongoc_client_command no longer applies the client's read preference and + read concern by default. Same change for mongoc_database_command and + mongoc_collection_command. + * mongoc_collection_count_with_opts now applies the collection's read + preference if no read preference is provided + * mongoc_collection_create_index and mongoc_collection_drop_index now apply + the collection's write concern. + * connectTimeoutMS timer now begins after DNS resolution, and resets + for each interface attempted (e.g., if the driver first tries IPv6, + then IPv4). + * New error code MONGOC_ERROR_DUPLICATE_KEY. + * mongoc_collection_find no longer treats the "filter" key specially in + queries - querying for a document with a key named "filter" is the same + now as any other key. + * The server description parameter to the following functions is "const": + * mongoc_server_description_host + * mongoc_server_description_id + * mongoc_server_description_ismaster + * mongoc_server_description_round_trip_time + * mongoc_server_description_type + * Exported symbols are no longer declared in separate export files. + This could break ABI with applications using clang, which previously + exported symbols from the internal private ABI. + * mongoc no longer crashes when multi roundtrip bulk operation fails. + * Added support for the new readConcernLevel "linearizable". + * Clients now check for misformatted "readPreferenceTags" in URI. + * New CMake option ENABLE_TRACING allows debug output, which before had only + been available with "configure --enable-tracing". + * Bugfix: "PossiblePrimary"-type replicas could be selected for reads + * Bugfixes: The random number generator used to select servers is now properly + seeded, and secondary queries are now properly distributed according to + localThresholdMS, not just to the lowest-latency secondary. + * mongoc_collection_insert, mongoc_collection_update, mongoc_collection_remove + consistently use domain MONGOC_ERROR_BSON, code MONGOC_ERROR_BSON_INVALID + if passed oversized BSON, and MONGOC_ERROR_COLLECTION for other errors. + mongoc_bulk_operation_execute continues to use MONGOC_ERROR_COMMAND for + all errors. + * If mongoc_client_pool_t fails to start its scanner thread in the background, + it logs and aborts instead of silently continuing, then failing to connect. + * The driver now updates its view of the whole topology with information from + each new connection handshake. + * mongoc_client_set_apm_callbacks can be used repeatedly to change or clear + the list of monitoring callbacks. + * Improved error reporting when the driver fails to reach the server. + +Deprecations: + * mongoc_collection_find is deprecated for mongoc_collection_find_with_opts. + +Removed configure flags: + * --enable-experimental has been removed. All previously experimental + features are now always on. + * The configure option "--enable-hardening" had had no effect. It is removed + in favor of system-wide compiler configuration. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Fiona Rowan + * Ian Boros + * Remi Collet + * Brian McCarthy + * Jeroen Ooms + * J. Rassi + * Christoph Schwarz + * Alexey Vorobeyev + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.4.2 +==================== + +It is my pleasure to announce mongo-c-driver 1.4.2. This release fixes bugs in +"minPoolSize" logic, see CDRIVER-1558 for details. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.4.1 +==================== + +It is my pleasure to announce mongo-c-driver 1.4.1. This is a bugfix release: + + * mongoc_client_get_server_descriptions could return a list including NULLs + * Tailable cursors on MongoDB 3.2 only worked with MONGOC_QUERY_AWAIT_DATA + * Spurious warnings with MONGOC_DISABLE_SHM + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.4.0 +==================== + +It is my pleasure to announce the release of mongo-c-driver 1.4.0. + +TLS +--- + +The driver can now use the native TLS and crypto functions included in macOS +and Windows. OpenSSL is no longer required for TLS or authentication on Mac or +Windows. By default, OpenSSL is used if available, the default will switch in +version 2.0 to prefer native TLS. + +For native TLS on Mac: + + ./configure --enable-ssl=darwin + +For Windows: + + cmake "-DENABLE_SSL=WINDOWS" -G "Visual Studio 10 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" + +All of the TLS implementations now load the native default certificate store, +with OpenSSL on Windows falling back on the Windows native certificate store if +no other can be found. + +The "ca_dir" field on mongoc_ssl_opt_t is only supported by OpenSSL. All other +fields, including "pem_file", are supported by all implementations. + +A new field, "allow_invalid_hostname", has been added to mongoc_ssl_opt_t and is +preferred over the existing "allow_invalid_certificate" to disable hostname +verification. + +The driver now supports the latest OpenSSL 1.1 in addition to past versions. + +Application Performance Monitoring +---------------------------------- + +The driver implements the MongoDB Command Monitoring Spec. Applications can +record the duration and other details of every operation the driver performs on +the server. See "Introduction to Application Performance Monitoring" in the +docs. + +Error API +--------- + +New functions mongoc_client_set_error_api and mongoc_client_pool_set_error_api +allow applications to distinguish client and server errors. See the "Error +Reporting" doc. + +Unacknowledged Write Results +---------------------------- + +Unacknowledged writes (writes whose mongoc_write_concern_t "w" value is zero) +now reply with an empty document instead of one with nInserted: 0, nUpdated: 0, +and so on. + +Command functions now ignore the read preferences set on a client, database, +or collection. Instead, they use the mongoc_read_prefs_t passed in explicitly, +or default to "primary". This change was made to bring them in line with the +Server Selection Spec. These are the affected functions: + + * mongoc_client_command + * mongoc_client_command_simple + * mongoc_database_command + * mongoc_database_command_simple + * mongoc_collection_command + * mongoc_collection_command_simple + +On the other hand, the following command-specific helper functions now use the +collection's read preference: + + * mongoc_collection_count + * mongoc_collection_stats + +New functions to send maxTimeMS or any arbitrary options with findAndModify: + + * mongoc_find_and_modify_opts_set_max_time_ms + * mongoc_find_and_modify_opts_append + +New function to include a write concern with a generic command function +like mongoc_client_command_simple: + + * mongoc_write_concern_append + +Public API For Higher-Level Drivers +----------------------------------- + +New functions support language drivers (specifically the PHP and HHVM drivers) +using only the libmongoc public API: + + * mongoc_bulk_operation_get_hint + * mongoc_client_command_simple_with_server_id + * mongoc_client_get_server_description + * mongoc_client_get_server_description_by_id + * mongoc_client_get_server_descriptions + * mongoc_client_select_server + * mongoc_cursor_get_limit + * mongoc_cursor_new_from_command_reply + * mongoc_cursor_set_hint + * mongoc_cursor_set_limit + * mongoc_log_trace_disable + * mongoc_log_trace_enable + * mongoc_server_description_ismaster + * mongoc_server_description_round_trip_time + * mongoc_server_description_type + * mongoc_server_descriptions_destroy_all + * mongoc_uri_get_option_as_bool + * mongoc_uri_get_option_as_int32 + * mongoc_uri_get_option_as_utf8 + * mongoc_uri_option_is_bool + * mongoc_uri_option_is_int32 + * mongoc_uri_option_is_utf8 + * mongoc_uri_set_auth_source + * mongoc_uri_set_database + * mongoc_uri_set_option_as_bool + * mongoc_uri_set_option_as_int32 + * mongoc_uri_set_option_as_utf8 + * mongoc_uri_set_password + * mongoc_uri_set_read_concern + * mongoc_uri_set_read_prefs_t + * mongoc_uri_set_username + * mongoc_uri_set_write_concern + * mongoc_write_concern_is_acknowledged + * mongoc_write_concern_is_valid + * mongoc_write_concern_journal_is_set + +Now that these public APIs are available, the PHP drivers no longer define the +MONGOC_I_AM_A_DRIVER preprocessor symbol to access private APIs. The symbol is +removed from C Driver headers, and libmongoc-priv.so is no longer installed. + +Other Features +-------------- + + * New connection string option "localThresholdMS". + * zSeries and POWER8 platform support. + * Performance enhancements, reduce allocation and copying in command code. + * All man page names now begin with "mongoc_" to avoid install conflicts. + * New function mongoc_gridfs_file_set_id. + +Deprecations +------------ + +Automatically calling mongoc_init and mongoc_cleanup is a GCC-specific feature +that is now deprecated, and will be removed in version 2. The driver should be +built with: + +./configure --disable-automatic-init-and-cleanup + +Or: + + cmake "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF" -G "Visual Studio 10 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" + +In this configuration, applications must explicitly init and cleanup libmongoc. + +Deprecated functions: + + * mongoc_write_concern_get_fsync + * mongoc_write_concern_set_fsync + +Notable Bug Fixes +----------------- + + * Logic bugs using tag sets to select replica set members with complex configs + * mongoc_client_get_database_names no longer filters out a replica set + member's "local" database. + * mongoc_client_get_gridfs now ensures the proper indexes on the files and + chunks collections. + * SecondaryPreferred fails if primary matches tags but secondaries don't. + * mongoc_collection_find_and_modify_with_opts can return true on + writeConcernError. + * mongoc_collection_validate doesn't always init "reply". + * The strings referred to by mongoc_ssl_opt_t, like pem_file and ca_file, are + now copied into the client or client pool by mongoc_client_set_ssl_opts or + mongoc_client_pool_set_ssl_opts, and need not be kept valid afterward. + * mongoc_collection_count_with_opts ignored flags and read_prefs. + * minPoolSize of 0 should mean "no minimum". + * mongoc_database_create_collection should always use the primary. + * The GSSAPI properties SERVICE_NAME and CANONICALIZE_HOST_NAME are now + properly parsed from the URI, see the "Authentication" doc for details. + * Comprehensive compatibility with various C standards and compilers. + +Acknowledgements +---------------- + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Ian Boros + * Fiona Rowan + * Jeremy Mikola + * Christoph Schwarz + * Mike Lloyd + * Remi Collet + * Jean-Bernard Jansen + * David Hatch + * Derick Rethans + * Brian Samek + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.5 +==================== + +It is my pleasure to announce mongo-c-driver 1.3.5. This release fixes a crash +in mongoc_cleanup when an allocator had been set with bson_mem_set_vtable, and +introduces a configure option MONGOC_NO_AUTOMATIC_GLOBALS which prevents code +built with GCC from automatically calling mongoc_init and mongoc_cleanup when +your code does not. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.4 +==================== + +It is my pleasure to announce the MongoDB C Driver 1.3.4. This release fixes a +security vulnerability: when a mongoc_client_t uses SSL and is disconnected, it +failed to re-verify the server certificate after reconnecting. This flaw affects +single clients, not pooled ones. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.3 +==================== + +It is my pleasure to announce MongoDB C Driver 1.3.3. This fixes a bug where +a slightly-oversized bulk write operation was not split into batches; instead, +it was sent whole to the server, which rejected it. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.2 +==================== + +It is my pleasure to announce MongoDB C Driver 1.3.2. This is a bugfix release: + + * A socket is properly discarded after a network error from a command. + * mongoc_database_get_collection now copies the database's read preferences, + read concern, and write concern, instead of copying the client's. + * mongoc_cursor_t's private struct now allows a negative limit. + +Thanks to everyone who contributed to this release. + + * A. Jesse Jiryu Davis + * Jeremy Mikola + * Hannes Magnusson + +Peace, + + A. Jesse Jiryu Davis + + + +mongo-c-driver 1.3.1 +==================== + +It is my pleasure to announce MongoDB C Driver 1.3.1. This is a bugfix release: + + * mongoc_client_get_gridfs now copies the client's read preferences, read + concern, and write concern to the newly created mongoc_gridfs_t. Before + this fix, GridFS operations were always executed with the default config: + data was read from the primary, with the read concern level "local", and + written with write concern "acknowledged". Now, if you have configured any + of these options on the mongoc_client_t, they are respected by the + mongoc_gridfs_t. + * CMakeLists.txt now includes and installs the pkg-config files. + +Thanks to everyone who contributed to this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Christopher Wang + * Jean-Bernard Jansen + * Jeremy Mikola + * Jeroen Ooms + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.0 +==================== + +It is my pleasure to announce to you the release of the MongoDB C Driver 1.3.0. + +Changes since the release candidate 1.3.0-rc0: + + * Fix a cursor bug introduced on big-endian platforms in 1.3.0-beta0. + * Improve documentation for mongoc_host_list_t. + * Move private mongoc_host_list_t functions from public header. + * Refactor the build system to declare library version in one place. + +All new features and changes since the previous stable release, 1.2.1: + + * If the driver is compiled without SSL support but a URI with "ssl=true" + is passed to mongoc_client_new, mongoc_client_new_from_uri, or + mongoc_client_pool_new, the function logs an error and returns NULL. Before, + the driver would attempt a non-SSL connection. + * mongoc_collection_find_and_modify will now apply the mongoc_collection_t's + write_concern_t when talking to MongoDB 3.2. + * Support for MongoDB 3.2's "readConcern" feature for queries, counts, and + aggregations. The option "readConcernLevel" is now accepted in the MongoDB + URI. New struct mongoc_read_concern_t, and functions operating on it: + - mongoc_client_get_read_concern + - mongoc_client_set_read_concern + - mongoc_database_get_read_concern + - mongoc_database_set_read_concern + - mongoc_collection_get_read_concern + - mongoc_collection_set_read_concern + - mongoc_read_concern_copy + - mongoc_read_concern_destroy + - mongoc_read_concern_get_level + - mongoc_read_concern_new + - mongoc_read_concern_set_level + - mongoc_uri_get_read_concern + * Support for MongoDB 3.2's "bypassDocumentValidation" option for writes. + * New struct mongoc_bulk_write_flags_t and related functions: + - mongoc_bulk_operation_set_bypass_document_validation + * New struct mongoc_find_and_modify_opts_t and related functions: + - mongoc_find_and_modify_opts_new + - mongoc_find_and_modify_opts_destroy + - mongoc_find_and_modify_opts_set_sort + - mongoc_find_and_modify_opts_set_update + - mongoc_find_and_modify_opts_set_fields + - mongoc_find_and_modify_opts_set_flags + - mongoc_find_and_modify_opts_set_bypass_document_validation + - mongoc_collection_find_and_modify_with_opts + * New functions to copy database and collection handles: + - mongoc_collection_copy + - mongoc_database_copy + * Support for MongoDB 3.2 wire protocol: use commands in place of OP_QUERY, + OP_GETMORE, and OP_KILLCURSORS messages. + * To explain a query plan with MongoDB 3.2, you must now call the "explain" + command, instead of including the "$explain" key in a mongoc_collection_find + query. See the mongoc_collection_find documentation page for details. + * Configurable wait time on tailable cursors with MongoDB 3.2: + - mongoc_cursor_get_max_await_time_ms + - mongoc_cursor_set_max_await_time_ms + * Use electionId to detect a stale replica set primary during a network split. + * Disconnect from replica set members whose "me" field does not match the + connection address. + * The client side matching feature, mongoc_matcher_t and related functions, + are deprecated and scheduled for removal in version 2.0. + * New CMake options ENABLE_SSL, ENABLE_SASL, ENABLE_TESTS, and ENABLE_EXAMPLES. + * Use constant-time comparison when verifying credentials. + * Combine environment's CFLAGS with configure options when building. + * Improved man page output and "whatis" entries. + +There are extensive bugfixes and improvements in GridFS since 1.2.1, including: + + * Handle seeking, reading, and writing past the end of a GridFS file. + * If a GridFS chunk is missing, mongoc_gridfs_file_readv sets file->error to + domain MONGOC_ERROR_GRIDFS and a new code MONGOC_ERROR_GRIDFS_CHUNK_MISSING. + * Optimization for long seeks forward with mongoc_gridfs_file_seek. + +Other fixes since 1.2.1: + + * Memory leaks in mongoc_database_has_collection and mongoc_cursor_next. + * Report writeConcern failures from findAndModify and from legacy writes. + * Memory leak in mongoc_database_find_collections. + * Set OP_QUERY's nToReturn from the provided limit. + * Fix compiler warnings and errors, especially with Visual Studio 2015, + GCC 4.8, and IBM XL C. + * Bugs and typos in tutorial examples. + +Thanks to everyone who contributed to this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Kyle Suarez + * Jose Sebastian Battig + * Matt Cotter + * Claudio Canella + * alexeyvo + * Christopher Wang + * Flavio Medeiros + * Iago Rubio + * Jeremy Mikola + * Victor Leschuk + * Jason Carey + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.0-rc0 +======================== + +It is my pleasure to announce to you the first release candidate of MongoDB C +driver 1.3.0. It includes additive ABI changes and bugfixes, and support for +the upcoming MongoDB 3.2. It is compatible with MongoDB 2.4 and later. + +New features and changes since 1.3.0-beta0: + + * If the driver is compiled without SSL support but a URI with "ssl=true" + is passed to mongoc_client_new, mongoc_client_new_from_uri, or + mongoc_client_pool_new, the function logs an error and returns NULL. Before, + the driver would attempt a non-SSL connection. + * New functions to copy database and collection handles: + - mongoc_collection_copy + - mongoc_database_copy + * If a GridFS chunk is missing, mongoc_gridfs_file_readv sets file->error to + domain MONGOC_ERROR_GRIDFS and a new code MONGOC_ERROR_GRIDFS_CHUNK_MISSING. + * Use electionId to detect a stale replica set primary during a network split. + * Disconnect from replica set members whose "me" field does not match the + connection address. + * The client side matching feature, mongoc_matcher_t and related functions, + are deprecated and scheduled for removal in version 2.0. + * New CMake options ENABLE_SSL, ENABLE_SASL, ENABLE_TESTS, and ENABLE_EXAMPLES. + * The build system is refactored to declare the current version and latest + release in one place. + +Other fixes: + + * Memory leaks in mongoc_database_has_collection and mongoc_cursor_next. + * Report writeConcern failures from findAndModify and from legacy writes. + +Thanks to everyone who contributed to this release candidate. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Matt Cotter + * Claudio Canella + * Victor Leschuk + * Flavio Medeiros + * Christopher Wang + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.3.0-beta0 +========================== + +It is my pleasure to announce to you the beta of MongoDB C driver 1.3.0. +This beta includes additive ABI changes and bugfixes, and support for +the upcoming MongoDB 3.2. It is compatible with MongoDB 2.4 and later. + +New features and changes: + + * mongoc_collection_find_and_modify will now apply the mongoc_collection_t's + write_concern_t when talking to MongoDB 3.2. + * Support for MongoDB 3.2's "readConcern" feature for queries, counts, and + aggregations. The option "readConcernLevel" is now accepted in the MongoDB + URI. New struct mongoc_read_concern_t, and functions operating on it: + - mongoc_client_get_read_concern + - mongoc_client_set_read_concern + - mongoc_database_get_read_concern + - mongoc_database_set_read_concern + - mongoc_collection_get_read_concern + - mongoc_collection_set_read_concern + - mongoc_read_concern_copy + - mongoc_read_concern_destroy + - mongoc_read_concern_get_level + - mongoc_read_concern_new + - mongoc_read_concern_set_level + - mongoc_uri_get_read_concern + * Support for MongoDB 3.2's "bypassDocumentValidation" option for writes. + * New struct mongoc_bulk_write_flags_t and related functions: + - mongoc_bulk_operation_set_bypass_document_validation + * New struct mongoc_find_and_modify_opts_t and related functions: + - mongoc_find_and_modify_opts_new + - mongoc_find_and_modify_opts_destroy + - mongoc_find_and_modify_opts_set_sort + - mongoc_find_and_modify_opts_set_update + - mongoc_find_and_modify_opts_set_fields + - mongoc_find_and_modify_opts_set_flags + - mongoc_find_and_modify_opts_set_bypass_document_validation + - mongoc_collection_find_and_modify_with_opts + * Configurable wait time on tailable cursors with MongoDB 3.2: + - mongoc_cursor_get_max_await_time_ms + - mongoc_cursor_set_max_await_time_ms + * Support for MongoDB 3.2 wire protocol: use commands in place of OP_QUERY, + OP_GETMORE, and OP_KILLCURSORS messages. + * To explain a query plan with MongoDB 3.2, you must now call the "explain" + command, instead of including the "$explain" key in a mongoc_collection_find + query. See the mongoc_collection_find documentation page for details. + * Use constant-time comparison when verifying credentials. + * Combine environment's CFLAGS with configure options when building. + * Improved man page output and "whatis" entries. + +Extensive bugfixes and improvements in GridFS, including: + + * Handle seeking, reading, and writing past the end of a GridFS file. + * Optimization for long seeks forward with mongoc_gridfs_file_seek. + +Other fixes: + + * Memory leak in mongoc_database_find_collections. + * Set OP_QUERY's nToReturn from the provided limit. + * Fix compiler warnings and errors, especially with Visual Studio 2015, + GCC 4.8, and IBM XL C. + * Bugs and typos in tutorial examples + +Thanks to everyone who contributed to this beta release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Kyle Suarez + * Jose Sebastian Battig + * Jeremy Mikola + * Iago Rubio + * Matt Cotter + * alexeyvo + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.2 +==================== + +It is my pleasure to announce to you the MongoDB C driver 1.2.2. + +This release fixes a rare bug where the driver can direct reads to hidden +secondaries unintentionally. It also includes fixes and improvements to the +build system. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.1 +==================== + +It is my pleasure to announce to you the MongoDB C driver 1.2.1. + +This release includes critical bugfixes for SSL connections with +mongoc_client_pool_t, and for Unix domain socket connections. + +The documentation is updated for a change introduced in version 1.2.0: +mongoc_client_set_ssl_opts and mongoc_client_pool_set_ssl_opts now configure +the driver to require an SSL connection to the server, even if "ssl=true" is +omitted from the MongoDB URI. Before, SSL options were ignored unless +"ssl=true" was included in the URI. + +The build instructions are improved, including the steps to build with OpenSSL +on OS X El Capitan. Build errors and warnings are fixed for clang in gnu99 +mode and MinGW. + +Thanks to everyone who contributed to this version of libmongoc. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Tamas Nagy + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.0 +==================== + +It is my pleasure to announce to you the MongoDB C driver 1.2.0. + +This is a stable release with additive ABI changes and bugfixes. It is +compatible with MongoDB version 2.4 and later. + +The following notes summarize changes since the previous stable release, +1.1.11, including changes in the 1.2.0 betas and release candidate. + +This version rewrites mongoc_client_t's internals to match two important new +specs for MongoDB drivers: the Server Discovery And Monitoring Spec and the +Server Selection Spec. The rewritten client has many advantages: + + * All replica set members or mongos servers are discovered and periodically + checked in parallel. The driver's performance is dramatically better and + more predictable with multi-server deployments, or with a flaky network, + or when some servers are slow or down. + * Clients from the same mongoc_client_pool_t share a background thread that + discovers and monitors all servers in parallel. + * Unnecessary round trips for server checks and pings are eliminated. + * Behavior is documented in the specs, and consistent with other drivers, + even in complex or unusual scenarios. + * The URI's "replicaSet" option is enforced: the driver now refuses to connect + to a server unless it is a member of a replica set with the correct setName. + * Many race conditions related to changing deployment conditions are fixed. + +To conform to the new specs, the client now accepts these options in the +MongoDB URI; see the mongoc_uri_t documentation for details: + + * heartbeatFrequencyMS + * serverSelectionTimeoutMS + * serverSelectionTryOnce + * socketCheckIntervalMS + +Other features: + + * All timeouts that can be configured in the URI now interpret 0 to mean "use + the default value for this timeout". + * The client's read preference can be configured in the URI with the new + options "readPreference" and "readPreferenceTags"; see the mongoc_uri_t + documentation. + * The new mongoc_uri_get_read_prefs_t function retrieves both the read mode + and tags from a mongoc_uri_t. + * New accessors mongoc_gridfs_file_get_id, mongoc_client_get_default_database, + and mongoc_bulk_operation_get_write_concern. + * Debug tracing can be controlled at runtime with mongoc_log_trace_enable and + mongoc_log_trace_disable. + * Set mongoc_client_pool_t's size with mongoc_client_pool_min_size() + and mongoc_client_pool_max_size(). + +Other changes: + + * Enable runtime asserts in release build. + * The libbson submodule's URL now uses the recommended https://, not git:// + * mongoc_client_kill_cursor is now deprecated and will be removed in 2.0. + * The write concern "w=-1" is documented as obsolete. + +These notable bugs have been fixed since 1.1.11: + + * The driver now uses the server's maxWireVersion to avoid an error and + extra round-trip when executing aggregations on MongoDB 2.4 and older. + * Much improved reporting of network errors, unavailable servers, and + authentication failure + * Off-by-one error in mongoc_gridfs_file_seek with mode SEEK_END + * The writeConcernErrors field of bulk results is properly formatted. + * A cursor with a server "hint" sets slaveOkay and / or $readPreference. + * Destroying an exhaust cursor must close its socket + * "wtimeoutms" was ignored for write concerns besides "majority". + * Bulk write operations might fail in mixed-version sharded clusters with + some pre-2.6 mongos servers. + * A variety of bugs and incorrect results in mongoc_bulk_operation_execute. + * Numerous compiler warnings and build failures on various platforms. + * Copious refinements to the documentation. + +Thanks to everyone who contributed to this version of libmongoc. + + * Jason Carey + * Samantha Ritter + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Kyle Suarez + * Jeremy Mikola + * Remi Collet + * Jose Sebastian Battig + * Derick Rethans + * Yuchen Xie + * Manuel Schoenlaub + * Sujan Dutta + * Lloyd Zhou + * rubicks + * Pawel Szczurko + * Yuval Hager + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.0-rc0 +======================== + +It is my pleasure to announce the release candidate of the MongoDB C driver +1.2.0. It includes features and bugfixes developed since 1.2.0-beta1. + +Notable bugs fixed: + + * Much improved reporting of network errors, unavailable servers, and + authentication failure + * Destroying an exhaust cursor must close its socket + * Various bugs in server reconnection logic + * mongoc_collection_aggregate returned invalid cursor after failure + * Wrong error message after failed network write on Sparc + * Missing JSON test files in release tarball + +Other changes: + + * Enable runtime asserts in release build. + * mongoc_client_kill_cursor is now deprecated and will be removed in + version 2.0. + +This release candidate also includes all bugfixes from 1.1.11. + +Version 1.2.0 final will be a stable release with additive ABI changes and +bugfixes. It is compatible with MongoDB version 2.4 and later. + +Thanks to everyone who contributed to this version of libmongoc. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Kyle Suarez + * rubicks + * Jose Sebastian Battig + * Jason Carey + * Remi Collet + * Yuval Hager + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.0-beta1 +========================== + +It is my pleasure to announce the second beta release of the MongoDB C driver +1.2.0. It includes features and bugfixes developed since 1.2.0-beta. + +New features: + + * Set mongoc_client_pool_t's size with mongoc_client_pool_min_size() + and mongoc_client_pool_max_size(). + * The write concern "w=-1" is now documented as obsolete. + * Abundant fixes and additions to the documentation, beyond those in the + previous beta. + +Notable bugs fixed: + + * Crashes and races in several replica set scenarios. + * The driver now uses the server's maxWireVersion to avoid an error and + extra round-trip when executing aggregations on MongoDB 2.4 and older. + * Fixed network error handling in multiple code paths. + * connectTimeoutMS limits the time the driver can spend reconnecting to + servers in single-threaded (non-pooled) mode with serverSelectionTryOnce. + +Version 1.2.0 final will be a stable release with additive ABI changes and +bugfixes. It is compatible with MongoDB version 2.4 and later. + +Thanks to everyone who contributed to this version of libmongoc. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Manuel Schoenlaub + * Kyle Suarez + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.2.0-beta +========================= + +It is my pleasure to announce to you the first beta release of the MongoDB C +driver 1.2.0. + +This release is a stable release with additive ABI changes and bugfixes. +It is compatible with MongoDB version 2.4 and later. + +Version 1.2.0 rewrites mongoc_client_t's internals to match two important new +specs for MongoDB drivers: the Server Discovery And Monitoring Spec and the +Server Selection Spec. The rewritten client has many advantages: + + * All replica set members or mongoses are discovered and periodically + checked in parallel. The driver's performance is dramatically better and + more predictable with multi-server deployments, or with a flaky network, + or when some servers are slow or down. + * Clients from the same mongoc_client_pool_t share a background thread that + discovers and monitors all servers in parallel. + * Unnecessary round trips for server checks and pings are eliminated. + * Behavior is documented in the specs, and consistent with other drivers, even + in complex or unusual scenarios. + * The URI's "replicaSet" option is enforced: the driver now refuses to connect + to a server unless it is a member of a replica set with the right setName. + * Many race conditions related to changing deployment conditions are fixed. + +To conform to the new specs, the client now accepts these options in the MongoDB +URI; see the mongoc_uri_t documentation for details: + + * heartbeatFrequencyMS + * serverSelectionTimeoutMS + * serverSelectionTryOnce + * socketCheckIntervalMS + +Other features: + + * All timeouts that can be configured in the URI now interpret 0 to mean "use + the default value for this timeout". + * The client's read preference can be configured in the URI with the new + options "readPreference" and "readPreferenceTags", see the mongoc_uri_t + documentation. + * The new mongoc_uri_get_read_prefs_t function retrieves both the read mode + and tags from a mongoc_uri_t. + * New accessors mongoc_gridfs_file_get_id, mongoc_client_get_default_database, + and mongoc_bulk_operation_get_write_concern. + * Debug tracing can be controlled at runtime with mongoc_log_trace_enable and + mongoc_log_trace_disable. + +Notable bugs fixed: + + * "wtimeoutms" was ignored for write concerns besides "majority". + * Bulk write operations might fail in mixed-version sharded clusters with + some pre-2.6 mongos servers. + * Normal operations were logged during startup and could not be silenced. + * A variety of bugs and incorrect results in mongoc_bulk_operation_execute. + * Numerous compiler warnings and build failures on various platforms. + * Copious refinements to the documentation. + +Thanks to everyone who contributed to this version of libmongoc. + + * A. Jesse Jiryu Davis + * Sujan Dutta + * Jason Carey + * Hannes Magnusson + * Jeremy Mikola + * Derick Rethans + * Samantha Ritter + * Yuchen Xie + * Lloyd Zhou + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.11 +===================== + +It is my pleasure to announce to you the MongoDB C driver 1.1.11. + +This is a patch release with bug fixes: + + * Undetected network errors when sending messages to the server + * Off-by-one error in mongoc_gridfs_file_seek with mode SEEK_END + * Memory leak parsing a URI that contains an invalid option + * The libbson submodule's URL now uses the recommended https://, not git:// + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jason Carey + * Jose Sebastian Battig + * rubicks + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.10 +===================== + +It is my pleasure to announce to you the MongoDB C driver 1.1.10. + +This is a patch release with bug fixes: + + * Occasional crash reconnecting to replica set. + * Queries sent to recovering replica set members. + * Memory leak when calling ismaster on replica set members. + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * A. Jesse Jiryu Davis + * Daniil Zaitsev + * Jason Carey + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.9 +==================== + +It is my pleasure to announce to you the MongoDB C driver 1.1.9. + +This release fixes a common crash in 1.1.8, which itself was introduced while +fixing a rare crash in 1.1.7. For further details: + +https://jira.mongodb.org/browse/CDRIVER-721 +https://jira.mongodb.org/browse/CDRIVER-695 + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.8 +==================== + +UPDATE: 1.1.8 suffered a severe new bug so I removed the release from GitHub: + +https://jira.mongodb.org/browse/CDRIVER-721 + +This is a patch release with bug fixes: + + * Crash freeing client after a replica set auth error. + * Compile error strict C89 mode. + +mongo-c-driver 1.1.7 +==================== + +It is my pleasure to announce to you the 1.1.7 release of the MongoDB C driver. + +This is a patch release with bug fixes: + + * Thread-safe use of Cyrus SASL library. + * Experimental support for building with CMake and SASL. + * Faster reconnection to replica set with some hosts down. + * Crash iterating a cursor after reconnecting to a replica set. + * Unchecked errors decoding invalid UTF-8 in MongoDB URIs. + * Fix error reporting from mongoc_client_get_database_names. + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * A. Jesse Jiryu Davis + * Jason Carey + * Hannes Magnusson + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.6 +==================== + +It is my pleasure to announce to you the 1.1.6 release of the MongoDB C driver. + +This is a patch release with performance enhancements and bug fixes: + + * mongoc_bulk_operation_execute now coalesces consecutive update operations + into a single message to a MongoDB 2.6+ server, yielding huge performance + gains. Same for remove operations. (Inserts were always coalesced.) + * Large numbers of insert operations are now properly batched according to + number of documents and total data size. + * GSSAPI / Kerberos auth now works. + * The driver no longer tries three times in vain to reconnect to a primary, + so socketTimeoutMS and connectTimeoutMS now behave *closer* to what you + expect for replica sets with down members. A full fix awaits 1.2.0. + +I snuck in a feature: + + * mongoc_matcher_t now supports basic subdocument and array matching + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * A. Jesse Jiryu Davis + * Jason Carey + * Kai Mast + * Matt Cotter + +Peace, + + A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.5 +==================== + +It is my pleasure to announce to you the 1.1.5 release of the MongoDB C driver. + +This is a patch release with performance enhancements and bug fixes: + + * The fsync and j write concern flags now imply acknowledged writes + * Prevent using fsync or j with conflicting w=0 write concern + * Obey socket timeout consistently in TLS/SSL mode + * Return an error promptly after a network hangup in TLS mode + * Prevent crash using SSL in FIPS mode + * Always return NULL from mongoc_database_get_collection_names on error + * Fix version check for GCC 5 and future versions of Clang + * Fix warnings and errors building on various platforms + * Add configure flag to enable/disable shared memory performance counters + * Minor docs improvements and fix links from C Driver docs to Libbson docs + +With this release, Libbson abandons the convention that odd-numbered patch +versions indicate unstable releases. We switch to simple semantic versioning: +1.1.5 is a stable release with bug fixes since 1.1.4. During subsequent +development the version will be "1.1.6-dev". + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * A. Jesse Jiryu Davis + * Christian Hergert + * Jason Carey + * Jeremy Mikola + * Jeroen Ooms + * Hannes Magnusson + +Enjoy! + +-- A. Jesse Jiryu Davis + + +mongo-c-driver 1.1.4 +==================== + +It is my pleasure to announce to you the 1.1.4 release of the MongoDB C driver. + +This release is a stable release with performance enhancements and bugfixes. + +Changes include: + * Fixed client pool concurrency issues + * Fixed some scenarios where replica sets would fail to reconnect on primary + step down. + * Improved write concern handling + * Validate port number in URI + * Various other fixes + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * Jason Carey + * Andrew Clayton + * A. Jesse Jiryu Davis + * Jeremy Mikola + +Enjoy! + +-- Jason Carey + + +mongo-c-driver 1.1.2 +==================== + +It is my pleasure to announce to you the 1.1.2 release of the MongoDB C driver. + +This release is a stable release with performance enhancements and bugfixes. + +Changes include: + * Process connectTimeoutMS cast insensitively + * Addition of missing trace macros + * Improvement of internal error messages + * Fix a segfault in OpenSSL cleanup routines + * Fix for IPv6 support for replica sets + * Coalesce small vectorized TLS writes + * MinGW fixups + * Fix for a memory leak in get_database_names() + * Fixes for patching write concern through the bulk api + * Fix to normalize hostnames in uri parsing + * Fix for managing connections in the client pool + * Various other fixes + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * Andrew Clayton + * Denis Gladkikh + * Hannes Magnusson + * Jason Carey + * Jeremy Mikola + * mschoenlaub + * Samantha Ritter + * Tyler Brock + +Enjoy! + +-- Jason Carey + + +mongo-c-driver 1.1.0 +==================== + +It is my pleasure to announce to you the 1.1.0 release of the MongoDB C driver. + +This release is a stable release with additive ABI changes and bugfixes. + +The below changes include some carried over from RC0. + +Changes include: + * RC0 + * ABI versioning for 1.1 versus 1.0 symbols + * additional geo index options + * authMechanismProperties in URI + * fixes for OS X Yosemite + * removal of replica set member limit + * SCRAM-SHA-1 SASL mechanism + * updated dependency on libbson 1.1 abi + * validation for bulk insert + * various memory leak fixes + * Fixes to documentation typos + * "How to Ask For Help" in the README + * Removed dependency on sasl for PLAIN authentication + * Use provided username, if available, for X.509 auth + * Fixed WriteConcern error reporting for some writes + * Check for closed sockets before attempting RPCs + * Fixes for gridfs file seek + * Fixes for mongoc_cursor_clone() + * Fixes for unix domain socket support + * Fixes for polling on win32 + * Improved warnings on failure to connect + * Addition of wired tiger options + * Fixes for examples + +Additions to the ABI include: + * support for extra option in count + - mongoc_collection_count_with_opts + * additional index options + - mongoc_index_opt_geo_get_default + - mongoc_index_opt_geo_init + - mongoc_index_opt_wt_get_default + - mongoc_index_opt_wt_init + * rand interface to seed and verify the strong random number generation needed + by some auth mechanisms + - mongoc_rand_seed + - mongoc_rand_add + - mongoc_rand_status + * URI additions to support more complicated auth credentials + - mongoc_uri_get_credentials + - mongoc_uri_get_mechanism_properties + * Support for cursor returning metadata crud operations + - mongoc_client_find_databases + - mongoc_collection_find_indexes + - mongoc_database_find_collections + * Kill cursor support + - mongoc_client_kill_cursor + * Various get/setters on cursor + - mongoc_cursor_get_batch_size + - mongoc_cursor_get_id + - mongoc_cursor_set_batch_size + * More socket/stream options + - mongoc_socket_check_closed + - mongoc_socket_inet_ntop + - mongoc_stream_check_closed + - mongoc_stream_write + +Additional Notes: + Existing complex index names may contain a zero instead of a type due to +a bug in mongoc_collection_keys_to_index_string. As a result those indexes may +be hard to drop from the driver as they have a name you would not expect. + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * Adam Midvidy + * aherlihy + * alexeyvo + * Christian Hergert + * Hannes Magnusson + * Jason Carey + * Jérôme Lebel + * Jesse Jiryu Davis + * lloydzhou + * Mark Benevenuto + * Paul Melnikow + * Samantha Ritter + * Shraya Ramani + * Spencer Jackson + * Tyler Brock + + +Enjoy! + +-- Jason Carey + + +mongo-c-driver 1.1.0-rc0 +======================== + +It is my pleasure to announce to you the 1.1.0-rc0 release of the MongoDB C driver. + +This release is a release candidate with additive ABI changes and bugfixes. + +Changes include: + * ABI versioning for 1.1 versus 1.0 symbols + * additional geo index options + * authMechanismProperties in URI + * fixes for OS X Yosemite + * removal of replica set member limit + * SCRAM-SHA-1 SASL mechanism + * updated dependency on libbson 1.1 abi + * validation for bulk insert + * various memory leak fixes + +Additions to the ABI include: + * support for extra option in count + - mongoc_collection_count_with_opts + * extra index and collection info + - mongoc_collection_get_index_info + - mongoc_database_get_collection_info + * additional geo options + - mongoc_index_opt_geo_get_default + - mongoc_index_opt_geo_init + * rand interface to seed and verify the strong random number generation needed + by some auth mechanisms + - mongoc_rand_seed + - mongoc_rand_add + - mongoc_rand_status + * URI additions to support more complicated auth credentials + - mongoc_uri_get_credentials + - mongoc_uri_get_mechanism_properties + +Additional Notes: + Existing complex index names may contain a zero instead of a type due to +a bug in mongoc_collection_keys_to_index_string. As a result those indexes may +be hard to drop from the driver as they have a name you would not expect. + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * Adam Midvidy + * aherlihy + * alexeyvo + * Christian Hergert + * Jason Carey + * Jérôme Lebel + * Samantha Ritter + * Spencer Jackson + * Tyler Brock + + +Enjoy! + +-- Jason Carey + + +mongo-c-driver 1.0.2 +==================== + +It is my pleasure to announce to you the 1.0.2 release of the MongoDB C driver. + +This release is a minor point release with no ABI changes and mostly small +bugfixes. + +Changes include: + * A variety of fixes for read preference based node selection + * Avoided inclusion of getLastError in 2.6 writeConcern + * Correct handling of pass through params for collection_aggregate + * Improved error reporting in socket connect + * Public MONGOC_DEFAULT_CONNECTTIMEOUTMS + +Thanks to everyone who contributed to the development of this point release for +libmongoc. + + * Adam Midvidy + * Christian Hergert + * Denis Gladkikh + * Jason Carey + * Jeremy Mikola + * Jérôme Lebel + * Tyler Brock + * Wisdom Omuya + +-- Jason Carey + + +mongo-c-driver 1.0.0 +==================== + +It is my very distinct pleasure to announce to you the 1.0 release of +the MongoDB C driver! + +This is the culmination of just over a year of work and could not have +been done without the help of our wonderful community. + +Thanks to everyone who contributed to the development of this driver! + + * Christian Hergert + * Jason Carey + * Gary Murakami + * Christian Heckl + * Frank Watson Song + * Hannes Magnusson + * Jérôme Lebel + * Kyle Suarez + * Maga Napanga + * Michael Kuhn + * Vincent Giersch + * essentia44 + * yuqing + +Happy Hacking! + +-- Christian Hergert + + +mongo-c-driver 0.98.2 +===================== + +One final step before our journey to 1.0! + +This is a relatively small release, adding some features needed for drivers +building on top of the C driver. + +A new libmongoc-priv.so library is installed that does not have symbols +hidden. You can access private headers via the -private.h variants. This +means you will need to recompile your project every time the library is +changed (if you use those private headers, as they are subject to change). + +A special thanks to Hannes Magnusson for patches in this release. + +See `git shortlog 0.98.0..0.98.2` for a list of all the changes. + +-- Christian Hergert + + +mongo-c-driver 0.98.0 +===================== + +Another step in the rapidly approaching path to 1.0! + +This release is primarily a bugfix release and stablization effort as we +approach 1.0 of the MongoDB C driver. + +This release requires 0.98.0 of Libbson for improvements to the memory +management system. You can now setup custom memory allocators at the +start of the process. + +This is a RC release that with a few improvements will likely become 1.0. + +A special thanks to the following for patches in this cycle: + + * Kyle Suarez + * yuqing + +See `git shortlog 0.96.4..0.98.0` for a list of all the changes. + +-- Christian Hergert + + +mongo-c-driver 0.96.4 +===================== + +Another incremental feature update and bugfix release! + +In this release, you will find the following changes: + + * build/mci.sh script for automatically building Debian packages, RPMs, and + Solaris packaging based on the host operating system. + * Various libbson improvements, now depending on 0.8.4. + * Alignment fixes for Solaris Studio C compiler via libbson. + * Addition of mongoc_gridfs_remove_by_filename() for removing a file from + gridfs by filename. + * client command functions can now take a fully qualified namespace. + * collections can now support names that indicate a command namespace. + * Commands will no longer fail if they do not contain an "ok" field. + * OP_QUERY will now set the slaveOk bit in the wire protocol if + * readPreferences are set to non-PRIMARY. + * Various documentation and build fixes. + +Thanks again to all the contributors, and happy hacking! + + +mongo-c-driver 0.96.2 +===================== + +Hot on the heels of 0.96.0 we would like to present mongo-c-driver 0.96.2! + +This is primarily a bugfix release. Included in this release are: + + * Ensure batchSize is used in cursor GETMORE operations with `aggregate`. + * Ensure enough buffer space is allocated for incoming RPC when buffering + from a stream. + * Require libbson 0.8.2 for more robust `bson_next_power_of_two()` when + using `size_t` and BCON compilation fix with C++. + * Handle cursor id's that are not 64-bit values in response from + `aggregate` command. + * Handle upsert on MongoDB < 2.6 when _id does not contain an `ObjectId`. + * Use 100 for default batchSize in `aggregate` command. + +Happy Hacking! + + +mongo-c-driver 0.96.0 +===================== + +It's that time again, time for another mongo-c-driver release! + +This release includes much new documentation, which can be found at +http://docs.mongodb.org/ecosystem/drivers/c/. + +Additionally, this release improves support for various exotic systems. +Solaris 10 is supported much better on SPARC and x86_64 based systems. + +Some workarounds for mixed-mode sharded-clusters have been added to improve +resiliency when rolling upgrades are performed. + +Build improvements have been added to help us detect SASL and SSL +implementations on platforms that do not support pkg-config. This should +simplify building for some of you. + +We've added some more logging to SASL authentication to help debug +authentication failures. + +A bug causing an abort() when SSL is used and a server is down has been fixed. + +We've renamed various _delete() functions to _remove() to provide consistency +with other MongoDB drivers. + +You can now specify SSL options for client pools. + +-D_REENTRANT is always defined now on Solaris to help with errno detection. +This may not have been done before if using a non-GCC platform with pthreads. + +A bug was fixed where timeouts could have been 1000x longer than expected +due to failure to convert from microseconds to milliseconds. + +A bug was fixed with authentication in sharded cluster and replica set +scenarios. + +Happy Hacking! + + +mongo-c-driver 0.94.2 +===================== + +Hot on the heels of 0.94.0 is 0.94.2, a bugfix release. + +A bug has been fixed when using TLS streams and large result sets. + +In this release, we added support for Sun's C compiler (Sun Pro C) on Solaris. +This allows for builds on Solaris 10 with SPARC using the native toolchain. + +This release contains a couple of fixes in libbson as well. + +Keep those bug reports coming, and as always, Happy Hacking! + + +mongo-c-driver 0.94.0 +===================== + +The mongo-c-driver team is proud to announce the release of 0.94.0. This +release is a followup to the previous release adding more features to be found +in MongoDB 2.6. + +You will find some new API's, bug fixes, and more documentation. Under the +hood, 0.94.0 uses the new write-commands as part of MongoDB 2.6 when it +discovers it is communicating with a MongoDB server. There is now a bulk +operation API (See `mongoc-bulk-operation.h`). + +Helpers for common server commands have been added. You can find most of +them `mongoc-collection.h`. + +To simply using mongo-c-driver from Windows, we've included pre-built binaries +on the release page. + +Thanks to all of the contributors this release! + +Happy Hacking! + + +mongo-c-driver 0.92.0 +===================== + +The mongo-c-driver team is proud to announce the release of 0.92.0. This +release is the culimation of a few months work and has many bug fixes and +new features. It contains over 350 commits from 4 authors since the 0.90.0 +release. + +The mongo-c-driver release tarballs now contain a bundled copy of libbson. +If you do not have libbson installed or the system installed libbson is too +old, the bundled copy of libbson will be installed. + + * Revamped build system to simplify installation. + * Windows Vista and newer support. + * Various GridFS fixes and features. + * Kerberos support via cyrus-sasl. + * Various SSL improvements. + * Support for Solaris 11, FreeBSD 10, RHEL 5+, and SmartOS. + * A new client side expression matcher to perform basic query processing. + It can perform queries such as {'field': {'$in': [1,2,3]}}. See + mongoc_matcher_t for more information. + * A new socket abstraction for platform independent network sockets. + * A new mongoc-dump example for how to write a simple mongodump replacement. + * Counters can use rdtscp instruction on Core iX systems for very fast + counters. + * configure has new options. If in doubt, the defaults are sensible. + * --enable-coverage=yes|no + * --enable-debug=yes|no + * --enable-debug-symbols=yes|no + * --enable-hardening=yes|no + * --enable-optimizations=yes|no + * --enable-ssl=yes|no + * --enable-sasl=yes|no + * --enable-tracing=yes|no + * --with-libbson=auto|system|bundled + +mongo-c-driver 0.92.0 requires libbson 0.6.4 or newer. + +Happy Hacking! + + +Libmongoc 0.90.0 +================ + +This is the initial release of the new Libmongoc. We chose 0.90.0 for the +release version to differentiate ourselves from the, now legacy, version of +libmongoc. We will rapidly work towards reaching an API/ABI stable library fit +for a 1.0.0 release. + +Libmongoc is Apache licensed so it can be embedded in a multitude of scenarios. + +The API of 0.90.0 is completely different from the previous versions. We think +this allowed us to create a high-quality library that you will enjoy using in +your applications. + +Many outstanding bugs were closed in the process of creating Libbson 0.90.0. So +if you had a pet issue, please take a look to see if it was resolved as part of +this effort! + +Thanks, and enjoy developing your applications with libmongoc! diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/README.rst b/contrib/mongoc/mongo-c-driver-1.13.1/README.rst new file mode 100644 index 0000000..cefbc73 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/README.rst @@ -0,0 +1,90 @@ +============== +mongo-c-driver +============== + +About +===== + +mongo-c-driver is a project that includes two libraries: + +- libmongoc, a client library written in C for MongoDB. +- libbson, a library providing useful routines related to building, parsing, and iterating BSON documents. + +If libmongoc is not needed, it is possible to build and install only libbson. + +Documentation / Support / Feedback +================================== + +The documentation is available at http://mongoc.org/. +For issues with, questions about, or feedback for libmongoc, please look into +our `support channels `_. Please +do not email any of the libmongoc developers directly with issues or +questions - you're more likely to get an answer on the `mongodb-user list`_ +on Google Groups. + +Bugs / Feature Requests +======================= + +Think you’ve found a bug? Want to see a new feature in libmongoc? Please open a +case in our issue management tool, JIRA: + +- `Create an account and login `_. +- Navigate to `the CDRIVER project `_. +- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. + +Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the +Core Server (i.e. SERVER) project are **public**. + +How To Ask For Help +------------------- + +If you are having difficulty building the driver after reading the below instructions, please email +the `mongodb-user list`_ to ask for help. Please include in your email all of the following +information: + +- The version of the driver you are trying to build (branch or tag). + - Examples: master branch, 1.9.5 tag +- Host OS, version, and architecture. + - Examples: Windows 10 64-bit x86, Ubuntu 16.04 64-bit x86, macOS 10.13 +- C Compiler and version. + - Examples: GCC 7.3.0, Visual Studio Community 2017, clang 3.9, XCode 9.3 +- The output of ``cmake``. +- The text of the error you encountered. + +Failure to include the relevant information will delay a useful response. +Here is a made-up example of a help request that provides the relevant +information: + + Hello, I'm trying to build the C driver with Kerberos support, from + mongo-c-driver-1.9.5.tar.gz. I'm on Ubuntu 16.04, 64-bit Intel, with gcc + 5.4.0. I run CMake like:: + + $ cmake . + -- The C compiler identification is ;GNU 5.4.0 + -- Check for working C compiler: /usr/bin/cc + -- Check for working C compiler: /usr/bin/cc -- works + + ... SNIPPED OUTPUT, but when you ask for help, include full output without any omissions ... + + -- Searching for libsasl2 + -- Not found (specify -DCMAKE_LIBRARY_PATH=/path/to/sasl/lib for SASL support) + CMake Error at CMakeLists.txt:10 (_message): + SASL not found + + Can you tell me what I need to install? Thanks! + +.. _mongodb-user list: http://groups.google.com/group/mongodb-user + +Security Vulnerabilities +------------------------ + +If you’ve identified a security vulnerability in a driver or any other +MongoDB project, please report it according to the `instructions here +`_. + + +Installation +============ + +Detailed installation instructions are in the manual: +http://mongoc.org/libmongoc/current/installing.html diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/THIRD_PARTY_NOTICES b/contrib/mongoc/mongo-c-driver-1.13.1/THIRD_PARTY_NOTICES new file mode 100644 index 0000000..beedada --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/THIRD_PARTY_NOTICES @@ -0,0 +1,157 @@ +The MongoDB C Driver uses third-party code distributed under different licenses. + +License notice for common-b64.c +------------------------------------------------------------------------------- + +ISC License + +Copyright: 1996, 1998 Internet Software Consortium + 1995 International Business Machines, Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +Portions Copyright (c) 1995 by International Business Machines, Inc. + +International Business Machines, Inc. (hereinafter called IBM) grants +permission under its copyrights to use, copy, modify, and distribute this +Software with or without fee, provided that the above copyright notice and +all paragraphs of this notice appear in all copies, and that the name of IBM +not be used in connection with the marketing of any product incorporating +the Software or modifications thereof, without specific, written prior +permission. + +To the extent it has a right to do so, IBM grants an immunity from suit +under its patents, if any, for the use, sale or manufacture of products to +the extent that such products are used for performing Domain Name System +dynamic updates in TCP/IP networks by means of the Software. No immunity is +granted for any product per se or for any other function of any product. + +THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, +DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING +OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN +IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +License notice for taglist.py +------------------------------------------------------------------------------- + +MIT License + +Portions Copyright 2007-2009 by the Sphinx team. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +License notice for mongoc.css_t +------------------------------------------------------------------------------- + +MIT License + +Portions Copyright 2013 by Ignacy Sokolowski. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +License notice for zlib +------------------------------------------------------------------------------- +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.11, January 15th, 2017 + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +License notice for common-md5.c +------------------------------------------------------------------------------- + +ZLib License + +Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +L. Peter Deutsch +ghost@aladdin.com \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_CURRENT b/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_CURRENT new file mode 100644 index 0000000..b50dd27 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_CURRENT @@ -0,0 +1 @@ +1.13.1 diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_RELEASED b/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_RELEASED new file mode 100644 index 0000000..b50dd27 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/VERSION_RELEASED @@ -0,0 +1 @@ +1.13.1 diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/generate_uninstall/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/generate_uninstall/CMakeLists.txt new file mode 100644 index 0000000..052830e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/generate_uninstall/CMakeLists.txt @@ -0,0 +1,56 @@ +# Fabricate our own copy of the install manifest, since the installation has not +# generated the final version yet at this point + +set (UNINSTALL_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + +if (WIN32) + string (REPLACE "/" "\\\\" CMAKE_INSTALL_PREFIX_WIN32 + "${CMAKE_INSTALL_PREFIX}" + ) + install (CODE " + string(REPLACE \";\" \"\\n\" MONGOC_INSTALL_MANIFEST_CONTENT + \"\${CMAKE_INSTALL_MANIFEST_FILES}\") + string(REPLACE \"/\" \"\\\\\" MONGOC_INSTALL_MANIFEST_CONTENT_WIN32 + \"\${MONGOC_INSTALL_MANIFEST_CONTENT}\") + file(WRITE \"mongoc_install_manifest.txt\" + \"\${MONGOC_INSTALL_MANIFEST_CONTENT_WIN32}\") + execute_process ( + COMMAND + ${CMAKE_COMMAND} -E env + ENABLE_MONGOC=${ENABLE_MONGOC} + cmd.exe /c + \"${PROJECT_SOURCE_DIR}/build/generate-uninstall.cmd\" + mongoc_install_manifest.txt + ${CMAKE_INSTALL_PREFIX_WIN32} + OUTPUT_FILE + \"${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}\" + ) + ") + install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS}) + + add_custom_target (uninstall + COMMAND call "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" + ) +else () + install (CODE " + string(REPLACE \";\" \"\\n\" MONGOC_INSTALL_MANIFEST_CONTENT + \"\${CMAKE_INSTALL_MANIFEST_FILES}\") + file(WRITE \"mongoc_install_manifest.txt\" + \"\${MONGOC_INSTALL_MANIFEST_CONTENT}\") + execute_process ( + COMMAND + ${CMAKE_COMMAND} -E env + ENABLE_MONGOC=${ENABLE_MONGOC} + \"${PROJECT_SOURCE_DIR}/build/generate-uninstall.sh\" + mongoc_install_manifest.txt + ${CMAKE_INSTALL_PREFIX} + OUTPUT_FILE + \"${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}\" + ) + ") + install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS}) + + add_custom_target (uninstall + COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" + ) +endif () diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/CMakeLists.txt new file mode 100644 index 0000000..948e1ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/CMakeLists.txt @@ -0,0 +1,9 @@ +file (GLOB_RECURSE orchestration_configs_DIST_pems RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.pem) +file (GLOB_RECURSE orchestration_configs_DIST_jsons RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.json) + +set_dist_list (orchestration_configs_DIST + CMakeLists.txt + ${orchestration_configs_DIST_pems} + ${orchestration_configs_DIST_jsons} +) + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-ssl.json new file mode 100644 index 0000000..84eec1d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-ssl.json @@ -0,0 +1,57 @@ +{ + "auth_key": "secret", + "id": "repl0", + "login": "bob", + "password": "pwd123", + "members": [ + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27017, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "one", + "dc": "ny" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27018, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "two", + "dc": "pa" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27019, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "arbiterOnly": true + } + } + ], + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-thisDB-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-thisDB-ssl.json new file mode 100644 index 0000000..b1f740a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth-thisDB-ssl.json @@ -0,0 +1,58 @@ +{ + "auth_key": "secret", + "id": "repl0", + "login": "bob", + "password": "pwd123", + "authSource": "thisDB", + "members": [ + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27017, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "one", + "dc": "ny" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27018, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "two", + "dc": "pa" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27019, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "arbiterOnly": true + } + } + ], + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth.json new file mode 100644 index 0000000..d436c50 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/auth.json @@ -0,0 +1,50 @@ +{ + "auth_key": "secret", + "id": "repl0", + "login": "bob", + "members": [ + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27017, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "one", + "dc": "ny" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27018, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "two", + "dc": "pa" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27019, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "arbiterOnly": true + } + } + ], + "password": "pwd123" +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic-ssl.json new file mode 100644 index 0000000..db00a6a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic-ssl.json @@ -0,0 +1,54 @@ +{ + "id": "repl0", + "members": [ + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27017, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "one", + "dc": "ny" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27018, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "two", + "dc": "pa" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27019, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "arbiterOnly": true + } + } + ], + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic.json new file mode 100644 index 0000000..3d9d3dc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/replica_sets/basic.json @@ -0,0 +1,47 @@ +{ + "id": "repl0", + "members": [ + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27017, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "one", + "dc": "ny" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27018, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "tags": { + "ordinal": "two", + "dc": "pa" + } + } + }, + { + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "journal": true, + "port": 27019, + "setParameter" : { "enableTestCommands": 1 } + }, + "rsParams": { + "arbiterOnly": true + } + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth-ssl.json new file mode 100644 index 0000000..7bf7c88 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth-ssl.json @@ -0,0 +1,20 @@ +{ + "id" : "standalonessl", + "name": "mongod", + "login": "bob", + "password": "pwd123", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + }, + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth.json new file mode 100644 index 0000000..0ccbb7f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/auth.json @@ -0,0 +1,14 @@ +{ + "id": "standalone", + "auth_key": "secret", + "login": "bob", + "name": "mongod", + "password": "pwd123", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ipv4-only.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ipv4-only.json new file mode 100644 index 0000000..f681a73 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ipv4-only.json @@ -0,0 +1,9 @@ +{ + "name": "mongod", + "procParams": { + "ipv6": false, + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ssl.json new file mode 100644 index 0000000..959a240 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic-ssl.json @@ -0,0 +1,18 @@ +{ + "id" : "standalonenoauthssl", + "name": "mongod", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + }, + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic.json new file mode 100644 index 0000000..e062966 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/basic.json @@ -0,0 +1,10 @@ +{ + "name": "mongod", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/mmapv1.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/mmapv1.json new file mode 100644 index 0000000..7bdca5d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/mmapv1.json @@ -0,0 +1,11 @@ +{ + "name": "mongod", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "storageEngine": "mmapv1", + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy-zlib.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy-zlib.json new file mode 100644 index 0000000..32de195 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy-zlib.json @@ -0,0 +1,11 @@ +{ + "name": "mongod", + "procParams": { + "networkMessageCompressors": "snappy,zlib", + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy.json new file mode 100644 index 0000000..6e62d3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/snappy.json @@ -0,0 +1,11 @@ +{ + "name": "mongod", + "procParams": { + "networkMessageCompressors": "snappy", + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/wiredtiger.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/wiredtiger.json new file mode 100644 index 0000000..e747d44 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/wiredtiger.json @@ -0,0 +1,11 @@ +{ + "name": "mongod", + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "storageEngine": "wiredTiger", + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/zlib.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/zlib.json new file mode 100644 index 0000000..95f0a26 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/servers/zlib.json @@ -0,0 +1,11 @@ +{ + "name": "mongod", + "procParams": { + "networkMessageCompressors": "zlib", + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "logappend": true, + "journal": true, + "port": 27017 + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth-ssl.json new file mode 100644 index 0000000..e25ff21 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth-ssl.json @@ -0,0 +1,56 @@ +{ + "id": "shard_cluster_1", + "login": "bob", + "password": "pwd123", + "auth_key": "secret", + "shards": [ + { + "id": "sh01", + "shardParams": { + "members": [{ + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "shardsvr": true, + "setParameter" : { "enableTestCommands": 1 }, + "port": 27217 + } + }] + } + }, + { + "id": "sh02", + "shardParams": { + "members": [{ + "procParams": { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "shardsvr": true, + "setParameter" : { "enableTestCommands": 1 }, + "port": 27218 + } + }] + } + } + ], + "routers": [ + { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "setParameter" : { "enableTestCommands": 1 }, + "port": 27017 + }, + { + "ipv6": true, + "bind_ip": "127.0.0.1,::1", + "setParameter" : { "enableTestCommands": 1 }, + "port": 27018 + } + ], + "sslParams": { + "sslOnNormalPorts": true, + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth.json new file mode 100644 index 0000000..f5dfbdf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/auth.json @@ -0,0 +1,58 @@ +{ + "id": "shard_cluster_1", + "login": "bob", + "password": "pwd123", + "auth_key": "secret", + "shards": [ + { + "id": "sh01", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27217 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27218 + } + } + ] + } + }, + { + "id": "sh02", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27219 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27220 + } + } + ] + } + } + ], + "routers": [ + { + "port": 27017, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + }, + { + "port": 27018, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic-ssl.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic-ssl.json new file mode 100644 index 0000000..7e4458b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic-ssl.json @@ -0,0 +1,62 @@ +{ + "id": "shard_cluster_1", + "shards": [ + { + "id": "sh01", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27217 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27218 + } + } + ] + } + }, + { + "id": "sh02", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27219 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27220 + } + } + ] + } + } + ], + "routers": [ + { + "port": 27017, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + }, + { + "port": 27018, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + } + ], + "sslParams": { + "sslMode": "requireSSL", + "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", + "sslCAFile": "/tmp/orchestration-home/ca.pem", + "sslAllowInvalidCertificates": true, + "sslWeakCertificateValidation" : true + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic.json b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic.json new file mode 100644 index 0000000..31f88e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/orchestration_configs/sharded_clusters/basic.json @@ -0,0 +1,55 @@ +{ + "id": "shard_cluster_1", + "shards": [ + { + "id": "sh01", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27217 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27218 + } + } + ] + } + }, + { + "id": "sh02", + "shardParams": { + "members": [ + { + "procParams": { + "shardsvr": true, + "port": 27219 + } + }, + { + "procParams": { + "shardsvr": true, + "port": 27220 + } + } + ] + } + } + ], + "routers": [ + { + "port": 27017, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + }, + { + "port": 27018, + "ipv6": true, + "bind_ip": "127.0.0.1,::1" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/CMakeLists.txt new file mode 100644 index 0000000..8c8e5cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/CMakeLists.txt @@ -0,0 +1,38 @@ +# sub-directory 'libbson' was already included at the top-level +# sub-directory 'libmongoc' was already included at the top-level +add_subdirectory (tools) +add_subdirectory (common) + +# zconf.h is generated by configure_file() in the parent CMakeLists.txt +extra_dist_generated (zlib-1.2.11/zconf.h) +set (src_zlib_DIST + src/zlib-1.2.11/crc32.h + src/zlib-1.2.11/deflate.h + src/zlib-1.2.11/gzguts.h + src/zlib-1.2.11/inffast.h + src/zlib-1.2.11/inffixed.h + src/zlib-1.2.11/inflate.h + src/zlib-1.2.11/inftrees.h + src/zlib-1.2.11/trees.h + src/zlib-1.2.11/zconf.h.in + src/zlib-1.2.11/zlib.h + src/zlib-1.2.11/zutil.h +) +# Strip leading directory components to make the paths relative for MakeDist. +# The ZLIB_SOURCES list is set in the top-level CMakeLists.txt. +foreach (zlib_src IN LISTS ZLIB_SOURCES) + string (REPLACE "${SOURCE_DIR}/" "" zlib_src_rel ${zlib_src}) + list (APPEND src_zlib_DIST ${zlib_src_rel}) +endforeach () + +set_local_dist (src_DIST_local + CMakeLists.txt +) + +set (src_DIST + ${src_DIST_local} + ${src_tools_DIST} + ${src_zlib_DIST} + ${src_common_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/CMakeLists.txt new file mode 100644 index 0000000..302a84f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/CMakeLists.txt @@ -0,0 +1,16 @@ +set (src_common_DIST_noinst_hs + common-b64-private.h + common-md5-private.h + common-thread-private.h +) + +set (src_common_DIST_cs + common-b64.c + common-md5.c +) + +set_dist_list (src_common_DIST + CMakeLists.txt + ${src_common_DIST_cs} + ${src_common_DIST_noinst_hs} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64-private.h new file mode 100644 index 0000000..9d3e41a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64-private.h @@ -0,0 +1,36 @@ +/* + * Copyright 2018-present MongoDB Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_B64_PRIVATE_H +#define COMMON_B64_PRIVATE_H + +#if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ + !defined(BSON_INSIDE) +#error "Only or can be included directly." +#endif + +#include + +int +bson_b64_ntop (uint8_t const *src, + size_t srclength, + char *target, + size_t targsize); + +int +bson_b64_pton (char const *src, uint8_t *target, size_t targsize); + +#endif /* COMMON_B64_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64.c new file mode 100644 index 0000000..905e306 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64.c @@ -0,0 +1,528 @@ +/* + * Copyright (c) 1996, 1998 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#include "bson/bson.h" +#include "common-b64-private.h" + +#define Assert(Cond) \ + if (!(Cond)) \ + abort () + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + * The following encoding technique is taken from RFC 1521 by Borenstein + * and Freed. It is reproduced here in a slightly edited form for + * convenience. + * + * A 65-character subset of US-ASCII is used, enabling 6 bits to be + * represented per printable character. (The extra 65th character, "=", + * is used to signify a special processing function.) + * + * The encoding process represents 24-bit groups of input bits as output + * strings of 4 encoded characters. Proceeding from left to right, a + * 24-bit input group is formed by concatenating 3 8-bit input groups. + * These 24 bits are then treated as 4 concatenated 6-bit groups, each + * of which is translated into a single digit in the base64 alphabet. + * + * Each 6-bit group is used as an index into an array of 64 printable + * characters. The character referenced by the index is placed in the + * output string. + * + * Table 1: The Base64 Alphabet + * + * Value Encoding Value Encoding Value Encoding Value Encoding + * 0 A 17 R 34 i 51 z + * 1 B 18 S 35 j 52 0 + * 2 C 19 T 36 k 53 1 + * 3 D 20 U 37 l 54 2 + * 4 E 21 V 38 m 55 3 + * 5 F 22 W 39 n 56 4 + * 6 G 23 X 40 o 57 5 + * 7 H 24 Y 41 p 58 6 + * 8 I 25 Z 42 q 59 7 + * 9 J 26 a 43 r 60 8 + * 10 K 27 b 44 s 61 9 + * 11 L 28 c 45 t 62 + + * 12 M 29 d 46 u 63 / + * 13 N 30 e 47 v + * 14 O 31 f 48 w (pad) = + * 15 P 32 g 49 x + * 16 Q 33 h 50 y + * + * Special processing is performed if fewer than 24 bits are available + * at the end of the data being encoded. A full encoding quantum is + * always completed at the end of a quantity. When fewer than 24 input + * bits are available in an input group, zero bits are added (on the + * right) to form an integral number of 6-bit groups. Padding at the + * end of the data is performed using the '=' character. + * + * Since all base64 input is an integral number of octets, only the + * following cases can arise: + * + * (1) the final quantum of encoding input is an integral + * multiple of 24 bits; here, the final unit of encoded + * output will be an integral multiple of 4 characters + * with no "=" padding, + * (2) the final quantum of encoding input is exactly 8 bits; + * here, the final unit of encoded output will be two + * characters followed by two "=" padding characters, or + * (3) the final quantum of encoding input is exactly 16 bits; + * here, the final unit of encoded output will be three + * characters followed by one "=" padding character. + */ + +int +bson_b64_ntop (uint8_t const *src, + size_t srclength, + char *target, + size_t targsize) +{ + size_t datalength = 0; + uint8_t input[3]; + uint8_t output[4]; + size_t i; + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + Assert (output[0] < 64); + Assert (output[1] < 64); + Assert (output[2] < 64); + Assert (output[3] < 64); + + if (datalength + 4 > targsize) { + return -1; + } + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = '\0'; + + for (i = 0; i < srclength; i++) { + input[i] = *src++; + } + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + Assert (output[0] < 64); + Assert (output[1] < 64); + Assert (output[2] < 64); + + if (datalength + 4 > targsize) { + return -1; + } + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + + if (srclength == 1) { + target[datalength++] = Pad64; + } else { + target[datalength++] = Base64[output[2]]; + } + target[datalength++] = Pad64; + } + + if (datalength >= targsize) { + return -1; + } + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (int) datalength; +} + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly edited form for + convenience. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a quantity. When fewer than 24 input + bits are available in an input group, zero bits are added (on the + right) to form an integral number of 6-bit groups. Padding at the + end of the data is performed using the '=' character. + + Since all base64 input is an integral number of octets, only the + following cases can arise: + + (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded + output will be an integral multiple of 4 characters + with no "=" padding, + (2) the final quantum of encoding input is exactly 8 bits; + here, the final unit of encoded output will be two + characters followed by two "=" padding characters, or + (3) the final quantum of encoding input is exactly 16 bits; + here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +static uint8_t mongoc_b64rmap[256]; + +static const uint8_t mongoc_b64rmap_special = 0xf0; +static const uint8_t mongoc_b64rmap_end = 0xfd; +static const uint8_t mongoc_b64rmap_space = 0xfe; +static const uint8_t mongoc_b64rmap_invalid = 0xff; + +/* initializing the reverse map isn't thread safe, do it in pthread_once */ +#if defined(BSON_OS_UNIX) +#include +#define mongoc_common_once_t pthread_once_t +#define mongoc_common_once pthread_once +#define MONGOC_COMMON_ONCE_FUN(n) void n (void) +#define MONGOC_COMMON_ONCE_RETURN return +#define MONGOC_COMMON_ONCE_INIT PTHREAD_ONCE_INIT +#else +#define mongoc_common_once_t INIT_ONCE +#define MONGOC_COMMON_ONCE_INIT INIT_ONCE_STATIC_INIT +#define mongoc_common_once(o, c) InitOnceExecuteOnce (o, c, NULL, NULL) +#define MONGOC_COMMON_ONCE_FUN(n) \ + BOOL CALLBACK n (PINIT_ONCE _ignored_a, PVOID _ignored_b, PVOID *_ignored_c) +#define MONGOC_COMMON_ONCE_RETURN return true +#endif + +static MONGOC_COMMON_ONCE_FUN (bson_b64_initialize_rmap) +{ + int i; + unsigned char ch; + + /* Null: end of string, stop parsing */ + mongoc_b64rmap[0] = mongoc_b64rmap_end; + + for (i = 1; i < 256; ++i) { + ch = (unsigned char) i; + /* Whitespaces */ + if (isspace (ch)) + mongoc_b64rmap[i] = mongoc_b64rmap_space; + /* Padding: stop parsing */ + else if (ch == Pad64) + mongoc_b64rmap[i] = mongoc_b64rmap_end; + /* Non-base64 char */ + else + mongoc_b64rmap[i] = mongoc_b64rmap_invalid; + } + + /* Fill reverse mapping for base64 chars */ + for (i = 0; Base64[i] != '\0'; ++i) + mongoc_b64rmap[(uint8_t) Base64[i]] = i; + + MONGOC_COMMON_ONCE_RETURN; +} + +static int +mongoc_b64_pton_do (char const *src, uint8_t *target, size_t targsize) +{ + int tarindex, state, ch; + uint8_t ofs; + + state = 0; + tarindex = 0; + + while (1) { + ch = *src++; + ofs = mongoc_b64rmap[ch]; + + if (ofs >= mongoc_b64rmap_special) { + /* Ignore whitespaces */ + if (ofs == mongoc_b64rmap_space) + continue; + /* End of base64 characters */ + if (ofs == mongoc_b64rmap_end) + break; + /* A non-base64 character. */ + return (-1); + } + + switch (state) { + case 0: + if ((size_t) tarindex >= targsize) + return (-1); + target[tarindex] = ofs << 2; + state = 1; + break; + case 1: + if ((size_t) tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= ofs >> 4; + target[tarindex + 1] = (ofs & 0x0f) << 4; + tarindex++; + state = 2; + break; + case 2: + if ((size_t) tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= ofs >> 2; + target[tarindex + 1] = (ofs & 0x03) << 6; + tarindex++; + state = 3; + break; + case 3: + if ((size_t) tarindex >= targsize) + return (-1); + target[tarindex] |= ofs; + tarindex++; + state = 0; + break; + default: + abort (); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target[tarindex] != 0) + return (-1); + default: + break; + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} + + +static int +mongoc_b64_pton_len (char const *src) +{ + int tarindex, state, ch; + uint8_t ofs; + + state = 0; + tarindex = 0; + + while (1) { + ch = *src++; + ofs = mongoc_b64rmap[ch]; + + if (ofs >= mongoc_b64rmap_special) { + /* Ignore whitespaces */ + if (ofs == mongoc_b64rmap_space) + continue; + /* End of base64 characters */ + if (ofs == mongoc_b64rmap_end) + break; + /* A non-base64 character. */ + return (-1); + } + + switch (state) { + case 0: + state = 1; + break; + case 1: + tarindex++; + state = 2; + break; + case 2: + tarindex++; + state = 3; + break; + case 3: + tarindex++; + state = 0; + break; + default: + abort (); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) + return (-1); + + default: + break; + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} + + +int +bson_b64_pton (char const *src, uint8_t *target, size_t targsize) +{ + static mongoc_common_once_t once = MONGOC_COMMON_ONCE_INIT; + + mongoc_common_once (&once, bson_b64_initialize_rmap); + + if (target) + return mongoc_b64_pton_do (src, target, targsize); + else + return mongoc_b64_pton_len (src); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5-private.h new file mode 100644 index 0000000..210b0f1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5-private.h @@ -0,0 +1,39 @@ +/* + * Copyright 2018-present MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_MD5_PRIVATE_H +#define COMMON_MD5_PRIVATE_H + + +#if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ + !defined(BSON_INSIDE) +#error "Only or can be included directly." +#endif + +#include "bson/bson.h" + +BSON_BEGIN_DECLS + +void +_bson_md5_init (bson_md5_t *pms); +void +_bson_md5_append (bson_md5_t *pms, const uint8_t *data, uint32_t nbytes); +void +_bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]); + +BSON_END_DECLS + +#endif /* COMMON_MD5_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5.c new file mode 100644 index 0000000..86f6f67 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5.c @@ -0,0 +1,395 @@ +/* + Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgement in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.c is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order + either statically or dynamically; added missing #include + in library. + 2002-03-11 lpd Corrected argument list for main(), and added int return + type, in test program and T value program. + 2002-02-21 lpd Added missing #include in test program. + 2000-07-03 lpd Patched to eliminate warnings about "constant is + unsigned in ANSI C, signed in traditional"; made test program + self-checking. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). + 1999-05-03 lpd Original version. + */ + +/* + * The following MD5 implementation has been modified to use types as + * specified in libbson. + */ + +#include + +#include "common-md5-private.h" + +#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ +#if BSON_BYTE_ORDER == BSON_BIG_ENDIAN +#define BYTE_ORDER 1 +#else +#define BYTE_ORDER -1 +#endif + +#define T_MASK ((uint32_t) ~0) +#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) +#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) +#define T3 0x242070db +#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) +#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) +#define T6 0x4787c62a +#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) +#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) +#define T9 0x698098d8 +#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) +#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) +#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) +#define T13 0x6b901122 +#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) +#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) +#define T16 0x49b40821 +#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) +#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) +#define T19 0x265e5a51 +#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) +#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) +#define T22 0x02441453 +#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) +#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) +#define T25 0x21e1cde6 +#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) +#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) +#define T28 0x455a14ed +#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) +#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) +#define T31 0x676f02d9 +#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) +#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) +#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) +#define T35 0x6d9d6122 +#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) +#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) +#define T38 0x4bdecfa9 +#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) +#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) +#define T41 0x289b7ec6 +#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) +#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) +#define T44 0x04881d05 +#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) +#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) +#define T47 0x1fa27cf8 +#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) +#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) +#define T50 0x432aff97 +#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) +#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) +#define T53 0x655b59c3 +#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) +#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) +#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) +#define T57 0x6fa87e4f +#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) +#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) +#define T60 0x4e0811a1 +#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) +#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) +#define T63 0x2ad7d2bb +#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) + + +static void +bson_md5_process (bson_md5_t *md5, const uint8_t *data) +{ + uint32_t a = md5->abcd[0]; + uint32_t b = md5->abcd[1]; + uint32_t c = md5->abcd[2]; + uint32_t d = md5->abcd[3]; + uint32_t t; + +#if BYTE_ORDER > 0 + /* Define storage only for big-endian CPUs. */ + uint32_t X[16]; +#else + /* Define storage for little-endian or both types of CPUs. */ + uint32_t xbuf[16]; + const uint32_t *X; +#endif + + { +#if BYTE_ORDER == 0 + /* + * Determine dynamically whether this is a big-endian or + * little-endian machine, since we can use a more efficient + * algorithm on the latter. + */ + static const int w = 1; + + if (*((const uint8_t *) &w)) /* dynamic little-endian */ +#endif +#if BYTE_ORDER <= 0 /* little-endian */ + { + /* + * On little-endian machines, we can process properly aligned + * data without copying it. + */ + if (!((data - (const uint8_t *) 0) & 3)) { +/* data are properly aligned */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-align" +#endif + X = (const uint32_t *) data; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + } else { + /* not aligned */ + memcpy (xbuf, data, sizeof (xbuf)); + X = xbuf; + } + } +#endif +#if BYTE_ORDER == 0 + else /* dynamic big-endian */ +#endif +#if BYTE_ORDER >= 0 /* big-endian */ + { + /* + * On big-endian machines, we must arrange the bytes in the + * right order. + */ + const uint8_t *xp = data; + int i; + +#if BYTE_ORDER == 0 + X = xbuf; /* (dynamic only) */ +#else +#define xbuf X /* (static only) */ +#endif + for (i = 0; i < 16; ++i, xp += 4) + xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); + } +#endif + } + +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + +/* Round 1. */ +/* Let [abcd k s i] denote the operation + a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ +#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define SET(a, b, c, d, k, s, Ti) \ + t = a + F (b, c, d) + X[k] + Ti; \ + a = ROTATE_LEFT (t, s) + b + /* Do the following 16 operations. */ + SET (a, b, c, d, 0, 7, T1); + SET (d, a, b, c, 1, 12, T2); + SET (c, d, a, b, 2, 17, T3); + SET (b, c, d, a, 3, 22, T4); + SET (a, b, c, d, 4, 7, T5); + SET (d, a, b, c, 5, 12, T6); + SET (c, d, a, b, 6, 17, T7); + SET (b, c, d, a, 7, 22, T8); + SET (a, b, c, d, 8, 7, T9); + SET (d, a, b, c, 9, 12, T10); + SET (c, d, a, b, 10, 17, T11); + SET (b, c, d, a, 11, 22, T12); + SET (a, b, c, d, 12, 7, T13); + SET (d, a, b, c, 13, 12, T14); + SET (c, d, a, b, 14, 17, T15); + SET (b, c, d, a, 15, 22, T16); +#undef SET + +/* Round 2. */ +/* Let [abcd k s i] denote the operation + a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ +#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define SET(a, b, c, d, k, s, Ti) \ + t = a + G (b, c, d) + X[k] + Ti; \ + a = ROTATE_LEFT (t, s) + b + /* Do the following 16 operations. */ + SET (a, b, c, d, 1, 5, T17); + SET (d, a, b, c, 6, 9, T18); + SET (c, d, a, b, 11, 14, T19); + SET (b, c, d, a, 0, 20, T20); + SET (a, b, c, d, 5, 5, T21); + SET (d, a, b, c, 10, 9, T22); + SET (c, d, a, b, 15, 14, T23); + SET (b, c, d, a, 4, 20, T24); + SET (a, b, c, d, 9, 5, T25); + SET (d, a, b, c, 14, 9, T26); + SET (c, d, a, b, 3, 14, T27); + SET (b, c, d, a, 8, 20, T28); + SET (a, b, c, d, 13, 5, T29); + SET (d, a, b, c, 2, 9, T30); + SET (c, d, a, b, 7, 14, T31); + SET (b, c, d, a, 12, 20, T32); +#undef SET + +/* Round 3. */ +/* Let [abcd k s t] denote the operation + a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define SET(a, b, c, d, k, s, Ti) \ + t = a + H (b, c, d) + X[k] + Ti; \ + a = ROTATE_LEFT (t, s) + b + /* Do the following 16 operations. */ + SET (a, b, c, d, 5, 4, T33); + SET (d, a, b, c, 8, 11, T34); + SET (c, d, a, b, 11, 16, T35); + SET (b, c, d, a, 14, 23, T36); + SET (a, b, c, d, 1, 4, T37); + SET (d, a, b, c, 4, 11, T38); + SET (c, d, a, b, 7, 16, T39); + SET (b, c, d, a, 10, 23, T40); + SET (a, b, c, d, 13, 4, T41); + SET (d, a, b, c, 0, 11, T42); + SET (c, d, a, b, 3, 16, T43); + SET (b, c, d, a, 6, 23, T44); + SET (a, b, c, d, 9, 4, T45); + SET (d, a, b, c, 12, 11, T46); + SET (c, d, a, b, 15, 16, T47); + SET (b, c, d, a, 2, 23, T48); +#undef SET + +/* Round 4. */ +/* Let [abcd k s t] denote the operation + a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ +#define I(x, y, z) ((y) ^ ((x) | ~(z))) +#define SET(a, b, c, d, k, s, Ti) \ + t = a + I (b, c, d) + X[k] + Ti; \ + a = ROTATE_LEFT (t, s) + b + /* Do the following 16 operations. */ + SET (a, b, c, d, 0, 6, T49); + SET (d, a, b, c, 7, 10, T50); + SET (c, d, a, b, 14, 15, T51); + SET (b, c, d, a, 5, 21, T52); + SET (a, b, c, d, 12, 6, T53); + SET (d, a, b, c, 3, 10, T54); + SET (c, d, a, b, 10, 15, T55); + SET (b, c, d, a, 1, 21, T56); + SET (a, b, c, d, 8, 6, T57); + SET (d, a, b, c, 15, 10, T58); + SET (c, d, a, b, 6, 15, T59); + SET (b, c, d, a, 13, 21, T60); + SET (a, b, c, d, 4, 6, T61); + SET (d, a, b, c, 11, 10, T62); + SET (c, d, a, b, 2, 15, T63); + SET (b, c, d, a, 9, 21, T64); +#undef SET + + /* Then perform the following additions. (That is increment each + of the four registers by the value it had before this block + was started.) */ + md5->abcd[0] += a; + md5->abcd[1] += b; + md5->abcd[2] += c; + md5->abcd[3] += d; +} + +void +_bson_md5_init (bson_md5_t *pms) +{ + pms->count[0] = pms->count[1] = 0; + pms->abcd[0] = 0x67452301; + pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; + pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; + pms->abcd[3] = 0x10325476; +} + +void +_bson_md5_append (bson_md5_t *pms, const uint8_t *data, uint32_t nbytes) +{ + const uint8_t *p = data; + int left = nbytes; + int offset = (pms->count[0] >> 3) & 63; + uint32_t nbits = (uint32_t) (nbytes << 3); + + if (nbytes <= 0) + return; + + /* Update the message length. */ + pms->count[1] += nbytes >> 29; + pms->count[0] += nbits; + if (pms->count[0] < nbits) + pms->count[1]++; + + /* Process an initial partial block. */ + if (offset) { + int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); + + memcpy (pms->buf + offset, p, copy); + if (offset + copy < 64) + return; + p += copy; + left -= copy; + bson_md5_process (pms, pms->buf); + } + + /* Process full blocks. */ + for (; left >= 64; p += 64, left -= 64) + bson_md5_process (pms, p); + + /* Process a final partial block. */ + if (left) + memcpy (pms->buf, p, left); +} + + +void +_bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) +{ + static const uint8_t pad[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + uint8_t data[8]; + int i; + + /* Save the length before padding. */ + for (i = 0; i < 8; ++i) + data[i] = (uint8_t) (pms->count[i >> 2] >> ((i & 3) << 3)); + /* Pad to 56 bytes mod 64. */ + _bson_md5_append (pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); + /* Append the length. */ + _bson_md5_append (pms, data, sizeof (data)); + for (i = 0; i < 16; ++i) + digest[i] = (uint8_t) (pms->abcd[i >> 2] >> ((i & 3) << 3)); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-thread-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-thread-private.h new file mode 100644 index 0000000..2d86e1b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-thread-private.h @@ -0,0 +1,66 @@ +/* + * Copyright 2013-present MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_THREAD_PRIVATE_H +#define COMMON_THREAD_PRIVATE_H + +#if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ + !defined(BSON_INSIDE) +#error "Only or can be included directly." +#endif + +#include "bson/bson-compat.h" +#include "bson/bson-config.h" +#include "bson/bson-macros.h" + +BSON_BEGIN_DECLS + +#if defined(BSON_OS_UNIX) +#include +#define BSON_ONCE_FUN(n) void n (void) +#define BSON_ONCE_RETURN return +#define BSON_ONCE_INIT PTHREAD_ONCE_INIT +#define bson_mutex_destroy pthread_mutex_destroy +#define bson_mutex_init(_n) pthread_mutex_init ((_n), NULL) +#define bson_mutex_lock pthread_mutex_lock +#define bson_mutex_t pthread_mutex_t +#define bson_mutex_unlock pthread_mutex_unlock +#define bson_once pthread_once +#define bson_once_t pthread_once_t +#define bson_thread_create(_t, _f, _d) pthread_create ((_t), NULL, (_f), (_d)) +#define bson_thread_join(_n) pthread_join ((_n), NULL) +#define bson_thread_t pthread_t +#else +#define BSON_ONCE_FUN(n) \ + BOOL CALLBACK n (PINIT_ONCE _ignored_a, PVOID _ignored_b, PVOID *_ignored_c) +#define BSON_ONCE_INIT INIT_ONCE_STATIC_INIT +#define BSON_ONCE_RETURN return true +#define bson_mutex_destroy DeleteCriticalSection +#define bson_mutex_init InitializeCriticalSection +#define bson_mutex_lock EnterCriticalSection +#define bson_mutex_t CRITICAL_SECTION +#define bson_mutex_unlock LeaveCriticalSection +#define bson_once(o, c) InitOnceExecuteOnce (o, c, NULL, NULL) +#define bson_once_t INIT_ONCE +#define bson_thread_create(_t, _f, _d) \ + (!(*(_t) = CreateThread (NULL, 0, (void *) _f, _d, 0, NULL))) +#define bson_thread_join(_n) WaitForSingleObject ((_n), INFINITE) +#define bson_thread_t HANDLE +#endif + +BSON_END_DECLS + +#endif /* COMMON_THREAD_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/CMakeLists.txt new file mode 100644 index 0000000..4bc2cb6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/CMakeLists.txt @@ -0,0 +1,414 @@ +cmake_minimum_required (VERSION 3.1) + +project (libbson C) + +# In the future we may need to check whether static dependencies are +# available. For now, AUTO means ON. +if (ENABLE_TESTS AND NOT ENABLE_STATIC MATCHES "ON|AUTO") + message (FATAL_ERROR "-DENABLE_STATIC=OFF also requires -DENABLE_TESTS=OFF") +endif () + +include (CheckFunctionExists) +include (CheckIncludeFile) +include (CheckStructHasMember) +include (CheckSymbolExists) +include (TestBigEndian) +include (InstallRequiredSystemLibraries) + +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake) + +# Set BSON_MAJOR_VERSION, BSON_MINOR_VERSION, etc. +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../build/cmake) +include (LoadVersion) +LoadVersion (${PROJECT_SOURCE_DIR}/../../VERSION_CURRENT BSON) +LoadVersion (${PROJECT_SOURCE_DIR}/../../VERSION_RELEASED BSON_RELEASED) + +message ("libbson version (from VERSION_CURRENT file): ${BSON_VERSION}") +if (NOT ${BSON_VERSION} STREQUAL ${BSON_RELEASED_VERSION}) + message ("libbson previous release (from VERSION_RELEASED file): ${BSON_RELEASED_VERSION}") +endif () + +set (BSON_API_VERSION 1.0) + +set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION}) +set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION}) + +include (CPack) +TEST_BIG_ENDIAN (BSON_BIG_ENDIAN) + +#librt needed on linux for clock_gettime +find_library (RT_LIBRARY rt) +if (RT_LIBRARY) + #set required libraries for CHECK_FUNCTION_EXISTS + set (CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY}) + set (BSON_LIBRARIES ${BSON_LIBRARIES} ${RT_LIBRARY}) +endif () + +# See https://public.kitware.com/Bug/view.php?id=15659 +CHECK_SYMBOL_EXISTS (snprintf stdio.h BSON_HAVE_SNPRINTF) +if (NOT BSON_HAVE_SNPRINTF) + set (BSON_HAVE_SNPRINTF 0) +else () + set (BSON_HAVE_SNPRINTF 1) +endif () + +CHECK_FUNCTION_EXISTS (reallocf BSON_HAVE_REALLOCF) +if (NOT BSON_HAVE_REALLOCF) + set (BSON_HAVE_REALLOCF 0) +endif () + +CHECK_STRUCT_HAS_MEMBER ("struct timespec" tv_sec time.h BSON_HAVE_TIMESPEC) +if (NOT BSON_HAVE_TIMESPEC) + message (STATUS " no timespec struct") + set (BSON_HAVE_TIMESPEC 0) +else () + message (STATUS " struct timespec found") + set (BSON_HAVE_TIMESPEC 1) +endif () + +CHECK_SYMBOL_EXISTS (gmtime_r time.h BSON_HAVE_GMTIME_R) +if (NOT BSON_HAVE_GMTIME_R) + set (BSON_HAVE_GMTIME_R 0) +else () + set (BSON_HAVE_GMTIME_R 1) +endif () + +CHECK_FUNCTION_EXISTS (rand_r BSON_HAVE_RAND_R) +if (NOT BSON_HAVE_RAND_R) + set (BSON_HAVE_RAND_R 0) +else () + set (BSON_HAVE_RAND_R 1) +endif () + +if (WIN32) + set (BSON_OS 2) +else () + set (BSON_OS 1) +endif () + +include (CheckIncludeFiles) + +CHECK_INCLUDE_FILE (strings.h BSON_HAVE_STRINGS_H) +if (NOT BSON_HAVE_STRINGS_H) + set (BSON_HAVE_STRINGS_H 0) +endif () + +if (MSVC) + set (BSON_HAVE_CLOCK_GETTIME 0) + set (BSON_HAVE_STDBOOL_H 0) + set (BSON_HAVE_STRNLEN 0) + set (BSON_HAVE_SYSCALL_TID 0) +else () + check_symbol_exists (clock_gettime time.h BSON_HAVE_CLOCK_GETTIME) + if (NOT BSON_HAVE_CLOCK_GETTIME) + set (BSON_HAVE_CLOCK_GETTIME 0) + endif () + check_symbol_exists (strnlen string.h BSON_HAVE_STRNLEN) + if (NOT BSON_HAVE_STRNLEN) + set (BSON_HAVE_STRNLEN 0) + endif () + CHECK_INCLUDE_FILE (stdbool.h BSON_HAVE_STDBOOL_H) + if (NOT BSON_HAVE_STDBOOL_H) + set (BSON_HAVE_STDBOOL_H 0) + endif () + CHECK_SYMBOL_EXISTS (SYS_gettid sys/syscall.h BSON_HAVE_SYSCALL_TID) + check_symbol_exists (syscall unistd.h _TMP_HAVE_SYSCALL) + if (NOT BSON_HAVE_SYSCALL_TID OR NOT _TMP_HAVE_SYSCALL OR APPLE OR ANDROID) + set (BSON_HAVE_SYSCALL_TID 0) + endif () +endif () + +if (BSON_BIG_ENDIAN) + set (BSON_BYTE_ORDER 4321) +else () + set (BSON_BYTE_ORDER 1234) +endif () + +include (CheckAtomics) + +configure_file ( + "${PROJECT_SOURCE_DIR}/src/bson/bson-config.h.in" + "${PROJECT_BINARY_DIR}/src/bson/bson-config.h" +) + +configure_file ( + "${PROJECT_SOURCE_DIR}/src/bson/bson-version.h.in" + "${PROJECT_BINARY_DIR}/src/bson/bson-version.h" +) + +if (ENABLE_APPLE_FRAMEWORK) + configure_file ( + "${PROJECT_SOURCE_DIR}/src/bson/modules/module.modulemap.in" + "${PROJECT_BINARY_DIR}/src/bson/modules/module.modulemap" + ) +endif () + +include_directories ("${PROJECT_BINARY_DIR}/src") +include_directories ("${PROJECT_SOURCE_DIR}/src") +include_directories ("${PROJECT_SOURCE_DIR}/../../src/common") + +if (APPLE) + cmake_policy (SET CMP0042 OLD) +endif () + +include (MaintainerFlags) + +if (ENABLE_COVERAGE) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage") +endif () + +set (SOURCES + ${PROJECT_SOURCE_DIR}/src/bson/bcon.c + ${PROJECT_SOURCE_DIR}/src/bson/bson.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-atomic.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-clock.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-context.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-decimal128.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-error.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-fnv.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-iso8601.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-iter.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-json.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-keys.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-md5.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-memory.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-oid.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-reader.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-string.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-timegm.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-utf8.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-value.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-version-functions.c + ${PROJECT_SOURCE_DIR}/src/bson/bson-writer.c + ${PROJECT_SOURCE_DIR}/src/jsonsl/jsonsl.c + ${PROJECT_SOURCE_DIR}/../../src/common/common-b64.c + ${PROJECT_SOURCE_DIR}/../../src/common/common-md5.c +) + +set (HEADERS + ${PROJECT_BINARY_DIR}/src/bson/bson-config.h + ${PROJECT_BINARY_DIR}/src/bson/bson-version.h + ${PROJECT_SOURCE_DIR}/src/bson/bcon.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-atomic.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-clock.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-compat.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-context.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-decimal128.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-endian.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-error.h + ${PROJECT_SOURCE_DIR}/src/bson/bson.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-iter.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-json.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-keys.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-macros.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-md5.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-memory.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-oid.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-reader.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-string.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-types.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-utf8.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-value.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-version-functions.h + ${PROJECT_SOURCE_DIR}/src/bson/bson-writer.h +) + +set (HEADERS_FORWARDING + ${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h +) + +add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +set (CMAKE_CXX_VISIBILITY_PRESET hidden) +set_target_properties (bson_shared PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;JSONSL_PARSE_NAN") +set_target_properties (bson_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) +set_target_properties (bson_shared PROPERTIES OUTPUT_NAME "bson-${BSON_API_VERSION}" PREFIX "lib") + +if (ENABLE_APPLE_FRAMEWORK) + set_target_properties(bson_shared PROPERTIES + FRAMEWORK TRUE + MACOSX_FRAMEWORK_BUNDLE_VERSION ${MONGOC_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MONGOC_VERSION} + MACOSX_FRAMEWORK_IDENTIFIER org.mongodb.bson + OUTPUT_NAME "bson" + PUBLIC_HEADER "${HEADERS}" + ) +endif () + +if (RT_LIBRARY) + target_link_libraries (bson_shared ${RT_LIBRARY}) +endif () + +find_library (M_LIBRARY m) +if (M_LIBRARY) + target_link_libraries (bson_shared ${M_LIBRARY}) + set (BSON_LIBRARIES ${BSON_LIBRARIES} ${M_LIBRARY}) +endif () + +set (THREADS_PREFER_PTHREAD_FLAG 1) +find_package (Threads REQUIRED) +target_link_libraries (bson_shared Threads::Threads) +if (CMAKE_USE_PTHREADS_INIT) + set (BSON_LIBRARIES ${BSON_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +endif () + +if (WIN32) + # gethostbyname + target_link_libraries (bson_shared ws2_32) + # Can't find_library () system dependencies + # must be handled specially since we can't resolve them + set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) +endif () + +if (ENABLE_STATIC MATCHES "ON|AUTO") + add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set_target_properties (bson_static PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;BSON_STATIC;JSONSL_PARSE_NAN") + set_target_properties (bson_static PROPERTIES VERSION 0.0.0) + set_target_properties (bson_static PROPERTIES OUTPUT_NAME "bson-static-${BSON_API_VERSION}") + target_link_libraries (bson_static Threads::Threads) + if (RT_LIBRARY) + target_link_libraries (bson_static ${RT_LIBRARY}) + endif () + if (M_LIBRARY) + target_link_libraries (bson_static ${M_LIBRARY}) + endif () + if (NOT UNIX) + # gethostbyname + target_link_libraries (bson_static ws2_32) + endif () +endif () + +function (add_example bin src) + set (BSON_EXAMPLE_SOURCES ${PROJECT_SOURCE_DIR}/${src}) + add_executable (${bin} ${BSON_EXAMPLE_SOURCES}) + + # Link against the shared lib like normal apps + target_link_libraries (${bin} bson_shared) + + set (EXAMPLES ${EXAMPLES} ${bin}) +endfunction () + +if (ENABLE_EXAMPLES) + add_example (bcon-col-view examples/bcon-col-view.c) + add_example (bcon-speed examples/bcon-speed.c) + add_example (bson-metrics examples/bson-metrics.c) + if (NOT WIN32) + target_link_libraries (bson-metrics m) + add_example (bson-streaming-reader examples/bson-streaming-reader.c) + endif () + add_example (bson-to-json examples/bson-to-json.c) + add_example (bson-validate examples/bson-validate.c) + add_example (json-to-bson examples/json-to-bson.c) +endif () # ENABLE_EXAMPLES + +set (BSON_HEADER_INSTALL_DIR + "${CMAKE_INSTALL_INCLUDEDIR}/libbson-${BSON_API_VERSION}" +) + +install ( + TARGETS bson_shared ${EXAMPLES} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} +) +if (ENABLE_STATIC MATCHES "ON|AUTO") + install ( + TARGETS bson_static ${EXAMPLES} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif () +install ( + FILES ${HEADERS} + DESTINATION "${BSON_HEADER_INSTALL_DIR}/bson" +) +install ( + FILES ${HEADERS_FORWARDING} + DESTINATION "${BSON_HEADER_INSTALL_DIR}" +) + +if (ENABLE_APPLE_FRAMEWORK) + install ( + FILES "${PROJECT_BINARY_DIR}/src/bson/modules/module.modulemap" + DESTINATION "${CMAKE_INSTALL_BINDIR}/bson.framework/Modules/" + ) +endif () + +set (LIBBSON_LIBRARIES "") +foreach (_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${BSON_LIBRARIES}) + if (_lib MATCHES ".*/.*" OR _lib MATCHES "^-") + set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") + else () + set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} -l${_lib}") + endif () +endforeach () +# System dependencies don't match the above regexs, but also don't want the -l +foreach (_lib ${BSON_SYSTEM_LIBRARIES}) + set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") +endforeach () + +set (VERSION "${BSON_VERSION}") +set (prefix "${CMAKE_INSTALL_PREFIX}") +set (libdir "\${prefix}/lib") +configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libbson-1.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-1.0.pc + @ONLY) + +install ( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-1.0.pc + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) + +if (ENABLE_STATIC MATCHES "ON|AUTO") + configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libbson-static-1.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-static-1.0.pc + @ONLY) + + install ( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-static-1.0.pc + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif () + +include (build/cmake/BSONPackage.cmake) + +if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) + find_package (Sphinx REQUIRED) + add_subdirectory (doc) + add_custom_target (bson-doc + ALL + DEPENDS + $<$:bson-man> + $<$:bson-html> + ) +endif () + +add_subdirectory (build) +# sub-directory 'doc' was already included above +add_subdirectory (examples) +add_subdirectory (src) +add_subdirectory (tests) + +set_local_dist (src_libbson_DIST_local + CMakeLists.txt + NEWS + THIRD_PARTY_NOTICES +) + +set (src_libbson_DIST + ${src_libbson_DIST_local} + ${src_libbson_build_DIST} + ${src_libbson_doc_DIST} + ${src_libbson_examples_DIST} + ${src_libbson_src_DIST} + ${src_libbson_tests_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/NEWS b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/NEWS new file mode 100644 index 0000000..3a37921 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/NEWS @@ -0,0 +1,1328 @@ +libbson 1.13.1 +============== + +It is my pleasure to announce libbson 1.13.1. + +Bug fixes: + + * Separate libmongoc and libbson uninstall scripts so they do not overwrite + each other. + +Thanks to everyone who contributed to the development of this release. + + * Kevin Albertson + * Henrik Edin + +Peace, + + Kevin Albertson + + +libbson 1.13.0 +============== + +It is my pleasure to announce libbson 1.13.0. + +Features: + + * New functions to save and restore progress of a bson_iter_t: + bson_iter_key_len, bson_iter_offset, and bson_iter_init_from_data_at_offset + * Additional functions bson_iter_overwrite_date_time, bson_iter_overwrite_oid, + and bson_iter_overwrite_timestamp. All fixed-length BSON values can now be + updated in place. + +Bug fixes: + + * Fix crash when iterating corrupt BSON. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Roberto C. Sánchez + * Kevin Albertson + * Henrik Edin + * Gustaf Neumann + * Scott Gayou + * Spencer McKenney + +Peace, + + Kevin Albertson + + +libbson 1.12.0 +============== + +It is my pleasure to announce libbson 1.12.0. This release deprecates all +MD5-related public APIs; they will be removed in the next major release. + +Bug fixes: + + * Properly handle zero-length BSON binary values + * Fix crash parsing Base64-encoded data in JSON when using libbson without + libmongoc + +Thanks to everyone who contributed to the development of this release. + + * Roberto C. Sánchez + * A. Jesse Jiryu Davis + * Kevin Albertson + +Peace, + + A. Jesse Jiryu Davis + + +libbson 1.11.0 +============== + +It is my pleasure to announce libbson 1.11.0. This version adds the following +features and improvements: + + * All "destroy" functions such as bson_destroy or bson_reader_destroy now + ignore a NULL argument. + * Replace MD5 with FNV-1a hash to generate ObjectIds (for FIPS compliance). + +Bug fixes: + + * Functions incorrectly marked with the "const" compiler attribute are now + marked as "pure", fixes build error when link-time optimization is enabled. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + * Roberto C. Sánchez + +Peace, + + A. Jesse Jiryu Davis + + +libbson 1.10.3 +============== + +It is my pleasure to announce libbson 1.10.3. This release fixes a crash when +parsing binary data from JSON if using libbson as a standalone library, without +calling mongoc_init. + +Peace, + + A. Jesse Jiryu Davis + + +libbson 1.10.2 +============== + +No change since 1.10.1; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +libbson 1.10.1 +============== + +No change since 1.10.0; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +libbson 1.10.0 +============== + +It is my pleasure to announce libbson 1.10.0. This version adds the following +features: + + * libbson and libmongoc are now maintained in the mongo-c-driver repository, + although they are still built as separate libraries, and libbson can still + be used without libmongoc. + * Building libbson and libmongoc now requires CMake on all platforms. The + Autotools build scripts ("configure" and related scripts) have been deleted. + See the "installing" page for updated instructions. + * Additional functions for strings of known length (not necessarily null- + terminated): + bson_iter_find_w_len + bson_iter_init_find_w_len + bson_append_regex_w_len + bson_decimal128_from_string_w_len + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Roberto C. Sánchez + * Xiangyu Yao + * Kevin Albertson + * Mansuro + * Petr Písař + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.9.5 +============= + +No change since 1.9.4; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.9.4 +============= + +It is my pleasure to announce Libbson-1.9.4. This release offers compatibility +with Sphinx 1.7.0 and later. + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.9.3 +============= + +No change since 1.9.2; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.9.2 +============= + +It is my pleasure to announce Libbson-1.9.2. This release completes reverting a +changed macro definition that broke API compatibility. The revert in 1.9.1 did +not completely fix the BC break. Thanks to Petr Písař for finding and fixing the +mistake. + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.9.1 +============= + +It is my pleasure to announce Libbson-1.9.1. This release reverts a changed +macro definition that broke API compatibility, and fixes an off-by-one error +in bson_append_regex that resulted in corrupt BSON. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Derick Rethans + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.9.0 +============= + +It is my pleasure to announce Libbson-1.9.0. + +New features and bugfixes: + + * Fix Autotools syntax for OpenBSD and any platform lacking stdint.h. + * Fix Android NDK incompatibilities. + * Fix a one-byte write past the end of a buffer in bson_decimal128_to_string. + * Avoid reading past the end of a string that contains UTF-8 multibyte NIL. + * Fix some pedantic warnings in C99 mode. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Kevin Albertson + * Jean-Marc Le Roux + * Jeremy Mikola + * Dimitri Gence + * Hannes Magnusson + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.8.2 +============= + +No change since 1.8.1; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.8.1 +============= + +It is my pleasure to announce libbson-1.8.1. This release removes a syntax +error in the configure script that affects some shells, and fixes the encoding +of this NEWS file. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Jeremy Mikola + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.8.0 +============= + +It is my pleasure to announce Libbson-1.8.0. + +New features and bugfixes: + + * Make symbols bson_get_major_version, bson_get_minor_version, + bson_get_micro_version, bson_get_version, and bson_check_version available + to C++ programs. + * New CMake option ENABLE_MAINTAINER_FLAGS. + * Crash iterating over invalid code with scope. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jeremy Mikola + * Kevin Albertson + * Michael Kuhn + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.7.0 +============= + + * Changes to JSON encoding and decoding: + * New functions bson_as_canonical_extended_json and + bson_as_relaxed_extended_json convert BSON to canonical and relaxed + extended JSON according to MongoDB Extended JSON Spec. + Output for the existing bson_as_json function has not been changed. + * When parsing JSON type wrappers like "$timestamp", any missing or extra + keys are an error. + * The JSON format for BSON regular expressions is now "$regularExpression": + {"pattern": "...", "options": "..."}. The old format {"$regex": "...", + "$options": "..."} is still parsed. + * The JSON format for BSON binary elements is now "$binary": {"base64": + "...", "subType": "..."}. The old format {"$binary": "...", "$type": + "..."} is still parsed. + * BSON dates can be parsed from "$date" as an ISO8601 date or "$numberLong" + as milliseconds since the epoch: "t": {"$date": {"$numberLong": "1234"}}. + Dates can no longer be formatted as raw integers. bson_as_json writes a + BSON date after 1970 as "$date" with an ISO8601 string, and dates before + 1970 as negative milliseconds wrapped in "$numberLong". + bson_as_canonical_extended_json always writes dates with "$numberLong". + bson_as_relaxed_extended_json always writes dates with "$date". + * The non-numbers NaN, Infinity, and -Infinity are now recognized (regardless + of case) when parsing JSON. + * CMake build now installs .pc files for programs that link to libbson using + pkg-config. Both the CMake and Autotools build systems now install .cmake + files for programs that link to libbson using CMake. Linking to libbson + statically or dynamically is now much more convenient. + * New CMake option, "ENABLE_STATIC", defaults to ON. + * Minimum required CMake version has been increased to 3.1. + * CMake remains experimental on non-Windows platforms and issues a warning now + * New functions + * bson_strcasecmp, a portable equivalent of strcasecmp. + * bson_iter_as_double, cast the current value to double. + * bson_iter_init_from_data, creates an iterator from BSON string. + * bson_validate_with_error, checks a document like bson_validate does but + also reports which key was invalid + * New convenience macros + * BSON_ITER_HOLDS_INT, checks if iterator holds int32 or int64 + * BSON_ITER_HOLDS_NUMBER, checks if iterator holds int32, int64 or double + * Raised BSON recursion limit to 200 + + +Libbson-1.6.0 +============= + +It is my pleasure to announce libbson-1.6.0. + +New features and bug fixes: + + * Use jsonsl instead of libyajl as our JSON parsing library, parse JSON more + strictly, fix minor parsing bugs. + * Extended JSON documents like '{"$code": "...", "$scope": {}}' are now parsed + into BSON "code" elements. + * ISO8601 dates now allow years from 0000 to 9999 inclusive. Before, years + before 1970 were prohibited. + * BSON floats and ints are now distinguished in JSON output. + * The library is now built and continuously tested with MinGW-W64 on Windows. + * The documentation is ported from Mallard XML to ReStructured Text, the + HTML documentation is restyled, and numerous man page syntax errors fixed. + * All public functions now have the __cdecl calling convention on Windows. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Aleksander Melnikov + * Remi Collet + +Peace, + + A. Jesse Jiryu Davis + + +libbson-1.5.5 +============= + +No change since 1.5.4; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.5.4 +============= + +No change since 1.5.3; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.5.3 +============= + +No change since 1.5.2; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.5.2 +============= + +This is a patch release that fixes a build error with MinGW on Windows. + + +Libbson-1.5.1 +============= + +No change since 1.5.0; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.5.2 +============= + +It is my pleasure to announce Libbson-1.5.2. + +New bug fixes: + + * CDRIVER-1982 fix ifdef for strerror_s with mingw. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + +Peace, + + Hannes Magnusson + + +Libbson-1.5.1 +============= + +No change since 1.5.0; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.5.0 +============= + +It is my pleasure to announce Libbson-1.5.0. + +New features and bug fixes: + + * New BSON Type, Decimal128 (bson_decimal128_t) along with the following + new functions and helpers: + * bson_decimal128_to_string() + * bson_decimal128_from_string() + * bson_iter_decimal128() + * bson_iter_overwrite_decimal128() + * BSON_ITER_HOLDS_DECIMAL128() + * bson_append_decimal128() + * BSON_APPEND_DECIMAL128() + * BCON_DECIMAL128() + See the documentations for further details. + * bson_validate and bson_iter_next now validate that BSON boolean values are + 0 or 1. Before, any non-zero value was considered true. + * bson_append_code_with_scope now preserves the "code with scope" type + if scope is an empty, non-NULL BSON document. + * BSON "code" and "code with scope" types are properly translated to and from + JSON of the form '{"$code": "...", "$scope": {...}}'. + * bson_json_reader functions now always validate UTF-8. + * JSON parsing now preserves integer width. + * bson_strtoll now matches stroll: it detects range errors, and when + parsing octal it stops at non-octal digits and returns what it parsed + instead of setting errno. + * New flag BSON_VALIDATE_EMPTY_KEYS causes bson_validate to fail if a document + contains zero-length field names. + * The configure option "--enable-hardening" had had no effect. It is removed + in favor of system-wide compiler configuration. + +Thanks to everyone who contributed to the development of this release. + + * Hannes Magnusson + * A. Jesse Jiryu Davis + * Fiona Rowan + * Brian Samek + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.4.1 +============= + +This release improves the HTML documentation's Makefile. + +-- A. Jesse Jiryu Davis + + +Libbson-1.4.0 +============= + +It is my pleasure to announce Libbson-1.4.0. + +New features and bug fixes: + + * bson_reader_reset seeks to the beginning of a BSON buffer. + * bson_steal efficiently transfers contents from one bson_t to another. + * Fix Windows compile error with BSON_EXTRA_ALIGN disabled. + * Potential buffer overrun in bson_strndup. + * bson_oid_to_string optimization for MS Visual Studio + * bson_oid_is_valid accepts uppercase hex characters. + * bson_json_reader_read aborted on some invalid Extended JSON documents. + * All man page names now begin with "bson_" to avoid install conflicts. + * Error messages sometimes truncated at 63 chars. + +This release tentatively supports the new BSON decimal type when built with +"./configure --enable-experimental-features", or with +"cmake -DENABLE_EXPERIMENTAL_FEATURES=ON", but this feature may change +between now and libbson 1.5. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jeremy Mikola + * David Hatch + * Ian Boros + * Fiona Rowan + * Shane Harvey + * Runar Buvik + * Raymond Jacobson + * ReadmeCritic + * Mike Lloyd + * Derick Rethans + * Maverick Chan + +Peace, + + A. Jesse Jiryu Davis + +Libbson-1.3.5 +============= + +No change since 1.3.4; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.3.4 +============= + +No change since 1.3.3; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.3.3 +============= + +No change since 1.3.2; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.3.2 +============= + +This is a patch release with a fix for the build system: + + * man pages couldn't be built from a distribution tarball. + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.3.1 +============= + +It is my pleasure to announce Libbson-1.3.1. This is a bugfix release: + + * bson_strnlen is off by one on Windows. + * BSON_HAVE_STRNLEN config check used incorrectly. + * Incompatibility with older CMake versions. + * Wrong-sized allocation in bson_json_reader_new. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Alex Bishop + * Jeroen Ooms + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.3.0 +============= + +It is my pleasure to announce to you the release of Libbson-1.3.0. Since the +release candidate 1.3.0-rc0, the only changes have been fixes for compiler +warnings and errors on various platforms. + +All changes since the previous stable release, 1.2.1: + + * Fix potential crash in bson_strncpy on Windows. + * Parse DBRefs correctly from JSON. + * CMake option to disable building tests: "cmake -DENABLE_TESTS:BOOL=OFF". + * Refactor the build system to declare library version in one place. + * Fix compiler warnings and errors, especially with Visual Studio 2015 + and IBM XL C. + * Combine environment's CFLAGS with configure options when building. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Mark Benvenuto + * Petr Písař + * xpol + * Jose Sebastian Battig + * Jeroen Ooms + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.3.0-rc0 +================= + +It is my pleasure to announce to you first release candidate of Libbson-1.3.0. + +Changes since 1.3.0-beta0: + + * Parse DBRefs correctly from JSON. + * CMake option to disable building tests: "cmake -DENABLE_TESTS:BOOL=OFF". + * Fix build warnings on some platforms, and refactor the build system. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jose Sebastian Battig + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.3.0-beta0 +=================== + +It is my pleasure to announce to you the beta release of Libbson-1.3.0. + +Changes since the previous stable release, 1.2.1: + + * Fix potential crash in bson_strncpy on Windows. + * Fix compiler warnings and errors, especially with Visual Studio 2015 + and IBM XL C. + * Combine environment's CFLAGS with configure options when building. + +Thanks to everyone who contributed to the development of this release. + + * Hannes Magnusson + * A. Jesse Jiryu Davis + * Jeroen Ooms + * Petr Písař + * xpol + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.2.1 +============= + +It is my pleasure to announce to you the release of Libbson-1.2.1. + +Changes since the previous stable release, 1.2.0 are solely in the content +and format of documentation. + +Peace, + + A. Jesse Jiryu Davis + + +Libbson-1.2.0 +============= + +It is my pleasure to announce to you the release of Libbson-1.2.0. + +Changes since the previous stable release, 1.1.11: + + * Add bson_mem_restore_vtable(), the inverse of bson_mem_set_vtable(). + * Enable runtime asserts in release build. + * Fixed compiler warnings and build failures on various platforms. + * Improvements to the formatting and contents of the documentation. + +Thanks to everyone who contributed to the development of this release. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Jason Carey + * Kyle Suarez + * Derick Rethans + * David Hatch + +Peace, + + A. Jesse Jiryu Davis + + +Libbson 1.2.0-rc0 +================== + +It is my pleasure to announce to you the release candidate of Libbson-1.2.0. + +Changes: + + * Merge changes from 1.1.11. + * Enable runtime asserts in release build. + +Thanks to everyone who contributed to the development of this release candidate. + + * A. Jesse Jiryu Davis + * Hannes Magnusson + * Kyle Suarez + * Jason Carey + +-- A. Jesse Jiryu Davis + + +Libbson 1.2.0-beta +================== + +It is my pleasure to announce to you the beta of Libbson-1.2.0. + +This release adds the bson_mem_restore_vtable() function to undo the effect +of bson_mem_set_vtable(). + +Thanks to everyone who contributed to the development of this beta. + + * Jason Carey + * Hannes Magnusson + + +Libbson-1.1.11 +============== + +It is my pleasure to announce to you the release of Libbson-1.1.11. + +This is a patch release with improvements to the documentation: + + * Document bson streaming reads with an example, + bson-streaming-reader.c. + * Document callback function types bson_reader_destroy_func_t and + bson_reader_read_func_t. + +Thanks to Kyle Suarez for his contributions to this version of Libbson. + +-- A. Jesse Jiryu Davis + + +Libbson-1.1.10 +============== + +No change since 1.1.9; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.1.9 +============= + +This is a patch release with a fix for the build system: + + * "./configure --enable-coverage" works now. + +-- A. Jesse Jiryu Davis + + +Libbson-1.1.8 +============= + +No change since 1.1.7; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson-1.1.7 +============= + +It is my pleasure to announce to you the release of Libbson-1.1.7. + +This is a patch release with bug fixes: + + * Unchecked error in bson_utf8_escape_for_json caused unbounded memory growth + and a crash. + * Nicer floating-point formatting in bson_as_json. + * Link error with CMake on Mac. + +Thanks to everyone who contributed to this version of Libbson. + + * A. Jesse Jiryu Davis + * Jason Carey + * Jeroen Ooms + * Hannes Magnusson + * Hendrik Dahlkamp + +-- A. Jesse Jiryu Davis + + +Libbson-1.1.6 +============= + +No change since 1.1.5; released to keep pace with libmongoc's version. + +-- A. Jesse Jiryu Davis + + +Libbson 1.1.5 +============= + +It is my pleasure to announce to you the release of Libbson-1.1.5. + +This is a patch release with small bug fixes: + + * Fix link error "missing __sync_add_and_fetch_4" in GCC on i386 - + the functions bson_atomic_int_add and bson_atomic_int64_add are now + compiled and exported if needed in i386 mode + * Fix version check for GCC 5 and future versions of Clang + * Fix warnings and errors building on various platforms + +With this release, Libbson abandons the convention that odd-numbered patch +versions indicate unstable releases. We switch to simple semantic versioning: +1.1.5 is a stable release with bug fixes since 1.1.4. During subsequent +development the version will be "1.1.6-dev". + +Thanks to everyone who contributed to this version of Libbson. + + * A. Jesse Jiryu Davis + * Christian Hergert + * Jason Carey + * Hannes Magnusson + * Paul Melnikow + +-- A. Jesse Jiryu Davis + +Libbson 1.1.4 +============= + +It is my pleasure to announce to you the release of Libbson-1.1.4. + +This release is a minor patch release with one bug fix for bson_iter_timeval + +Thanks to everyone who contributed to the development of this release candidate for +Libbson. + + * Jason Carey + * A. Jesse Jiryu Davis + * Vladimir Zidar + +-- Jason Carey + +Libbson 1.1.2 +============= + +It is my pleasure to announce to you the release of Libbson-1.1.2. + +This release is a minor patch release with one bug fix for mingw. + +* sscanf_s doesn't exist for mingw. + +-- Jason Carey + +Libbson 1.1.0 +============= + +It is my pleasure to announce to you the release of Libbson-1.1.0. + +This release is a stable release with some ABI additions and bugfixes. + +The below changes include the changes mentioned in the rc0. + +ABI/API changes include: + * RC0 + * Deprecation of bson_copy_to_excluding + * Addition of bson_copy_to_excluding_noinit + * Removal of MIN, MAX and ABS macros in favor of BSON_MIN, BSON_MAX and + BSON_ABS. Note this is a breaking source level change if you relied on + these from bson.h. Also note that this is not a breaking ABI change. + * Addition of BSON_ERROR_BUFFER_SIZE macro + +Other changes include: + * RC0 + * Addition of a versioned ABI for the libbson shared library + * fixed bson_get_monotonic_time fallback when a system monotonic clock can not + be found. Formerly failed to compile with an incorrect call to + bson_gettimeofday + * Allow the "dbref" convention in bson_validate when BSON_VALIDATE_DOLLAR_KEYS + is present + * Support for ISO-8601 or $numberLong dates in bson <-> json parsing + * Quiet various compiler warnings + +Thanks to everyone who contributed to the development of this release candidate for +Libbson. + + * Adam Midvidy + * Christian Hergert + * Daniel Colchete + * Ivan Suvorov + * Hannes Magnusson + * Jason Carey + * Jérôme Lebel + * Samantha Ritter + +-- Jason Carey + +Libbson 1.1.0-rc0 +================= + +It is my pleasure to announce to you the release of Libbson-1.1.0-rc0. + +This release is a release candidate release with some ABI additions and bugfixes. + +ABI changes include: + * Deprecation of bson_copy_to_excluding + * Addition of bson_copy_to_excluding_noinit + +Other changes include: + * Addition of a versioned ABI for the libbson shared library + * fixed bson_get_monotonic_time fallback when a system monotonic clock can not + be found. Formerly failed to compile with an incorrect call to + bson_gettimeofday + * Allow the "dbref" convention in bson_validate when BSON_VALIDATE_DOLLAR_KEYS + is present + * Support for ISO-8601 or $numberLong dates in bson <-> json parsing + * Quiet various compiler warnings + +Thanks to everyone who contributed to the development of this release candidate for +Libbson. + + * Adam Midvidy + * Christian Hergert + * Daniel Colchete + * Ivan Suvorov + * Jason Carey + * Jérôme Lebel + +-- Jason Carey + +Libbson 1.0.2 +============= + +It is my pleasure to announce to you the release of Libbson-1.0.2. + +This release is a minor point release with no ABI changes and mostly small +bugfixes. + +Changes include: + * bson_init_from_json supports top level arrays + * fixes for bson_strerror_r + * fix for timeouts on OS X + * house cleaning for various integer types + +Thanks to everyone who contributed to the development of this point release for +Libbson. + + * Adam Midvidy + * Christian Hergert + * Jason Carey + * Jérôme Lebel + * Tyler Brock + +-- Jason Carey + +Libbson 1.0.0 +============= + +It is my very distinct pleasure to announce to you the release of +Libbson-1.0.0! + +This is the culmination of just over a year of work and could not have been +done without the help of our wonderful community. + +Thanks to everyone who contributed to the development of Libbson! + + * Christian Hergert + * Jason Carey + * Jose Sebastian Battig + * Maxim Zakharov + * Jérôme Lebel + * Itay Neeman + * Mike Manilone + * Michael Kuhn + * Kyle Suarez + * Josh Blum + * Jason Choy + * mntmnt7@gmail.com + * Tyler Brock + * Stefan Kaes + * Paul Melnikow + * Matt Cotter + * Gary J. Murakami + * Toon Schoenmakers + * Máximo Cuadros + * Michael Whittaker + * Kota Yamaguchi + * Justin Case + * Jeff Yemin + * Ivan Suvorov + * Hannes Magnusson + * Eric Daniels + * Anil Kumar + * A. Jesse Jiryu Davis + +Happy Hacking! + +-- Christian Hergert + + +Libbson 0.98.0 +============== + +One more step closer to a 1.0! + +This release has a few fixes as we near the finish line of a 1.0 release. +We have bumped the version to 0.98.0 to sync up with MongoDB C driver, which +is the primary consumer of this library. + +This release includes a new memory callback vtable to help in embedding +situations that have their own custom allocator such as various language +runtimes. + +A few compilation fixes for various C++ compilers have also been included. + +A special thanks to: + + * Itay Neeman + * Michael Whittaker + +Happy Hacking! + +-- Christian + + +Libbson 0.8.4 +============= + +Another incremental release with a couple of new functions and bugfixes. + +In this release you will find the following changes: + + * Alignment fixes for Solaris Studio C compiler. + * RPM and Debian packaging helpers. + * bson_gettimeofday() has dropped the deprecated timezone field used + when calling posix gettimeofday(). This eases portability concerns. + It is technically an ABI break, but since the field was never set, + in reality it shouldn't be an issue. + * Multi-byte optimizations for bson_oid_to_string() have been disabled + on non-x86 based platforms. This should aid in architecture portability. + * The JSON parser can now support $numberLong. + * bson_ascii_strtoll() has been added, which is a portable strtoll() + implementation. This is primarily useful for Windows users and is + used by the JSON parser. + * A bug was fixed in bson_iter_find_descendent() where the wrong field + could be matched if it's prefix matched the query. + * bson_array_as_json() has been added to convert a bson_t as a top-level + array. + +Thanks to: + * Kyle Suarez + * Itay Neeman + +Happy Hacking! + + +Libbson 0.8.2 +============= + +A bugfix release is here as a follow up to 0.8.0. + +In this release you will find the following changes: + + * A fix for BCON when used from C++. + * Change bson_next_power_of_two() to accept size_t. This should not be + an ABI break since it is static inline. + +Happy Hacking! + + +Libbson 0.8.0 +============= + +It's that time again, time for another Libbson release! + +This cycle includes much, much more documentation for your perusing. There is +much more cross-referencing and structure for your navigation pleasure. + +We've improved support for Libbson on a few more exotic platforms. SPARC +support is looking pretty good these days. + +You'll also find some new examples in this release to help you get started a +bit faster. If there is something you'd like to see, just ask! + +There are a few ABI breaks this cycle, as we are well on the road to a 1.0 and +would like things as clean as possible. I anticipate a few more during the next +couple of cycles, but we will try to keep them to a minimum. With that said, +you *WILL* need to recompile your application against 0.8.0. + +Happy Hacking! + + +Libbson 0.6.8 +============= + +Quickly following up on the 0.6.6 release is 0.6.8. This release contains +a couple of bugfixes and more support for older architectures. + +On big-endian systems, bson_append_date_time() was not properly converting +to little-endian. This is now fixed. + +We've added support for Sun Pro C Compiler on Solaris 10 and 11. This includes +support for SPARC systems as well as x86_64. In particular, intrinsics were +added for the Solaris/SPARC/SunProC combination. If you are running SunProC +on a non-Solaris platform, a fallback path will be used which is slower than +native support for atomics. Additionally, bson_gettimeofday() does not fully +support timezones under SunProC as struct timezone is not defined. + +Libbson will now check for GLibc 2.19 to remove various warnings with both +_GNU_SOURCE and _BSD_SOURCE defined. + +Happy Hacking! + + +Libbson 0.6.6 +============= + +Another release for your hacking pleasure! + +First off, note that there are two ABI breaks as part of this release. We +felt they were important as they will help us stablize towards a 1.0 release. +It is recommended that you recompile against this version of libbson. + +Lots of small fixes went into this release to help get things building better +on various platforms. Windows support should be improved and many warnings have +been cleaned up. + +The signature of bson_realloc_func has changed to allow for context to be +provided. This should help in situations where a pointer to the memory pool is +required. + +bson_destroy_with_steal() has been added so that you can steal a buffer instead +of freeing it when bson_destroy() is called. + +bson_new_from_buffer() has been added so that you can provide your own realloc +function to manage the underlying buffer. This will be useful for bindings that +want to integrate their memory manager for bson documents. + +bson_value_t is a new container type that can hold any bson type. + +I'd like to thank everyone who contributed to this release. + + Gary Murakami + Jason Carey + Jose Sebastian Battig + Máximo Cuadros + Paul Melnikow + Stefan Kaes + +Happy hacking! + +Libbson 0.6.4 +============= + +This is just a followup release of libbson as we work towards stablizing for +the new mongo-c-driver release. In fact, it only includes build work and a +new macro, bson_clear(). + +Happy hacking! + + +Libbson 0.6.2 +============= + +A new Libbson release is already here as a follow up to the 0.6.0 release. + +This release includes a few build and installation fixes. In particular, + + * Windows build fixes + * CMake build fixes + * C++ build fixes. + +The monotonic clock is now more accurately calculated on Windows as well. +If you'd like to build on Windows, check out the section in README.md for +information on how to do so. + +Happy hacking! + + +Libbson 0.6.0 +============= + +Many changes have gone into this release! + +TL;DR + + * C99 types (from C89). + * JSON parsing. + * Lots of Operating System support, including Windows. + * Parallel Test Suite. + * Revamped build system. + * A couple ABI breaks. + +First off, 0.6.0 has gone through a significant amount of build system cleanup. +This should simplify using libbson as a submodule for those that wish to do so. +For example, the mongo-c-driver now does this using autotools. + +Windows Vista and higher is now supported as a build target through the use of +cmake. See README.md for the instructions. Other platforms should continue to +use autotools. + +The test suite has been improved and more tests added. We now generate random +seeds on every run to help catch more errors with additional fuzzing passes. +By default, the test suite will run all tests in parallel with subprocesses. +This should speed up execution of `make test' for contributors. + +bson_string_t went through an ABI break to support power-of-two growth. + +JSON parsing has been added through the bson_json_reader_t type. You can also +now use bson_init_from_json() for a simplified interface. + +Types were revamped to appear to be using C99 types. If C99 types are +available, they will be used. If not, they will be emulated. This means you +can just go on using uint64_t and similar. We even use bool now. + +Many functions have been made portable to deal with inconsistencies with Win32. + +This release has been tested on the following operating systems: + + * RedHat Enterprise 5, 6, and 7 beta. + * CentOS 6.5 + * Ubuntu 12.04 LTS + * Fedora 20 + * Windows 7 + * FreeBSD 10 + * DragonFly BSD + * Solaris 11 + * SmartOS + * mingw64 + +Thanks again and enjoy using libbson! + +Libbson 0.4.0 +============= + +This release includes a few bug fixes and copious documentation. Additionally, +we improved our fuzz testing and found a couple issues in the process. It is +suggested that everyone upgrade their installations to 0.4.0. + +We have been busy adding a lot of documentation that we hope you will like. +Many `man' pages have been added for various API endpoints and structures. If +you use vim, remember that you can jump to the documentation with k +while on a symbol. + +Thanks and enjoy using libbson! + +Libbson 0.2.4 +============= + +This release includes some more performance improvements and bug fixes. + +It contains an important fix for dealing with invalid string lengths that could +cause an integer overflow when checking to see if the string length fits within +the end of the buffer. + +There is preliminary support for Solaris on x86_64 and SPARC. + +Generating OIDs is now simpler with the use of bson_context_get_default(). This +function will return a thread-safe generic bson_context_t implementation. +Alternatively, you may pass NULL to bson_oid_init() for the context and the +default context is automatically used. + +The fuzz tests now use srand() with a 32-bit integer derived from /dev/urandom. + +Endianess conversions are now performed by __builtin_bswap*() functions when +available with the GCC compiler. + +Endianness conversions for the double type are now properly handled on +big-endian systems. + +bson_reinit() has been added to cleanup code that needs to destroy and then +initialize a bson_t. + +Validation of Code with Scope fields was absent from bson_validate(). This is +now supported. + +Libbson 0.2.2 +============= + +This release includes a few performance improvements and bug fixes. + +The bson_t structure is more efficient when growing allocated buffers. +The use of memalign() was unnecessary for allocated bson_t structures +and has therefore been removed. Performance sensitive allocations now +use bson_malloc() instead of calloc() and initialize fields directly. +Stack alignment of bson_t is now enforced through compiler intrinsics. + +The unit tests can now support running inside of valgrind to check for +various memory leaks. Simply defing VALGRIND=valgrind when running +`make test`. + +Enjoy libbson-0.2.2! + + +Libbson 0.2.0 +============= + +This is the initial release of Libbson. It has not yet reached API and ABI +maturity and is therefore subject to change without notice. Developers are +encouraged to start using Libbson as we journey on the road to 1.0, where ABI +stability will be guaranteed. + +Libbson is Apache 2.0 licensed so that it can be embedded in a multitude of +scenarios. This means that we try hard to not rely on external libraries. +Therefore, Libbson contains useful routines to help in portability as well +as BSON support. + +Libbson is the basis of a new MongoDB C driver that will follow shortly. + +Please see the doc/ directory for documentation on how to use Libbson. We +would love for you to contribute to Libbson, whether that is code, +documentation or packaging. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/THIRD_PARTY_NOTICES b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/THIRD_PARTY_NOTICES new file mode 100644 index 0000000..dd62332 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/THIRD_PARTY_NOTICES @@ -0,0 +1,45 @@ +Libbson uses third-party libraries distributed under different licenses. + +License notice for jsonsl +------------------------------------------------------------------------------- + +MIT License + +Copyright (c) 2012-2015 M. Nunberg, mnunberg@haskalah.org + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +License notice for bson-fnv-private.h, bson-fnv.c and test-fnv.c +------------------------------------------------------------------------------- + +Please do not copyright this code. This code is in the public domain. + +LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +By: + chongo /\oo/\ + http://www.isthe.com/chongo/ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/CMakeLists.txt new file mode 100644 index 0000000..0d27291 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/CMakeLists.txt @@ -0,0 +1,36 @@ +include (SphinxBuild) + +if (ENABLE_HTML_DOCS) + sphinx_build_html (bson-html libbson) + set (src_libbson_doc_DIST_htmls ${doc_DIST_htmls}) +endif () + +if (ENABLE_MAN_PAGES) + sphinx_build_man (bson-man) + set (src_libbson_doc_DIST_mans ${doc_DIST_mans}) +endif () + +add_subdirectory (html) +add_subdirectory (man) + +file (GLOB src_libbson_doc_DIST_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rst) + +extra_dist_generated ( + ${src_libbson_doc_DIST_htmls} + ${src_libbson_doc_DIST_mans} +) + +set_local_dist (src_libbson_doc_DIST_local + CMakeLists.txt + ${src_libbson_doc_DIST_rsts} + conf.py +) + +set (src_libbson_doc_DIST + ${src_libbson_doc_DIST_local} + ${src_libbson_doc_html_DIST} + ${src_libbson_doc_man_DIST} + ${src_libbson_doc_mongoc_DIST} + ${src_libbson_doc_mongoc-theme_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/api.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/api.rst new file mode 100644 index 0000000..f5e24fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/api.rst @@ -0,0 +1,27 @@ +API Reference +============= + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + bson_t + bson_context_t + bson_decimal128_t + bson_error_t + bson_iter_t + bson_json_reader_t + bson_md5_t + bson_oid_t + bson_reader_t + character_and_string_routines + bson_string_t + bson_subtype_t + bson_type_t + bson_unichar_t + bson_value_t + bson_visitor_t + bson_writer_t + bson_get_monotonic_time + bson_memory + version diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array.rst new file mode 100644 index 0000000..626e879 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_array + +bson_append_array() +=================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_ARRAY(b, key, val) \ + bson_append_array (b, key, (int) strlen (key), val) + + bool + bson_append_array (bson_t *bson, + const char *key, + int key_length, + const bson_t *array); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``array``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_append_array()` function shall append ``array`` to ``bson`` using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of ``array`` are properly formatted with string keys such as "0", "1", "2" and so forth. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function fails if appending the array grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_begin.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_begin.rst new file mode 100644 index 0000000..4a326d7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_begin.rst @@ -0,0 +1,39 @@ +:man_page: bson_append_array_begin + +bson_append_array_begin() +========================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_ARRAY_BEGIN(b, key, child) \ + bson_append_array_begin (b, key, (int) strlen (key), child) + + bool + bson_append_array_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: A string containing the name for the key. +* ``key_length``: The length of ``key`` or -1 to call ``strlen()``. +* ``child``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_append_array_begin()` function shall begin appending an array field to ``bson``. This allows for incrementally building a sub-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub-array, the caller *MUST* call :symbol:`bson_append_array_end()`. + +For generating array element keys, see :symbol:`bson_uint32_to_string`. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the array grows ``bson`` larger than INT32_MAX. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_end.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_end.rst new file mode 100644 index 0000000..5c0a2fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_array_end.rst @@ -0,0 +1,28 @@ +:man_page: bson_append_array_end + +bson_append_array_end() +======================= + +Synopsis +-------- + +.. code-block:: c + + bool + bson_append_array_end (bson_t *bson, bson_t *child); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``child``: The :symbol:`bson_t` initialized in a call to :symbol:`bson_append_array_begin()`. + +Description +----------- + +The :symbol:`bson_append_array_end()` function shall complete the appending of an array field started with :symbol:`bson_append_array_begin()`. ``child`` is invalid after calling this function. + +Returns +------- + +Returns ``true`` if successful. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_binary.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_binary.rst new file mode 100644 index 0000000..958f3b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_binary.rst @@ -0,0 +1,40 @@ +:man_page: bson_append_binary + +bson_append_binary() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_BINARY(b, key, subtype, val, len) \ + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + + bool + bson_append_binary (bson_t *bson, + const char *key, + int key_length, + bson_subtype_t subtype, + const uint8_t *binary, + uint32_t length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: The key name. +* ``key_length``: The length of ``key`` in bytes or -1 to use strlen(). +* ``subtype``: A bson_subtype_t indicating the binary subtype. +* ``binary``: A buffer to embed as binary data. Must not be ``NULL``. +* ``length``: The length of ``buffer`` in bytes. + +Description +----------- + +The :symbol:`bson_append_binary()` function shall append a new element to ``bson`` containing the binary data provided. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``binary`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_bool.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_bool.rst new file mode 100644 index 0000000..a0bcb4d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_bool.rst @@ -0,0 +1,33 @@ +:man_page: bson_append_bool + +bson_append_bool() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_BOOL(b, key, val) \ + bson_append_bool (b, key, (int) strlen (key), val) + + bool + bson_append_bool (bson_t *bson, const char *key, int key_length, bool value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: The name of the field. +* ``key_length``: The length of ``key`` or -1 to use strlen(). +* ``value``: true or false. + +Description +----------- + +The :symbol:`bson_append_bool()` function shall append a new element to ``bson`` containing the boolean provided. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code.rst new file mode 100644 index 0000000..724927e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_code + +bson_append_code() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_CODE(b, key, val) \ + bson_append_code (b, key, (int) strlen (key), val) + + bool + bson_append_code (bson_t *bson, + const char *key, + int key_length, + const char *javascript); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: The key name. +* ``key_length``: The length of ``key`` or -1 to use strlen(). +* ``javascript``: A UTF-8 encoded string containing the javascript. + +Description +----------- + +The :symbol:`bson_append_code()` function shall append a new element to ``bson`` using the UTF-8 encoded ``javascript`` provided. ``javascript`` must be a NULL terminated C string. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``javascript`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code_with_scope.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code_with_scope.rst new file mode 100644 index 0000000..2c6e32c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_code_with_scope.rst @@ -0,0 +1,40 @@ +:man_page: bson_append_code_with_scope + +bson_append_code_with_scope() +============================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \ + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + + bool + bson_append_code_with_scope (bson_t *bson, + const char *key, + int key_length, + const char *javascript, + const bson_t *scope); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``javascript``: A NULL-terminated UTF-8 encoded string containing the javascript fragment. +* ``scope``: Optional :symbol:`bson_t` containing the scope for ``javascript``. + +Description +----------- + +The :symbol:`bson_append_code_with_scope()` function shall perform like :symbol:`bson_append_code()` except it allows providing a scope to the javascript function in the form of a bson document. + +If ``scope`` is NULL, this function appends an element with BSON type "code", otherwise with BSON type "code with scope". + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``javascript`` and ``scope`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_date_time.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_date_time.rst new file mode 100644 index 0000000..974d052 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_date_time.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_date_time + +bson_append_date_time() +======================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DATE_TIME(b, key, val) \ + bson_append_date_time (b, key, (int) strlen (key), val) + + bool + bson_append_date_time (bson_t *bson, + const char *key, + int key_length, + int64_t value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: The date and time as specified in milliseconds since the UNIX epoch. + +Description +----------- + +The :symbol:`bson_append_date_time()` function shall append a new element to a ``bson`` document containing a date and time with no timezone information. ``value`` is assumed to be in UTC format of milliseconds since the UNIX epoch. ``value`` *MAY* be negative. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_dbpointer.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_dbpointer.rst new file mode 100644 index 0000000..78387b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_dbpointer.rst @@ -0,0 +1,40 @@ +:man_page: bson_append_dbpointer + +bson_append_dbpointer() +======================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DBPOINTER(b, key, coll, oid) \ + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + + bool + bson_append_dbpointer (bson_t *bson, + const char *key, + int key_length, + const char *collection, + const bson_oid_t *oid); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``collection``: The target collection name. +* ``oid``: The target document identifier. + +Description +----------- + +.. warning:: + + The dbpointer field type is *DEPRECATED* and should only be used when interacting with legacy systems. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the array grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_decimal128.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_decimal128.rst new file mode 100644 index 0000000..ee1ee5b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_decimal128.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_decimal128 + +bson_append_decimal128() +======================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DECIMAL128(b, key, val) \ + bson_append_decimal128 (b, key, (int) strlen (key), val) + + bool + bson_append_decimal128 (bson_t *bson, + const char *key, + int key_length, + const bson_decimal128_t *value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A :symbol:`bson_decimal128_t`. + +Description +----------- + +The :symbol:`bson_append_decimal128()` function shall append a new element to ``bson`` containing a Decimal 128. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document.rst new file mode 100644 index 0000000..76fea4e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_document + +bson_append_document() +====================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DOCUMENT(b, key, val) \ + bson_append_document (b, key, (int) strlen (key), val) + + bool + bson_append_document (bson_t *bson, + const char *key, + int key_length, + const bson_t *value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A :symbol:`bson_t` containing the sub-document to append. + +Description +----------- + +The :symbol:`bson_append_document()` function shall append ``child`` to ``bson`` using the specified key. The type of the field will be a document. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_begin.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_begin.rst new file mode 100644 index 0000000..416ae00 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_begin.rst @@ -0,0 +1,38 @@ +:man_page: bson_append_document_begin + +bson_append_document_begin() +============================ + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \ + bson_append_document_begin (b, key, (int) strlen (key), child) + + bool + bson_append_document_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``child``: An uninitialized :symbol:`bson_t` to be initialized as the sub-document. + +Description +----------- + +The :symbol:`bson_append_document_begin()` function shall begin appending a sub-document to ``bson``. Use ``child`` to add fields to the sub-document. When completed, call :symbol:`bson_append_document_end()` to complete the element. + +``child`` *MUST* be an uninitialized :symbol:`bson_t` to avoid leaking memory. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if ``bson`` must grow larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_end.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_end.rst new file mode 100644 index 0000000..3eba9ad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_document_end.rst @@ -0,0 +1,28 @@ +:man_page: bson_append_document_end + +bson_append_document_end() +========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_append_document_end (bson_t *bson, bson_t *child); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``child``: The child :symbol:`bson_t` initialized in a call to :symbol:`bson_append_document_begin()`. + +Description +----------- + +The :symbol:`bson_append_document_end()` function shall complete the appending of a document with :symbol:`bson_append_document_begin()`. ``child`` is invalid after calling this function. + +Returns +------- + +Returns ``true`` if successful. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_double.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_double.rst new file mode 100644 index 0000000..fcb3552 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_double.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_double + +bson_append_double() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_DOUBLE(b, key, val) \ + bson_append_double (b, key, (int) strlen (key), val) + + bool + bson_append_double (bson_t *bson, + const char *key, + int key_length, + double value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A double value to append. + +Description +----------- + +The :symbol:`bson_append_double()` function shall append a new element to a bson document of type ``double``. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int32.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int32.rst new file mode 100644 index 0000000..ca9f4d5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int32.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_int32 + +bson_append_int32() +=================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_INT32(b, key, val) \ + bson_append_int32 (b, key, (int) strlen (key), val) + + bool + bson_append_int32 (bson_t *bson, + const char *key, + int key_length, + int32_t value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: An int32_t. + +Description +----------- + +The :symbol:`bson_append_int32()` function shall append a new element to ``bson`` containing a 32-bit signed integer. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int64.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int64.rst new file mode 100644 index 0000000..b037e83 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_int64.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_int64 + +bson_append_int64() +=================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_INT64(b, key, val) \ + bson_append_int64 (b, key, (int) strlen (key), val) + + bool + bson_append_int64 (bson_t *bson, + const char *key, + int key_length, + int64_t value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: An int64_t. + +Description +----------- + +The :symbol:`bson_append_int64()` function shall append a new element to ``bson`` containing a 64-bit signed integer. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_iter.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_iter.rst new file mode 100644 index 0000000..9c3a73b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_iter.rst @@ -0,0 +1,33 @@ +:man_page: bson_append_iter + +bson_append_iter() +================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_append_iter (bson_t *bson, + const char *key, + int key_length, + const bson_iter_t *iter); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: Optional field name. If NULL, uses :symbol:`bson_iter_key(iter) `. +* ``key_length``: The length of ``key`` or -1 to use strlen(). +* ``iter``: A :symbol:`bson_iter_t` located on the position of the element to append. + +Description +----------- + +Appends the value at the current position of ``iter`` to the document. + +Returns +------- + +Returns ``true`` if successful; ``false`` if the operation would overflow the maximum document size or another invalid state is detected. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_maxkey.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_maxkey.rst new file mode 100644 index 0000000..8b8322a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_maxkey.rst @@ -0,0 +1,32 @@ +:man_page: bson_append_maxkey + +bson_append_maxkey() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_MAXKEY(b, key) \ + bson_append_maxkey (b, key, (int) strlen (key)) + + bool + bson_append_maxkey (bson_t *bson, const char *key, int key_length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_maxkey()` function shall append an element of type BSON_TYPE_MAXKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_minkey.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_minkey.rst new file mode 100644 index 0000000..cde6428 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_minkey.rst @@ -0,0 +1,32 @@ +:man_page: bson_append_minkey + +bson_append_minkey() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_MINKEY(b, key) \ + bson_append_minkey (b, key, (int) strlen (key)) + + bool + bson_append_minkey (bson_t *bson, const char *key, int key_length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_minkey()` function shall append an element of type BSON_TYPE_MINKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_now_utc.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_now_utc.rst new file mode 100644 index 0000000..66d3dad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_now_utc.rst @@ -0,0 +1,31 @@ +:man_page: bson_append_now_utc + +bson_append_now_utc() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_append_now_utc (bson_t *bson, const char *key, int key_length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_now_utc()` function is a helper to get the current date and time in UTC and append it to ``bson`` as a BSON_TYPE_DATE_TIME element. + +This function calls :symbol:`bson_append_date_time()` internally. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_null.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_null.rst new file mode 100644 index 0000000..1559154 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_null.rst @@ -0,0 +1,31 @@ +:man_page: bson_append_null + +bson_append_null() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + + bool + bson_append_null (bson_t *bson, const char *key, int key_length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_null()` function shall append a new element to ``bson`` of type BSON_TYPE_NULL. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_oid.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_oid.rst new file mode 100644 index 0000000..c965533 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_oid.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_oid + +bson_append_oid() +================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_OID(b, key, val) \ + bson_append_oid (b, key, (int) strlen (key), val) + + bool + bson_append_oid (bson_t *bson, + const char *key, + int key_length, + const bson_oid_t *oid); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``oid``: A bson_oid_t. + +Description +----------- + +The :symbol:`bson_append_oid()` function shall append a new element to ``bson`` of type BSON_TYPE_OID. ``oid`` *MUST* be a pointer to a :symbol:`bson_oid_t`. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending ``oid`` grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex.rst new file mode 100644 index 0000000..48df06c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex.rst @@ -0,0 +1,47 @@ +:man_page: bson_append_regex + +bson_append_regex() +=================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_REGEX(b, key, val, opt) \ + bson_append_regex (b, key, (int) strlen (key), val, opt) + + bool + bson_append_regex (bson_t *bson, + const char *key, + int key_length, + const char *regex, + const char *options); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``regex``: An ASCII string containing the regex. +* ``options``: An optional string containing the regex options as a string. + +Description +----------- + +Appends a new field to ``bson`` of type BSON_TYPE_REGEX. ``regex`` should be the regex string. ``options`` should contain the options for the regex. + +Valid characters for ``options`` include: + +* ``'i'`` for case-insensitive. +* ``'m'`` for multiple matching. +* ``'x'`` for verbose mode. +* ``'l'`` to make \w and \W locale dependent. +* ``'s'`` for dotall mode ('.' matches everything) +* ``'u'`` to make \w and \W match unicode. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the regex grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex_w_len.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex_w_len.rst new file mode 100644 index 0000000..9335b35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_regex_w_len.rst @@ -0,0 +1,47 @@ +:man_page: bson_append_regex_w_len + +bson_append_regex_w_len() +========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_append_regex_w_len (bson_t *bson, + const char *key, + int key_length, + const char *regex, + int regex_length, + const char *options); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``regex``: An ASCII string containing the regex. +* ``regex_length``: The length of ``regex`` in bytes, or -1 to determine the length with ``strlen()``. +* ``options``: An optional string containing the regex options as a string. + +Description +----------- + +Appends a new field to ``bson`` of type BSON_TYPE_REGEX. ``regex`` should be the regex string. ``options`` should contain the options for the regex. + +Valid characters for ``options`` include: + +* ``'i'`` for case-insensitive. +* ``'m'`` for multiple matching. +* ``'x'`` for verbose mode. +* ``'l'`` to make \w and \W locale dependent. +* ``'s'`` for dotall mode ('.' matches everything) +* ``'u'`` to make \w and \W match unicode. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the regex grows ``bson`` larger than INT32_MAX. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_symbol.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_symbol.rst new file mode 100644 index 0000000..307c9fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_symbol.rst @@ -0,0 +1,38 @@ +:man_page: bson_append_symbol + +bson_append_symbol() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_SYMBOL(b, key, val) \ + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + + bool + bson_append_symbol (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: The symbol. +* ``length``: A length of ``symbol`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +Appends a new field to ``bson`` of type BSON_TYPE_SYMBOL. This BSON type is deprecated and should not be used in new code. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_time_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_time_t.rst new file mode 100644 index 0000000..17fb84d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_time_t.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_time_t + +bson_append_time_t() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_TIME_T(b, key, val) \ + bson_append_time_t (b, key, (int) strlen (key), val) + + bool + bson_append_time_t (bson_t *bson, + const char *key, + int key_length, + time_t value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A time_t. + +Description +----------- + +The :symbol:`bson_append_time_t()` function is a helper that takes a ``time_t`` instead of milliseconds since the UNIX epoch. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timestamp.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timestamp.rst new file mode 100644 index 0000000..913991d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timestamp.rst @@ -0,0 +1,42 @@ +:man_page: bson_append_timestamp + +bson_append_timestamp() +======================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_TIMESTAMP(b, key, val, inc) \ + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + + bool + bson_append_timestamp (bson_t *bson, + const char *key, + int key_length, + uint32_t timestamp, + uint32_t increment); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``timestamp``: A uint32_t. +* ``increment``: A uint32_t. + +Description +----------- + +This function is not similar in functionality to :symbol:`bson_append_date_time()`. Timestamp elements are different in that they include only second precision and an increment field. + +They are primarily used for intra-MongoDB server communication. + +The :symbol:`bson_append_timestamp()` function shall append a new element of type BSON_TYPE_TIMESTAMP. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timeval.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timeval.rst new file mode 100644 index 0000000..fb9bb64 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_timeval.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_timeval + +bson_append_timeval() +===================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_TIMEVAL(b, key, val) \ + bson_append_timeval (b, key, (int) strlen (key), val) + + bool + bson_append_timeval (bson_t *bson, + const char *key, + int key_length, + struct timeval *value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A struct timeval. + +Description +----------- + +The :symbol:`bson_append_timeval()` function is a helper that takes a ``struct timeval`` instead of milliseconds since the UNIX epoch. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_undefined.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_undefined.rst new file mode 100644 index 0000000..09e265c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_undefined.rst @@ -0,0 +1,32 @@ +:man_page: bson_append_undefined + +bson_append_undefined() +======================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_UNDEFINED(b, key) \ + bson_append_undefined (b, key, (int) strlen (key)) + + bool + bson_append_undefined (bson_t *bson, const char *key, int key_length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_undefined()` function shall append a new element to ``bson`` of type BSON_TYPE_UNDEFINED. Undefined is common in Javascript. However, this element type is deprecated and should not be used in new code. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_utf8.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_utf8.rst new file mode 100644 index 0000000..0500dc4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_utf8.rst @@ -0,0 +1,44 @@ +:man_page: bson_append_utf8 + +bson_append_utf8() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_UTF8(b, key, val) \ + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + + bool + bson_append_utf8 (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A UTF-8 encoded string. +* ``length``: The number of bytes in ``value`` excluding the trailing ``\0``, or -1 to determine the length with ``strlen()``. + +Description +----------- + +The :symbol:`bson_append_utf8()` function shall append a UTF-8 encoded string to ``bson``. + +``value`` *MUST* be valid UTF-8. + +Some UTF-8 implementations allow for ``\0`` to be contained within the string (excluding the termination ``\0``. This is allowed, but remember that it could cause issues with communicating with external systems that do not support it. + +It is suggested to use modified UTF-8 which uses a 2 byte representation for embedded ``\0`` within the string. This will allow these UTF-8 encoded strings to used with many libc functions. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_value.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_value.rst new file mode 100644 index 0000000..1deb5ce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_append_value.rst @@ -0,0 +1,36 @@ +:man_page: bson_append_value + +bson_append_value() +=================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_APPEND_VALUE(b, key, val) \ + bson_append_value (b, key, (int) strlen (key), (val)) + + bool + bson_append_value (bson_t *bson, + const char *key, + int key_length, + const bson_value_t *value); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: An ASCII C string containing the name of the field. +* ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. +* ``value``: A :symbol:`bson_value_t`. + +Description +----------- + +Appends a new field to ``bson`` by determining the boxed type in ``value``. This is useful if you want to copy fields between documents but do not know the field type until runtime. + +Returns +------- + +Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_array_as_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_array_as_json.rst new file mode 100644 index 0000000..cc12d61 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_array_as_json.rst @@ -0,0 +1,71 @@ +:man_page: bson_array_as_json + +bson_array_as_json() +==================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_array_as_json (const bson_t *bson, size_t *length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``length``: An optional location for the length of the resulting string. + +Description +----------- + +The :symbol:`bson_array_as_json()` function shall encode ``bson`` as a UTF-8 +string using libbson's legacy JSON format, except the outermost element is +encoded as a JSON array, rather than a JSON document. +The caller is responsible for freeing the resulting UTF-8 encoded string by +calling :symbol:`bson_free()` with the result. + +If non-NULL, ``length`` will be set to the length of the result in bytes. + +Returns +------- + +If successful, a newly allocated UTF-8 encoded string and ``length`` is set. + +Upon failure, NULL is returned. + +Example +------- + +.. code-block:: c + + #include + + int main () + { + bson_t bson; + char *str; + + bson_init (&bson); + /* BSON array is a normal BSON document with integer values for the keys, + * starting with 0 and continuing sequentially + */ + BSON_APPEND_UTF8 (&bson, "0", "foo"); + BSON_APPEND_UTF8 (&bson, "1", "bar"); + + str = bson_array_as_json (&bson, NULL); + /* Prints + * [ "foo", "bar" ] + */ + printf ("%s\n", str); + bson_free (str); + + bson_destroy (&bson); + } + + +.. only:: html + + .. taglist:: See Also: + :tags: bson-as-json diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_canonical_extended_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_canonical_extended_json.rst new file mode 100644 index 0000000..7f2f8fd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_canonical_extended_json.rst @@ -0,0 +1,51 @@ +:man_page: bson_as_canonical_extended_json + +bson_as_canonical_extended_json() +================================= + +Synopsis +-------- + +.. code-block:: c + + char * + bson_as_canonical_extended_json (const bson_t *bson, size_t *length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``length``: An optional location for the length of the resulting string. + +Description +----------- + +The :symbol:`bson_as_canonical_extended_json()` encodes ``bson`` as a UTF-8 string in the canonical `MongoDB Extended JSON format`_. + +The caller is responsible for freeing the resulting UTF-8 encoded string by calling :symbol:`bson_free()` with the result. + +If non-NULL, ``length`` will be set to the length of the result in bytes. + +Returns +------- + +If successful, a newly allocated UTF-8 encoded string and ``length`` is set. + +Upon failure, NULL is returned. + +Example +------- + +.. code-block:: c + + char *str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\n", str); + bson_free (str); + + +.. only:: html + + .. taglist:: See Also: + :tags: bson-as-json + +.. _MongoDB Extended JSON format: https://github.com/mongodb/specifications/blob/master/source/extended-json.rst diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_json.rst new file mode 100644 index 0000000..816505e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_json.rst @@ -0,0 +1,68 @@ +:man_page: bson_as_json + +bson_as_json() +============== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_as_json (const bson_t *bson, size_t *length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``length``: An optional location for the length of the resulting string. + +Description +----------- + +The :symbol:`bson_as_json()` function shall encode ``bson`` as a UTF-8 string using libbson's legacy JSON format. This function is superseded by :symbol:`bson_as_canonical_extended_json()` and :symbol:`bson_as_relaxed_extended_json()`, which use the same `MongoDB Extended JSON format`_ as all other MongoDB drivers. + +The caller is responsible for freeing the resulting UTF-8 encoded string by calling :symbol:`bson_free()` with the result. + +If non-NULL, ``length`` will be set to the length of the result in bytes. + +Returns +------- + +If successful, a newly allocated UTF-8 encoded string and ``length`` is set. + +Upon failure, NULL is returned. + +Example +------- + +.. code-block:: c + + #include + + int main () + { + bson_t bson; + char *str; + + bson_init (&bson); + BSON_APPEND_UTF8 (&bson, "0", "foo"); + BSON_APPEND_UTF8 (&bson, "1", "bar"); + + str = bson_as_json (&bson, NULL); + /* Prints + * { "0" : "foo", "1" : "bar" } + */ + printf ("%s\n", str); + bson_free (str); + + bson_destroy (&bson); + } + +.. only:: html + + .. taglist:: See Also: + :tags: bson-as-json + +.. _MongoDB Extended JSON format: https://github.com/mongodb/specifications/blob/master/source/extended-json.rst + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_relaxed_extended_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_relaxed_extended_json.rst new file mode 100644 index 0000000..37a6fcf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_as_relaxed_extended_json.rst @@ -0,0 +1,51 @@ +:man_page: bson_as_relaxed_extended_json + +bson_as_relaxed_extended_json() +=============================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_as_relaxed_extended_json (const bson_t *bson, size_t *length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``length``: An optional location for the length of the resulting string. + +Description +----------- + +The :symbol:`bson_as_relaxed_extended_json()` encodes ``bson`` as a UTF-8 string in the relaxed `MongoDB Extended JSON format`_. + +The caller is responsible for freeing the resulting UTF-8 encoded string by calling :symbol:`bson_free()` with the result. + +If non-NULL, ``length`` will be set to the length of the result in bytes. + +Returns +------- + +If successful, a newly allocated UTF-8 encoded string and ``length`` is set. + +Upon failure, NULL is returned. + +Example +------- + +.. code-block:: c + + char *str = bson_as_relaxed_extended_json (doc, NULL); + printf ("%s\n", str); + bson_free (str); + + +.. only:: html + + .. taglist:: See Also: + :tags: bson-as-json + +.. _MongoDB Extended JSON format: https://github.com/mongodb/specifications/blob/master/source/extended-json.rst diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_ascii_strtoll.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_ascii_strtoll.rst new file mode 100644 index 0000000..24cc6d7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_ascii_strtoll.rst @@ -0,0 +1,44 @@ +:man_page: bson_ascii_strtoll + +bson_ascii_strtoll() +==================== + +Synopsis +-------- + +.. code-block:: c + + int64_t + bson_ascii_strtoll (const char *str, char **endptr, int base); + +Parameters +---------- + +* ``str``: The string to convert. +* ``endptr``: Address of the first invalid character of ``str``, or null. +* ``base``: The base to use for the conversion. + +Description +----------- + +A portable version of ``strtoll()``. + + +Converts a string to a 64-bit signed integer according to the given ``base``, +which must be 16, 10, or 8. Leading whitespace will be ignored. + +If base is 0 is passed in, the base is inferred from the string's leading +characters. Base-16 numbers start with "0x" or "0X", base-8 numbers start with +"0", base-10 numbers start with a digit from 1 to 9. + +If ``endptr`` is not NULL, it will be assigned the address of the first invalid +character of ``str``, or its null terminating byte if the entire string was valid. + +If an invalid value is encountered, errno will be set to EINVAL and zero will +be returned. If the number is out of range, errno is set to ERANGE and +LLONG_MAX or LLONG_MIN is returned. + +Returns +------- + +The result of the conversion. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_check_version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_check_version.rst new file mode 100644 index 0000000..139d365 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_check_version.rst @@ -0,0 +1,30 @@ +:man_page: bson_check_version + +bson_check_version() +==================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_check_version (int required_major, int required_minor, int required_micro); + +Parameters +---------- + +* ``required_major``: The minimum major version required. +* ``required_minor``: The minimum minor version required. +* ``required_micro``: The minimum micro version required. + +Description +----------- + +Check at runtime if this release of libbson meets a required version. + +Returns +------- + +True if libbson's version is greater than or equal to the required version. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_compare.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_compare.rst new file mode 100644 index 0000000..5f7257e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_compare.rst @@ -0,0 +1,37 @@ +:man_page: bson_compare + +bson_compare() +============== + +Synopsis +-------- + +.. code-block:: c + + int + bson_compare (const bson_t *bson, const bson_t *other); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``other``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_compare()` function shall compare two bson documents for equality. + +This can be useful in conjunction with _qsort()_. + +If equal, 0 is returned. + +.. tip:: + + This function uses _memcmp()_ internally, so the semantics are the same. + +Returns +------- + +less than zero, zero, or greater than zero in ``qsort()`` style. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_concat.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_concat.rst new file mode 100644 index 0000000..ebe17f0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_concat.rst @@ -0,0 +1,33 @@ +:man_page: bson_concat + +bson_concat() +============= + +Synopsis +-------- + +.. code-block:: c + + bool + bson_concat (bson_t *dst, const bson_t *src); + +Parameters +---------- + +* ``dst``: A :symbol:`bson_t`. +* ``src``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_concat()` function shall append the contents of ``src`` to ``dst``. + +Returns +------- + +Returns ``true`` if successful; ``false`` if the operation would overflow the maximum document size or another invalid state is detected. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_destroy.rst new file mode 100644 index 0000000..7255a9d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_destroy.rst @@ -0,0 +1,25 @@ +:man_page: bson_context_destroy + +bson_context_destroy() +====================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_context_destroy (bson_context_t *context); + +Parameters +---------- + +* ``context``: A :symbol:`bson_context_t`. + +Description +----------- + +The ``bson_context_destroy()`` function shall release all resources associated with ``context``. Does nothing if ``context`` is NULL. + +This should be called when you are no longer using a :symbol:`bson_context_t` that you have allocated with :symbol:`bson_context_new()`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_get_default.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_get_default.rst new file mode 100644 index 0000000..1eaf8cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_get_default.rst @@ -0,0 +1,18 @@ +:man_page: bson_context_get_default + +bson_context_get_default() +========================== + +Synopsis +-------- + +.. code-block:: c + + bson_context_t * + bson_context_get_default (void); + +Returns +------- + +The ``bson_context_get_default()`` function shall return the default, thread-safe, :symbol:`bson_context_t` for the process. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_new.rst new file mode 100644 index 0000000..65d83d3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_new.rst @@ -0,0 +1,28 @@ +:man_page: bson_context_new + +bson_context_new() +================== + +Synopsis +-------- + +.. code-block:: c + + bson_context_t * + bson_context_new (bson_context_flags_t flags); + +Parameters +---------- + +* ``flags``: A :symbol:`bson_context_flags_t `. + +Description +----------- + +Creates a new :symbol:`bson_context_t`. This is rarely needed as :symbol:`bson_context_get_default()` serves most use-cases. + +Returns +------- + +A newly allocated :symbol:`bson_context_t` that should be freed with :symbol:`bson_context_destroy`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_t.rst new file mode 100644 index 0000000..a425b29 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_context_t.rst @@ -0,0 +1,77 @@ +:man_page: bson_context_t + +bson_context_t +============== + +BSON OID Generation Context + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef enum { + BSON_CONTEXT_NONE = 0, + BSON_CONTEXT_THREAD_SAFE = (1 << 0), + BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1), + BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2), + #ifdef BSON_HAVE_SYSCALL_TID + BSON_CONTEXT_USE_TASK_ID = (1 << 3), + #endif + } bson_context_flags_t; + + typedef struct _bson_context_t bson_context_t; + + bson_context_t * + bson_context_get_default (void) BSON_GNUC_CONST; + bson_context_t * + bson_context_new (bson_context_flags_t flags); + void + bson_context_destroy (bson_context_t *context); + +Description +----------- + +The :symbol:`bson_context_t` structure is context for generation of BSON Object IDs. This context allows for specialized overriding of how ObjectIDs are generated based on the applications requirements. For example, disabling of PID caching can be configured if the application cannot detect when a call to ``fork()`` has occurred. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_context_destroy + bson_context_get_default + bson_context_new + +Example +------- + +.. code-block:: c + + #include + + int + main (int argc, char *argv[]) + { + bson_context_t *ctx = NULL; + bson_oid_t oid; + + /* use default context, via bson_context_get_default() */ + bson_oid_init (&oid, NULL); + + /* specify a local context for additional control */ + ctx = bson_context_new (BSON_CONTEXT_DISABLE_PID_CACHE | + BSON_CONTEXT_THREAD_SAFE); + bson_oid_init (&oid, ctx); + + bson_context_destroy (ctx); + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy.rst new file mode 100644 index 0000000..6fe69cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy.rst @@ -0,0 +1,30 @@ +:man_page: bson_copy + +bson_copy() +=========== + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_copy (const bson_t *bson); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_copy()` function shall copy the contents of a bson document into a new :symbol:`bson_t`. + +The resulting :symbol:`bson_t` should be freed with :symbol:`bson_destroy()`. + +Returns +------- + +A newly allocated :symbol:`bson_t` that should be freed with :symbol:`bson_destroy()`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to.rst new file mode 100644 index 0000000..293f1cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to.rst @@ -0,0 +1,26 @@ +:man_page: bson_copy_to + +bson_copy_to() +============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_copy_to (const bson_t *src, bson_t *dst); + +Parameters +---------- + +* ``src``: A :symbol:`bson_t`. +* ``dst``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_copy_to()` function shall initialize ``dst`` with a copy of the contents of ``src``. + +``dst`` *MUST* be an uninitialized :symbol:`bson_t` to avoid leaking memory. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding.rst new file mode 100644 index 0000000..05c89c5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding.rst @@ -0,0 +1,41 @@ +:man_page: bson_copy_to_excluding + +bson_copy_to_excluding() +======================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_copy_to_excluding (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED + BSON_GNUC_DEPRECATED_FOR (bson_copy_to_excluding_noinit); + +Parameters +---------- + +* ``src``: A :symbol:`bson_t`. +* ``dst``: A :symbol:`bson_t`. +* ``first_exclude``: The first field name to exclude. + +Description +----------- + +The :symbol:`bson_copy_to_excluding()` function shall copy all fields from +``src`` to ``dst`` except those specified by the variadic, NULL terminated list +of keys starting from ``first_exclude``. + +Deprecated +---------- + + This function is deprecated. Please use + :symbol:`bson_copy_to_excluding_noinit` in new code. + +.. warning:: + + :symbol:`bson_init` is called on ``dst``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding_noinit.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding_noinit.rst new file mode 100644 index 0000000..a3f5952 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_copy_to_excluding_noinit.rst @@ -0,0 +1,69 @@ +:man_page: bson_copy_to_excluding_noinit + +bson_copy_to_excluding_noinit() +=============================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_copy_to_excluding_noinit (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED; + +Parameters +---------- + +* ``src``: A :symbol:`bson_t`. +* ``dst``: A :symbol:`bson_t`. +* ``first_exclude``: The first field name to exclude. + +Description +----------- + +The :symbol:`bson_copy_to_excluding_noinit()` function shall copy all fields +from ``src`` to ``dst`` except those specified by the variadic, NULL terminated +list of keys starting from ``first_exclude``. +Works the same way as :symbol:`bson_copy_to_excluding`, except does **not** call +:symbol:`bson_init` on ``dst``. +This function should be preferred in new code over :symbol:`bson_copy_to_excluding`. + +.. warning:: + + This is generally not needed except in very special situations. + +Example +------- + +.. code-block:: c + + #include + + int main () + { + bson_t bson; + bson_t bson2; + char *str; + + bson_init (&bson); + bson_append_int32 (&bson, "a", 1, 1); + bson_append_int32 (&bson, "b", 1, 2); + bson_append_int32 (&bson, "c", 1, 2); + + bson_init (&bson2); + bson_copy_to_excluding_noinit (&bson, &bson2, "b", NULL); + + str = bson_as_json (&bson2, NULL); + /* Prints + * { "a" : 1, "c" : 2 } + */ + printf ("%s\n", str); + bson_free (str); + + bson_destroy (&bson); + bson_destroy (&bson2); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_count_keys.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_count_keys.rst new file mode 100644 index 0000000..ab99542 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_count_keys.rst @@ -0,0 +1,28 @@ +:man_page: bson_count_keys + +bson_count_keys() +================= + +Synopsis +-------- + +.. code-block:: c + + uint32_t + bson_count_keys (const bson_t *bson); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_count_keys()` function shall count the number of elements within ``bson``. + +Returns +------- + +A positive integer or zero. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string.rst new file mode 100644 index 0000000..a10acc4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string.rst @@ -0,0 +1,41 @@ +:man_page: bson_decimal128_from_string + +bson_decimal128_from_string() +============================= + +Synopsis +-------- + +.. code-block:: c + + bool + bson_decimal128_from_string (const char *string, bson_decimal128_t *dec); + +Parameters +---------- + +* ``string``: A string containing ASCII encoded Decimal128. +* ``dec``: A :symbol:`bson_decimal128_t`. + +Description +----------- + +Parses the string containing ascii encoded Decimal128 and initialize the bytes +in ``dec``. See the `Decimal128 specification +`_ +for the exact string format. + +Returns +------- + +Returns ``true`` if valid Decimal128 string was provided, otherwise ``false`` +and ``dec`` will be set to ``NaN``. + +Example +------- + +.. code-block:: c + + bson_decimal128_t dec; + bson_decimal128_from_string ("1.00", &dec); + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string_w_len.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string_w_len.rst new file mode 100644 index 0000000..8693580 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_from_string_w_len.rst @@ -0,0 +1,44 @@ +:man_page: bson_decimal128_from_string_w_len + +bson_decimal128_from_string_w_len() +=================================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_decimal128_from_string_w_len (const char *string, + int len, + bson_decimal128_t *dec); + +Parameters +---------- + +* ``string``: A string containing ASCII encoded Decimal128. +* ``len``: The length of ``string`` in bytes, or -1 meaning the string is null-terminated. +* ``dec``: A :symbol:`bson_decimal128_t`. + +Description +----------- + +Parses the string containing ascii encoded Decimal128 and initialize the bytes +in ``dec``. See the `Decimal128 specification +`_ +for the exact string format. + +Returns +------- + +Returns ``true`` if valid Decimal128 string was provided, otherwise ``false`` +and ``dec`` will be set to ``NaN``. + +Example +------- + +.. code-block:: c + + bson_decimal128_t dec; + bson_decimal128_from_string_w_len ("1.00", 4, &dec); + bson_decimal128_from_string_w_len ("1.00", -1, &dec); diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_t.rst new file mode 100644 index 0000000..ac7baa2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_t.rst @@ -0,0 +1,68 @@ +:man_page: bson_decimal128_t + +bson_decimal128_t +================= + +BSON Decimal128 Abstraction + +Synopsis +-------- + +.. code-block:: c + + #include + + #define BSON_DECIMAL128_STRING 43 + #define BSON_DECIMAL128_INF "Infinity" + #define BSON_DECIMAL128_NAN "NaN" + + typedef struct { + #if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN + uint64_t low; + uint64_t high; + #elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN + uint64_t high; + uint64_t low; + #endif + } bson_decimal128_t; + +Description +----------- + +The :symbol:`bson_decimal128_t` structure +represents the IEEE-754 Decimal128 data type. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_decimal128_from_string + bson_decimal128_from_string_w_len + bson_decimal128_to_string + +Example +------- + +.. code-block:: c + + #include + #include + + int + main (int argc, char *argv[]) + { + char string[BSON_DECIMAL128_STRING]; + bson_decimal128_t decimal128; + + bson_decimal128_from_string ("100.00", &decimal128); + bson_decimal128_to_string (&decimal128, string); + printf ("Decimal128 value: %s\n", string); + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_to_string.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_to_string.rst new file mode 100644 index 0000000..7a12fe7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_decimal128_to_string.rst @@ -0,0 +1,32 @@ +:man_page: bson_decimal128_to_string + +bson_decimal128_to_string() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_decimal128_to_string (const bson_decimal128_t *dec, char *str); + +Parameters +---------- + +* ``dec``: A :symbol:`bson_decimal128_t`. +* ``str``: A location of length BSON_DECIMAL128_STRING for the resulting string. + +Description +----------- + +Converts ``dec`` into a printable string. + +Example +------- + +.. code-block:: c + + char decimal128_string[BSON_DECIMAL128_STRING]; + bson_decimal128_to_string (&decimal128t, decimal128_string); + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy.rst new file mode 100644 index 0000000..d2fea65 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy.rst @@ -0,0 +1,25 @@ +:man_page: bson_destroy + +bson_destroy() +============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_destroy (bson_t *bson); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_destroy()` function shall free an allocated :symbol:`bson_t` structure. Does nothing if ``bson`` is NULL. + +This function should always be called when you are done with a :symbol:`bson_t` unless otherwise specified. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy_with_steal.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy_with_steal.rst new file mode 100644 index 0000000..a409a71 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_destroy_with_steal.rst @@ -0,0 +1,32 @@ +:man_page: bson_destroy_with_steal + +bson_destroy_with_steal() +========================= + +Synopsis +-------- + +.. code-block:: c + + uint8_t * + bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``steal``: A bool indicating if the underlying buffer should be stolen. +* ``length``: A location for storing the resulting buffer length. + +Description +----------- + +The :symbol:`bson_destroy_with_steal()` function shall destroy a :symbol:`bson_t` structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a :symbol:`bson_t` that is not a top-level :symbol:`bson_t`, such as those initialized with :symbol:`bson_append_document_begin()`, :symbol:`bson_append_array_begin()`, and :symbol:`bson_writer_begin()`. + +See also :symbol:`bson_steal`, a higher-level function that efficiently transfers the contents of one :symbol:`bson_t` to another. + +Returns +------- + +:symbol:`bson_destroy_with_steal()` shall return a buffer containing the contents of the :symbol:`bson_t` if ``steal`` is non-zero. This should be freed with :symbol:`bson_free()` when no longer in use. ``length`` will be set to the length of the bson document if non-NULL. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_equal.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_equal.rst new file mode 100644 index 0000000..7950e35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_equal.rst @@ -0,0 +1,29 @@ +:man_page: bson_equal + +bson_equal() +============ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_equal (const bson_t *bson, const bson_t *other); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``other``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_equal()` function shall return true if both documents are equal. + +Returns +------- + +true if both documents are equal. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_error_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_error_t.rst new file mode 100644 index 0000000..8fad1b6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_error_t.rst @@ -0,0 +1,53 @@ +:man_page: bson_error_t + +bson_error_t +============ + +BSON Error Encapsulation + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct { + uint32_t domain; + uint32_t code; + char message[504]; + } bson_error_t; + +Description +----------- + +The :symbol:`bson_error_t` structure is used as an out-parameter to pass error information to the caller. It should be stack-allocated and does not requiring freeing. + +See :doc:`Handling Errors `. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_set_error + bson_strerror_r + +Example +------- + +.. code-block:: c + + bson_reader_t *reader; + bson_error_t error; + + reader = bson_reader_new_from_file ("dump.bson", &error); + if (!reader) { + fprintf ( + stderr, "ERROR: %d.%d: %s\n", error.domain, error.code, error.message); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_free.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_free.rst new file mode 100644 index 0000000..88e8512 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_free.rst @@ -0,0 +1,23 @@ +:man_page: bson_free + +bson_free() +=========== + +Synopsis +-------- + +.. code-block:: c + + void + bson_free (void *mem); + +Parameters +---------- + +* ``mem``: A memory region. + +Description +----------- + +This function shall free the memory supplied by ``mem``. This should be used by functions that require you free the result with ``bson_free()``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_data.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_data.rst new file mode 100644 index 0000000..631dd9b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_data.rst @@ -0,0 +1,28 @@ +:man_page: bson_get_data + +bson_get_data() +=============== + +Synopsis +-------- + +.. code-block:: c + + const uint8_t * + bson_get_data (const bson_t *bson); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_get_data()` function shall return the raw buffer of a bson document. This can be used in conjunction with the ``len`` property of a :symbol:`bson_t` if you want to copy the raw buffer around. + +Returns +------- + +A buffer which should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_major_version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_major_version.rst new file mode 100644 index 0000000..14fec71 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_major_version.rst @@ -0,0 +1,23 @@ +:man_page: bson_get_major_version + +bson_get_major_version() +======================== + +Synopsis +-------- + +.. code-block:: c + + int + bson_get_major_version (void); + +Description +----------- + +Get the first number in libbson's MAJOR.MINOR.MICRO release version. + +Returns +------- + +The value of ``BSON_MAJOR_VERSION`` when Libbson was compiled. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_micro_version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_micro_version.rst new file mode 100644 index 0000000..8594145 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_micro_version.rst @@ -0,0 +1,23 @@ +:man_page: bson_get_micro_version + +bson_get_micro_version() +======================== + +Synopsis +-------- + +.. code-block:: c + + int + bson_get_micro_version (void); + +Description +----------- + +Get the third number in libbson's MAJOR.MINOR.MICRO release version. + +Returns +------- + +The value of ``BSON_MICRO_VERSION`` when Libbson was compiled. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_minor_version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_minor_version.rst new file mode 100644 index 0000000..f14be8e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_minor_version.rst @@ -0,0 +1,23 @@ +:man_page: bson_get_minor_version + +bson_get_minor_version() +======================== + +Synopsis +-------- + +.. code-block:: c + + int + bson_get_minor_version (void); + +Description +----------- + +Get the middle number in libbson's MAJOR.MINOR.MICRO release version. + +Returns +------- + +The value of ``BSON_MINOR_VERSION`` when Libbson was compiled. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_monotonic_time.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_monotonic_time.rst new file mode 100644 index 0000000..8da7053 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_monotonic_time.rst @@ -0,0 +1,32 @@ +:man_page: bson_get_monotonic_time + +System Clock +============ + +BSON Clock Abstraction + +Synopsis +-------- + +.. code-block:: c + + int64_t + bson_get_monotonic_time (void); + int + bson_gettimeofday (struct timeval *tv, + struct timezone *tz); + +Description +----------- + +The clock abstraction in Libbson provides a cross-platform way to handle timeouts within the BSON library. It abstracts the differences in implementations of ``gettimeofday()`` as well as providing a monotonic (incrementing only) clock in microseconds. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_version.rst new file mode 100644 index 0000000..755dba3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_get_version.rst @@ -0,0 +1,23 @@ +:man_page: bson_get_version + +bson_get_version() +================== + +Synopsis +-------- + +.. code-block:: c + + const char * + bson_get_version (void); + +Description +----------- + +A string representation of Libbson's version, formatted something like "1.2.3" or "1.2.3-dev". + +Returns +------- + +A string you must not modify or free. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_has_field.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_has_field.rst new file mode 100644 index 0000000..eab6cec --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_has_field.rst @@ -0,0 +1,29 @@ +:man_page: bson_has_field + +bson_has_field() +================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_has_field (const bson_t *bson, const char *key); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``key``: A string containing the name of the field to check for. + +Description +----------- + +Checks to see if key contains an element named ``key``. This also accepts "dotkey" notation such as "a.b.c.d". + +Returns +------- + +true if ``key`` was found within ``bson``; otherwise false. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init.rst new file mode 100644 index 0000000..4139b70 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init.rst @@ -0,0 +1,27 @@ +:man_page: bson_init + +bson_init() +=========== + +Synopsis +-------- + +.. code-block:: c + + void + bson_init (bson_t *b); + +Parameters +---------- + +* ``b``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_init()` function shall initialize a :symbol:`bson_t` that is placed on the stack. This is equivalent to initializing a :symbol:`bson_t` to ``BSON_INITIALIZER``. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_from_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_from_json.rst new file mode 100644 index 0000000..d333cce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_from_json.rst @@ -0,0 +1,45 @@ +:man_page: bson_init_from_json + +bson_init_from_json() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_init_from_json (bson_t *bson, + const char *data, + ssize_t len, + bson_error_t *error); + +Parameters +---------- + +* ``bson``: Pointer to an uninitialized :symbol:`bson_t`. +* ``data``: A UTF-8 encoded string containing valid JSON. +* ``len``: The length of ``data`` in bytes excluding a trailing ``\0`` or -1 to determine the length with ``strlen()``. +* ``error``: An optional location for a :symbol:`bson_error_t`. + +Description +----------- + +The ``bson_init_from_json()`` function will initialize a new :symbol:`bson_t` by parsing the JSON found in ``data``. Only a single JSON object may exist in ``data`` or an error will be set and false returned. + +``data`` should be in `MongoDB Extended JSON `_ format. + +Errors +------ + +Errors are propagated via the ``error`` parameter. + +Returns +------- + +Returns ``true`` if valid JSON was parsed, otherwise ``false`` and ``error`` is set. On success, ``bson`` is initialized and must be freed with :symbol:`bson_destroy`, otherwise ``bson`` is invalid. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson json diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_static.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_static.rst new file mode 100644 index 0000000..ae77633 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_init_static.rst @@ -0,0 +1,36 @@ +:man_page: bson_init_static + +bson_init_static() +================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_init_static (bson_t *b, const uint8_t *data, size_t length); + +Parameters +---------- + +* ``b``: A :symbol:`bson_t`. +* ``data``: A buffer to initialize with. +* ``length``: The length of ``data`` in bytes. + +Description +----------- + +The :symbol:`bson_init_static()` function shall shall initialize a read-only :symbol:`bson_t` on the stack using the data provided. No copies of the data will be made and therefore must remain valid for the lifetime of the :symbol:`bson_t`. + +The resulting `bson_t` has internal references and therefore must not be copied to avoid dangling pointers in the copy. + +Returns +------- + +Returns ``true`` if :symbol:`bson_t` was successfully initialized, otherwise ``false``. The function can fail if ``data`` or ``length`` are invalid. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_array.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_array.rst new file mode 100644 index 0000000..6b03e92 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_array.rst @@ -0,0 +1,29 @@ +:man_page: bson_iter_array + +bson_iter_array() +================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_ARRAY(iter) (bson_iter_type ((iter)) == BSON_TYPE_ARRAY) + + void + bson_iter_array (const bson_iter_t *iter, + uint32_t *array_len, + const uint8_t **array); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``array_len``: A location for the buffer length. +* ``array``: A location for the immutable buffer. + +Description +----------- + +The ``bson_iter_array()`` function shall retrieve the raw buffer of a sub-array from ``iter``. ``iter`` *MUST* be on an element that is of type BSON_TYPE_ARRAY. This can be verified with :symbol:`bson_iter_type()` or the ``BSON_ITER_HOLDS_ARRAY()`` macro. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_bool.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_bool.rst new file mode 100644 index 0000000..a120a13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_bool.rst @@ -0,0 +1,40 @@ +:man_page: bson_iter_as_bool + +bson_iter_as_bool() +=================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_as_bool (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the current field as if it were a boolean. + +``bson_iter_as_bool()`` currently knows how to determine a boolean value from the following types: + +* BSON_TYPE_BOOL +* BSON_TYPE_DOUBLE +* BSON_TYPE_INT32 +* BSON_TYPE_INT64 +* BSON_TYPE_NULL +* BSON_TYPE_UNDEFINED +* BSON_TYPE_UTF8 + +BSON_TYPE_UTF8 will always equate to ``true``. + +Returns +------- + +true if the field equates to non-zero. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_double.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_double.rst new file mode 100644 index 0000000..bb5d52a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_double.rst @@ -0,0 +1,37 @@ +:man_page: bson_iter_as_double + +bson_iter_as_double() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_as_double (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the current field as if it were a double. + +``bson_iter_as_double()`` will cast the following types to double + +* BSON_TYPE_BOOL +* BSON_TYPE_DOUBLE +* BSON_TYPE_INT32 +* BSON_TYPE_INT64 + +Any other value will return 0. + +Returns +------- + +The value type casted to double. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_int64.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_int64.rst new file mode 100644 index 0000000..54f5b64 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_as_int64.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_as_int64 + +bson_iter_as_int64() +==================== + +Synopsis +-------- + +.. code-block:: c + + int64_t + bson_iter_as_int64 (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +The ``bson_iter_as_int64()`` function shall return the contents of the current element as if it were a BSON_TYPE_INT64 element. The currently supported casts include: + +* BSON_TYPE_BOOL +* BSON_TYPE_DOUBLE +* BSON_TYPE_INT32 +* BSON_TYPE_INT64 + +Returns +------- + +A 64-bit signed integer. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_binary.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_binary.rst new file mode 100644 index 0000000..b456bfb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_binary.rst @@ -0,0 +1,34 @@ +:man_page: bson_iter_binary + +bson_iter_binary() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_BINARY(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_BINARY) + + void + bson_iter_binary (const bson_iter_t *iter, + bson_subtype_t *subtype, + uint32_t *binary_len, + const uint8_t **binary); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``subtype``: A location for a :symbol:`bson_subtype_t` or NULL. +* ``binary_len``: A location for the length of ``binary``. +* ``binary``: A location for a pointer to the immutable buffer. + +Description +----------- + +This function shall return the binary data of a BSON_TYPE_BINARY element. It is a programming error to call this function on a field that is not of type BSON_TYPE_BINARY. You can check this with the BSON_ITER_HOLDS_BINARY() macro or :symbol:`bson_iter_type()`. + +The buffer that ``binary`` points to is only valid until the iterator's :symbol:`bson_t` is modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_bool.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_bool.rst new file mode 100644 index 0000000..a46f539 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_bool.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_bool + +bson_iter_bool() +================ + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_BOOL(iter) (bson_iter_type ((iter)) == BSON_TYPE_BOOL) + + bool + bson_iter_bool (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +The ``bson_iter_bool()`` function shall return the boolean value of a BSON_TYPE_BOOL element. It is a programming error to call this function on an element other than BSON_TYPE_BOOL. You can check this with :symbol:`bson_iter_type()` or ``BSON_ITER_HOLDS_BOOL()``. + +Returns +------- + +Either ``true`` or ``false``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_code.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_code.rst new file mode 100644 index 0000000..b9efdd1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_code.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_code + +bson_iter_code() +================ + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_CODE(iter) (bson_iter_type ((iter)) == BSON_TYPE_CODE) + + const char * + bson_iter_code (const bson_iter_t *iter, uint32_t *length); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``length``: A location for the length of the UTF-8 encoded string or NULL. + +Description +----------- + +This function returns the contents of a BSON_TYPE_CODE field. The length of the string is stored in ``length`` if non-NULL. + +It is invalid to call this function on a field that is not of type BSON_TYPE_CODE. + +Returns +------- + +A UTF-8 encoded string which should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_codewscope.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_codewscope.rst new file mode 100644 index 0000000..c220bc9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_codewscope.rst @@ -0,0 +1,37 @@ +:man_page: bson_iter_codewscope + +bson_iter_codewscope() +====================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_CODEWSCOPE(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_CODEWSCOPE) + + const char * + bson_iter_codewscope (const bson_iter_t *iter, + uint32_t *length, + uint32_t *scope_len, + const uint8_t **scope); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``length``: An optional location for the length of the resulting UTF-8 encoded string. +* ``scope_len``: A optional location for the length of ``scope``. +* ``scope``: An optional location to store the immutable raw scope BSON document. + +Description +----------- + +The ``bson_iter_codewscope()`` function acts similar to :symbol:`bson_iter_code()` except for BSON_TYPE_CODEWSCOPE elements. It also will provide a pointer to the buffer for scope, which can be loaded into a :symbol:`bson_t` using :symbol:`bson_init_static()`. + +Returns +------- + +An UTF-8 encoded string containing the JavaScript code which should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_date_time.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_date_time.rst new file mode 100644 index 0000000..5d11d7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_date_time.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_date_time + +bson_iter_date_time() +===================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_DATE_TIME(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DATE_TIME) + + int64_t + bson_iter_date_time (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +The bson_iter_date_time() function shall return the number of milliseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element. + +Returns +------- + +A 64-bit integer containing the number of milliseconds since the UNIX epoch. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dbpointer.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dbpointer.rst new file mode 100644 index 0000000..5c99189 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dbpointer.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_dbpointer + +bson_iter_dbpointer() +===================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_dbpointer (const bson_iter_t *iter, + uint32_t *collection_len, + const char **collection, + const bson_oid_t **oid); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``collection_len``: A location for the length of the collection name. +* ``collection``: A location for the collection name.. +* ``oid``: A location for a :symbol:`bson_oid_t`. + +Description +----------- + +Fetches the contents of a BSON_TYPE_DBPOINTER element. + +.. warning:: + + The BSON_TYPE_DBPOINTER field type is deprecated by the BSON spec and should not be used in new code. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_decimal128.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_decimal128.rst new file mode 100644 index 0000000..a76f44d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_decimal128.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_decimal128 + +bson_iter_decimal128() +====================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_DECIMAL128(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DECIMAL128) + + bool + bson_iter_decimal128 (const bson_iter_t *iter, /* IN */ + bson_decimal128_t *dec); /* OUT */ + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``dec``: A location for a :symbol:`bson_decimal128_t`. + +Description +----------- + +Fetches the value from a BSON_TYPE_DECIMAL128 field. You should verify that this is a BSON_TYPE_DECIMAL128 field before calling this function. + +Returns +------- + +true if type was BSON_TYPE_DECIMAL128, otherwise false. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_document.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_document.rst new file mode 100644 index 0000000..ff5b717 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_document.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_document + +bson_iter_document() +==================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_DOCUMENT(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DOCUMENT) + + void + bson_iter_document (const bson_iter_t *iter, + uint32_t *document_len, + const uint8_t **document); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``document_len``: A location for the length of the document in bytes. +* ``document``: A location for the document buffer. + +Description +----------- + +The ``bson_iter_document()`` function shall retrieve the raw buffer of a sub-document from ``iter``. ``iter`` *MUST* be on an element that is of type BSON_TYPE_DOCUMENT. This can be verified with :symbol:`bson_iter_type()` or the ``BSON_ITER_HOLDS_DOCUMENT()`` macro. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_double.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_double.rst new file mode 100644 index 0000000..7beccd5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_double.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_double + +bson_iter_double() +================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_DOUBLE(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DOUBLE) + + double + bson_iter_double (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the contents of a BSON_TYPE_DOUBLE field. + +Returns +------- + +A double. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dup_utf8.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dup_utf8.rst new file mode 100644 index 0000000..ac2a396 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_dup_utf8.rst @@ -0,0 +1,29 @@ +:man_page: bson_iter_dup_utf8 + +bson_iter_dup_utf8() +==================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_iter_dup_utf8 (const bson_iter_t *iter, uint32_t *length); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``length``: An optional location for the length of the UTF-8 encoded string. + +Description +----------- + +This function is similar to :symbol:`bson_iter_utf8()` except that it calls :symbol:`bson_strndup()` on the result. + +Returns +------- + +A newly allocated string that should be freed with :symbol:`bson_free()`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find.rst new file mode 100644 index 0000000..73ab0e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_find + +bson_iter_find() +================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_find (bson_iter_t *iter, const char *key); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``key``: A string containing the requested key. + +Description +----------- + +The ``bson_iter_find()`` function shall advance ``iter`` to the element named ``key`` or exhaust all elements of ``iter``. If ``iter`` is exhausted, false is returned and ``iter`` should be considered invalid. + +``key`` is case-sensitive. For a case-folded version, see :symbol:`bson_iter_find_case()`. + +Returns +------- + +true is returned if the requested key was found. If not, ``iter`` was exhausted and should now be considered invalid. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_case.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_case.rst new file mode 100644 index 0000000..f5d03f5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_case.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_find_case + +bson_iter_find_case() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_find_case (bson_iter_t *iter, const char *key); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``key``: An ASCII string containing the field to locate. + +Description +----------- + +Advances ``iter`` until it is observing an element matching the name of ``key`` or exhausting all elements. + +``key`` is not case-sensitive. The keys will be case-folded to determine a match using the current locale. + +Returns +------- + +true if ``key`` was found. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_descendant.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_descendant.rst new file mode 100644 index 0000000..36bb14e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_descendant.rst @@ -0,0 +1,32 @@ +:man_page: bson_iter_find_descendant + +bson_iter_find_descendant() +=========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_find_descendant (bson_iter_t *iter, + const char *dotkey, + bson_iter_t *descendant); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``dotkey``: A dot-notation key like ``"a.b.c.d"``. +* ``descendant``: A :symbol:`bson_iter_t`. + +Description +----------- + +The :symbol:`bson_iter_find_descendant()` function shall follow standard MongoDB dot notation to recurse into subdocuments. ``descendant`` will be initialized and advanced to the descendant. If false is returned, both ``iter`` and ``descendant`` should be considered invalid. + +Returns +------- + +true is returned if the requested key was found. If not, false is returned and ``iter`` was exhausted and should now be considered invalid. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_w_len.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_w_len.rst new file mode 100644 index 0000000..5cb8feb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_find_w_len.rst @@ -0,0 +1,32 @@ +:man_page: bson_iter_find_w_len + +bson_iter_find_w_len() +====================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_find_w_len (bson_iter_t *iter, const char *key, int keylen); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``key``: A string containing the requested key. +* ``keylen``: An integer indicating the length of the key string. + +Description +----------- + +The ``bson_iter_find_w_len()`` function shall advance ``iter`` to the element named ``key`` or exhaust all elements of ``iter``. If ``iter`` is exhausted, false is returned and ``iter`` should be considered invalid. + +``key`` is case-sensitive. For a case-folded version, see :symbol:`bson_iter_find_case()`. + +Returns +------- + +true is returned if the requested key was found. If not, ``iter`` was exhausted and should now be considered invalid. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init.rst new file mode 100644 index 0000000..0128f7c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init.rst @@ -0,0 +1,73 @@ +:man_page: bson_iter_init + +bson_iter_init() +================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init (bson_iter_t *iter, const bson_t *bson); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +The ``bson_iter_init()`` function shall initialize ``iter`` to iterate upon the BSON document ``bson``. Upon initialization, ``iter`` is placed before the first element. Callers must call :symbol:`bson_iter_next()`, :symbol:`bson_iter_find()`, or :symbol:`bson_iter_find_case()` to advance to an element. + +Returns +------- + +Returns true if the iter was successfully initialized. + +Example +------- + +.. code-block:: c + + static void + print_doc_id (const bson_t *doc) + { + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init (&iter, doc) && bson_iter_find (&iter, "_id") && + BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\n", oidstr); + } else { + printf ("Document is missing _id.\n"); + } + } + + /* alternatively */ + + static void + print_doc_id (const bson_t *doc) + { + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init_find (&iter, doc, "_id") && BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\n", oidstr); + } else { + printf ("Document is missing _id.\n"); + } + } + +.. only:: html + + .. taglist:: See Also: + :tags: iter-init diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find.rst new file mode 100644 index 0000000..7fb04c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find.rst @@ -0,0 +1,29 @@ +:man_page: bson_iter_init_find + +bson_iter_init_find() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init_find (bson_iter_t *iter, const bson_t *bson, const char *key); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``bson``: A :symbol:`bson_t`. +* ``key``: A key to locate after initializing the iter. + +Description +----------- + +This function is identical to ``(bson_iter_init() && bson_iter_find())``. + +.. only:: html + + .. taglist:: See Also: + :tags: iter-init diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_case.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_case.rst new file mode 100644 index 0000000..0938bc7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_case.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_init_find_case + +bson_iter_init_find_case() +========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init_find_case (bson_iter_t *iter, + const bson_t *bson, + const char *key); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``bson``: A :symbol:`bson_t`. +* ``key``: A key to locate after initializing the iter. + +Description +----------- + +This function is identical to ``bson_iter_init() && bson_iter_find_case()``. + +.. only:: html + + .. taglist:: See Also: + :tags: iter-init diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_w_len.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_w_len.rst new file mode 100644 index 0000000..83508f1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_find_w_len.rst @@ -0,0 +1,34 @@ +:man_page: bson_iter_init_find_w_len + +bson_iter_init_find_w_len() +=========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init_find_w_len (bson_iter_t *iter, + const bson_t *bson, + const char *key, + int keylen); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``bson``: A :symbol:`bson_t`. +* ``key``: A key to locate after initializing the iter. +* ``keylen``: An integer indicating the length of the key string. + +Description +----------- + +This function is identical to ``(bson_iter_init() && bson_iter_find_w_len())``. + +.. only:: html + + .. taglist:: See Also: + :tags: iter-init + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data.rst new file mode 100644 index 0000000..5adcc63 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data.rst @@ -0,0 +1,56 @@ +:man_page: bson_iter_init_from_data + +bson_iter_init_from_data() +========================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init_from_data (bson_iter_t *iter, const uint8_t *data, size_t length); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``data``: A buffer to initialize with. +* ``length``: The length of ``data`` in bytes. + +Description +----------- + +The ``bson_iter_init_from_data()`` function shall initialize ``iter`` to iterate upon the buffer ``data``, which must contain a BSON document. Upon initialization, ``iter`` is placed before the first element. Callers must call :symbol:`bson_iter_next()`, :symbol:`bson_iter_find()`, or :symbol:`bson_iter_find_case()` to advance to an element. + +Returns +------- + +Returns true if the iter was successfully initialized. + +Example +------- + +.. code-block:: c + + static void + print_doc_id (const uint8_t *data, size_t length) + { + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init_from_data (&iter, data, length) && bson_iter_find (&iter, "_id") && + BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\n", oidstr); + } else { + printf ("Document is missing _id.\n"); + } + } + +.. only:: html + + .. taglist:: See Also: + :tags: iter-init diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data_at_offset.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data_at_offset.rst new file mode 100644 index 0000000..10d9cfc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_init_from_data_at_offset.rst @@ -0,0 +1,57 @@ +:man_page: bson_iter_init_from_data_at_offset + +bson_iter_init_from_data_at_offset() +==================================== + + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_init_from_data_at_offset (bson_iter_t *iter, + const uint8_t *data, + size_t length, + uint32_t offset, + uint32_t keylen); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``data``: A buffer to initialize with. This is not validated. +* ``length``: The length of ``data`` in bytes. This is not validated. +* ``offset``: The offset of the field to start iterating. This is not validated. This should be an offset previously obtained from :symbol:`bson_iter_offset()`. +* ``keylen``: The string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained from :symbol:`bson_iter_key_len()`. + +Description +----------- + +Creates a :symbol:`bson_iter_t` and starts iteration on a field at the offset. + +:symbol:`bson_iter_init_from_data_at_offset` is useful for situations where the +progress of a :symbol:`bson_iter_t` must be saved and restored without relying +on the :symbol:`bson_iter_t` data layout. Saving the progress could be +accomplished by: + +- Saving the current field's key length with :symbol:`bson_iter_key_len()` +- Saving the current offset with :symbol:`bson_iter_offset()` +- Saving the data pointer of the iterated :symbol:`bson_t` with :symbol:`bson_get_data()` +- Saving the data length of the iterated :symbol:`bson_t` with the ``len`` struct field + +Then later, these saved values can be passed to +:symbol:`bson_iter_init_from_data_at_offset()` to reconstruct the +:symbol:`bson_iter_t` in constant time. + +See Also +-------- + +* :symbol:`bson_iter_key_len()` +* :symbol:`bson_iter_offset()` +* :symbol:`bson_get_data()` + +Returns +------- + +Returns true if the iter was successfully initialized. \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int32.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int32.rst new file mode 100644 index 0000000..94fef37 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int32.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_int32 + +bson_iter_int32() +================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_INT32(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT32) + + int32_t + bson_iter_int32 (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the value from a BSON_TYPE_INT32 element. You should verify that the field is a BSON_TYPE_INT32 field before calling this function. + +Returns +------- + +A 32-bit integer. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int64.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int64.rst new file mode 100644 index 0000000..99ec975 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_int64.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_int64 + +bson_iter_int64() +================= + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_INT64(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT64) + + int64_t + bson_iter_int64 (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the value from a BSON_TYPE_INT64 field. You should verify that this is a BSON_TYPE_INT64 field before calling this function. + +Returns +------- + +A 64-bit integer. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key.rst new file mode 100644 index 0000000..af422e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_key + +bson_iter_key() +=============== + +Synopsis +-------- + +.. code-block:: c + + const char * + bson_iter_key (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the key for the current element observed by ``iter``. + +See Also +-------- + +:symbol:`bson_iter_key_len()` to retrieve the length of the key in constant time. + +Returns +------- + +A string which should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key_len.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key_len.rst new file mode 100644 index 0000000..16acb13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_key_len.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_key_len + +bson_iter_key_len() +=================== + +Synopsis +-------- + +.. code-block:: c + + uint32_t + bson_iter_key_len (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the length of the key for the current element observed by ``iter``. This is a constant time computation, and therefore faster than calling ``strlen()`` on a key returned by :symbol:`bson_iter_key()`. + +See Also +-------- + +:symbol:`bson_iter_key()` to retrieve current key. + +Returns +------- + +An integer representing the key length. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_next.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_next.rst new file mode 100644 index 0000000..fc7bdb6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_next.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_next + +bson_iter_next() +================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_next (bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Advances ``iter`` to the next element in the document. + +Returns +------- + +true if ``iter`` was advanced. Returns false if ``iter`` has passed the last element in the document or encountered invalid BSON. + +It is a programming error to use ``iter`` after this function has returned false. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_offset.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_offset.rst new file mode 100644 index 0000000..86430d3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_offset.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_offset + +bson_iter_offset() +================== + +Synopsis +-------- + +.. code-block:: c + + uint32_t + bson_iter_offset (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the offset for the current element observed by ``iter``. + +See Also +-------- + +:symbol:`bson_iter_init_from_data_at_offset()` to use this offset to reconstruct a :symbol:`bson_iter_t` in constant time. + +Returns +------- + +An unsigned integer representing the offset in the BSON data of the current element. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_oid.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_oid.rst new file mode 100644 index 0000000..9a6633a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_oid.rst @@ -0,0 +1,30 @@ +:man_page: bson_iter_oid + +bson_iter_oid() +=============== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_OID(iter) (bson_iter_type ((iter)) == BSON_TYPE_OID) + + const bson_oid_t * + bson_iter_oid (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the :symbol:`bson_oid_t` for a BSON_TYPE_OID element. You should verify it is an element of type BSON_TYPE_OID before calling this function. + +Returns +------- + +A :symbol:`bson_oid_t` that should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_bool.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_bool.rst new file mode 100644 index 0000000..3c85b0d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_bool.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_bool + +bson_iter_overwrite_bool() +========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_bool (bson_iter_t *iter, bool value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: A bool containing the new value. + +Description +----------- + +The ``bson_iter_overwrite_bool()`` function shall overwrite the contents of a BSON_TYPE_BOOL element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_BOOL. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_date_time.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_date_time.rst new file mode 100644 index 0000000..8fccb13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_date_time.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_date_time + +bson_iter_overwrite_date_time() +=============================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: The date and time as specified in milliseconds since the UNIX epoch. + +Description +----------- + +The ``bson_iter_overwrite_date_time()`` function shall overwrite the contents of a BSON_TYPE_DATE_TIME element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_DATE_TIME. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_decimal128.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_decimal128.rst new file mode 100644 index 0000000..d1308e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_decimal128.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_decimal128 + +bson_iter_overwrite_decimal128() +================================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_overwrite_decimal128 (bson_iter_t *iter, bson_decimal128_t *value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: The new Decimal128 value. + +Description +----------- + +The :symbol:`bson_iter_overwrite_decimal128()` function shall overwrite the contents of a BSON_TYPE_DECIMAL128 element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_DECIMAL128. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_double.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_double.rst new file mode 100644 index 0000000..ca42333 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_double.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_double + +bson_iter_overwrite_double() +============================ + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_double (bson_iter_t *iter, double value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: The new double value. + +Description +----------- + +The :symbol:`bson_iter_overwrite_double()` function shall overwrite the contents of a BSON_TYPE_DOUBLE element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_DOUBLE. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int32.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int32.rst new file mode 100644 index 0000000..931f60f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int32.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_int32 + +bson_iter_overwrite_int32() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_int32 (bson_iter_t *iter, int32_t value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: A int32_t. + +Description +----------- + +The :symbol:`bson_iter_overwrite_int32()` function shall overwrite the contents of a BSON_TYPE_INT32 element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_BOOL. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int64.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int64.rst new file mode 100644 index 0000000..e74714d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_int64.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_int64 + +bson_iter_overwrite_int64() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_int64 (bson_iter_t *iter, int64_t value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``value``: A int64_t. + +Description +----------- + +The :symbol:`bson_iter_overwrite_int64()` function shall overwrite the contents of a BSON_TYPE_INT64 element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_INT64. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_oid.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_oid.rst new file mode 100644 index 0000000..85f013f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_oid.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_overwrite_oid + +bson_iter_overwrite_oid() +========================= + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_oid (bson_iter_t *iter, const bson_oid_t *value); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``oid``: A :symbol:`bson_oid_t`. + +Description +----------- + +The ``bson_iter_overwrite_oid()`` function shall overwrite the contents of a BSON_TYPE_OID element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_OID. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_timestamp.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_timestamp.rst new file mode 100644 index 0000000..8973009 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_overwrite_timestamp.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_overwrite_timestamp + +bson_iter_overwrite_timestamp() +=============================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_overwrite_timestamp (bson_iter_t *iter, + uint32_t timestamp, + uint32_t increment); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``timestamp``: A uint32_t. +* ``increment``: A uint32_t. + +Description +----------- + +The ``bson_iter_overwrite_timestamp()`` function shall overwrite the contents of a BSON_TYPE_TIMESTAMP element in place. + +This may only be done when the underlying bson document allows mutation. + +It is a programming error to call this function when ``iter`` is not observing an element of type BSON_TYPE_TIMESTAMP. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_recurse.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_recurse.rst new file mode 100644 index 0000000..f13843c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_recurse.rst @@ -0,0 +1,32 @@ +:man_page: bson_iter_recurse + +bson_iter_recurse() +=================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_recurse (const bson_iter_t *iter, bson_iter_t *child); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``child``: A :symbol:`bson_iter_t`. + +Description +----------- + +The :symbol:`bson_iter_recurse()` function shall initialize ``child`` using the embedded document or array currently observed by ``iter``. + +If there was a failure to initialize the ``iter``, false is returned and both ``iter`` and ``child`` should be considered invalid. + +This should only be called when observing an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT. + +Returns +------- + +If ``iter`` observes an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT, then ``child`` is initialized and the function returns ``true``. Otherwise, the function returns ``false`` and ``child`` is invalid. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_regex.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_regex.rst new file mode 100644 index 0000000..aa87e12 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_regex.rst @@ -0,0 +1,31 @@ +:man_page: bson_iter_regex + +bson_iter_regex() +================= + +Synopsis +-------- + +.. code-block:: c + + const char * + bson_iter_regex (const bson_iter_t *iter, const char **options); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``options``: A (null). + +Description +----------- + +The :symbol:`bson_iter_regex()` function shall retrieve the contents of a BSON_TYPE_REGEX element currently observed by ``iter``. + +It is invalid to call this function when not observing an element of type BSON_TYPE_REGEX. + +Returns +------- + +A string containing the regex which should not be modified or freed. ``options`` is set to the options provided for the regex. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_symbol.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_symbol.rst new file mode 100644 index 0000000..d21d67b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_symbol.rst @@ -0,0 +1,33 @@ +:man_page: bson_iter_symbol + +bson_iter_symbol() +================== + +Synopsis +-------- + +.. code-block:: c + + const char * + bson_iter_symbol (const bson_iter_t *iter, uint32_t *length); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``length``: A uint32_t. + +Description +----------- + +The symbol element type is *DEPRECATED* in the bson specification at http://bsonspec.org. + +The :symbol:`bson_iter_symbol()` function shall return the contents of a BSON_TYPE_SYMBOL element. + +If non-NULL, ``length`` will be set to the length of the resulting string. + +Returns +------- + +The symbol and ``length`` is set. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_t.rst new file mode 100644 index 0000000..620388f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_t.rst @@ -0,0 +1,178 @@ +:man_page: bson_iter_t + +bson_iter_t +=========== + +BSON Document Iterator + +Synopsis +-------- + +.. code-block:: c + + #include + + #define BSON_ITER_HOLDS_DOUBLE(iter) /* ... */ + + #define BSON_ITER_HOLDS_UTF8(iter) /* ... */ + + #define BSON_ITER_HOLDS_DOCUMENT(iter) /* ... */ + + #define BSON_ITER_HOLDS_ARRAY(iter) /* ... */ + + #define BSON_ITER_HOLDS_BINARY(iter) /* ... */ + + #define BSON_ITER_HOLDS_UNDEFINED(iter) /* ... */ + + #define BSON_ITER_HOLDS_OID(iter) /* ... */ + + #define BSON_ITER_HOLDS_BOOL(iter) /* ... */ + + #define BSON_ITER_HOLDS_DATE_TIME(iter) /* ... */ + + #define BSON_ITER_HOLDS_NULL(iter) /* ... */ + + #define BSON_ITER_HOLDS_REGEX(iter) /* ... */ + + #define BSON_ITER_HOLDS_DBPOINTER(iter) /* ... */ + + #define BSON_ITER_HOLDS_CODE(iter) /* ... */ + + #define BSON_ITER_HOLDS_SYMBOL(iter) /* ... */ + + #define BSON_ITER_HOLDS_CODEWSCOPE(iter) /* ... */ + + #define BSON_ITER_HOLDS_INT32(iter) /* ... */ + + #define BSON_ITER_HOLDS_TIMESTAMP(iter) /* ... */ + + #define BSON_ITER_HOLDS_INT64(iter) /* ... */ + + #define BSON_ITER_HOLDS_DECIMAL128(iter) /* ... */ + + #define BSON_ITER_HOLDS_MAXKEY(iter) /* ... */ + + #define BSON_ITER_HOLDS_MINKEY(iter) /* ... */ + + #define BSON_ITER_HOLDS_INT(iter) \ + (BSON_ITER_HOLDS_INT32 (iter) || BSON_ITER_HOLDS_INT64 (iter)) + + #define BSON_ITER_HOLDS_NUMBER(iter) \ + (BSON_ITER_HOLDS_INT (iter) || BSON_ITER_HOLDS_DOUBLE (iter)) + + #define BSON_ITER_IS_KEY(iter, key) \ + (0 == strcmp ((key), bson_iter_key ((iter)))) + + typedef struct { + /*< private >*/ + } bson_iter_t; + +Description +----------- + +:symbol:`bson_iter_t` is a structure used to iterate through the elements of a :symbol:`bson_t`. It is meant to be used on the stack and can be discarded at any time as it contains no external allocation. The contents of the structure should be considered private and may change between releases, however the structure size will not change. + +The :symbol:`bson_t` *MUST* be valid for the lifetime of the iter and it is an error to modify the :symbol:`bson_t` while using the iter. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_iter_array + bson_iter_as_bool + bson_iter_as_double + bson_iter_as_int64 + bson_iter_binary + bson_iter_bool + bson_iter_code + bson_iter_codewscope + bson_iter_date_time + bson_iter_dbpointer + bson_iter_decimal128 + bson_iter_document + bson_iter_double + bson_iter_dup_utf8 + bson_iter_find + bson_iter_find_case + bson_iter_find_descendant + bson_iter_find_w_len + bson_iter_init + bson_iter_init_find + bson_iter_init_find_case + bson_iter_init_find_w_len + bson_iter_init_from_data + bson_iter_init_from_data_at_offset + bson_iter_int32 + bson_iter_int64 + bson_iter_key + bson_iter_key_len + bson_iter_next + bson_iter_offset + bson_iter_oid + bson_iter_overwrite_bool + bson_iter_overwrite_date_time + bson_iter_overwrite_decimal128 + bson_iter_overwrite_double + bson_iter_overwrite_int32 + bson_iter_overwrite_int64 + bson_iter_overwrite_oid + bson_iter_overwrite_timestamp + bson_iter_recurse + bson_iter_regex + bson_iter_symbol + bson_iter_time_t + bson_iter_timestamp + bson_iter_timeval + bson_iter_type + bson_iter_utf8 + bson_iter_value + bson_iter_visit_all + +Examples +-------- + +.. code-block:: c + + bson_iter_t iter; + + if (bson_iter_init (&iter, my_bson_doc)) { + while (bson_iter_next (&iter)) { + printf ("Found a field named: %s\n", bson_iter_key (&iter)); + } + } + +.. code-block:: c + + bson_iter_t iter; + + if (bson_iter_init (&iter, my_bson_doc) && bson_iter_find (&iter, "my_field")) { + printf ("Found the field named: %s\n", bson_iter_key (&iter)); + } + +.. code-block:: c + + bson_iter_t iter; + bson_iter_t sub_iter; + + if (bson_iter_init_find (&iter, my_bson_doc, "mysubdoc") && + (BSON_ITER_HOLDS_DOCUMENT (&iter) || BSON_ITER_HOLDS_ARRAY (&iter)) && + bson_iter_recurse (&iter, &sub_iter)) { + while (bson_iter_next (&sub_iter)) { + printf ("Found key \"%s\" in sub document.\n", bson_iter_key (&sub_iter)); + } + } + +.. code-block:: c + + bson_iter_t iter; + + if (bson_iter_init (&iter, my_doc) && + bson_iter_find_descendant (&iter, "a.b.c.d", &sub_iter)) { + printf ("The type of a.b.c.d is: %d\n", (int) bson_iter_type (&sub_iter)); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_time_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_time_t.rst new file mode 100644 index 0000000..080c55a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_time_t.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_time_t + +bson_iter_time_t() +================== + +Synopsis +-------- + +.. code-block:: c + + time_t + bson_iter_time_t (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +The :symbol:`bson_iter_time_t()` function shall return the number of seconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element. + +Returns +------- + +A ``time_t`` containing the number of seconds since the UNIX epoch. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timestamp.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timestamp.rst new file mode 100644 index 0000000..c0be03a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timestamp.rst @@ -0,0 +1,34 @@ +:man_page: bson_iter_timestamp + +bson_iter_timestamp() +===================== + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_TIMESTAMP(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_TIMESTAMP) + + void + bson_iter_timestamp (const bson_iter_t *iter, + uint32_t *timestamp, + uint32_t *increment); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``timestamp``: A uint32_t. +* ``increment``: A uint32_t. + +Description +----------- + +The BSON_TYPE_TIMESTAMP type is not a date/time and is typically used for intra-server communication. + +You probably want :symbol:`bson_iter_date_time()`. + +The :symbol:`bson_iter_timestamp()` function shall return the contents of a BSON_TYPE_TIMESTAMP element. It is invalid to call this function while observing an element that is not of type BSON_TYPE_TIMESTAMP. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timeval.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timeval.rst new file mode 100644 index 0000000..6e10ff4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_timeval.rst @@ -0,0 +1,24 @@ +:man_page: bson_iter_timeval + +bson_iter_timeval() +=================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_iter_timeval (const bson_iter_t *iter, struct timeval *tv); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``tv``: A struct timeval. + +Description +----------- + +The :symbol:`bson_iter_timeval()` function shall return the number of seconds and microseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element into ``tv``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_type.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_type.rst new file mode 100644 index 0000000..f8aafe3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_type.rst @@ -0,0 +1,52 @@ +:man_page: bson_iter_type + +bson_iter_type() +================ + +Synopsis +-------- + +.. code-block:: c + + typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, + } bson_type_t; + + bson_type_t + bson_iter_type (const bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +The ``bson_iter_type()`` function shall return the type of the observed element in a bson document. + +Returns +------- + +A :symbol:`bson_type_t`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_utf8.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_utf8.rst new file mode 100644 index 0000000..1e113ca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_utf8.rst @@ -0,0 +1,37 @@ +:man_page: bson_iter_utf8 + +bson_iter_utf8() +================ + +Synopsis +-------- + +.. code-block:: c + + #define BSON_ITER_HOLDS_UTF8(iter) (bson_iter_type ((iter)) == BSON_TYPE_UTF8) + + const char * + bson_iter_utf8 (const bson_iter_t *iter, uint32_t *length); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``length``: An optional location for the length of the resulting UTF-8 encoded string. + +Description +----------- + +The :symbol:`bson_iter_utf8()` function shall retrieve the contents of a BSON_TYPE_UTF8 element currently observed by ``iter``. + +It is invalid to call this function while observing an element other than BSON_TYPE_UTF8. + +Returns +------- + +A UTF-8 encoded string that has not been modified or freed. + +It is suggested that the caller validate the content is valid UTF-8 before using this in other places. That can be done by calling :symbol:`bson_utf8_validate()` or validating the underlying :symbol:`bson_t` before iterating it. + +Note that not all drivers use multi-byte representation for ``\0`` in UTF-8 encodings (commonly referred to as modified-UTF8). You probably want to take a look at the length field when marshaling to other runtimes. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_value.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_value.rst new file mode 100644 index 0000000..d528b5b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_value.rst @@ -0,0 +1,28 @@ +:man_page: bson_iter_value + +bson_iter_value() +================= + +Synopsis +-------- + +.. code-block:: c + + const bson_value_t * + bson_iter_value (bson_iter_t *iter); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. + +Description +----------- + +Fetches the value for the currently observed type as a boxed type. This allows passing around the value without knowing the type at runtime. + +Returns +------- + +A :symbol:`bson_value_t` that should not be modified or freed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_visit_all.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_visit_all.rst new file mode 100644 index 0000000..e7e3523 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_iter_visit_all.rst @@ -0,0 +1,34 @@ +:man_page: bson_iter_visit_all + +bson_iter_visit_all() +===================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_iter_visit_all (bson_iter_t *iter, + const bson_visitor_t *visitor, + void *data); + +Parameters +---------- + +* ``iter``: A :symbol:`bson_iter_t`. +* ``visitor``: A :symbol:`bson_visitor_t`. +* ``data``: Optional data for ``visitor``. + +Description +----------- + +A convenience function to iterate all remaining fields of ``iter`` using the callback vtable provided by ``visitor``. + +Returns +------- + +Returns true if visitation was prematurely stopped by a callback function. Returns false either because all elements were visited *or* due to corrupt BSON. + +See :symbol:`bson_visitor_t` for examples of how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_ingest.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_ingest.rst new file mode 100644 index 0000000..7bdc4b2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_ingest.rst @@ -0,0 +1,27 @@ +:man_page: bson_json_data_reader_ingest + +bson_json_data_reader_ingest() +============================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_json_data_reader_ingest (bson_json_reader_t *reader, + const uint8_t *data, + size_t len); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_json_reader_t`. +* ``data``: A uint8_t containing data to feed. +* ``len``: A size_t containing the length of ``data``. + +Description +----------- + +Feed data to a memory based json reader. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_new.rst new file mode 100644 index 0000000..c263320 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_data_reader_new.rst @@ -0,0 +1,31 @@ +:man_page: bson_json_data_reader_new + +bson_json_data_reader_new() +=========================== + +Synopsis +-------- + +.. code-block:: c + + bson_json_reader_t * + bson_json_data_reader_new (bool allow_multiple, size_t size); + +Parameters +---------- + +* ``allow_multiple``: Unused. +* ``size``: A requested buffer size. + +Description +----------- + +Creates a new streaming JSON reader that will convert JSON documents to BSON. + +The ``allow_multiple`` parameter is unused. + +Returns +------- + +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_destroy.rst new file mode 100644 index 0000000..eb1eb3d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_destroy.rst @@ -0,0 +1,22 @@ +:man_page: bson_json_reader_destroy + +bson_json_reader_destroy() +========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_json_reader_destroy (bson_json_reader_t *reader); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_json_reader_t`. + +Description +----------- + +Frees a bson_json_reader_t. Does nothing if ``reader`` is NULL. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new.rst new file mode 100644 index 0000000..f37c151 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new.rst @@ -0,0 +1,38 @@ +:man_page: bson_json_reader_new + +bson_json_reader_new() +====================== + +Synopsis +-------- + +.. code-block:: c + + bson_json_reader_t * + bson_json_reader_new (void *data, + bson_json_reader_cb cb, + bson_json_destroy_cb dcb, + bool allow_multiple, + size_t buf_size); + +Parameters +---------- + +* ``data``: A user-defined pointer. +* ``cb``: A bson_json_reader_cb. +* ``dcb``: A bson_json_destroy_cb. +* ``allow_multiple``: Unused. +* ``buf_size``: A size_t containing the requested internal buffer size. + +Description +----------- + +Creates a new bson_json_reader_t that can read from an arbitrary data source in a streaming fashion. + +The ``allow_multiple`` parameter is unused. + +Returns +------- + +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_fd.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_fd.rst new file mode 100644 index 0000000..9b7982b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_fd.rst @@ -0,0 +1,29 @@ +:man_page: bson_json_reader_new_from_fd + +bson_json_reader_new_from_fd() +============================== + +Synopsis +-------- + +.. code-block:: c + + bson_json_reader_t * + bson_json_reader_new_from_fd (int fd, bool close_on_destroy); + +Parameters +---------- + +* ``fd``: An open file-descriptor. +* ``close_on_destroy``: Whether ``close()`` should be called on ``fd`` when the reader is destroyed. + +Description +----------- + +Creates a new JSON to BSON converter that will be reading from the file-descriptor ``fd``. + +Returns +------- + +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_file.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_file.rst new file mode 100644 index 0000000..1d603fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_new_from_file.rst @@ -0,0 +1,34 @@ +:man_page: bson_json_reader_new_from_file + +bson_json_reader_new_from_file() +================================ + +Synopsis +-------- + +.. code-block:: c + + bson_json_reader_t * + bson_json_reader_new_from_file (const char *filename, bson_error_t *error); + +Parameters +---------- + +* ``filename``: A file-name in the system file-name encoding. +* ``error``: A :symbol:`bson_error_t`. + +Description +----------- + +Creates a new bson_json_reader_t using the underlying file found at ``filename``. + +Errors +------ + +Errors are propagated via ``error``. + +Returns +------- + +A newly allocated bson_json_reader_t if successful, otherwise NULL and error is set. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_read.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_read.rst new file mode 100644 index 0000000..ae6c69e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_read.rst @@ -0,0 +1,41 @@ +:man_page: bson_json_reader_read + +bson_json_reader_read() +======================= + +Synopsis +-------- + +.. code-block:: c + + int + bson_json_reader_read (bson_json_reader_t *reader, + bson_t *bson, + bson_error_t *error); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_json_reader_t`. +* ``bson``: A :symbol:`bson_t`. +* ``error``: A :symbol:`bson_error_t`. + +Description +----------- + +Reads the next BSON document from the underlying JSON source. + +Errors +------ + +Errors are propagated via the ``error`` parameter. + +Returns +------- + +1 if successful and data was read. 0 if successful and no data was read. -1 if there was an error. + +.. only:: html + + .. taglist:: See Also: + :tags: json diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_t.rst new file mode 100644 index 0000000..cd79588 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_json_reader_t.rst @@ -0,0 +1,143 @@ +:man_page: bson_json_reader_t + +bson_json_reader_t +================== + +Bulk JSON to BSON conversion + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct _bson_json_reader_t bson_json_reader_t; + + typedef enum { + BSON_JSON_ERROR_READ_CORRUPT_JS = 1, + BSON_JSON_ERROR_READ_INVALID_PARAM, + BSON_JSON_ERROR_READ_CB_FAILURE, + } bson_json_error_code_t; + +Description +----------- + +The :symbol:`bson_json_reader_t` structure is used for reading a sequence of JSON documents and transforming them to :symbol:`bson_t` documents. + +This can often be useful if you want to perform bulk operations that are defined in a file containing JSON documents. + +.. tip:: + + :symbol:`bson_json_reader_t` works upon JSON documents formatted in `MongoDB extended JSON `_ format. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_json_data_reader_ingest + bson_json_data_reader_new + bson_json_reader_destroy + bson_json_reader_new + bson_json_reader_new_from_fd + bson_json_reader_new_from_file + bson_json_reader_read + +Example +------- + +.. code-block:: c + + /* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + /* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + + #include + #include + #include + + + int + main (int argc, char *argv[]) + { + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\n%s\n", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\n"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc.rst new file mode 100644 index 0000000..f7a09c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc.rst @@ -0,0 +1,36 @@ +:man_page: bson_malloc + +bson_malloc() +============= + +Synopsis +-------- + +.. code-block:: c + + void * + bson_malloc (size_t num_bytes); + +Parameters +---------- + +* ``num_bytes``: A size_t containing the number of bytes to allocate. + +Description +----------- + +This is a portable ``malloc()`` wrapper. + +In general, this function will return an allocation at least ``sizeof(void*)`` bytes or bigger. + +If there was a failure to allocate ``num_bytes`` bytes, the process will be aborted. + +.. warning:: + + This function will abort on failure to allocate memory. + +Returns +------- + +A pointer to a memory region which *HAS NOT* been zeroed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc0.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc0.rst new file mode 100644 index 0000000..bbab2fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_malloc0.rst @@ -0,0 +1,36 @@ +:man_page: bson_malloc0 + +bson_malloc0() +============== + +Synopsis +-------- + +.. code-block:: c + + void * + bson_malloc0 (size_t num_bytes); + +Parameters +---------- + +* ``num_bytes``: A size_t. + +Description +----------- + +This is a portable ``malloc()`` wrapper that also sets the memory to zero. Similar to ``calloc()``. + +In general, this function will return an allocation at least ``sizeof(void*)`` bytes or bigger. + +If there was a failure to allocate ``num_bytes`` bytes, the process will be aborted. + +.. warning:: + + This function will abort on failure to allocate memory. + +Returns +------- + +A pointer to a memory region which *HAS* been zeroed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_append.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_append.rst new file mode 100644 index 0000000..fc11db6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_append.rst @@ -0,0 +1,32 @@ +:man_page: bson_md5_append + +bson_md5_append() +================= + +Deprecated +---------- +All MD5 APIs are deprecated in libbson. + +Synopsis +-------- + +.. code-block:: c + + void + bson_md5_append (bson_md5_t *pms, + const uint8_t *data, + uint32_t nbytes) BSON_GNUC_DEPRECATED; + +Parameters +---------- + +* ``pms``: A :symbol:`bson_md5_t`. +* ``data``: A memory region to feed to the md5 algorithm. +* ``nbytes``: The length of ``data`` in bytes. + +Description +----------- + +Feeds more data into the MD5 algorithm. + +This function is deprecated and should not be used in new code. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_finish.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_finish.rst new file mode 100644 index 0000000..1013c11 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_finish.rst @@ -0,0 +1,29 @@ +:man_page: bson_md5_finish + +bson_md5_finish() +================= + +Deprecated +---------- +All MD5 APIs are deprecated in libbson. + +Synopsis +-------- + +.. code-block:: c + + void + bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) BSON_GNUC_DEPRECATED; + +Parameters +---------- + +* ``pms``: A :symbol:`bson_md5_t`. +* ``digest``: A location for the digest. + +Description +----------- + +Completes the MD5 algorithm and stores the digest in ``digest``. + +This function is deprecated and should not be used in new code. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_init.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_init.rst new file mode 100644 index 0000000..c96b089 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_init.rst @@ -0,0 +1,28 @@ +:man_page: bson_md5_init + +bson_md5_init() +=============== + +Deprecated +---------- +All MD5 APIs are deprecated in libbson. + +Synopsis +-------- + +.. code-block:: c + + void + bson_md5_init (bson_md5_t *pms) BSON_GNUC_DEPRECATED; + +Parameters +---------- + +* ``pms``: A :symbol:`bson_md5_t`. + +Description +----------- + +Initialize a new instance of the MD5 algorithm. + +This function is deprecated and should not be used in new code. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_t.rst new file mode 100644 index 0000000..6dc2e51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_md5_t.rst @@ -0,0 +1,40 @@ +:man_page: bson_md5_t + +bson_md5_t +========== + +BSON MD5 Abstraction + +Deprecated +---------- +All MD5 APIs are deprecated in libbson. + +Synopsis +-------- + +.. code-block:: c + + typedef struct { + uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t abcd[4]; /* digest buffer */ + uint8_t buf[64]; /* accumulate block */ + } bson_md5_t; + +Description +----------- + +bson_md5_t encapsulates an implementation of the MD5 algorithm. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_md5_append + bson_md5_finish + bson_md5_init + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_restore_vtable.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_restore_vtable.rst new file mode 100644 index 0000000..418c76d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_restore_vtable.rst @@ -0,0 +1,22 @@ +:man_page: bson_mem_restore_vtable + +bson_mem_restore_vtable() +========================= + +Synopsis +-------- + +.. code-block:: c + + void + bson_mem_restore_vtable (void); + +Description +----------- + +This function shall restore the default memory allocator to be used by Libbson. + +.. warning:: + + This function *MUST* be called at the end of the process. Failure to do so will result in memory being freed by the wrong allocator. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_set_vtable.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_set_vtable.rst new file mode 100644 index 0000000..85574aa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_mem_set_vtable.rst @@ -0,0 +1,35 @@ +:man_page: bson_mem_set_vtable + +bson_mem_set_vtable() +===================== + +Synopsis +-------- + +.. code-block:: c + + typedef struct _bson_mem_vtable_t { + void *(*malloc) (size_t num_bytes); + void *(*calloc) (size_t n_members, size_t num_bytes); + void *(*realloc) (void *mem, size_t num_bytes); + void (*free) (void *mem); + void *padding[4]; + } bson_mem_vtable_t; + + void + bson_mem_set_vtable (const bson_mem_vtable_t *vtable); + +Parameters +---------- + +* ``vtable``: A bson_mem_vtable_t with every non-padding field set. + +Description +----------- + +This function shall install a new memory allocator to be used by Libbson. + +.. warning:: + + This function *MUST* be called at the beginning of the process. Failure to do so will result in memory being freed by the wrong allocator. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_memory.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_memory.rst new file mode 100644 index 0000000..c3802ac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_memory.rst @@ -0,0 +1,33 @@ +:man_page: bson_memory + +Memory Management +================= + +BSON Memory Abstraction. + +Description +----------- + +Libbson contains a lightweight memory abstraction to make portability to new platforms easier. Additionally, it helps us integrate with interesting higher-level languages. One caveat, however, is that Libbson is not designed to deal with Out of Memory (OOM) situations. Doing so requires extreme diligence throughout the application stack that has rarely been implemented correctly. This may change in the future. As it stands now, Libbson will ``abort()`` under OOM situations. + +To aid in language binding integration, Libbson allows for setting a custom memory allocator via :symbol:`bson_mem_set_vtable()`. This allocation may be reversed via :symbol:`bson_mem_restore_vtable()`. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_free + bson_malloc + bson_malloc0 + bson_mem_restore_vtable + bson_mem_set_vtable + bson_realloc + bson_realloc_ctx + bson_realloc_func + bson_zero_free + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new.rst new file mode 100644 index 0000000..c100d3e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new.rst @@ -0,0 +1,27 @@ +:man_page: bson_new + +bson_new() +========== + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_new (void); + +Description +----------- + +The :symbol:`bson_new()` function shall create a new :symbol:`bson_t` structure on the heap. It should be freed with :symbol:`bson_destroy()` when it is no longer in use. + +Returns +------- + +A newly allocated :symbol:`bson_t` that should be freed with :symbol:`bson_destroy()`. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_buffer.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_buffer.rst new file mode 100644 index 0000000..69294ea --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_buffer.rst @@ -0,0 +1,42 @@ +:man_page: bson_new_from_buffer + +bson_new_from_buffer() +====================== + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_new_from_buffer (uint8_t **buf, + size_t *buf_len, + bson_realloc_func realloc_func, + void *realloc_func_ctx); + +Parameters +---------- + +* ``buf``: An out-pointer to a buffer containing a serialized BSON document, or to NULL. +* ``buf_len``: An out-pointer to the length of the buffer in bytes. +* ``realloc_func``: Optional :symbol:`bson_realloc_func` for reallocating the buffer. +* ``realloc_func_ctx``: Optional pointer that will be passed as ``ctx`` to ``realloc_func``. + +Description +----------- + +Creates a new :symbol:`bson_t` using the data provided. + +The ``realloc_func``, if provided, is called to resize ``buf`` if the document is later expanded, for example by a call to one of the ``bson_append`` functions. + +If ``*buf`` is initially NULL then it is allocated, using ``realloc_func`` or the default allocator, and initialized with an empty BSON document, and ``*buf_len`` is set to 5, the size of an empty document. + +Returns +------- + +A newly-allocated :symbol:`bson_t` on success, or NULL. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_data.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_data.rst new file mode 100644 index 0000000..9612c13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_data.rst @@ -0,0 +1,33 @@ +:man_page: bson_new_from_data + +bson_new_from_data() +==================== + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_new_from_data (const uint8_t *data, size_t length); + +Parameters +---------- + +* ``data``: A BSON encoded document buffer. +* ``length``: The length of ``data`` in bytes. + +Description +----------- + +The :symbol:`bson_new_from_data()` function shall create a new :symbol:`bson_t` on the heap and copy the contents of ``data``. This may be helpful when working with language bindings but is generally expected to be slower. + +Returns +------- + +A newly allocated :symbol:`bson_t` if successful, otherwise NULL. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_json.rst new file mode 100644 index 0000000..e061c59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_new_from_json.rst @@ -0,0 +1,39 @@ +:man_page: bson_new_from_json + +bson_new_from_json() +==================== + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error); + +Parameters +---------- + +* ``data``: A UTF-8 encoded string containing valid JSON. +* ``len``: The length of ``data`` in bytes excluding a trailing ``\0`` or -1 to determine the length with ``strlen()``. +* ``error``: An optional location for a :symbol:`bson_error_t`. + +Description +----------- + +The ``bson_new_from_json()`` function allocates and initialize a new :symbol:`bson_t` by parsing the JSON found in ``data``. Only a single JSON object may exist in ``data`` or an error will be set and NULL returned. + +Errors +------ + +Errors are propagated via the ``error`` parameter. + +Returns +------- + +A newly allocated :symbol:`bson_t` if successful, otherwise NULL and ``error`` is set. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson json diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_compare.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_compare.rst new file mode 100644 index 0000000..5a48c2c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_compare.rst @@ -0,0 +1,29 @@ +:man_page: bson_oid_compare + +bson_oid_compare() +================== + +Synopsis +-------- + +.. code-block:: c + + int + bson_oid_compare (const bson_oid_t *oid1, const bson_oid_t *oid2); + +Parameters +---------- + +* ``oid1``: A :symbol:`bson_oid_t`. +* ``oid2``: A :symbol:`bson_oid_t`. + +Description +----------- + +The :symbol:`bson_oid_compare()` function shall return a qsort() style value of a lexicographical sort of _oid1_ and _oid2_. + +Returns +------- + +less than 0, 0, or greater than 0 based on the comparison. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_copy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_copy.rst new file mode 100644 index 0000000..39d4fe7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_copy.rst @@ -0,0 +1,24 @@ +:man_page: bson_oid_copy + +bson_oid_copy() +=============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_copy (const bson_oid_t *src, bson_oid_t *dst); + +Parameters +---------- + +* ``src``: A :symbol:`bson_oid_t`. +* ``dst``: A :symbol:`bson_oid_t`. + +Description +----------- + +Copies the contents of src into dst. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_equal.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_equal.rst new file mode 100644 index 0000000..e1014e7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_equal.rst @@ -0,0 +1,29 @@ +:man_page: bson_oid_equal + +bson_oid_equal() +================ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_oid_equal (const bson_oid_t *oid1, const bson_oid_t *oid2); + +Parameters +---------- + +* ``oid1``: A :symbol:`bson_oid_t`. +* ``oid2``: A :symbol:`bson_oid_t`. + +Description +----------- + +Checks if two bson_oid_t contain the same bytes. + +Returns +------- + +true if they are equal, otherwise false. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_get_time_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_get_time_t.rst new file mode 100644 index 0000000..4aad5db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_get_time_t.rst @@ -0,0 +1,28 @@ +:man_page: bson_oid_get_time_t + +bson_oid_get_time_t() +===================== + +Synopsis +-------- + +.. code-block:: c + + time_t + bson_oid_get_time_t (const bson_oid_t *oid); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. + +Description +----------- + +Fetches the generation time in seconds since the UNIX Epoch of ``oid``. + +Returns +------- + +A time_t containing the seconds since the UNIX epoch of ``oid``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_hash.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_hash.rst new file mode 100644 index 0000000..57222d3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_hash.rst @@ -0,0 +1,28 @@ +:man_page: bson_oid_hash + +bson_oid_hash() +=============== + +Synopsis +-------- + +.. code-block:: c + + uint32_t + bson_oid_hash (const bson_oid_t *oid); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. + +Description +----------- + +Generates a hash code for ``oid`` suitable for a hashtable. + +Returns +------- + +A 32-bit hash code. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init.rst new file mode 100644 index 0000000..7066621 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init.rst @@ -0,0 +1,24 @@ +:man_page: bson_oid_init + +bson_oid_init() +=============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_init (bson_oid_t *oid, bson_context_t *context); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. +* ``context``: An *optional* :symbol:`bson_context_t` or NULL. + +Description +----------- + +Generates a new :symbol:`bson_oid_t` using either ``context`` or the default :symbol:`bson_context_t`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_data.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_data.rst new file mode 100644 index 0000000..fc978d2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_data.rst @@ -0,0 +1,24 @@ +:man_page: bson_oid_init_from_data + +bson_oid_init_from_data() +========================= + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_init_from_data (bson_oid_t *oid, const uint8_t *data); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. +* ``data``: A buffer containing 12 bytes for the oid. + +Description +----------- + +Initializes a :symbol:`bson_oid_t` using the raw buffer provided. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_string.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_string.rst new file mode 100644 index 0000000..38f14e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_from_string.rst @@ -0,0 +1,31 @@ +:man_page: bson_oid_init_from_string + +bson_oid_init_from_string() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_init_from_string (bson_oid_t *oid, const char *str); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. +* ``str``: A string containing a hex encoded version of the oid. + +Description +----------- + +Parses the string containing hex encoded oid and initialize the bytes in ``oid``. + +Example +------- + +.. code-block:: c + + bson_oid_init_from_string (&oid, "012345678901234567890123"); + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_sequence.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_sequence.rst new file mode 100644 index 0000000..ba14ca0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_init_sequence.rst @@ -0,0 +1,28 @@ +:man_page: bson_oid_init_sequence + +bson_oid_init_sequence() +======================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_init_sequence (bson_oid_t *oid, bson_context_t *context); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. +* ``context``: An optional :symbol:`bson_context_t`. + +Description +----------- + +Generates a new ObjectID using the 64-bit sequence. + +.. warning:: + + This form of ObjectID is generally used by MongoDB replica peers only. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_is_valid.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_is_valid.rst new file mode 100644 index 0000000..c64bf05 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_is_valid.rst @@ -0,0 +1,29 @@ +:man_page: bson_oid_is_valid + +bson_oid_is_valid() +=================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_oid_is_valid (const char *str, size_t length); + +Parameters +---------- + +* ``str``: A string. +* ``length``: The length of ``str``. + +Description +----------- + +Checks if a string containing a hex encoded string is a valid BSON ObjectID. + +Returns +------- + +true if ``str`` could be parsed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_t.rst new file mode 100644 index 0000000..4d52816 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_t.rst @@ -0,0 +1,98 @@ +:man_page: bson_oid_t + +bson_oid_t +========== + +BSON ObjectID Abstraction + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct { + uint8_t bytes[12]; + } bson_oid_t; + +Description +----------- + +The :symbol:`bson_oid_t` structure contains the 12-byte ObjectId notation defined by the `BSON ObjectID specification `_. + +ObjectId is a 12-byte BSON type, constructed using: + +* a 4-byte value representing the seconds since the Unix epoch (in Big Endian) +* a 3-byte machine identifier +* a 2-byte process id (Big Endian), and +* a 3-byte counter (Big Endian), starting with a random value. + +String Conversion +----------------- + +You can convert an Object ID to a string using :symbol:`bson_oid_to_string()` and back with :symbol:`bson_oid_init_from_string()`. + +Hashing +------- + +A :symbol:`bson_oid_t` can be used in hashtables using the function :symbol:`bson_oid_hash()` and :symbol:`bson_oid_equal()`. + +Comparing +--------- + +A :symbol:`bson_oid_t` can be compared to another using :symbol:`bson_oid_compare()` for ``qsort()`` style comparing and :symbol:`bson_oid_equal()` for direct equality. + +Validating +---------- + +You can validate that a string containing a hex-encoded ObjectID is valid using the function :symbol:`bson_oid_is_valid()`. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_oid_compare + bson_oid_copy + bson_oid_equal + bson_oid_get_time_t + bson_oid_hash + bson_oid_init + bson_oid_init_from_data + bson_oid_init_from_string + bson_oid_init_sequence + bson_oid_is_valid + bson_oid_to_string + +Example +------- + +.. code-block:: c + + #include + #include + + int + main (int argc, char *argv[]) + { + bson_oid_t oid; + char str[25]; + + bson_oid_init (&oid, NULL); + bson_oid_to_string (&oid, str); + printf ("%s\n", str); + + if (bson_oid_is_valid (str, sizeof str)) { + bson_oid_init_from_string (&oid, str); + } + + printf ("The UNIX time was: %u\n", (unsigned) bson_oid_get_time_t (&oid)); + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_to_string.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_to_string.rst new file mode 100644 index 0000000..2fec669 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_oid_to_string.rst @@ -0,0 +1,24 @@ +:man_page: bson_oid_to_string + +bson_oid_to_string() +==================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_oid_to_string (const bson_oid_t *oid, char str[25]); + +Parameters +---------- + +* ``oid``: A :symbol:`bson_oid_t`. +* ``str``: A location for the resulting string. + +Description +----------- + +Converts ``oid`` into a hex encoded string. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy.rst new file mode 100644 index 0000000..b02fbdf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy.rst @@ -0,0 +1,22 @@ +:man_page: bson_reader_destroy + +bson_reader_destroy() +===================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_reader_destroy (bson_reader_t *reader); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. + +Description +----------- + +Destroys and releases all resources associated with ``reader``. Does nothing if ``reader`` is NULL. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy_func_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy_func_t.rst new file mode 100644 index 0000000..6388ae1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_destroy_func_t.rst @@ -0,0 +1,24 @@ +:man_page: bson_reader_destroy_func_t + +bson_reader_destroy_func_t +========================== + +Synopsis +-------- + +.. code-block:: c + + typedef void (*bson_reader_destroy_func_t) (void *handle); + +Parameters +---------- + +* ``handle``: The opaque handle provided to :symbol:`bson_reader_new_from_handle`. + +Description +----------- + +An optional callback function that will be called when a :symbol:`bson_reader_t` created with :symbol:`bson_reader_new_from_handle` is destroyed with :symbol:`bson_reader_destroy()`. + +The handle used when creating the reader is passed to this callback. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_data.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_data.rst new file mode 100644 index 0000000..1f0ebf5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_data.rst @@ -0,0 +1,29 @@ +:man_page: bson_reader_new_from_data + +bson_reader_new_from_data() +=========================== + +Synopsis +-------- + +.. code-block:: c + + bson_reader_t * + bson_reader_new_from_data (const uint8_t *data, size_t length); + +Parameters +---------- + +* ``data``: A uint8_t. +* ``length``: A size_t. + +Description +----------- + +The :symbol:`bson_reader_new_from_data()` function shall create a new :symbol:`bson_reader_t` using the buffer supplied. ``data`` is not copied and *MUST* be valid for the lifetime of the resulting :symbol:`bson_reader_t`. + +Returns +------- + +A newly allocated :symbol:`bson_reader_t`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_fd.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_fd.rst new file mode 100644 index 0000000..8f6f809 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_fd.rst @@ -0,0 +1,33 @@ +:man_page: bson_reader_new_from_fd + +bson_reader_new_from_fd() +========================= + +Synopsis +-------- + +.. code-block:: c + + bson_reader_t * + bson_reader_new_from_fd (int fd, bool close_on_destroy); + +Parameters +---------- + +* ``fd``: A valid file-descriptor. +* ``close_on_destroy``: Whether ``close()`` should be called on ``fd`` when the reader is destroyed. + +Description +----------- + +The :symbol:`bson_reader_new_from_fd()` function shall create a new :symbol:`bson_reader_t` that will read from the provided file-descriptor. + +fd *MUST* be in blocking mode. + +If ``close_fd`` is true, then ``fd`` will be closed when the :symbol:`bson_reader_t` is destroyed with :symbol:`bson_reader_destroy()`. + +Returns +------- + +A newly allocated :symbol:`bson_reader_t` that should be freed with :symbol:`bson_reader_destroy`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_file.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_file.rst new file mode 100644 index 0000000..a1c5fb3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_file.rst @@ -0,0 +1,34 @@ +:man_page: bson_reader_new_from_file + +bson_reader_new_from_file() +=========================== + +Synopsis +-------- + +.. code-block:: c + + bson_reader_t * + bson_reader_new_from_file (const char *path, bson_error_t *error); + +Parameters +---------- + +* ``path``: A filename in the host filename encoding. +* ``error``: A :symbol:`bson_error_t`. + +Description +----------- + +Creates a new :symbol:`bson_reader_t` using the file denoted by ``filename``. + +Errors +------ + +Errors are propagated via the ``error`` parameter. + +Returns +------- + +A newly allocated :symbol:`bson_reader_t` on success, otherwise NULL and error is set. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_handle.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_handle.rst new file mode 100644 index 0000000..e1c63ce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_new_from_handle.rst @@ -0,0 +1,32 @@ +:man_page: bson_reader_new_from_handle + +bson_reader_new_from_handle() +============================= + +Synopsis +-------- + +.. code-block:: c + + bson_reader_t * + bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); + +Parameters +---------- + +* ``handle``: A user-provided pointer or NULL. +* ``rf``: A :symbol:`bson_reader_read_func_t`. +* ``df``: A :symbol:`bson_reader_destroy_func_t`. + +Description +----------- + +This function allows for a pluggable data stream for the reader. This can be used to read from sockets, files, memory, or other arbitrary sources. + +Returns +------- + +A newly allocated bson_reader_t if successful; otherwise NULL. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read.rst new file mode 100644 index 0000000..bcaf211 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read.rst @@ -0,0 +1,51 @@ +:man_page: bson_reader_read + +bson_reader_read() +================== + +Synopsis +-------- + +.. code-block:: c + + const bson_t * + bson_reader_read (bson_reader_t *reader, bool *reached_eof); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. +* ``reached_eof``: A UNKNOWN. + +Description +----------- + +The :symbol:`bson_reader_read()` function shall read the next document from the underlying file-descriptor or buffer. + +If there are no further documents or a failure was detected, then NULL is returned. + +If we reached the end of the sequence, ``reached_eof`` is set to true. + +To detect an error, check for NULL and ``reached_of`` is false. + +Returns +------- + +A :symbol:`bson_t` that should not be modified or freed. + +Example +------- + +.. code-block:: c + + const bson_t *doc; + bool reached_eof = false; + + while ((doc = bson_reader_read (reader, &reached_eof))) { + /* do something */ + } + + if (!reached_eof) { + fprintf (stderr, "Failed to read all documents.\n"); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read_func_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read_func_t.rst new file mode 100644 index 0000000..87aa826 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_read_func_t.rst @@ -0,0 +1,37 @@ +:man_page: bson_reader_read_func_t + +bson_reader_read_func_t +======================= + +Synopsis +-------- + +.. code-block:: c + + typedef ssize_t (*bson_reader_read_func_t) (void *handle, + void *buf, + size_t count); + +Parameters +---------- + +* ``handle``: The handle to read from. +* ``buf``: The buffer to read into. +* ``count``: The number of bytes to read. + +Description +----------- + +A callback function that will be called by :symbol:`bson_reader_t` to read the next chunk of data from the underlying opaque file descriptor. + +This function is meant to operate similar to the ``read(2)`` function as part of libc on UNIX-like systems. + +Returns +------- + +0 for end of stream. + +-1 for a failure on read. + +A value greater than zero for the number of bytes read into ``buf``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_reset.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_reset.rst new file mode 100644 index 0000000..28b4c50 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_reset.rst @@ -0,0 +1,23 @@ +:man_page: bson_reader_reset + +bson_reader_reset() +=================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_reader_reset (bson_reader_t *reader); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. + +Description +----------- + +Seeks to the beginning of the underlying buffer. Valid only for a reader created from a buffer with :symbol:`bson_reader_new_from_data`, not one created from a file, file descriptor, or handle. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_destroy_func.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_destroy_func.rst new file mode 100644 index 0000000..770b85a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_destroy_func.rst @@ -0,0 +1,25 @@ +:man_page: bson_reader_set_destroy_func + +bson_reader_set_destroy_func() +============================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_reader_set_destroy_func (bson_reader_t *reader, + bson_reader_destroy_func_t func); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. +* ``func``: A :symbol:`bson_reader_destroy_func_t`. + +Description +----------- + +Allows for setting a callback to be executed when a reader is destroyed. This should only be used by implementations implementing their own read callbacks. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_read_func.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_read_func.rst new file mode 100644 index 0000000..badcb51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_set_read_func.rst @@ -0,0 +1,24 @@ +:man_page: bson_reader_set_read_func + +bson_reader_set_read_func() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_reader_set_read_func (bson_reader_t *reader, bson_reader_read_func_t func); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. +* ``func``: A :symbol:`bson_reader_read_func_t`. + +Description +----------- + +Sets the function to read more data from the underlying stream in a custom bson_reader_t. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_t.rst new file mode 100644 index 0000000..b5aa4d4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_t.rst @@ -0,0 +1,141 @@ +:man_page: bson_reader_t + +bson_reader_t +============= + +Streaming BSON Document Reader + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct _bson_reader_t bson_reader_t; + + bson_reader_t * + bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); + bson_reader_t * + bson_reader_new_from_fd (int fd, bool close_on_destroy); + bson_reader_t * + bson_reader_new_from_file (const char *path, bson_error_t *error); + bson_reader_t * + bson_reader_new_from_data (const uint8_t *data, size_t length); + + void + bson_reader_destroy (bson_reader_t *reader); + +Description +----------- + +:symbol:`bson_reader_t` is a structure used for reading a sequence of BSON documents. The sequence can come from a file-descriptor, memory region, or custom callbacks. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_reader_destroy + bson_reader_destroy_func_t + bson_reader_new_from_data + bson_reader_new_from_fd + bson_reader_new_from_file + bson_reader_new_from_handle + bson_reader_read + bson_reader_read_func_t + bson_reader_reset + bson_reader_set_destroy_func + bson_reader_set_read_func + bson_reader_tell + +Example +------- + +.. code-block:: c + + /* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + /* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + + #include + #include + + + int + main (int argc, char *argv[]) + { + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | -]...\nUse - for STDIN.\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\n", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_tell.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_tell.rst new file mode 100644 index 0000000..6ac344c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reader_tell.rst @@ -0,0 +1,28 @@ +:man_page: bson_reader_tell + +bson_reader_tell() +================== + +Synopsis +-------- + +.. code-block:: c + + off_t + bson_reader_tell (bson_reader_t *reader); + +Parameters +---------- + +* ``reader``: A :symbol:`bson_reader_t`. + +Description +----------- + +Tells the current position within the underlying stream. + +Returns +------- + +-1 on failure, otherwise the offset within the underlying stream. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc.rst new file mode 100644 index 0000000..ad9e802 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc.rst @@ -0,0 +1,37 @@ +:man_page: bson_realloc + +bson_realloc() +============== + +Synopsis +-------- + +.. code-block:: c + + void * + bson_realloc (void *mem, size_t num_bytes); + +Parameters +---------- + +* ``mem``: A memory region. +* ``num_bytes``: A size_t containing the new requested size. + +Description +----------- + +This is a portable ``realloc()`` wrapper. + +In general, this function will return an allocation at least ``sizeof(void*)`` bytes or bigger. If ``num_bytes`` is 0, then the allocation will be freed. + +If there was a failure to allocate ``num_bytes`` bytes, the process will be aborted. + +.. warning:: + + This function will abort on failure to allocate memory. + +Returns +------- + +A pointer to a memory region which *HAS NOT* been zeroed. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_ctx.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_ctx.rst new file mode 100644 index 0000000..2955c48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_ctx.rst @@ -0,0 +1,25 @@ +:man_page: bson_realloc_ctx + +bson_realloc_ctx() +================== + +Synopsis +-------- + +.. code-block:: c + + void * + bson_realloc_ctx (void *mem, size_t num_bytes, void *ctx); + +Parameters +---------- + +* ``mem``: A memory region. +* ``num_bytes``: A size_t containing the requested size. +* ``ctx``: A consumer-specific pointer or ``NULL``. + +Description +----------- + +This function is identical to :symbol:`bson_realloc()` except it takes a context parameter. This is useful when working with pooled or specific memory allocators. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_func.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_func.rst new file mode 100644 index 0000000..e0299ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_realloc_func.rst @@ -0,0 +1,24 @@ +:man_page: bson_realloc_func + +bson_realloc_func +================= + +Synopsis +-------- + +.. code-block:: c + + typedef void *(*bson_realloc_func) (void *mem, size_t num_bytes, void *ctx); + +Parameters +---------- + +* ``mem``: A memory region. +* ``num_bytes``: A size_t containing the requested size. +* ``ctx``: A consumer-specific pointer or ``NULL``. + +Description +----------- + +This is a prototype for pluggable realloc functions used through the Libbson library. If you wish to use a custom allocator this is one way to do it. Additionally, :symbol:`bson_realloc_ctx()` is a default implementation of this prototype. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reinit.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reinit.rst new file mode 100644 index 0000000..b20b57c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reinit.rst @@ -0,0 +1,29 @@ +:man_page: bson_reinit + +bson_reinit() +============= + +Synopsis +-------- + +.. code-block:: c + + void + bson_reinit (bson_t *b); + +Parameters +---------- + +* ``b``: A :symbol:`bson_t`. + +Description +----------- + +The :symbol:`bson_reinit()` function shall be equivalent to calling :symbol:`bson_destroy()` and :symbol:`bson_init()`. + +However, if the :symbol:`bson_t` structure contains a malloc()'d buffer, it may be reused. To be certain that any buffer is freed, always call :symbol:`bson_destroy` on any :symbol:`bson_t` structure, whether initialized or reinitialized, after its final use. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reserve_buffer.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reserve_buffer.rst new file mode 100644 index 0000000..1bf5146 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_reserve_buffer.rst @@ -0,0 +1,112 @@ +:man_page: bson_reserve_buffer + +bson_reserve_buffer() +===================== + +Synopsis +-------- + +.. code-block:: c + + uint8_t * + bson_reserve_buffer (bson_t *bson, uint32_t size); + +Parameters +---------- + +* ``bson``: An initialized :symbol:`bson_t`. +* ``size``: The length in bytes of the new buffer. + +Description +----------- + +Grow the internal buffer of ``bson`` to ``size`` and set the document length to ``size``. Useful for eliminating copies when reading BSON bytes from a stream. + +First, initialize ``bson`` with :symbol:`bson_init` or :symbol:`bson_new`, then call this function. After it returns, the length of ``bson`` is set to ``size`` but its contents are uninitialized memory: you must fill the contents with a BSON document of the correct length before any other operations. + +The document must be freed with :symbol:`bson_destroy`. + +Returns +------- + +A pointer to the internal buffer, which is at least ``size`` bytes, or NULL if the space could not be allocated. + +Example +------- + +Use ``bson_reserve_buffer`` to write a function that takes a :symbol:`bson_t` pointer and reads a file into it directly: + +.. code-block:: c + + #include + #include + + bool + read_into (bson_t *bson, FILE *fp) + { + uint8_t *buffer; + long size; + + if (fseek (fp, 0L, SEEK_END) < 0) { + perror ("Couldn't get file size"); + return 1; + } + + size = ftell (fp); + if (size == EOF) { + perror ("Couldn't get file size"); + return 1; + } + + if (size > INT32_MAX) { + fprintf (stderr, "File too large\n"); + return 1; + } + + /* reserve buffer space - bson is temporarily invalid */ + buffer = bson_reserve_buffer (bson, (uint32_t) size); + if (!buffer) { + fprintf (stderr, "Couldn't reserve %ld bytes", size); + return false; + } + + /* read file directly into the buffer */ + rewind (fp); + if (fread ((void *) buffer, 1, (size_t) size, fp) < (size_t) size) { + perror ("Couldn't read file"); + return false; + } + + return true; + } + + int + main () + { + FILE *fp; + char *json; + + /* stack-allocated, initialized bson_t */ + bson_t bson = BSON_INITIALIZER; + + if (!(fp = fopen ("document.bson", "rb"))) { + perror ("Couldn't read file"); + return 1; + } + + read_into (&bson, fp); + fclose (fp); + + json = bson_as_canonical_extended_json (&bson, NULL); + printf ("%s\n", json); + + bson_free (json); + bson_destroy (&bson); + + return 0; + } + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_set_error.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_set_error.rst new file mode 100644 index 0000000..8d13d0e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_set_error.rst @@ -0,0 +1,28 @@ +:man_page: bson_set_error + +bson_set_error() +================ + +Synopsis +-------- + +.. code-block:: c + + void + bson_set_error ( + bson_error_t *error, uint32_t domain, uint32_t code, const char *format, ...) + BSON_GNUC_PRINTF (4, 5); + +Parameters +---------- + +* ``error``: A :symbol:`bson_error_t`. +* ``domain``: A ``uint32_t``. +* ``code``: A ``uint32_t``. +* ``format``: A ``printf()`` style format string. + +Description +----------- + +This is a helper function to set the parameters of a :symbol:`bson_error_t`. It handles the case where ``error`` is NULL by doing nothing. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_sized_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_sized_new.rst new file mode 100644 index 0000000..7dda529 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_sized_new.rst @@ -0,0 +1,32 @@ +:man_page: bson_sized_new + +bson_sized_new() +================ + +Synopsis +-------- + +.. code-block:: c + + bson_t * + bson_sized_new (size_t size); + +Parameters +---------- + +* ``size``: The size to pre-allocate for the underlying buffer. + +Description +----------- + +The :symbol:`bson_sized_new()` function shall create a new :symbol:`bson_t` on the heap with a preallocated buffer. This is useful if you have a good idea of the size of the resulting document. + +Returns +------- + +A newly allocated :symbol:`bson_t` that should be freed with :symbol:`bson_destroy()`. + +.. only:: html + + .. taglist:: See Also: + :tags: create-bson diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_snprintf.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_snprintf.rst new file mode 100644 index 0000000..92e8ec6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_snprintf.rst @@ -0,0 +1,31 @@ +:man_page: bson_snprintf + +bson_snprintf() +=============== + +Synopsis +-------- + +.. code-block:: c + + int + bson_snprintf (char *str, size_t size, const char *format, ...) + BSON_GNUC_PRINTF (3, 4); + +Parameters +---------- + +* ``str``: The destination buffer. +* ``size``: The size of ``str``. +* ``format``: A printf style format string. + +Description +----------- + +This is a portable wrapper around ``snprintf()``. It also enforces a trailing ``\0`` in the resulting string. + +Returns +------- + +The number of bytes written to ``str``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_steal.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_steal.rst new file mode 100644 index 0000000..6165323 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_steal.rst @@ -0,0 +1,79 @@ +:man_page: bson_steal + +bson_steal() +============ + +Synopsis +-------- + +.. code-block:: c + + bool + bson_steal (bson_t *dst, bson_t *src); + +Parameters +---------- + +* ``dst``: An uninitialized :symbol:`bson_t`. +* ``src``: A :symbol:`bson_t`. + +Description +----------- + +Efficiently transfer the contents of ``src`` to ``dst`` and destroy ``src``. + +Before calling this function, ``src`` must be initialized and ``dst`` must be uninitialized. After this function returns successfully, ``src`` is destroyed, and ``dst`` is initialized and must be freed with :symbol:`bson_destroy`. + +For example, if you have a higher-level structure that wraps a :symbol:`bson_t`, use ``bson_steal`` to transfer BSON data into it: + +.. code-block:: c + + typedef struct { + bson_t bson; + } bson_wrapper_t; + + + bson_wrapper_t * + wrap_bson (bson_t *b) + { + bson_wrapper_t *wrapper = bson_malloc (sizeof (bson_wrapper_t)); + + if (bson_steal (&wrapper->bson, b)) { + return wrapper; + } + + bson_free (wrapper); + return NULL; + } + + + void + bson_wrapper_destroy (bson_wrapper_t *wrapper) + { + bson_destroy (&wrapper->bson); + bson_free (wrapper); + } + + + int + main (int argc, char *argv[]) + { + bson_t bson = BSON_INITIALIZER; + bson_wrapper_t *wrapper; + + BSON_APPEND_UTF8 (&bson, "key", "value"); + + /* now "bson" is destroyed */ + wrapper = wrap_bson (&bson); + + /* clean up */ + bson_wrapper_destroy (wrapper); + } + +See also :symbol:`bson_destroy_with_steal`, a lower-level function that returns the raw contents of a :symbol:`bson_t`. + +Returns +------- + +Returns ``true`` if ``src`` was successfully moved to ``dst``, ``false`` if ``src`` is invalid, or was statically initialized, or another error occurred. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strcasecmp.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strcasecmp.rst new file mode 100644 index 0000000..fbb318a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strcasecmp.rst @@ -0,0 +1,30 @@ +:man_page: bson_strcasecmp + +bson_strcasecmp() +================= + +Synopsis +-------- + +.. code-block:: c + + int + bson_strcasecmp (const char *s1, const char *s2); + +Parameters +---------- + +* ``s1``: A string. +* ``s2``: A string. + +Description +----------- + +A portable version of ``strcasecmp()``. + +Returns +------- + +Returns a negative integer if s1 sorts lexicographically before s2, a positive +integer if it sorts after, or 0 if they are equivalent, after translating both +strings to lower case. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup.rst new file mode 100644 index 0000000..fcafc2c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup.rst @@ -0,0 +1,28 @@ +:man_page: bson_strdup + +bson_strdup() +============= + +Synopsis +-------- + +.. code-block:: c + + char * + bson_strdup (const char *str); + +Parameters +---------- + +* ``str``: A string. + +Description +----------- + +Copies ``str`` into a new string. If ``str`` is NULL, then NULL is returned. + +Returns +------- + +A newly allocated string that should be freed with bson_free(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup_printf.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup_printf.rst new file mode 100644 index 0000000..d28ad54 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdup_printf.rst @@ -0,0 +1,28 @@ +:man_page: bson_strdup_printf + +bson_strdup_printf() +==================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_strdup_printf (const char *format, ...) BSON_GNUC_PRINTF (1, 2); + +Parameters +---------- + +* ``format``: A printf style format string. + +Description +----------- + +This function performs a printf style format but into a newly allocated string. + +Returns +------- + +A newly allocated string that should be freed with bson_free(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdupv_printf.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdupv_printf.rst new file mode 100644 index 0000000..0b9eb89 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strdupv_printf.rst @@ -0,0 +1,29 @@ +:man_page: bson_strdupv_printf + +bson_strdupv_printf() +===================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_strdupv_printf (const char *format, va_list args) BSON_GNUC_PRINTF (1, 0); + +Parameters +---------- + +* ``format``: A printf style format string. +* ``args``: A va_list. + +Description +----------- + +This function is like :symbol:`bson_strdup_printf()` except takes a va_list of parameters. + +Returns +------- + +A newly allocated string that should be freed with bson_free(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strerror_r.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strerror_r.rst new file mode 100644 index 0000000..9a0f417 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strerror_r.rst @@ -0,0 +1,30 @@ +:man_page: bson_strerror_r + +bson_strerror_r() +================= + +Synopsis +-------- + +.. code-block:: c + + char * + bson_strerror_r (int err_code, char *buf, size_t buflen); + +Parameters +---------- + +* ``err_code``: An errno. +* ``buf``: A location to store the string. +* ``buflen``: The size of ``buf``. + +Description +----------- + +This is a portability wrapper around ``strerror()``. + +Returns +------- + +The passed in ``buf`` parameter or an internal string. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strfreev.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strfreev.rst new file mode 100644 index 0000000..abe325b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strfreev.rst @@ -0,0 +1,23 @@ +:man_page: bson_strfreev + +bson_strfreev() +=============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_strfreev (char **strv); + +Parameters +---------- + +* ``strv``: A NULL-terminated array of strings to free, including the array. + +Description +----------- + +This will free each string in a NULL-terminated array of strings and then the array itself. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append.rst new file mode 100644 index 0000000..d456a16 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append.rst @@ -0,0 +1,24 @@ +:man_page: bson_string_append + +bson_string_append() +==================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_string_append (bson_string_t *string, const char *str); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``str``: A string. + +Description +----------- + +Appends the ASCII or UTF-8 encoded string ``str`` to ``string``. This is not suitable for embedding NULLs in strings. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_c.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_c.rst new file mode 100644 index 0000000..e723846 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_c.rst @@ -0,0 +1,24 @@ +:man_page: bson_string_append_c + +bson_string_append_c() +====================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_string_append_c (bson_string_t *string, char str); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``str``: An ASCII char. + +Description +----------- + +Appends ``c`` to the string builder ``string``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_printf.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_printf.rst new file mode 100644 index 0000000..926e6c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_printf.rst @@ -0,0 +1,25 @@ +:man_page: bson_string_append_printf + +bson_string_append_printf() +=========================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_string_append_printf (bson_string_t *string, const char *format, ...) + BSON_GNUC_PRINTF (2, 3); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``format``: A printf style format string. + +Description +----------- + +Like bson_string_append() but formats a printf style string and then appends that to ``string``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_unichar.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_unichar.rst new file mode 100644 index 0000000..426d992 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_append_unichar.rst @@ -0,0 +1,24 @@ +:man_page: bson_string_append_unichar + +bson_string_append_unichar() +============================ + +Synopsis +-------- + +.. code-block:: c + + void + bson_string_append_unichar (bson_string_t *string, bson_unichar_t unichar); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``unichar``: A :symbol:`bson_unichar_t`. + +Description +----------- + +Appends a unicode character to string. The character will be encoded into its multi-byte UTF-8 representation. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_free.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_free.rst new file mode 100644 index 0000000..c9ca381 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_free.rst @@ -0,0 +1,29 @@ +:man_page: bson_string_free + +bson_string_free() +================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_string_free (bson_string_t *string, bool free_segment); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``free_segment``: A bool indicating if ``str->str`` should be returned. + +Description +----------- + +Frees the bson_string_t structure and optionally the string itself. + +Returns +------- + +``str->str`` if ``free_segment`` is true, otherwise NULL. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_new.rst new file mode 100644 index 0000000..d13162b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_new.rst @@ -0,0 +1,28 @@ +:man_page: bson_string_new + +bson_string_new() +================= + +Synopsis +-------- + +.. code-block:: c + + bson_string_t * + bson_string_new (const char *str); + +Parameters +---------- + +* ``str``: A string to be copied or NULL. + +Description +----------- + +Creates a new string builder, which uses power-of-two growth of buffers. Use the various bson_string_append*() functions to append to the string. + +Returns +------- + +A newly allocated bson_string_t that should be freed with bson_string_free() when no longer in use. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_t.rst new file mode 100644 index 0000000..1fe930c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_t.rst @@ -0,0 +1,61 @@ +:man_page: bson_string_t + +bson_string_t +============= + +String Building Abstraction + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct { + char *str; + uint32_t len; + uint32_t alloc; + } bson_string_t; + +Description +----------- + +:symbol:`bson_string_t` is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two. + +This API is useful if you need to build UTF-8 encoded strings. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_string_append + bson_string_append_c + bson_string_append_printf + bson_string_append_unichar + bson_string_free + bson_string_new + bson_string_truncate + +Example +------- + +.. code-block:: c + + bson_string_t *str; + + str = bson_string_new (NULL); + bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123); + printf ("%s\n", str->str); + + bson_string_free (str, true); + +.. tip:: + + You can call :symbol:`bson_string_free()` with ``false`` if you would like to take ownership of ``str->str``. Some APIs that do this might call ``return bson_string_free (str, false);`` after building the string. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_truncate.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_truncate.rst new file mode 100644 index 0000000..1871e02 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_string_truncate.rst @@ -0,0 +1,26 @@ +:man_page: bson_string_truncate + +bson_string_truncate() +====================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_string_truncate (bson_string_t *string, uint32_t len); + +Parameters +---------- + +* ``string``: A :symbol:`bson_string_t`. +* ``len``: The new length of the string, excluding the trailing ``\0``. + +Description +----------- + +Truncates the string so that it is ``len`` bytes in length. This must be smaller or equal to the current length of the string. + +A ``\0`` byte will be placed where the end of the string occurs. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strncpy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strncpy.rst new file mode 100644 index 0000000..0286c59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strncpy.rst @@ -0,0 +1,28 @@ +:man_page: bson_strncpy + +bson_strncpy() +============== + +Synopsis +-------- + +.. code-block:: c + + void + bson_strncpy (char *dst, const char *src, size_t size); + +Parameters +---------- + +* ``dst``: The destination buffer. +* ``src``: The src buffer. +* ``size``: The number of bytes to copy into dst, which must be at least that size. + +Description +----------- + +Copies up to ``size`` bytes from ``src`` into ``dst``. ``dst`` must be at least ``size`` bytes in size. A trailing ``\0`` is always set. + +Does nothing if ``size`` is zero. + +``bson_strncpy`` matches the behavior of the C11 standard ``strncpy_s``, rather than ``strncpy``. This means that ``bson_strncpy`` always writes a null terminator to ``dst``, even if ``dst`` is too short to fit the entire string from ``src``. If there is additional space left in ``dst`` after copying ``src``, ``bson_strncpy`` does not fill the remaining space with null characters. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strndup.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strndup.rst new file mode 100644 index 0000000..92ea0c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strndup.rst @@ -0,0 +1,29 @@ +:man_page: bson_strndup + +bson_strndup() +============== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_strndup (const char *str, size_t n_bytes); + +Parameters +---------- + +* ``str``: A string to copy. +* ``n_bytes``: A size_t. + +Description +----------- + +Allocates a new string and copies up to ``n_bytes`` from ``str`` into it. A trailing ``\0`` is always set. + +Returns +------- + +A newly allocated string that should be freed with bson_free(). + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strnlen.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strnlen.rst new file mode 100644 index 0000000..6877fff --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_strnlen.rst @@ -0,0 +1,29 @@ +:man_page: bson_strnlen + +bson_strnlen() +============== + +Synopsis +-------- + +.. code-block:: c + + size_t + bson_strnlen (const char *s, size_t maxlen); + +Parameters +---------- + +* ``s``: A string. +* ``maxlen``: The maximum size of string to check. + +Description +----------- + +A portable version of ``strnlen()``. + +Returns +------- + +The length of ``s`` in bytes or ``maxlen`` if no ``\0`` was found. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_subtype_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_subtype_t.rst new file mode 100644 index 0000000..6c1599e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_subtype_t.rst @@ -0,0 +1,48 @@ +:man_page: bson_subtype_t + +bson_subtype_t +============== + +Binary Field Subtype + +Synopsis +-------- + +.. code-block:: c + + #include + + + typedef enum { + BSON_SUBTYPE_BINARY = 0x00, + BSON_SUBTYPE_FUNCTION = 0x01, + BSON_SUBTYPE_BINARY_DEPRECATED = 0x02, + BSON_SUBTYPE_UUID_DEPRECATED = 0x03, + BSON_SUBTYPE_UUID = 0x04, + BSON_SUBTYPE_MD5 = 0x05, + BSON_SUBTYPE_USER = 0x80, + } bson_subtype_t; + +Description +----------- + +This enumeration contains the various subtypes that may be used in a binary field. See `http://bsonspec.org `_ for more information. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + +Example +------- + +.. code-block:: c + + bson_t doc = BSON_INITIALIZER; + + BSON_APPEND_BINARY (&doc, "binary", BSON_SUBTYPE_BINARY, data, data_len); + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_t.rst new file mode 100644 index 0000000..09ad5de --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_t.rst @@ -0,0 +1,230 @@ +:man_page: bson_t + +bson_t +====== + +BSON Document Abstraction + +Synopsis +-------- + +.. code-block:: c + + #include + + /** + * bson_empty: + * @b: a bson_t. + * + * Checks to see if @b is an empty BSON document. An empty BSON document is + * a 5 byte document which contains the length (4 bytes) and a single NUL + * byte indicating end of fields. + */ + #define bson_empty(b) /* ... */ + + /** + * bson_empty0: + * + * Like bson_empty() but treats NULL the same as an empty bson_t document. + */ + #define bson_empty0(b) /* ... */ + + /** + * bson_clear: + * + * Easily free a bson document and set it to NULL. Use like: + * + * bson_t *doc = bson_new(); + * bson_clear (&doc); + * BSON_ASSERT (doc == NULL); + */ + #define bson_clear(bptr) /* ... */ + + /** + * BSON_MAX_SIZE: + * + * The maximum size in bytes of a BSON document. + */ + #define BSON_MAX_SIZE /* ... */ + + #define BSON_APPEND_ARRAY(b, key, val) \ + bson_append_array (b, key, (int) strlen (key), val) + + #define BSON_APPEND_ARRAY_BEGIN(b, key, child) \ + bson_append_array_begin (b, key, (int) strlen (key), child) + + #define BSON_APPEND_BINARY(b, key, subtype, val, len) \ + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + + #define BSON_APPEND_BOOL(b, key, val) \ + bson_append_bool (b, key, (int) strlen (key), val) + + #define BSON_APPEND_CODE(b, key, val) \ + bson_append_code (b, key, (int) strlen (key), val) + + #define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \ + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + + #define BSON_APPEND_DBPOINTER(b, key, coll, oid) \ + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + + #define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \ + bson_append_document_begin (b, key, (int) strlen (key), child) + + #define BSON_APPEND_DOUBLE(b, key, val) \ + bson_append_double (b, key, (int) strlen (key), val) + + #define BSON_APPEND_DOCUMENT(b, key, val) \ + bson_append_document (b, key, (int) strlen (key), val) + + #define BSON_APPEND_INT32(b, key, val) \ + bson_append_int32 (b, key, (int) strlen (key), val) + + #define BSON_APPEND_INT64(b, key, val) \ + bson_append_int64 (b, key, (int) strlen (key), val) + + #define BSON_APPEND_MINKEY(b, key) \ + bson_append_minkey (b, key, (int) strlen (key)) + + #define BSON_APPEND_DECIMAL128(b, key, val) \ + bson_append_decimal128 (b, key, (int) strlen (key), val) + + #define BSON_APPEND_MAXKEY(b, key) \ + bson_append_maxkey (b, key, (int) strlen (key)) + + #define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + + #define BSON_APPEND_OID(b, key, val) \ + bson_append_oid (b, key, (int) strlen (key), val) + + #define BSON_APPEND_REGEX(b, key, val, opt) \ + bson_append_regex (b, key, (int) strlen (key), val, opt) + + #define BSON_APPEND_UTF8(b, key, val) \ + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + + #define BSON_APPEND_SYMBOL(b, key, val) \ + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + + #define BSON_APPEND_TIME_T(b, key, val) \ + bson_append_time_t (b, key, (int) strlen (key), val) + + #define BSON_APPEND_TIMEVAL(b, key, val) \ + bson_append_timeval (b, key, (int) strlen (key), val) + + #define BSON_APPEND_DATE_TIME(b, key, val) \ + bson_append_date_time (b, key, (int) strlen (key), val) + + #define BSON_APPEND_TIMESTAMP(b, key, val, inc) \ + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + + #define BSON_APPEND_UNDEFINED(b, key) \ + bson_append_undefined (b, key, (int) strlen (key)) + + #define BSON_APPEND_VALUE(b, key, val) \ + bson_append_value (b, key, (int) strlen (key), (val)) + + BSON_ALIGNED_BEGIN (128) + typedef struct { + uint32_t flags; /* Internal flags for the bson_t. */ + uint32_t len; /* Length of BSON data. */ + uint8_t padding[120]; /* Padding for stack allocation. */ + } bson_t BSON_ALIGNED_END (128); + +Description +----------- + +The :symbol:`bson_t` structure represents a BSON document. This structure manages the underlying BSON encoded buffer. For mutable documents, it can append new data to the document. + +Performance Notes +----------------- + +The :symbol:`bson_t` structure attempts to use an inline allocation within the structure to speed up performance of small documents. When this internal buffer has been exhausted, a heap allocated buffer will be dynamically allocated. Therefore, it is essential to call :symbol:`bson_destroy()` on allocated documents. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_append_array + bson_append_array_begin + bson_append_array_end + bson_append_binary + bson_append_bool + bson_append_code + bson_append_code_with_scope + bson_append_date_time + bson_append_dbpointer + bson_append_decimal128 + bson_append_document + bson_append_document_begin + bson_append_document_end + bson_append_double + bson_append_int32 + bson_append_int64 + bson_append_iter + bson_append_maxkey + bson_append_minkey + bson_append_now_utc + bson_append_null + bson_append_oid + bson_append_regex + bson_append_regex_w_len + bson_append_symbol + bson_append_time_t + bson_append_timestamp + bson_append_timeval + bson_append_undefined + bson_append_utf8 + bson_append_value + bson_array_as_json + bson_as_canonical_extended_json + bson_as_json + bson_as_relaxed_extended_json + bson_compare + bson_concat + bson_copy + bson_copy_to + bson_copy_to_excluding + bson_copy_to_excluding_noinit + bson_count_keys + bson_destroy + bson_destroy_with_steal + bson_equal + bson_get_data + bson_has_field + bson_init + bson_init_from_json + bson_init_static + bson_new + bson_new_from_buffer + bson_new_from_data + bson_new_from_json + bson_reinit + bson_reserve_buffer + bson_sized_new + bson_steal + bson_validate + bson_validate_with_error + +Example +------- + +.. code-block:: c + + static void + create_on_heap (void) + { + bson_t *b = bson_new (); + + BSON_APPEND_INT32 (b, "foo", 123); + BSON_APPEND_UTF8 (b, "bar", "foo"); + BSON_APPEND_DOUBLE (b, "baz", 1.23f); + + bson_destroy (b); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_type_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_type_t.rst new file mode 100644 index 0000000..8079089 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_type_t.rst @@ -0,0 +1,65 @@ +:man_page: bson_type_t + +bson_type_t +=========== + +BSON Type Enumeration + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_DECIMAL128 = 0x13, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, + } bson_type_t; + +Description +----------- + +The :symbol:`bson_type_t` enumeration contains all of the types from the `BSON Specification `_. It can be used to determine the type of a field at runtime. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + +Example +------- + +.. code-block:: c + + bson_iter_t iter; + + if (bson_iter_init_find (&iter, doc, "foo") && + (BSON_TYPE_INT32 == bson_iter_type (&iter))) { + printf ("'foo' is an int32.\n"); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_uint32_to_string.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_uint32_to_string.rst new file mode 100644 index 0000000..9f5b782 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_uint32_to_string.rst @@ -0,0 +1,57 @@ +:man_page: bson_uint32_to_string + +bson_uint32_to_string() +======================= + +Synopsis +-------- + +.. code-block:: c + + size_t + bson_uint32_to_string (uint32_t value, + const char **strptr, + char *str, + size_t size); + + +Parameters +---------- + +* ``value``: A uint32_t. +* ``strptr``: A location for the resulting string pointer. +* ``str``: A location to buffer the string. +* ``size``: A size_t containing the size of ``str``. + +Description +----------- + +Converts ``value`` to a string. + +If ``value`` is from 0 to 999, it will use a constant string in the data section of the library. + +If not, a string will be formatted using ``str`` and ``snprintf()``. + +``strptr`` will always be set. It will either point to ``str`` or a constant string. Use this as your key. + +Array Element Key Building +-------------------------- + +Each element in a BSON array has a monotonic string key like ``"0"``, ``"1"``, etc. This function is optimized for generating such string keys. + +.. code-block:: c + + char str[16]; + const char *key; + uint32_t i; + + for (i = 0; i < 10; i++) { + bson_uint32_to_string (i, &key, str, sizeof str); + printf ("Key: %s\n", key); + } + +Returns +------- + +The number of bytes in the resulting string. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_unichar_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_unichar_t.rst new file mode 100644 index 0000000..0a7fda4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_unichar_t.rst @@ -0,0 +1,44 @@ +:man_page: bson_unichar_t + +bson_unichar_t +============== + +Unicode Character Abstraction + +Synopsis +-------- + +.. code-block:: c + + typedef uint32_t bson_unichar_t; + +Description +----------- + +:symbol:`bson_unichar_t` provides an abstraction on a single unicode character. It is the 32-bit representation of a character. As UTF-8 can contain multi-byte characters, this should be used when iterating through UTF-8 text. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + +Example +------- + +.. code-block:: c + + static void + print_each_char (const char *str) + { + bson_unichar_t c; + + for (; *str; str = bson_utf8_next_char (str)) { + c = bson_utf8_get_char (str); + printf ("The numberic value is %u.\n", (unsigned) c); + } + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_escape_for_json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_escape_for_json.rst new file mode 100644 index 0000000..8c2af20 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_escape_for_json.rst @@ -0,0 +1,34 @@ +:man_page: bson_utf8_escape_for_json + +bson_utf8_escape_for_json() +=========================== + +Synopsis +-------- + +.. code-block:: c + + char * + bson_utf8_escape_for_json (const char *utf8, ssize_t utf8_len); + +Parameters +---------- + +* ``utf8``: A UTF-8 encoded string. +* ``utf8_len``: The length of ``utf8`` in bytes or -1 if it is NULL terminated. + +Description +----------- + +Allocates a new string matching ``utf8`` except that special +characters in JSON are escaped. The resulting string is also +UTF-8 encoded. + +Both " and \\ characters will be backslash-escaped. If a NUL +byte is found before ``utf8_len`` bytes, it is converted to +"\\u0000". Other non-ASCII characters in the input are preserved. + +Returns +------- + +A newly allocated string that should be freed with :symbol:`bson_free()`. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_from_unichar.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_from_unichar.rst new file mode 100644 index 0000000..a748f40 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_from_unichar.rst @@ -0,0 +1,25 @@ +:man_page: bson_utf8_from_unichar + +bson_utf8_from_unichar() +======================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_utf8_from_unichar (bson_unichar_t unichar, char utf8[6], uint32_t *len); + +Parameters +---------- + +* ``unichar``: A :symbol:`bson_unichar_t`. +* ``utf8``: A location for the utf8 sequence. +* ``len``: A location for the number of bytes in the resulting utf8 sequence. + +Description +----------- + +Converts a single unicode character to a multi-byte UTF-8 sequence. The result is stored in ``utf8`` and the number of bytes used in ``len``. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_get_char.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_get_char.rst new file mode 100644 index 0000000..d11d878 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_get_char.rst @@ -0,0 +1,28 @@ +:man_page: bson_utf8_get_char + +bson_utf8_get_char() +==================== + +Synopsis +-------- + +.. code-block:: c + + bson_unichar_t + bson_utf8_get_char (const char *utf8); + +Parameters +---------- + +* ``utf8``: A UTF-8 encoded string. + +Description +----------- + +Converts the current character in a UTF-8 sequence to a bson_unichar_t, the 32-bit representation of the multi-byte character. + +Returns +------- + +A bson_unichar_t. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_next_char.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_next_char.rst new file mode 100644 index 0000000..5c17abb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_next_char.rst @@ -0,0 +1,30 @@ +:man_page: bson_utf8_next_char + +bson_utf8_next_char() +===================== + +Synopsis +-------- + +.. code-block:: c + + const char * + bson_utf8_next_char (const char *utf8); + +Parameters +---------- + +* ``utf8``: A UTF-8 encoded string. + +Description +----------- + +Advances within ``utf8`` to the next UTF-8 character, which may be multiple bytes offset from ``utf8``. A pointer to the next character is returned. + +It is invalid to call this function on a string whose current character is ``\0``. + +Returns +------- + +A pointer to the beginning of the next character in the UTF-8 encoded string. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_validate.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_validate.rst new file mode 100644 index 0000000..8f8d066 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_utf8_validate.rst @@ -0,0 +1,30 @@ +:man_page: bson_utf8_validate + +bson_utf8_validate() +==================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_utf8_validate (const char *utf8, size_t utf8_len, bool allow_null); + +Parameters +---------- + +* ``utf8``: A string to verify. +* ``utf8_len``: The length of ``utf8`` in bytes. +* ``allow_null``: A bool indicating that embedded ``\0`` bytes are allowed. + +Description +----------- + +Validates that the content within ``utf8`` is valid UTF-8 (by the RFC 3629 standard). If ``allow_null`` is ``true``, then embedded NULL bytes are allowed (``\0``). + +Returns +------- + +true if ``utf8`` contains valid UTF-8. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate.rst new file mode 100644 index 0000000..56cd7a2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate.rst @@ -0,0 +1,32 @@ +:man_page: bson_validate + +bson_validate() +=============== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_validate (const bson_t *bson, bson_validate_flags_t flags, size_t *offset); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``flags``: A bitwise-or of all desired :symbol:`bson_validate_flags_t `. +* ``offset``: A location for the offset within ``bson`` where the error occurred. + +Description +----------- + +Validates a BSON document by walking through the document and inspecting the keys and values for valid content. + +You can modify how the validation occurs through the use of the ``flags`` parameter, see :symbol:`bson_validate_with_error()` for details. + +Returns +------- + +Returns true if ``bson`` is valid; otherwise false and ``offset`` is set to the byte offset where the error was detected. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate_with_error.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate_with_error.rst new file mode 100644 index 0000000..f05b379 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_validate_with_error.rst @@ -0,0 +1,53 @@ +:man_page: bson_validate_with_error + +bson_validate_with_error() +========================== + +Synopsis +-------- + +.. code-block:: c + + typedef enum { + BSON_VALIDATE_NONE = 0, + BSON_VALIDATE_UTF8 = (1 << 0), + BSON_VALIDATE_DOLLAR_KEYS = (1 << 1), + BSON_VALIDATE_DOT_KEYS = (1 << 2), + BSON_VALIDATE_UTF8_ALLOW_NULL = (1 << 3), + BSON_VALIDATE_EMPTY_KEYS = (1 << 4), + } bson_validate_flags_t; + + bool + bson_validate_with_error (const bson_t *bson, + bson_validate_flags_t flags, + bson_error_t *error); + +Parameters +---------- + +* ``bson``: A :symbol:`bson_t`. +* ``flags``: A bitwise-or of all desired validation flags. +* ``error``: Optional :symbol:`bson_error_t`. + +Description +----------- + +Validates a BSON document by walking through the document and inspecting the keys and values for valid content. + +You can modify how the validation occurs through the use of the ``flags`` parameter. A description of their effect is below. + +* ``BSON_VALIDATE_NONE`` Basic validation of BSON length and structure. +* ``BSON_VALIDATE_UTF8`` All keys and string values are checked for invalid UTF-8. +* ``BSON_VALIDATE_UTF8_ALLOW_NULL`` String values are allowed to have embedded NULL bytes. +* ``BSON_VALIDATE_DOLLAR_KEYS`` Prohibit keys that start with ``$`` outside of a "DBRef" subdocument. +* ``BSON_VALIDATE_DOT_KEYS`` Prohibit keys that contain ``.`` anywhere in the string. +* ``BSON_VALIDATE_EMPTY_KEYS`` Prohibit zero-length keys. + +See also :symbol:`bson_validate()`. + +Returns +------- + +Returns true if ``bson`` is valid; otherwise false and ``error`` is filled out. + +The :symbol:`bson_error_t` domain is set to ``BSON_ERROR_INVALID``. Its code is set to one of the ``bson_validate_flags_t`` flags indicating which validation failed; for example, if a key contains invalid UTF-8, then the code is set to ``BSON_VALIDATE_UTF8``, but if the basic structure of the BSON document is corrupt, the code is set to ``BSON_VALIDATE_NONE``. The error message is filled out, and gives more detail if possible. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_copy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_copy.rst new file mode 100644 index 0000000..6eb519b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_copy.rst @@ -0,0 +1,24 @@ +:man_page: bson_value_copy + +bson_value_copy() +================= + +Synopsis +-------- + +.. code-block:: c + + void + bson_value_copy (const bson_value_t *src, bson_value_t *dst); + +Parameters +---------- + +* ``src``: A :symbol:`bson_value_t` to copy from. +* ``dst``: A :symbol:`bson_value_t` to copy into. + +Description +----------- + +This function will copy the boxed content in ``src`` into ``dst``. ``dst`` must be freed with :symbol:`bson_value_destroy()` when no longer in use. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_destroy.rst new file mode 100644 index 0000000..1f1b52a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_destroy.rst @@ -0,0 +1,22 @@ +:man_page: bson_value_destroy + +bson_value_destroy() +==================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_value_destroy (bson_value_t *value); + +Parameters +---------- + +* ``value``: A :symbol:`bson_value_t`. + +Description +----------- + +Releases any resources associated with ``value``. Does nothing if ``value`` is NULL. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_t.rst new file mode 100644 index 0000000..8f6d033 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_value_t.rst @@ -0,0 +1,97 @@ +:man_page: bson_value_t + +bson_value_t +============ + +BSON Boxed Container Type + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct _bson_value_t { + bson_type_t value_type; + union { + bson_oid_t v_oid; + int64_t v_int64; + int32_t v_int32; + int8_t v_int8; + double v_double; + bool v_bool; + int64_t v_datetime; + struct { + uint32_t timestamp; + uint32_t increment; + } v_timestamp; + struct { + uint32_t len; + char *str; + } v_utf8; + struct { + uint32_t data_len; + uint8_t *data; + } v_doc; + struct { + uint32_t data_len; + uint8_t *data; + bson_subtype_t subtype; + } v_binary; + struct { + char *regex; + char *options; + } v_regex; + struct { + char *collection; + uint32_t collection_len; + bson_oid_t oid; + } v_dbpointer; + struct { + uint32_t code_len; + char *code; + } v_code; + struct { + uint32_t code_len; + char *code; + uint32_t scope_len; + uint8_t *scope_data; + } v_codewscope; + struct { + uint32_t len; + char *symbol; + } v_symbol; + } value; + } bson_value_t; + +Description +----------- + +The :symbol:`bson_value_t` structure is a boxed type for encapsulating a runtime determined type. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_value_copy + bson_value_destroy + +Example +------- + +.. code-block:: c + + const bson_value_t *value; + + value = bson_iter_value (&iter); + + if (value->value_type == BSON_TYPE_INT32) { + printf ("%d\n", value->value.v_int32); + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_visitor_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_visitor_t.rst new file mode 100644 index 0000000..81bdcd1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_visitor_t.rst @@ -0,0 +1,221 @@ +:man_page: bson_visitor_t + +bson_visitor_t +============== + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct { + /* run before / after descending into a document */ + bool (*visit_before) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_after) (const bson_iter_t *iter, const char *key, void *data); + /* corrupt BSON, or unsupported type and visit_unsupported_type not set */ + void (*visit_corrupt) (const bson_iter_t *iter, void *data); + /* normal bson field callbacks */ + bool (*visit_double) (const bson_iter_t *iter, + const char *key, + double v_double, + void *data); + bool (*visit_utf8) (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data); + bool (*visit_document) (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + bool (*visit_array) (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); + bool (*visit_binary) (const bson_iter_t *iter, + const char *key, + bson_subtype_t v_subtype, + size_t v_binary_len, + const uint8_t *v_binary, + void *data); + /* normal field with deprecated "Undefined" BSON type */ + bool (*visit_undefined) (const bson_iter_t *iter, + const char *key, + void *data); + bool (*visit_oid) (const bson_iter_t *iter, + const char *key, + const bson_oid_t *v_oid, + void *data); + bool (*visit_bool) (const bson_iter_t *iter, + const char *key, + bool v_bool, + void *data); + bool (*visit_date_time) (const bson_iter_t *iter, + const char *key, + int64_t msec_since_epoch, + void *data); + bool (*visit_null) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_regex) (const bson_iter_t *iter, + const char *key, + const char *v_regex, + const char *v_options, + void *data); + bool (*visit_dbpointer) (const bson_iter_t *iter, + const char *key, + size_t v_collection_len, + const char *v_collection, + const bson_oid_t *v_oid, + void *data); + bool (*visit_code) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + void *data); + bool (*visit_symbol) (const bson_iter_t *iter, + const char *key, + size_t v_symbol_len, + const char *v_symbol, + void *data); + bool (*visit_codewscope) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data); + bool (*visit_int32) (const bson_iter_t *iter, + const char *key, + int32_t v_int32, + void *data); + bool (*visit_timestamp) (const bson_iter_t *iter, + const char *key, + uint32_t v_timestamp, + uint32_t v_increment, + void *data); + bool (*visit_int64) (const bson_iter_t *iter, + const char *key, + int64_t v_int64, + void *data); + bool (*visit_maxkey) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_minkey) (const bson_iter_t *iter, const char *key, void *data); + /* if set, called instead of visit_corrupt when an apparently valid BSON + * includes an unrecognized field type (reading future version of BSON) */ + void (*visit_unsupported_type) (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data); + bool (*visit_decimal128) (const bson_iter_t *iter, + const char *key, + const bson_decimal128_t *v_decimal128, + void *data); + + void *padding[7]; + } bson_visitor_t bson_visitor_t; + +Description +----------- + +The :symbol:`bson_visitor_t` structure provides a series of callbacks that can be called while iterating a BSON document. This may simplify the conversion of a :symbol:`bson_t` to a higher level language structure. + +If the optional callback ``visit_unsupported_type`` is set, it is called instead of ``visit_corrupt`` in the specific case of an unrecognized field type. (Parsing is aborted in either case.) Use this callback to report an error like "unrecognized type" instead of simply "corrupt BSON". This future-proofs code that may use an older version of libbson to parse future BSON formats. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + +Example +------- + +.. code-block:: c + + #include + #include + + static bool + my_visit_before (const bson_iter_t *iter, const char *key, void *data) + { + int *count = (int *) data; + + (*count)++; + + /* returning true stops further iteration of the document */ + + return false; + } + + static void + count_fields (bson_t *doc) + { + bson_visitor_t visitor = {0}; + bson_iter_t iter; + int count = 0; + + visitor.visit_before = my_visit_before; + + if (bson_iter_init (&iter, doc)) { + bson_iter_visit_all (&iter, &visitor, &count); + } + + printf ("Found %d fields.\n", count); + } + +The example below demonstrates how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries. + +Example +------- + +.. code-block:: c + + #include + #include + + typedef struct { + ssize_t *err_offset; + } my_state_t; + + static void + my_visit_corrupt (const bson_iter_t *iter, void *data) + { + *(((my_state_t *) data)->err_offset) = iter->off; + } + + static void + my_visit_unsupported_type (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data) + { + *(((my_state_t *) data)->err_offset) = iter->off; + } + + static void + find_error_location (bson_t *doc) + { + bson_visitor_t visitors = {0}; + bson_iter_t iter; + my_state_t state; + ssize_t err_offset = -1; + + visitors.visit_corrupt = my_visit_corrupt; + visitors.visit_unsupported_type = my_visit_unsupported_type; + /* provide additional visitors as needed based on your requirements */ + state.err_offset = &err_offset; + + if (!bson_iter_init (&iter, doc)) { + printf ("Could not initialize iterator!"); + exit (1); + } + + if (bson_iter_visit_all (&iter, &visitors, &state) || + err_offset != -1) { + printf ("Found error at offset %d.\n", err_offset); + } else { + printf ("BSON document had no errors.\n"); + } + } diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_vsnprintf.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_vsnprintf.rst new file mode 100644 index 0000000..d585ff3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_vsnprintf.rst @@ -0,0 +1,32 @@ +:man_page: bson_vsnprintf + +bson_vsnprintf() +================ + +Synopsis +-------- + +.. code-block:: c + + int + bson_vsnprintf (char *str, size_t size, const char *format, va_list ap) + BSON_GNUC_PRINTF (3, 0); + +Parameters +---------- + +* ``str``: A location for the resulting string. +* ``size``: The size of str in bytes. +* ``format``: A printf style format string. +* ``ap``: A va_list of parameters for the format. + +Description +----------- + +Like bson_snprintf() but allows for variadic parameters. + +Returns +------- + +The number of bytes written to ``str`` excluding the ``\0`` byte. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_begin.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_begin.rst new file mode 100644 index 0000000..f613af7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_begin.rst @@ -0,0 +1,29 @@ +:man_page: bson_writer_begin + +bson_writer_begin() +=================== + +Synopsis +-------- + +.. code-block:: c + + bool + bson_writer_begin (bson_writer_t *writer, bson_t **bson); + +Parameters +---------- + +* ``writer``: A :symbol:`bson_writer_t`. +* ``bson``: A :symbol:`bson_t`. + +Description +----------- + +Begins writing a new document. The caller may use the bson structure to write out a new BSON document. When completed, the caller must call either :symbol:`bson_writer_end()` or :symbol:`bson_writer_rollback()`. + +Returns +------- + +true if there was space in the underlying buffers to begin the document. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_destroy.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_destroy.rst new file mode 100644 index 0000000..ffc16b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_destroy.rst @@ -0,0 +1,22 @@ +:man_page: bson_writer_destroy + +bson_writer_destroy() +===================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_writer_destroy (bson_writer_t *writer); + +Parameters +---------- + +* ``writer``: A :symbol:`bson_writer_t`. + +Description +----------- + +Cleanup after ``writer`` and release any allocated memory. Does nothing if ``writer`` is NULL. Note that the buffer supplied to :symbol:`bson_writer_new()` is *NOT* freed from this method. The caller is responsible for that. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_end.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_end.rst new file mode 100644 index 0000000..45652d8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_end.rst @@ -0,0 +1,23 @@ +:man_page: bson_writer_end + +bson_writer_end() +================= + +Synopsis +-------- + +.. code-block:: c + + void + bson_writer_end (bson_writer_t *writer); + +Parameters +---------- + +* ``writer``: A :symbol:`bson_writer_t`. + +Description +----------- + +Complete writing of a :symbol:`bson_writer_t` to the buffer supplied. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_get_length.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_get_length.rst new file mode 100644 index 0000000..da4c540 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_get_length.rst @@ -0,0 +1,30 @@ +:man_page: bson_writer_get_length + +bson_writer_get_length() +======================== + +Synopsis +-------- + +.. code-block:: c + + size_t + bson_writer_get_length (bson_writer_t *writer); + +Parameters +---------- + +* ``writer``: A :symbol:`bson_writer_t`. + +Description +----------- + +Fetches the current length of the content written by the buffer (including the initial offset). This includes a partly written document currently being written. + +This is useful if you want to check to see if you've passed a given memory boundary that cannot be sent in a packet. See :symbol:`bson_writer_rollback()` to abort the current document being written. + +Returns +------- + +The length of the underlying buffer. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_new.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_new.rst new file mode 100644 index 0000000..a265bd2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_new.rst @@ -0,0 +1,38 @@ +:man_page: bson_writer_new + +bson_writer_new() +================= + +Synopsis +-------- + +.. code-block:: c + + bson_writer_t * + bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); + +Parameters +---------- + +* ``buf``: A uint8_t. +* ``buflen``: A size_t. +* ``offset``: A size_t. +* ``realloc_func``: A bson_realloc_func. +* ``realloc_func_ctx``: A bson_realloc_func. + +Description +----------- + +Creates a new instance of :symbol:`bson_writer_t` using the ``buffer``, ``length``, ``offset``, and _realloc()_ function supplied. + +The caller is expected to clean up the structure when finished using :symbol:`bson_writer_destroy()`. + +Returns +------- + +A newly allocated bson_writer_t. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_rollback.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_rollback.rst new file mode 100644 index 0000000..dafbd9d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_rollback.rst @@ -0,0 +1,23 @@ +:man_page: bson_writer_rollback + +bson_writer_rollback() +====================== + +Synopsis +-------- + +.. code-block:: c + + void + bson_writer_rollback (bson_writer_t *writer); + +Parameters +---------- + +* ``writer``: A :symbol:`bson_writer_t`. + +Description +----------- + +Abort the appending of the current bson_t to the memory region managed by ``writer``. This is useful if you detected that you went past a particular memory limit. For example, MongoDB has 48MB message limits. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_t.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_t.rst new file mode 100644 index 0000000..c72c19a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_writer_t.rst @@ -0,0 +1,76 @@ +:man_page: bson_writer_t + +bson_writer_t +============= + +Bulk BSON serialization Abstraction + +Synopsis +-------- + +.. code-block:: c + + #include + + typedef struct _bson_writer_t bson_writer_t; + + bson_writer_t * + bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); + void + bson_writer_destroy (bson_writer_t *writer); + +Description +----------- + +The :symbol:`bson_writer_t` API provides an abstraction for serializing many BSON documents to a single memory region. The memory region may be dynamically allocated and re-allocated as more memory is demanded. This can be useful when building network packets from a high-level language. For example, you can serialize a Python Dictionary directly to a single buffer destined for a TCP packet. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_writer_begin + bson_writer_destroy + bson_writer_end + bson_writer_get_length + bson_writer_new + bson_writer_rollback + +Example +------- + +.. code-block:: c + + #include + + int + main (int argc, char *argv[]) + { + bson_writer_t *writer; + uint8_t *buf = NULL; + size_t buflen = 0; + bson_t *doc; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 1000; i++) { + bson_writer_begin (writer, &doc); + BSON_APPEND_INT32 (&doc, "i", i); + bson_writer_end (writer); + } + + bson_writer_destroy (writer); + + bson_free (buf); + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_zero_free.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_zero_free.rst new file mode 100644 index 0000000..1c7d5e8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/bson_zero_free.rst @@ -0,0 +1,24 @@ +:man_page: bson_zero_free + +bson_zero_free() +================ + +Synopsis +-------- + +.. code-block:: c + + void + bson_zero_free (void *mem, size_t size); + +Parameters +---------- + +* ``mem``: A memory region. +* ``size``: The size of ``mem``. + +Description +----------- + +This function behaves like :symbol:`bson_free()` except that it zeroes the memory first. This can be useful if you are storing passwords or other similarly important data. Note that if it truly is important, you probably want a page protected with ``mlock()`` as well to prevent it swapping to disk. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/character_and_string_routines.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/character_and_string_routines.rst new file mode 100644 index 0000000..5f9b37b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/character_and_string_routines.rst @@ -0,0 +1,33 @@ +:man_page: bson_character_and_string_routines + +Character and String Routines +============================= + +We provide a small number of character and string routines to substitute for those that are not available on all platforms, and routines to make UTF-8 character manipulation convenient. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_ascii_strtoll + bson_snprintf + bson_strcasecmp + bson_strdup + bson_strdup_printf + bson_strdupv_printf + bson_strfreev + bson_strncpy + bson_strndup + bson_strnlen + bson_uint32_to_string + bson_utf8_escape_for_json + bson_utf8_from_unichar + bson_utf8_get_char + bson_utf8_next_char + bson_utf8_validate + bson_vsnprintf diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/conf.py b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/conf.py new file mode 100644 index 0000000..2f63a78 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/conf.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +import os.path +import sys + +# Ensure we can import "taglist" extension module. +this_path = os.path.dirname(__file__) +sys.path.append(os.path.normpath(os.path.join(this_path, '../../../build/sphinx'))) + +from mongoc_common import * + +extensions = [ + 'mongoc', + 'taglist', + 'sphinx.ext.extlinks', +] + +# General information about the project. +project = 'Libbson' +copyright = '2017-present, MongoDB, Inc' + +version_path = os.path.join( + os.path.dirname(__file__), '../../..', 'VERSION_CURRENT') +version = open(version_path).read().strip() +release_path = os.path.join( + os.path.dirname(__file__), '../../..', 'VERSION_RELEASED') +release = open(release_path).read().strip() +release_major, release_minor, release_patch = release.split('.') +release_download = 'https://github.com/mongodb/libbson/releases/download/{0}/libbson-{0}.tar.gz'.format(release) +rst_prolog = """ +.. |release_major| replace:: %(release_major)s + +.. |release_minor| replace:: %(release_minor)s + +.. |release_patch| replace:: %(release_patch)s + +.. |release_download| replace:: https://github.com/mongodb/libbson/releases/download/%(release)s/libbson-%(release)s.tar.gz +""" % locals() + +# The extension requires the "base" to contain '%s' exactly once, but we never intend to use it though +extlinks = {'release': (release_download+'%s', '')} + +language = 'en' +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +master_doc = 'index' + +# -- Options for HTML output ---------------------------------------------- + +html_theme_path = ['../../../build/sphinx'] +html_theme = 'mongoc-theme' +html_title = html_shorttitle = 'libbson %s' % version +# html_favicon = None + +html_sidebars = { + '**': ['globaltoc.html'], + 'errors': [], # Make more room for the big table. +} + + +def add_canonical_link(app, pagename, templatename, context, doctree): + link = ('' % pagename) + + context['metatags'] = context.get('metatags', '') + link + + +def setup(app): + mongoc_common_setup(app) + app.connect('html-page-context', add_canonical_link) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/creating.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/creating.rst new file mode 100644 index 0000000..d67f463 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/creating.rst @@ -0,0 +1,108 @@ +:man_page: bson_creating + +Creating a BSON Document +======================== + +The bson_t structure +-------------------- + +BSON documents are created using the :symbol:`bson_t` structure. This structure encapsulates the necessary logic for encoding using the `BSON Specification `_. At the core, :symbol:`bson_t` is a buffer manager and set of encoding routines. + +.. tip:: + + BSON documents can live on the stack or the heap based on the performance needs or preference of the consumer. + +Let's start by creating a new BSON document on the stack. Whenever using libbson, make sure you ``#include ``. + +.. code-block:: c + + bson_t b; + + bson_init (&b); + +This creates an empty document. In JSON, this would be the same as ``{}``. + +We can now proceed to adding items to the BSON document. A variety of functions prefixed with ``bson_append_`` can be used based on the type of field you want to append. Let's append a UTF-8 encoded string. + +.. code-block:: c + + bson_append_utf8 (&b, "key", -1, "value", -1); + +Notice the two ``-1`` parameters. The first indicates that the length of ``key`` in bytes should be determined with ``strlen()``. Alternatively, we could have passed the number ``3``. The same goes for the second ``-1``, but for ``value``. + +Libbson provides macros to make this less tedious when using string literals. The following two appends are identical. + +.. code-block:: c + + bson_append_utf8 (&b, "key", -1, "value", -1); + BSON_APPEND_UTF8 (&b, "key", "value"); + +Now let's take a look at an example that adds a few different field types to a BSON document. + +.. code-block:: c + + bson_t b = BSON_INITIALIZER; + + BSON_APPEND_INT32 (&b, "a", 1); + BSON_APPEND_UTF8 (&b, "hello", "world"); + BSON_APPEND_BOOL (&b, "bool", true); + +Notice that we omitted the call to :symbol:`bson_init()`. By specifying ``BSON_INITIALIZER`` we can remove the need to initialize the structure to a base state. + +Sub-Documents and Sub-Arrays +---------------------------- + +To simplify the creation of sub-documents and arrays, :symbol:`bson_append_document_begin()` and :symbol:`bson_append_array_begin()` exist. These can be used to build a sub-document using the parent documents memory region as the destination buffer. + +.. code-block:: c + + bson_t parent; + bson_t child; + char *str; + + bson_init (&parent); + bson_append_document_begin (&parent, "foo", 3, &child); + bson_append_int32 (&child, "baz", 3, 1); + bson_append_document_end (&parent, &child); + + str = bson_as_canonical_extended_json (&parent, NULL); + printf ("%s\n", str); + bson_free (str); + + bson_destroy (&parent); + +.. code-block:: none + + { "foo" : { "baz" : 1 } } + +Simplified BSON C Object Notation +--------------------------------- + +Creating BSON documents by hand can be tedious and time consuming. BCON, or BSON C Object Notation, was added to allow for the creation of BSON documents in a format that looks closer to the destination format. + +The following example shows the use of BCON. Notice that values for fields are wrapped in the ``BCON_*`` macros. These are required for the variadic processor to determine the parameter type. + +.. code-block:: c + + bson_t *doc; + + doc = BCON_NEW ("foo", + "{", + "int", + BCON_INT32 (1), + "array", + "[", + BCON_INT32 (100), + "{", + "sub", + BCON_UTF8 ("value"), + "}", + "]", + "}"); + +Creates the following document + +.. code-block:: none + + { "foo" : { "int" : 1, "array" : [ 100, { "sub" : "value" } ] } } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/cross-platform-notes.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/cross-platform-notes.rst new file mode 100644 index 0000000..8dfbe93 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/cross-platform-notes.rst @@ -0,0 +1,10 @@ +:man_page: bson_cross_platform_notes + +Cross Platform Notes +==================== + +.. toctree:: + :titlesonly: + + endianness + threading diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/endianness.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/endianness.rst new file mode 100644 index 0000000..7f13b0c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/endianness.rst @@ -0,0 +1,7 @@ +:man_page: bson_endianness + +Endianness +========== + +The BSON specification dictates that the encoding format is in little-endian. Many implementations simply ignore endianness altogether and expect that they are to be run on little-endian. Libbson supports both Big and Little Endian systems. This means we use ``memcpy()`` when appropriate instead of dereferencing and properly convert to and from the host endian format. We expect the compiler intrinsics to optimize it to a dereference when possible. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/errors.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/errors.rst new file mode 100644 index 0000000..e2255e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/errors.rst @@ -0,0 +1,23 @@ +:man_page: bson_errors + +Handling Errors +=============== + +Description +----------- + +Many libbson functions report errors by returning ``NULL`` or -1 and filling out a :symbol:`bson_error_t` structure with an error domain, error code, and message. + +* ``error.domain`` names the subsystem that generated the error. +* ``error.code`` is a domain-specific error type. +* ``error.message`` describes the error. + +Some error codes overlap with others; always check both the domain and code to determine the type of error. + +===================== ====================================== ================================================================================================== +``BSON_ERROR_JSON`` ``BSON_JSON_ERROR_READ_CORRUPT_JS`` :symbol:`bson_json_reader_t` tried to parse invalid MongoDB Extended JSON. + ``BSON_JSON_ERROR_READ_INVALID_PARAM`` Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. + ``BSON_JSON_ERROR_READ_CB_FAILURE`` An internal callback failure during JSON parsing. +``BSON_ERROR_READER`` ``BSON_ERROR_READER_BADFD`` :symbol:`bson_json_reader_new_from_file` could not open the file. +===================== ====================================== ================================================================================================== + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/full_index.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/full_index.rst new file mode 100644 index 0000000..4574cf0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/full_index.rst @@ -0,0 +1,15 @@ +:man_page: bson_reference +:orphan: + +.. Yes it's confusing: the home page is called "index" so this is "full_index", + and it works by including the complete Table of Contents from the homepage, + i.e., "index". + +Index +===== + +.. toctree:: + :maxdepth: 6 + :titlesonly: + + index diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/guides.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/guides.rst new file mode 100644 index 0000000..0d4b568 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/guides.rst @@ -0,0 +1,11 @@ +:man_page: bson_guides + +Guides +====== + +.. toctree:: + :titlesonly: + + streaming-bson + json + valgrind diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/.nojekyll b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/.nojekyll new file mode 100644 index 0000000..1910281 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/.nojekyll @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/CMakeLists.txt new file mode 100644 index 0000000..b5800a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/CMakeLists.txt @@ -0,0 +1,31 @@ +# Additional generated static files +extra_dist_generated ( + .nojekyll + objects.inv + _static/ajax-loader.gif + _static/basic.css + _static/comment-bright.png + _static/comment-close.png + _static/comment.png + _static/doctools.js + _static/down-pressed.png + _static/down.png + _static/file.png + _static/jquery.js + _static/minus.png + _static/mongoc.css + _static/plus.png + _static/pygments.css + _static/searchtools.js + _static/underscore.js + _static/up-pressed.png + _static/up.png + _static/websupport.js + genindex.html + search.html + searchindex.js +) + +set_dist_list (src_libbson_doc_html_DIST + CMakeLists.txt +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/ajax-loader.gif b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/ajax-loader.gif new file mode 100644 index 0000000..61faf8c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/ajax-loader.gif differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/basic.css b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/basic.css new file mode 100644 index 0000000..104f076 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/basic.css @@ -0,0 +1,676 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 450px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist td { + vertical-align: top; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-bright.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-bright.png new file mode 100644 index 0000000..15e27ed Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-bright.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-close.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-close.png new file mode 100644 index 0000000..4d91bcf Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment-close.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment.png new file mode 100644 index 0000000..dfbc0cb Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/comment.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/doctools.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/doctools.js new file mode 100644 index 0000000..ffadbec --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/doctools.js @@ -0,0 +1,315 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var bbox = span.getBBox(); + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + var parentOfText = node.parentNode.parentNode; + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { + this.initOnKeyListeners(); + } + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated === 'undefined') + return string; + return (typeof translated === 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated === 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) === 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this === '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down-pressed.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down-pressed.png new file mode 100644 index 0000000..5756c8c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down-pressed.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down.png new file mode 100644 index 0000000..1b3bdad Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/down.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/file.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/file.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/jquery.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/jquery.js new file mode 100644 index 0000000..644d35e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/_static/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S), +a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), +null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

API Reference

+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array.html new file mode 100644 index 0000000..92a961e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_array() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_array()

+
+

Synopsis

+
#define BSON_APPEND_ARRAY(b, key, val) \
+   bson_append_array (b, key, (int) strlen (key), val)
+
+bool
+bson_append_array (bson_t *bson,
+                   const char *key,
+                   int key_length,
+                   const bson_t *array);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • array: A bson_t.
  • +
+
+
+

Description

+

The bson_append_array() function shall append array to bson using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of array are properly formatted with string keys such as “0”, “1”, “2” and so forth.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function fails if appending the array grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_begin.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_begin.html new file mode 100644 index 0000000..b855443 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_begin.html @@ -0,0 +1,139 @@ + + + + + + + + bson_append_array_begin() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_array_begin()

+
+

Synopsis

+
#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \
+   bson_append_array_begin (b, key, (int) strlen (key), child)
+
+bool
+bson_append_array_begin (bson_t *bson,
+                         const char *key,
+                         int key_length,
+                         bson_t *child);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: A string containing the name for the key.
  • +
  • key_length: The length of key or -1 to call strlen().
  • +
  • child: A bson_t.
  • +
+
+
+

Description

+

The bson_append_array_begin() function shall begin appending an array field to bson. This allows for incrementally building a sub-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub-array, the caller MUST call bson_append_array_end().

+

For generating array element keys, see bson_uint32_to_string().

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the array grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_end.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_end.html new file mode 100644 index 0000000..4148994 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_array_end.html @@ -0,0 +1,130 @@ + + + + + + + + bson_append_array_end() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_array_end()

+
+

Synopsis

+
bool
+bson_append_array_end (bson_t *bson, bson_t *child);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_append_array_end() function shall complete the appending of an array field started with bson_append_array_begin(). child is invalid after calling this function.

+
+
+

Returns

+

Returns true if successful.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_binary.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_binary.html new file mode 100644 index 0000000..9f7aa8b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_binary.html @@ -0,0 +1,142 @@ + + + + + + + + bson_append_binary() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_binary()

+
+

Synopsis

+
#define BSON_APPEND_BINARY(b, key, subtype, val, len) \
+   bson_append_binary (b, key, (int) strlen (key), subtype, val, len)
+
+bool
+bson_append_binary (bson_t *bson,
+                    const char *key,
+                    int key_length,
+                    bson_subtype_t subtype,
+                    const uint8_t *binary,
+                    uint32_t length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: The key name.
  • +
  • key_length: The length of key in bytes or -1 to use strlen().
  • +
  • subtype: A bson_subtype_t indicating the binary subtype.
  • +
  • binary: A buffer to embed as binary data. Must not be NULL.
  • +
  • length: The length of buffer in bytes.
  • +
+
+
+

Description

+

The bson_append_binary() function shall append a new element to bson containing the binary data provided.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending binary grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_bool.html new file mode 100644 index 0000000..2a1a37e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_bool.html @@ -0,0 +1,135 @@ + + + + + + + + bson_append_bool() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_bool()

+
+

Synopsis

+
#define BSON_APPEND_BOOL(b, key, val) \
+   bson_append_bool (b, key, (int) strlen (key), val)
+
+bool
+bson_append_bool (bson_t *bson, const char *key, int key_length, bool value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: The name of the field.
  • +
  • key_length: The length of key or -1 to use strlen().
  • +
  • value: true or false.
  • +
+
+
+

Description

+

The bson_append_bool() function shall append a new element to bson containing the boolean provided.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code.html new file mode 100644 index 0000000..b3fca6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_code() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_code()

+
+

Synopsis

+
#define BSON_APPEND_CODE(b, key, val) \
+   bson_append_code (b, key, (int) strlen (key), val)
+
+bool
+bson_append_code (bson_t *bson,
+                  const char *key,
+                  int key_length,
+                  const char *javascript);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: The key name.
  • +
  • key_length: The length of key or -1 to use strlen().
  • +
  • javascript: A UTF-8 encoded string containing the javascript.
  • +
+
+
+

Description

+

The bson_append_code() function shall append a new element to bson using the UTF-8 encoded javascript provided. javascript must be a NULL terminated C string.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending javascript grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code_with_scope.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code_with_scope.html new file mode 100644 index 0000000..3cd4b19 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_code_with_scope.html @@ -0,0 +1,141 @@ + + + + + + + + bson_append_code_with_scope() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_code_with_scope()

+
+

Synopsis

+
#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \
+   bson_append_code_with_scope (b, key, (int) strlen (key), val, scope)
+
+bool
+bson_append_code_with_scope (bson_t *bson,
+                             const char *key,
+                             int key_length,
+                             const char *javascript,
+                             const bson_t *scope);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • javascript: A NULL-terminated UTF-8 encoded string containing the javascript fragment.
  • +
  • scope: Optional bson_t containing the scope for javascript.
  • +
+
+
+

Description

+

The bson_append_code_with_scope() function shall perform like bson_append_code() except it allows providing a scope to the javascript function in the form of a bson document.

+

If scope is NULL, this function appends an element with BSON type “code”, otherwise with BSON type “code with scope”.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending javascript and scope grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_date_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_date_time.html new file mode 100644 index 0000000..64308e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_date_time.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_date_time() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_date_time()

+
+

Synopsis

+
#define BSON_APPEND_DATE_TIME(b, key, val) \
+   bson_append_date_time (b, key, (int) strlen (key), val)
+
+bool
+bson_append_date_time (bson_t *bson,
+                       const char *key,
+                       int key_length,
+                       int64_t value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: The date and time as specified in milliseconds since the UNIX epoch.
  • +
+
+
+

Description

+

The bson_append_date_time() function shall append a new element to a bson document containing a date and time with no timezone information. value is assumed to be in UTC format of milliseconds since the UNIX epoch. value MAY be negative.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_dbpointer.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_dbpointer.html new file mode 100644 index 0000000..51c75ee --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_dbpointer.html @@ -0,0 +1,143 @@ + + + + + + + + bson_append_dbpointer() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_dbpointer()

+
+

Synopsis

+
#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \
+   bson_append_dbpointer (b, key, (int) strlen (key), coll, oid)
+
+bool
+bson_append_dbpointer (bson_t *bson,
+                       const char *key,
+                       int key_length,
+                       const char *collection,
+                       const bson_oid_t *oid);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • collection: The target collection name.
  • +
  • oid: The target document identifier.
  • +
+
+
+

Description

+
+

Warning

+

The dbpointer field type is DEPRECATED and should only be used when interacting with legacy systems.

+
+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the array grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_decimal128.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_decimal128.html new file mode 100644 index 0000000..a63e5b2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_decimal128.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_decimal128() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_decimal128()

+
+

Synopsis

+
#define BSON_APPEND_DECIMAL128(b, key, val) \
+   bson_append_decimal128 (b, key, (int) strlen (key), val)
+
+bool
+bson_append_decimal128 (bson_t *bson,
+                        const char *key,
+                        int key_length,
+                        const bson_decimal128_t *value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A bson_decimal128_t.
  • +
+
+
+

Description

+

The bson_append_decimal128() function shall append a new element to bson containing a Decimal 128.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document.html new file mode 100644 index 0000000..9ae86a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_document() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_document()

+
+

Synopsis

+
#define BSON_APPEND_DOCUMENT(b, key, val) \
+   bson_append_document (b, key, (int) strlen (key), val)
+
+bool
+bson_append_document (bson_t *bson,
+                      const char *key,
+                      int key_length,
+                      const bson_t *value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A bson_t containing the sub-document to append.
  • +
+
+
+

Description

+

The bson_append_document() function shall append child to bson using the specified key. The type of the field will be a document.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_begin.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_begin.html new file mode 100644 index 0000000..8c62b1a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_begin.html @@ -0,0 +1,139 @@ + + + + + + + + bson_append_document_begin() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_document_begin()

+
+

Synopsis

+
#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \
+   bson_append_document_begin (b, key, (int) strlen (key), child)
+
+bool
+bson_append_document_begin (bson_t *bson,
+                            const char *key,
+                            int key_length,
+                            bson_t *child);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • child: An uninitialized bson_t to be initialized as the sub-document.
  • +
+
+
+

Description

+

The bson_append_document_begin() function shall begin appending a sub-document to bson. Use child to add fields to the sub-document. When completed, call bson_append_document_end() to complete the element.

+

child MUST be an uninitialized bson_t to avoid leaking memory.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if bson must grow larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_end.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_end.html new file mode 100644 index 0000000..7d07bbf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_document_end.html @@ -0,0 +1,130 @@ + + + + + + + + bson_append_document_end() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_document_end()

+
+

Synopsis

+
bool
+bson_append_document_end (bson_t *bson, bson_t *child);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_append_document_end() function shall complete the appending of a document with bson_append_document_begin(). child is invalid after calling this function.

+
+
+

Returns

+

Returns true if successful.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_double.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_double.html new file mode 100644 index 0000000..f74aa25 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_double.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_double() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_double()

+
+

Synopsis

+
#define BSON_APPEND_DOUBLE(b, key, val) \
+   bson_append_double (b, key, (int) strlen (key), val)
+
+bool
+bson_append_double (bson_t *bson,
+                    const char *key,
+                    int key_length,
+                    double value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A double value to append.
  • +
+
+
+

Description

+

The bson_append_double() function shall append a new element to a bson document of type double.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int32.html new file mode 100644 index 0000000..21a0d89 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int32.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_int32() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_int32()

+
+

Synopsis

+
#define BSON_APPEND_INT32(b, key, val) \
+   bson_append_int32 (b, key, (int) strlen (key), val)
+
+bool
+bson_append_int32 (bson_t *bson,
+                   const char *key,
+                   int key_length,
+                   int32_t value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: An int32_t.
  • +
+
+
+

Description

+

The bson_append_int32() function shall append a new element to bson containing a 32-bit signed integer.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int64.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int64.html new file mode 100644 index 0000000..8b1b74b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_int64.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_int64() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_int64()

+
+

Synopsis

+
#define BSON_APPEND_INT64(b, key, val) \
+   bson_append_int64 (b, key, (int) strlen (key), val)
+
+bool
+bson_append_int64 (bson_t *bson,
+                   const char *key,
+                   int key_length,
+                   int64_t value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: An int64_t.
  • +
+
+
+

Description

+

The bson_append_int64() function shall append a new element to bson containing a 64-bit signed integer.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_iter.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_iter.html new file mode 100644 index 0000000..9d982bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_iter.html @@ -0,0 +1,135 @@ + + + + + + + + bson_append_iter() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_iter()

+
+

Synopsis

+
bool
+bson_append_iter (bson_t *bson,
+                  const char *key,
+                  int key_length,
+                  const bson_iter_t *iter);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: Optional field name. If NULL, uses bson_iter_key(iter).
  • +
  • key_length: The length of key or -1 to use strlen().
  • +
  • iter: A bson_iter_t located on the position of the element to append.
  • +
+
+
+

Description

+

Appends the value at the current position of iter to the document.

+
+
+

Returns

+

Returns true if successful; false if the operation would overflow the maximum document size or another invalid state is detected.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_maxkey.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_maxkey.html new file mode 100644 index 0000000..56f9e7a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_maxkey.html @@ -0,0 +1,134 @@ + + + + + + + + bson_append_maxkey() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_maxkey()

+
+

Synopsis

+
#define BSON_APPEND_MAXKEY(b, key) \
+   bson_append_maxkey (b, key, (int) strlen (key))
+
+bool
+bson_append_maxkey (bson_t *bson, const char *key, int key_length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_maxkey() function shall append an element of type BSON_TYPE_MAXKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_minkey.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_minkey.html new file mode 100644 index 0000000..13b7f9d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_minkey.html @@ -0,0 +1,134 @@ + + + + + + + + bson_append_minkey() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_minkey()

+
+

Synopsis

+
#define BSON_APPEND_MINKEY(b, key) \
+   bson_append_minkey (b, key, (int) strlen (key))
+
+bool
+bson_append_minkey (bson_t *bson, const char *key, int key_length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_minkey() function shall append an element of type BSON_TYPE_MINKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_now_utc.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_now_utc.html new file mode 100644 index 0000000..e6cdd3b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_now_utc.html @@ -0,0 +1,132 @@ + + + + + + + + bson_append_now_utc() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_now_utc()

+
+

Synopsis

+
bool
+bson_append_now_utc (bson_t *bson, const char *key, int key_length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_now_utc() function is a helper to get the current date and time in UTC and append it to bson as a BSON_TYPE_DATE_TIME element.

+

This function calls bson_append_date_time() internally.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_null.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_null.html new file mode 100644 index 0000000..61f3357 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_null.html @@ -0,0 +1,133 @@ + + + + + + + + bson_append_null() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_null()

+
+

Synopsis

+
#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key))
+
+bool
+bson_append_null (bson_t *bson, const char *key, int key_length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_null() function shall append a new element to bson of type BSON_TYPE_NULL.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_oid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_oid.html new file mode 100644 index 0000000..a790fee --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_oid.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_oid() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_oid()

+
+

Synopsis

+
#define BSON_APPEND_OID(b, key, val) \
+   bson_append_oid (b, key, (int) strlen (key), val)
+
+bool
+bson_append_oid (bson_t *bson,
+                 const char *key,
+                 int key_length,
+                 const bson_oid_t *oid);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • oid: A bson_oid_t.
  • +
+
+
+

Description

+

The bson_append_oid() function shall append a new element to bson of type BSON_TYPE_OID. oid MUST be a pointer to a bson_oid_t.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending oid grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex.html new file mode 100644 index 0000000..0ee3889 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex.html @@ -0,0 +1,149 @@ + + + + + + + + bson_append_regex() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_regex()

+
+

Synopsis

+
#define BSON_APPEND_REGEX(b, key, val, opt) \
+   bson_append_regex (b, key, (int) strlen (key), val, opt)
+
+bool
+bson_append_regex (bson_t *bson,
+                   const char *key,
+                   int key_length,
+                   const char *regex,
+                   const char *options);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • regex: An ASCII string containing the regex.
  • +
  • options: An optional string containing the regex options as a string.
  • +
+
+
+

Description

+

Appends a new field to bson of type BSON_TYPE_REGEX. regex should be the regex string. options should contain the options for the regex.

+

Valid characters for options include:

+
    +
  • 'i' for case-insensitive.
  • +
  • 'm' for multiple matching.
  • +
  • 'x' for verbose mode.
  • +
  • 'l' to make w and W locale dependent.
  • +
  • 's' for dotall mode (‘.’ matches everything)
  • +
  • 'u' to make w and W match unicode.
  • +
+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the regex grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex_w_len.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex_w_len.html new file mode 100644 index 0000000..df143ad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_regex_w_len.html @@ -0,0 +1,148 @@ + + + + + + + + bson_append_regex_w_len() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_regex_w_len()

+
+

Synopsis

+
bool
+bson_append_regex_w_len (bson_t *bson,
+                          const char *key,
+                          int key_length,
+                          const char *regex,
+                          int regex_length,
+                          const char *options);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • regex: An ASCII string containing the regex.
  • +
  • regex_length: The length of regex in bytes, or -1 to determine the length with strlen().
  • +
  • options: An optional string containing the regex options as a string.
  • +
+
+
+

Description

+

Appends a new field to bson of type BSON_TYPE_REGEX. regex should be the regex string. options should contain the options for the regex.

+

Valid characters for options include:

+
    +
  • 'i' for case-insensitive.
  • +
  • 'm' for multiple matching.
  • +
  • 'x' for verbose mode.
  • +
  • 'l' to make w and W locale dependent.
  • +
  • 's' for dotall mode (‘.’ matches everything)
  • +
  • 'u' to make w and W match unicode.
  • +
+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the regex grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_symbol.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_symbol.html new file mode 100644 index 0000000..03b7ba5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_symbol.html @@ -0,0 +1,140 @@ + + + + + + + + bson_append_symbol() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_symbol()

+
+

Synopsis

+
#define BSON_APPEND_SYMBOL(b, key, val) \
+   bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val))
+
+bool
+bson_append_symbol (bson_t *bson,
+                    const char *key,
+                    int key_length,
+                    const char *value,
+                    int length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: The symbol.
  • +
  • length: A length of symbol in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

Appends a new field to bson of type BSON_TYPE_SYMBOL. This BSON type is deprecated and should not be used in new code.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_time_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_time_t.html new file mode 100644 index 0000000..d42ae71 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_time_t.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_time_t() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_time_t()

+
+

Synopsis

+
#define BSON_APPEND_TIME_T(b, key, val) \
+   bson_append_time_t (b, key, (int) strlen (key), val)
+
+bool
+bson_append_time_t (bson_t *bson,
+                    const char *key,
+                    int key_length,
+                    time_t value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A time_t.
  • +
+
+
+

Description

+

The bson_append_time_t() function is a helper that takes a time_t instead of milliseconds since the UNIX epoch.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timestamp.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timestamp.html new file mode 100644 index 0000000..06171dd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timestamp.html @@ -0,0 +1,142 @@ + + + + + + + + bson_append_timestamp() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_timestamp()

+
+

Synopsis

+
#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \
+   bson_append_timestamp (b, key, (int) strlen (key), val, inc)
+
+bool
+bson_append_timestamp (bson_t *bson,
+                       const char *key,
+                       int key_length,
+                       uint32_t timestamp,
+                       uint32_t increment);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • timestamp: A uint32_t.
  • +
  • increment: A uint32_t.
  • +
+
+
+

Description

+

This function is not similar in functionality to bson_append_date_time(). Timestamp elements are different in that they include only second precision and an increment field.

+

They are primarily used for intra-MongoDB server communication.

+

The bson_append_timestamp() function shall append a new element of type BSON_TYPE_TIMESTAMP.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timeval.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timeval.html new file mode 100644 index 0000000..66afad0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_timeval.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_timeval() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_timeval()

+
+

Synopsis

+
#define BSON_APPEND_TIMEVAL(b, key, val) \
+   bson_append_timeval (b, key, (int) strlen (key), val)
+
+bool
+bson_append_timeval (bson_t *bson,
+                     const char *key,
+                     int key_length,
+                     struct timeval *value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A struct timeval.
  • +
+
+
+

Description

+

The bson_append_timeval() function is a helper that takes a struct timeval instead of milliseconds since the UNIX epoch.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_undefined.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_undefined.html new file mode 100644 index 0000000..1978cf1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_undefined.html @@ -0,0 +1,134 @@ + + + + + + + + bson_append_undefined() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_undefined()

+
+

Synopsis

+
#define BSON_APPEND_UNDEFINED(b, key) \
+   bson_append_undefined (b, key, (int) strlen (key))
+
+bool
+bson_append_undefined (bson_t *bson, const char *key, int key_length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_undefined() function shall append a new element to bson of type BSON_TYPE_UNDEFINED. Undefined is common in Javascript. However, this element type is deprecated and should not be used in new code.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_utf8.html new file mode 100644 index 0000000..a4bd1f3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_utf8.html @@ -0,0 +1,143 @@ + + + + + + + + bson_append_utf8() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_utf8()

+
+

Synopsis

+
#define BSON_APPEND_UTF8(b, key, val) \
+   bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val))
+
+bool
+bson_append_utf8 (bson_t *bson,
+                  const char *key,
+                  int key_length,
+                  const char *value,
+                  int length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A UTF-8 encoded string.
  • +
  • length: The number of bytes in value excluding the trailing \0, or -1 to determine the length with strlen().
  • +
+
+
+

Description

+

The bson_append_utf8() function shall append a UTF-8 encoded string to bson.

+

value MUST be valid UTF-8.

+

Some UTF-8 implementations allow for \0 to be contained within the string (excluding the termination \0. This is allowed, but remember that it could cause issues with communicating with external systems that do not support it.

+

It is suggested to use modified UTF-8 which uses a 2 byte representation for embedded \0 within the string. This will allow these UTF-8 encoded strings to used with many libc functions.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_value.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_value.html new file mode 100644 index 0000000..94d83b8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_append_value.html @@ -0,0 +1,138 @@ + + + + + + + + bson_append_value() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_append_value()

+
+

Synopsis

+
#define BSON_APPEND_VALUE(b, key, val) \
+   bson_append_value (b, key, (int) strlen (key), (val))
+
+bool
+bson_append_value (bson_t *bson,
+                   const char *key,
+                   int key_length,
+                   const bson_value_t *value);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: An ASCII C string containing the name of the field.
  • +
  • key_length: The length of key in bytes, or -1 to determine the length with strlen().
  • +
  • value: A bson_value_t.
  • +
+
+
+

Description

+

Appends a new field to bson by determining the boxed type in value. This is useful if you want to copy fields between documents but do not know the field type until runtime.

+
+
+

Returns

+

Returns true if the operation was applied successfully. The function will fail if appending the value grows bson larger than INT32_MAX.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_array_as_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_array_as_json.html new file mode 100644 index 0000000..0daa4bf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_array_as_json.html @@ -0,0 +1,171 @@ + + + + + + + + bson_array_as_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_array_as_json()

+
+

Synopsis

+
char *
+bson_array_as_json (const bson_t *bson, size_t *length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • length: An optional location for the length of the resulting string.
  • +
+
+
+

Description

+

The bson_array_as_json() function shall encode bson as a UTF-8 +string using libbson’s legacy JSON format, except the outermost element is +encoded as a JSON array, rather than a JSON document. +The caller is responsible for freeing the resulting UTF-8 encoded string by +calling bson_free() with the result.

+

If non-NULL, length will be set to the length of the result in bytes.

+
+
+

Returns

+

If successful, a newly allocated UTF-8 encoded string and length is set.

+

Upon failure, NULL is returned.

+
+
+

Example

+
#include <bson/bson.h>
+
+int main ()
+{
+   bson_t bson;
+   char *str;
+
+   bson_init (&bson);
+   /* BSON array is a normal BSON document with integer values for the keys,
+    * starting with 0 and continuing sequentially
+    */
+   BSON_APPEND_UTF8 (&bson, "0", "foo");
+   BSON_APPEND_UTF8 (&bson, "1", "bar");
+
+   str = bson_array_as_json (&bson, NULL);
+   /* Prints
+    * [ "foo", "bar" ]
+    */
+   printf ("%s\n", str);
+   bson_free (str);
+
+   bson_destroy (&bson);
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_canonical_extended_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_canonical_extended_json.html new file mode 100644 index 0000000..dc12721 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_canonical_extended_json.html @@ -0,0 +1,148 @@ + + + + + + + + bson_as_canonical_extended_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_as_canonical_extended_json()

+
+

Synopsis

+
char *
+bson_as_canonical_extended_json (const bson_t *bson, size_t *length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • length: An optional location for the length of the resulting string.
  • +
+
+
+

Description

+

The bson_as_canonical_extended_json() encodes bson as a UTF-8 string in the canonical MongoDB Extended JSON format.

+

The caller is responsible for freeing the resulting UTF-8 encoded string by calling bson_free() with the result.

+

If non-NULL, length will be set to the length of the result in bytes.

+
+
+

Returns

+

If successful, a newly allocated UTF-8 encoded string and length is set.

+

Upon failure, NULL is returned.

+
+
+

Example

+
char *str = bson_as_canonical_extended_json (doc, NULL);
+printf ("%s\n", str);
+bson_free (str);
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_json.html new file mode 100644 index 0000000..22ac620 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_json.html @@ -0,0 +1,165 @@ + + + + + + + + bson_as_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_as_json()

+
+

Synopsis

+
char *
+bson_as_json (const bson_t *bson, size_t *length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • length: An optional location for the length of the resulting string.
  • +
+
+
+

Description

+

The bson_as_json() function shall encode bson as a UTF-8 string using libbson’s legacy JSON format. This function is superseded by bson_as_canonical_extended_json() and bson_as_relaxed_extended_json(), which use the same MongoDB Extended JSON format as all other MongoDB drivers.

+

The caller is responsible for freeing the resulting UTF-8 encoded string by calling bson_free() with the result.

+

If non-NULL, length will be set to the length of the result in bytes.

+
+
+

Returns

+

If successful, a newly allocated UTF-8 encoded string and length is set.

+

Upon failure, NULL is returned.

+
+
+

Example

+
#include <bson/bson.h>
+
+int main ()
+{
+   bson_t bson;
+   char *str;
+
+   bson_init (&bson);
+   BSON_APPEND_UTF8 (&bson, "0", "foo");
+   BSON_APPEND_UTF8 (&bson, "1", "bar");
+
+   str = bson_as_json (&bson, NULL);
+   /* Prints
+    * { "0" : "foo", "1" : "bar" }
+    */
+   printf ("%s\n", str);
+   bson_free (str);
+
+   bson_destroy (&bson);
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_relaxed_extended_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_relaxed_extended_json.html new file mode 100644 index 0000000..b92c076 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_as_relaxed_extended_json.html @@ -0,0 +1,148 @@ + + + + + + + + bson_as_relaxed_extended_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_as_relaxed_extended_json()

+
+

Synopsis

+
char *
+bson_as_relaxed_extended_json (const bson_t *bson, size_t *length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • length: An optional location for the length of the resulting string.
  • +
+
+
+

Description

+

The bson_as_relaxed_extended_json() encodes bson as a UTF-8 string in the relaxed MongoDB Extended JSON format.

+

The caller is responsible for freeing the resulting UTF-8 encoded string by calling bson_free() with the result.

+

If non-NULL, length will be set to the length of the result in bytes.

+
+
+

Returns

+

If successful, a newly allocated UTF-8 encoded string and length is set.

+

Upon failure, NULL is returned.

+
+
+

Example

+
char *str = bson_as_relaxed_extended_json (doc, NULL);
+printf ("%s\n", str);
+bson_free (str);
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_ascii_strtoll.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_ascii_strtoll.html new file mode 100644 index 0000000..0ad0806 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_ascii_strtoll.html @@ -0,0 +1,141 @@ + + + + + + + + bson_ascii_strtoll() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_ascii_strtoll()

+
+

Synopsis

+
int64_t
+bson_ascii_strtoll (const char *str, char **endptr, int base);
+
+
+
+
+

Parameters

+
    +
  • str: The string to convert.
  • +
  • endptr: Address of the first invalid character of str, or null.
  • +
  • base: The base to use for the conversion.
  • +
+
+
+

Description

+

A portable version of strtoll().

+

Converts a string to a 64-bit signed integer according to the given base, +which must be 16, 10, or 8. Leading whitespace will be ignored.

+

If base is 0 is passed in, the base is inferred from the string’s leading +characters. Base-16 numbers start with “0x” or “0X”, base-8 numbers start with +“0”, base-10 numbers start with a digit from 1 to 9.

+

If endptr is not NULL, it will be assigned the address of the first invalid +character of str, or its null terminating byte if the entire string was valid.

+

If an invalid value is encountered, errno will be set to EINVAL and zero will +be returned. If the number is out of range, errno is set to ERANGE and +LLONG_MAX or LLONG_MIN is returned.

+
+
+

Returns

+

The result of the conversion.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_check_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_check_version.html new file mode 100644 index 0000000..010eb02 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_check_version.html @@ -0,0 +1,131 @@ + + + + + + + + bson_check_version() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_check_version()

+
+

Synopsis

+
bool
+bson_check_version (int required_major, int required_minor, int required_micro);
+
+
+
+
+

Parameters

+
    +
  • required_major: The minimum major version required.
  • +
  • required_minor: The minimum minor version required.
  • +
  • required_micro: The minimum micro version required.
  • +
+
+
+

Description

+

Check at runtime if this release of libbson meets a required version.

+
+
+

Returns

+

True if libbson’s version is greater than or equal to the required version.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_compare.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_compare.html new file mode 100644 index 0000000..f736a56 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_compare.html @@ -0,0 +1,136 @@ + + + + + + + + bson_compare() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_compare()

+
+

Synopsis

+
int
+bson_compare (const bson_t *bson, const bson_t *other);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_compare() function shall compare two bson documents for equality.

+

This can be useful in conjunction with _qsort()_.

+

If equal, 0 is returned.

+
+

Tip

+

This function uses _memcmp()_ internally, so the semantics are the same.

+
+
+
+

Returns

+

less than zero, zero, or greater than zero in qsort() style.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_concat.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_concat.html new file mode 100644 index 0000000..e5f7d9a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_concat.html @@ -0,0 +1,144 @@ + + + + + + + + bson_concat() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_concat()

+
+

Synopsis

+
bool
+bson_concat (bson_t *dst, const bson_t *src);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_concat() function shall append the contents of src to dst.

+
+
+

Returns

+

Returns true if successful; false if the operation would overflow the maximum document size or another invalid state is detected.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_destroy.html new file mode 100644 index 0000000..00601e6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_destroy.html @@ -0,0 +1,126 @@ + + + + + + + + bson_context_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_context_destroy()

+
+

Synopsis

+
void
+bson_context_destroy (bson_context_t *context);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_context_destroy() function shall release all resources associated with context. Does nothing if context is NULL.

+

This should be called when you are no longer using a bson_context_t that you have allocated with bson_context_new().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_get_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_get_default.html new file mode 100644 index 0000000..c9416b5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_get_default.html @@ -0,0 +1,119 @@ + + + + + + + + bson_context_get_default() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_context_get_default()

+
+

Synopsis

+
bson_context_t *
+bson_context_get_default (void);
+
+
+
+
+

Returns

+

The bson_context_get_default() function shall return the default, thread-safe, bson_context_t for the process.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_new.html new file mode 100644 index 0000000..853b0b4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_new.html @@ -0,0 +1,129 @@ + + + + + + + + bson_context_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_context_new()

+
+

Synopsis

+
bson_context_t *
+bson_context_new (bson_context_flags_t flags);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Creates a new bson_context_t. This is rarely needed as bson_context_get_default() serves most use-cases.

+
+
+

Returns

+

A newly allocated bson_context_t that should be freed with bson_context_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_t.html new file mode 100644 index 0000000..a45904c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_context_t.html @@ -0,0 +1,171 @@ + + + + + + + + bson_context_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_context_t

+

BSON OID Generation Context

+
+

Synopsis

+
#include <bson.h>
+
+typedef enum {
+   BSON_CONTEXT_NONE = 0,
+   BSON_CONTEXT_THREAD_SAFE = (1 << 0),
+   BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1),
+   BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2),
+#ifdef BSON_HAVE_SYSCALL_TID
+   BSON_CONTEXT_USE_TASK_ID = (1 << 3),
+#endif
+} bson_context_flags_t;
+
+typedef struct _bson_context_t bson_context_t;
+
+bson_context_t *
+bson_context_get_default (void) BSON_GNUC_CONST;
+bson_context_t *
+bson_context_new (bson_context_flags_t flags);
+void
+bson_context_destroy (bson_context_t *context);
+
+
+
+
+

Description

+

The bson_context_t structure is context for generation of BSON Object IDs. This context allows for specialized overriding of how ObjectIDs are generated based on the applications requirements. For example, disabling of PID caching can be configured if the application cannot detect when a call to fork() has occurred.

+
+ +
+

Example

+
#include <bson/bson.h>
+
+int
+main (int argc, char *argv[])
+{
+   bson_context_t *ctx = NULL;
+   bson_oid_t oid;
+
+   /* use default context, via bson_context_get_default() */
+   bson_oid_init (&oid, NULL);
+
+   /* specify a local context for additional control */
+   ctx = bson_context_new (BSON_CONTEXT_DISABLE_PID_CACHE |
+                           BSON_CONTEXT_THREAD_SAFE);
+   bson_oid_init (&oid, ctx);
+
+   bson_context_destroy (ctx);
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy.html new file mode 100644 index 0000000..c57e78a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy.html @@ -0,0 +1,130 @@ + + + + + + + + bson_copy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_copy()

+
+

Synopsis

+
bson_t *
+bson_copy (const bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_copy() function shall copy the contents of a bson document into a new bson_t.

+

The resulting bson_t should be freed with bson_destroy().

+
+
+

Returns

+

A newly allocated bson_t that should be freed with bson_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to.html new file mode 100644 index 0000000..535b4bd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to.html @@ -0,0 +1,127 @@ + + + + + + + + bson_copy_to() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_copy_to()

+
+

Synopsis

+
void
+bson_copy_to (const bson_t *src, bson_t *dst);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_copy_to() function shall initialize dst with a copy of the contents of src.

+

dst MUST be an uninitialized bson_t to avoid leaking memory.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding.html new file mode 100644 index 0000000..df1263c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding.html @@ -0,0 +1,143 @@ + + + + + + + + bson_copy_to_excluding() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_copy_to_excluding()

+
+

Synopsis

+
void
+bson_copy_to_excluding (const bson_t *src,
+                        bson_t *dst,
+                        const char *first_exclude,
+                        ...) BSON_GNUC_NULL_TERMINATED
+   BSON_GNUC_DEPRECATED_FOR (bson_copy_to_excluding_noinit);
+
+
+
+
+

Parameters

+
    +
  • src: A bson_t.
  • +
  • dst: A bson_t.
  • +
  • first_exclude: The first field name to exclude.
  • +
+
+
+

Description

+

The bson_copy_to_excluding() function shall copy all fields from +src to dst except those specified by the variadic, NULL terminated list +of keys starting from first_exclude.

+
+
+

Deprecated

+
+
This function is deprecated. Please use +bson_copy_to_excluding_noinit() in new code.
+
+

Warning

+

bson_init() is called on dst.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding_noinit.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding_noinit.html new file mode 100644 index 0000000..49a9cbd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_copy_to_excluding_noinit.html @@ -0,0 +1,170 @@ + + + + + + + + bson_copy_to_excluding_noinit() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_copy_to_excluding_noinit()

+
+

Synopsis

+
void
+bson_copy_to_excluding_noinit (const bson_t *src,
+                               bson_t *dst,
+                               const char *first_exclude,
+                               ...) BSON_GNUC_NULL_TERMINATED;
+
+
+
+
+

Parameters

+
    +
  • src: A bson_t.
  • +
  • dst: A bson_t.
  • +
  • first_exclude: The first field name to exclude.
  • +
+
+
+

Description

+

The bson_copy_to_excluding_noinit() function shall copy all fields +from src to dst except those specified by the variadic, NULL terminated +list of keys starting from first_exclude. +Works the same way as bson_copy_to_excluding(), except does not call +bson_init() on dst. +This function should be preferred in new code over bson_copy_to_excluding().

+
+

Warning

+

This is generally not needed except in very special situations.

+
+
+
+

Example

+
#include <bson/bson.h>
+
+int main ()
+{
+   bson_t bson;
+   bson_t bson2;
+   char *str;
+
+   bson_init (&bson);
+   bson_append_int32 (&bson, "a", 1, 1);
+   bson_append_int32 (&bson, "b", 1, 2);
+   bson_append_int32 (&bson, "c", 1, 2);
+
+   bson_init (&bson2);
+   bson_copy_to_excluding_noinit (&bson, &bson2, "b", NULL);
+
+   str = bson_as_json (&bson2, NULL);
+   /* Prints
+    * { "a" : 1, "c" : 2 }
+    */
+   printf ("%s\n", str);
+   bson_free (str);
+
+   bson_destroy (&bson);
+   bson_destroy (&bson2);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_count_keys.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_count_keys.html new file mode 100644 index 0000000..d191712 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_count_keys.html @@ -0,0 +1,129 @@ + + + + + + + + bson_count_keys() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_count_keys()

+
+

Synopsis

+
uint32_t
+bson_count_keys (const bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_count_keys() function shall count the number of elements within bson.

+
+
+

Returns

+

A positive integer or zero.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string.html new file mode 100644 index 0000000..c062b46 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string.html @@ -0,0 +1,140 @@ + + + + + + + + bson_decimal128_from_string() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_decimal128_from_string()

+
+

Synopsis

+
bool
+bson_decimal128_from_string (const char *string, bson_decimal128_t *dec);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Parses the string containing ascii encoded Decimal128 and initialize the bytes +in dec. See the Decimal128 specification +for the exact string format.

+
+
+

Returns

+

Returns true if valid Decimal128 string was provided, otherwise false +and dec will be set to NaN.

+
+
+

Example

+
bson_decimal128_t dec;
+bson_decimal128_from_string ("1.00", &dec);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string_w_len.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string_w_len.html new file mode 100644 index 0000000..a093a0d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_from_string_w_len.html @@ -0,0 +1,144 @@ + + + + + + + + bson_decimal128_from_string_w_len() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_decimal128_from_string_w_len()

+
+

Synopsis

+
bool
+bson_decimal128_from_string_w_len (const char *string,
+                                   int len,
+                                   bson_decimal128_t *dec);
+
+
+
+
+

Parameters

+
    +
  • string: A string containing ASCII encoded Decimal128.
  • +
  • len: The length of string in bytes, or -1 meaning the string is null-terminated.
  • +
  • dec: A bson_decimal128_t.
  • +
+
+
+

Description

+

Parses the string containing ascii encoded Decimal128 and initialize the bytes +in dec. See the Decimal128 specification +for the exact string format.

+
+
+

Returns

+

Returns true if valid Decimal128 string was provided, otherwise false +and dec will be set to NaN.

+
+
+

Example

+
bson_decimal128_t dec;
+bson_decimal128_from_string_w_len ("1.00", 4, &dec);
+bson_decimal128_from_string_w_len ("1.00", -1, &dec);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_t.html new file mode 100644 index 0000000..ace2f40 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_t.html @@ -0,0 +1,162 @@ + + + + + + + + bson_decimal128_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_decimal128_t

+

BSON Decimal128 Abstraction

+
+

Synopsis

+
#include <bson/bson.h>
+
+#define BSON_DECIMAL128_STRING 43
+#define BSON_DECIMAL128_INF "Infinity"
+#define BSON_DECIMAL128_NAN "NaN"
+
+typedef struct {
+#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN
+   uint64_t low;
+   uint64_t high;
+#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN
+   uint64_t high;
+   uint64_t low;
+#endif
+} bson_decimal128_t;
+
+
+
+
+

Description

+

The bson_decimal128_t structure +represents the IEEE-754 Decimal128 data type.

+
+ +
+

Example

+
#include <bson/bson.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   char string[BSON_DECIMAL128_STRING];
+   bson_decimal128_t decimal128;
+
+   bson_decimal128_from_string ("100.00", &decimal128);
+   bson_decimal128_to_string (&decimal128, string);
+   printf ("Decimal128 value: %s\n", string);
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_to_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_to_string.html new file mode 100644 index 0000000..371dd7e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_decimal128_to_string.html @@ -0,0 +1,133 @@ + + + + + + + + bson_decimal128_to_string() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_decimal128_to_string()

+
+

Synopsis

+
void
+bson_decimal128_to_string (const bson_decimal128_t *dec, char *str);
+
+
+
+
+

Parameters

+
    +
  • dec: A bson_decimal128_t.
  • +
  • str: A location of length BSON_DECIMAL128_STRING for the resulting string.
  • +
+
+
+

Description

+

Converts dec into a printable string.

+
+
+

Example

+
char decimal128_string[BSON_DECIMAL128_STRING];
+bson_decimal128_to_string (&decimal128t, decimal128_string);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy.html new file mode 100644 index 0000000..b469fc4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy.html @@ -0,0 +1,126 @@ + + + + + + + + bson_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_destroy()

+
+

Synopsis

+
void
+bson_destroy (bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_destroy() function shall free an allocated bson_t structure. Does nothing if bson is NULL.

+

This function should always be called when you are done with a bson_t unless otherwise specified.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy_with_steal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy_with_steal.html new file mode 100644 index 0000000..40f6863 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_destroy_with_steal.html @@ -0,0 +1,132 @@ + + + + + + + + bson_destroy_with_steal() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_destroy_with_steal()

+
+

Synopsis

+
uint8_t *
+bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • steal: A bool indicating if the underlying buffer should be stolen.
  • +
  • length: A location for storing the resulting buffer length.
  • +
+
+
+

Description

+

The bson_destroy_with_steal() function shall destroy a bson_t structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a bson_t that is not a top-level bson_t, such as those initialized with bson_append_document_begin(), bson_append_array_begin(), and bson_writer_begin().

+

See also bson_steal(), a higher-level function that efficiently transfers the contents of one bson_t to another.

+
+
+

Returns

+

bson_destroy_with_steal() shall return a buffer containing the contents of the bson_t if steal is non-zero. This should be freed with bson_free() when no longer in use. length will be set to the length of the bson document if non-NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_equal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_equal.html new file mode 100644 index 0000000..1022f5e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_equal.html @@ -0,0 +1,130 @@ + + + + + + + + bson_equal() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_equal()

+
+

Synopsis

+
bool
+bson_equal (const bson_t *bson, const bson_t *other);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_equal() function shall return true if both documents are equal.

+
+
+

Returns

+

true if both documents are equal.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_error_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_error_t.html new file mode 100644 index 0000000..2c28700 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_error_t.html @@ -0,0 +1,146 @@ + + + + + + + + bson_error_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_error_t

+

BSON Error Encapsulation

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct {
+   uint32_t domain;
+   uint32_t code;
+   char message[504];
+} bson_error_t;
+
+
+
+
+

Description

+

The bson_error_t structure is used as an out-parameter to pass error information to the caller. It should be stack-allocated and does not requiring freeing.

+

See Handling Errors.

+
+
+

Functions

+ +
+
+

Example

+
bson_reader_t *reader;
+bson_error_t error;
+
+reader = bson_reader_new_from_file ("dump.bson", &error);
+if (!reader) {
+   fprintf (
+      stderr, "ERROR: %d.%d: %s\n", error.domain, error.code, error.message);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_free.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_free.html new file mode 100644 index 0000000..ea4f57e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_free.html @@ -0,0 +1,125 @@ + + + + + + + + bson_free() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_free()

+
+

Synopsis

+
void
+bson_free (void *mem);
+
+
+
+
+

Parameters

+
    +
  • mem: A memory region.
  • +
+
+
+

Description

+

This function shall free the memory supplied by mem. This should be used by functions that require you free the result with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_data.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_data.html new file mode 100644 index 0000000..4e5a95e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_data.html @@ -0,0 +1,129 @@ + + + + + + + + bson_get_data() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_get_data()

+
+

Synopsis

+
const uint8_t *
+bson_get_data (const bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_get_data() function shall return the raw buffer of a bson document. This can be used in conjunction with the len property of a bson_t if you want to copy the raw buffer around.

+
+
+

Returns

+

A buffer which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_major_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_major_version.html new file mode 100644 index 0000000..c288ed8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_major_version.html @@ -0,0 +1,123 @@ + + + + + + + + bson_get_major_version() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_get_major_version()

+
+

Synopsis

+
int
+bson_get_major_version (void);
+
+
+
+
+

Description

+

Get the first number in libbson’s MAJOR.MINOR.MICRO release version.

+
+
+

Returns

+

The value of BSON_MAJOR_VERSION when Libbson was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_micro_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_micro_version.html new file mode 100644 index 0000000..33bf3dc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_micro_version.html @@ -0,0 +1,123 @@ + + + + + + + + bson_get_micro_version() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_get_micro_version()

+
+

Synopsis

+
int
+bson_get_micro_version (void);
+
+
+
+
+

Description

+

Get the third number in libbson’s MAJOR.MINOR.MICRO release version.

+
+
+

Returns

+

The value of BSON_MICRO_VERSION when Libbson was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_minor_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_minor_version.html new file mode 100644 index 0000000..f06278a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_minor_version.html @@ -0,0 +1,123 @@ + + + + + + + + bson_get_minor_version() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_get_minor_version()

+
+

Synopsis

+
int
+bson_get_minor_version (void);
+
+
+
+
+

Description

+

Get the middle number in libbson’s MAJOR.MINOR.MICRO release version.

+
+
+

Returns

+

The value of BSON_MINOR_VERSION when Libbson was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_monotonic_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_monotonic_time.html new file mode 100644 index 0000000..ebab267 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_monotonic_time.html @@ -0,0 +1,126 @@ + + + + + + + + System Clock — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

System Clock

+

BSON Clock Abstraction

+
+

Synopsis

+
int64_t
+bson_get_monotonic_time (void);
+int
+bson_gettimeofday (struct timeval *tv,
+                   struct timezone *tz);
+
+
+
+
+

Description

+

The clock abstraction in Libbson provides a cross-platform way to handle timeouts within the BSON library. It abstracts the differences in implementations of gettimeofday() as well as providing a monotonic (incrementing only) clock in microseconds.

+
+
+

Functions

+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_version.html new file mode 100644 index 0000000..4aa7a3d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_get_version.html @@ -0,0 +1,121 @@ + + + + + + + + bson_get_version() — libbson 1.13.1 + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_get_version()

+
+

Synopsis

+
const char *
+bson_get_version (void);
+
+
+
+
+

Description

+

A string representation of Libbson’s version, formatted something like “1.2.3” or “1.2.3-dev”.

+
+
+

Returns

+

A string you must not modify or free.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_has_field.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_has_field.html new file mode 100644 index 0000000..6674b21 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_has_field.html @@ -0,0 +1,130 @@ + + + + + + + + bson_has_field() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_has_field()

+
+

Synopsis

+
bool
+bson_has_field (const bson_t *bson, const char *key);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • key: A string containing the name of the field to check for.
  • +
+
+
+

Description

+

Checks to see if key contains an element named key. This also accepts “dotkey” notation such as “a.b.c.d”.

+
+
+

Returns

+

true if key was found within bson; otherwise false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init.html new file mode 100644 index 0000000..a11353a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init.html @@ -0,0 +1,139 @@ + + + + + + + + bson_init() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_init()

+
+

Synopsis

+
void
+bson_init (bson_t *b);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_init() function shall initialize a bson_t that is placed on the stack. This is equivalent to initializing a bson_t to BSON_INITIALIZER.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_from_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_from_json.html new file mode 100644 index 0000000..5315731 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_from_json.html @@ -0,0 +1,156 @@ + + + + + + + + bson_init_from_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_init_from_json()

+
+

Synopsis

+
bool
+bson_init_from_json (bson_t *bson,
+                     const char *data,
+                     ssize_t len,
+                     bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • bson: Pointer to an uninitialized bson_t.
  • +
  • data: A UTF-8 encoded string containing valid JSON.
  • +
  • len: The length of data in bytes excluding a trailing \0 or -1 to determine the length with strlen().
  • +
  • error: An optional location for a bson_error_t.
  • +
+
+
+

Description

+

The bson_init_from_json() function will initialize a new bson_t by parsing the JSON found in data. Only a single JSON object may exist in data or an error will be set and false returned.

+

data should be in MongoDB Extended JSON format.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if valid JSON was parsed, otherwise false and error is set. On success, bson is initialized and must be freed with bson_destroy(), otherwise bson is invalid.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_static.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_static.html new file mode 100644 index 0000000..fd159f3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_init_static.html @@ -0,0 +1,146 @@ + + + + + + + + bson_init_static() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_init_static()

+
+

Synopsis

+
bool
+bson_init_static (bson_t *b, const uint8_t *data, size_t length);
+
+
+
+
+

Parameters

+
    +
  • b: A bson_t.
  • +
  • data: A buffer to initialize with.
  • +
  • length: The length of data in bytes.
  • +
+
+
+

Description

+

The bson_init_static() function shall shall initialize a read-only bson_t on the stack using the data provided. No copies of the data will be made and therefore must remain valid for the lifetime of the bson_t.

+

The resulting bson_t has internal references and therefore must not be copied to avoid dangling pointers in the copy.

+
+
+

Returns

+

Returns true if bson_t was successfully initialized, otherwise false. The function can fail if data or length are invalid.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_array.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_array.html new file mode 100644 index 0000000..c036273 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_array.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_array() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_array()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_ARRAY(iter) (bson_iter_type ((iter)) == BSON_TYPE_ARRAY)
+
+void
+bson_iter_array (const bson_iter_t *iter,
+                 uint32_t *array_len,
+                 const uint8_t **array);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • array_len: A location for the buffer length.
  • +
  • array: A location for the immutable buffer.
  • +
+
+
+

Description

+

The bson_iter_array() function shall retrieve the raw buffer of a sub-array from iter. iter MUST be on an element that is of type BSON_TYPE_ARRAY. This can be verified with bson_iter_type() or the BSON_ITER_HOLDS_ARRAY() macro.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_bool.html new file mode 100644 index 0000000..99f97db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_bool.html @@ -0,0 +1,140 @@ + + + + + + + + bson_iter_as_bool() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_as_bool()

+
+

Synopsis

+
bool
+bson_iter_as_bool (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the current field as if it were a boolean.

+

bson_iter_as_bool() currently knows how to determine a boolean value from the following types:

+
    +
  • BSON_TYPE_BOOL
  • +
  • BSON_TYPE_DOUBLE
  • +
  • BSON_TYPE_INT32
  • +
  • BSON_TYPE_INT64
  • +
  • BSON_TYPE_NULL
  • +
  • BSON_TYPE_UNDEFINED
  • +
  • BSON_TYPE_UTF8
  • +
+

BSON_TYPE_UTF8 will always equate to true.

+
+
+

Returns

+

true if the field equates to non-zero.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_double.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_double.html new file mode 100644 index 0000000..805a2c9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_double.html @@ -0,0 +1,137 @@ + + + + + + + + bson_iter_as_double() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_as_double()

+
+

Synopsis

+
bool
+bson_iter_as_double (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the current field as if it were a double.

+

bson_iter_as_double() will cast the following types to double

+
    +
  • BSON_TYPE_BOOL
  • +
  • BSON_TYPE_DOUBLE
  • +
  • BSON_TYPE_INT32
  • +
  • BSON_TYPE_INT64
  • +
+

Any other value will return 0.

+
+
+

Returns

+

The value type casted to double.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_int64.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_int64.html new file mode 100644 index 0000000..972f95b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_as_int64.html @@ -0,0 +1,135 @@ + + + + + + + + bson_iter_as_int64() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_as_int64()

+
+

Synopsis

+
int64_t
+bson_iter_as_int64 (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_as_int64() function shall return the contents of the current element as if it were a BSON_TYPE_INT64 element. The currently supported casts include:

+
    +
  • BSON_TYPE_BOOL
  • +
  • BSON_TYPE_DOUBLE
  • +
  • BSON_TYPE_INT32
  • +
  • BSON_TYPE_INT64
  • +
+
+
+

Returns

+

A 64-bit signed integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_binary.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_binary.html new file mode 100644 index 0000000..05e93af --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_binary.html @@ -0,0 +1,135 @@ + + + + + + + + bson_iter_binary() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_binary()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_BINARY(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_BINARY)
+
+void
+bson_iter_binary (const bson_iter_t *iter,
+                  bson_subtype_t *subtype,
+                  uint32_t *binary_len,
+                  const uint8_t **binary);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • subtype: A location for a bson_subtype_t or NULL.
  • +
  • binary_len: A location for the length of binary.
  • +
  • binary: A location for a pointer to the immutable buffer.
  • +
+
+
+

Description

+

This function shall return the binary data of a BSON_TYPE_BINARY element. It is a programming error to call this function on a field that is not of type BSON_TYPE_BINARY. You can check this with the BSON_ITER_HOLDS_BINARY() macro or bson_iter_type().

+

The buffer that binary points to is only valid until the iterator’s bson_t is modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_bool.html new file mode 100644 index 0000000..e2f95cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_bool.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_bool() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_bool()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_BOOL(iter) (bson_iter_type ((iter)) == BSON_TYPE_BOOL)
+
+bool
+bson_iter_bool (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_bool() function shall return the boolean value of a BSON_TYPE_BOOL element. It is a programming error to call this function on an element other than BSON_TYPE_BOOL. You can check this with bson_iter_type() or BSON_ITER_HOLDS_BOOL().

+
+
+

Returns

+

Either true or false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_code.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_code.html new file mode 100644 index 0000000..7ac03af --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_code.html @@ -0,0 +1,133 @@ + + + + + + + + bson_iter_code() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_code()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_CODE(iter) (bson_iter_type ((iter)) == BSON_TYPE_CODE)
+
+const char *
+bson_iter_code (const bson_iter_t *iter, uint32_t *length);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • length: A location for the length of the UTF-8 encoded string or NULL.
  • +
+
+
+

Description

+

This function returns the contents of a BSON_TYPE_CODE field. The length of the string is stored in length if non-NULL.

+

It is invalid to call this function on a field that is not of type BSON_TYPE_CODE.

+
+
+

Returns

+

A UTF-8 encoded string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_codewscope.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_codewscope.html new file mode 100644 index 0000000..f197a02 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_codewscope.html @@ -0,0 +1,138 @@ + + + + + + + + bson_iter_codewscope() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_codewscope()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_CODEWSCOPE(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_CODEWSCOPE)
+
+const char *
+bson_iter_codewscope (const bson_iter_t *iter,
+                      uint32_t *length,
+                      uint32_t *scope_len,
+                      const uint8_t **scope);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • length: An optional location for the length of the resulting UTF-8 encoded string.
  • +
  • scope_len: A optional location for the length of scope.
  • +
  • scope: An optional location to store the immutable raw scope BSON document.
  • +
+
+
+

Description

+

The bson_iter_codewscope() function acts similar to bson_iter_code() except for BSON_TYPE_CODEWSCOPE elements. It also will provide a pointer to the buffer for scope, which can be loaded into a bson_t using bson_init_static().

+
+
+

Returns

+

An UTF-8 encoded string containing the JavaScript code which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_date_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_date_time.html new file mode 100644 index 0000000..886d11c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_date_time.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_date_time() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_date_time()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_DATE_TIME(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_DATE_TIME)
+
+int64_t
+bson_iter_date_time (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_date_time() function shall return the number of milliseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element.

+
+
+

Returns

+

A 64-bit integer containing the number of milliseconds since the UNIX epoch.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dbpointer.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dbpointer.html new file mode 100644 index 0000000..f88be2f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dbpointer.html @@ -0,0 +1,135 @@ + + + + + + + + bson_iter_dbpointer() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_dbpointer()

+
+

Synopsis

+
void
+bson_iter_dbpointer (const bson_iter_t *iter,
+                     uint32_t *collection_len,
+                     const char **collection,
+                     const bson_oid_t **oid);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • collection_len: A location for the length of the collection name.
  • +
  • collection: A location for the collection name..
  • +
  • oid: A location for a bson_oid_t.
  • +
+
+
+

Description

+

Fetches the contents of a BSON_TYPE_DBPOINTER element.

+
+

Warning

+

The BSON_TYPE_DBPOINTER field type is deprecated by the BSON spec and should not be used in new code.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_decimal128.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_decimal128.html new file mode 100644 index 0000000..a92b0aa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_decimal128.html @@ -0,0 +1,134 @@ + + + + + + + + bson_iter_decimal128() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_decimal128()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_DECIMAL128(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_DECIMAL128)
+
+bool
+bson_iter_decimal128 (const bson_iter_t *iter, /* IN */
+                      bson_decimal128_t *dec); /* OUT */
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the value from a BSON_TYPE_DECIMAL128 field. You should verify that this is a BSON_TYPE_DECIMAL128 field before calling this function.

+
+
+

Returns

+

true if type was BSON_TYPE_DECIMAL128, otherwise false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_document.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_document.html new file mode 100644 index 0000000..d03b9db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_document.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_document() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_document()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_DOCUMENT(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_DOCUMENT)
+
+void
+bson_iter_document (const bson_iter_t *iter,
+                    uint32_t *document_len,
+                    const uint8_t **document);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • document_len: A location for the length of the document in bytes.
  • +
  • document: A location for the document buffer.
  • +
+
+
+

Description

+

The bson_iter_document() function shall retrieve the raw buffer of a sub-document from iter. iter MUST be on an element that is of type BSON_TYPE_DOCUMENT. This can be verified with bson_iter_type() or the BSON_ITER_HOLDS_DOCUMENT() macro.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_double.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_double.html new file mode 100644 index 0000000..7dc3b21 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_double.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_double() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_double()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_DOUBLE(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_DOUBLE)
+
+double
+bson_iter_double (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the contents of a BSON_TYPE_DOUBLE field.

+
+
+

Returns

+

A double.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dup_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dup_utf8.html new file mode 100644 index 0000000..e8b5dcc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_dup_utf8.html @@ -0,0 +1,130 @@ + + + + + + + + bson_iter_dup_utf8() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_dup_utf8()

+
+

Synopsis

+
char *
+bson_iter_dup_utf8 (const bson_iter_t *iter, uint32_t *length);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • length: An optional location for the length of the UTF-8 encoded string.
  • +
+
+
+

Description

+

This function is similar to bson_iter_utf8() except that it calls bson_strndup() on the result.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find.html new file mode 100644 index 0000000..166891d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_find() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_find()

+
+

Synopsis

+
bool
+bson_iter_find (bson_iter_t *iter, const char *key);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • key: A string containing the requested key.
  • +
+
+
+

Description

+

The bson_iter_find() function shall advance iter to the element named key or exhaust all elements of iter. If iter is exhausted, false is returned and iter should be considered invalid.

+

key is case-sensitive. For a case-folded version, see bson_iter_find_case().

+
+
+

Returns

+

true is returned if the requested key was found. If not, iter was exhausted and should now be considered invalid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_case.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_case.html new file mode 100644 index 0000000..ac320a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_case.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_find_case() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_find_case()

+
+

Synopsis

+
bool
+bson_iter_find_case (bson_iter_t *iter, const char *key);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • key: An ASCII string containing the field to locate.
  • +
+
+
+

Description

+

Advances iter until it is observing an element matching the name of key or exhausting all elements.

+

key is not case-sensitive. The keys will be case-folded to determine a match using the current locale.

+
+
+

Returns

+

true if key was found.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_descendant.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_descendant.html new file mode 100644 index 0000000..fbf258f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_descendant.html @@ -0,0 +1,133 @@ + + + + + + + + bson_iter_find_descendant() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_find_descendant()

+
+

Synopsis

+
bool
+bson_iter_find_descendant (bson_iter_t *iter,
+                           const char *dotkey,
+                           bson_iter_t *descendant);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_find_descendant() function shall follow standard MongoDB dot notation to recurse into subdocuments. descendant will be initialized and advanced to the descendant. If false is returned, both iter and descendant should be considered invalid.

+
+
+

Returns

+

true is returned if the requested key was found. If not, false is returned and iter was exhausted and should now be considered invalid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_w_len.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_w_len.html new file mode 100644 index 0000000..4a706ac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_find_w_len.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_find_w_len() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_find_w_len()

+
+

Synopsis

+
bool
+bson_iter_find_w_len (bson_iter_t *iter, const char *key, int keylen);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • key: A string containing the requested key.
  • +
  • keylen: An integer indicating the length of the key string.
  • +
+
+
+

Description

+

The bson_iter_find_w_len() function shall advance iter to the element named key or exhaust all elements of iter. If iter is exhausted, false is returned and iter should be considered invalid.

+

key is case-sensitive. For a case-folded version, see bson_iter_find_case().

+
+
+

Returns

+

true is returned if the requested key was found. If not, iter was exhausted and should now be considered invalid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init.html new file mode 100644 index 0000000..7bab096 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init.html @@ -0,0 +1,177 @@ + + + + + + + + bson_iter_init() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init()

+
+

Synopsis

+
bool
+bson_iter_init (bson_iter_t *iter, const bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_init() function shall initialize iter to iterate upon the BSON document bson. Upon initialization, iter is placed before the first element. Callers must call bson_iter_next(), bson_iter_find(), or bson_iter_find_case() to advance to an element.

+
+
+

Returns

+

Returns true if the iter was successfully initialized.

+
+
+

Example

+
static void
+print_doc_id (const bson_t *doc)
+{
+   bson_iter_t iter;
+   bson_oid_t oid;
+   char oidstr[25];
+
+   if (bson_iter_init (&iter, doc) && bson_iter_find (&iter, "_id") &&
+       BSON_ITER_HOLDS_OID (&iter)) {
+      bson_iter_oid (&iter, &oid);
+      bson_oid_to_string (&oid, oidstr);
+      printf ("%s\n", oidstr);
+   } else {
+      printf ("Document is missing _id.\n");
+   }
+}
+
+/* alternatively */
+
+static void
+print_doc_id (const bson_t *doc)
+{
+   bson_iter_t iter;
+   bson_oid_t oid;
+   char oidstr[25];
+
+   if (bson_iter_init_find (&iter, doc, "_id") && BSON_ITER_HOLDS_OID (&iter)) {
+      bson_iter_oid (&iter, &oid);
+      bson_oid_to_string (&oid, oidstr);
+      printf ("%s\n", oidstr);
+   } else {
+      printf ("Document is missing _id.\n");
+   }
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find.html new file mode 100644 index 0000000..ac4818d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find.html @@ -0,0 +1,135 @@ + + + + + + + + bson_iter_init_find() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init_find()

+
+

Synopsis

+
bool
+bson_iter_init_find (bson_iter_t *iter, const bson_t *bson, const char *key);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • bson: A bson_t.
  • +
  • key: A key to locate after initializing the iter.
  • +
+
+
+

Description

+

This function is identical to (bson_iter_init() && bson_iter_find()).

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_case.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_case.html new file mode 100644 index 0000000..889aca4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_case.html @@ -0,0 +1,137 @@ + + + + + + + + bson_iter_init_find_case() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init_find_case()

+
+

Synopsis

+
bool
+bson_iter_init_find_case (bson_iter_t *iter,
+                          const bson_t *bson,
+                          const char *key);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • bson: A bson_t.
  • +
  • key: A key to locate after initializing the iter.
  • +
+
+
+

Description

+

This function is identical to bson_iter_init() && bson_iter_find_case().

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_w_len.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_w_len.html new file mode 100644 index 0000000..9a7b802 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_find_w_len.html @@ -0,0 +1,139 @@ + + + + + + + + bson_iter_init_find_w_len() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init_find_w_len()

+
+

Synopsis

+
bool
+bson_iter_init_find_w_len (bson_iter_t *iter,
+                           const bson_t *bson,
+                           const char *key,
+                           int keylen);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • bson: A bson_t.
  • +
  • key: A key to locate after initializing the iter.
  • +
  • keylen: An integer indicating the length of the key string.
  • +
+
+
+

Description

+

This function is identical to (bson_iter_init() && bson_iter_find_w_len()).

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data.html new file mode 100644 index 0000000..bb7b855 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data.html @@ -0,0 +1,160 @@ + + + + + + + + bson_iter_init_from_data() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init_from_data()

+
+

Synopsis

+
bool
+bson_iter_init_from_data (bson_iter_t *iter, const uint8_t *data, size_t length);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • data: A buffer to initialize with.
  • +
  • length: The length of data in bytes.
  • +
+
+
+

Description

+

The bson_iter_init_from_data() function shall initialize iter to iterate upon the buffer data, which must contain a BSON document. Upon initialization, iter is placed before the first element. Callers must call bson_iter_next(), bson_iter_find(), or bson_iter_find_case() to advance to an element.

+
+
+

Returns

+

Returns true if the iter was successfully initialized.

+
+
+

Example

+
static void
+print_doc_id (const uint8_t *data, size_t length)
+{
+   bson_iter_t iter;
+   bson_oid_t oid;
+   char oidstr[25];
+
+   if (bson_iter_init_from_data (&iter, data, length) && bson_iter_find (&iter, "_id") &&
+       BSON_ITER_HOLDS_OID (&iter)) {
+      bson_iter_oid (&iter, &oid);
+      bson_oid_to_string (&oid, oidstr);
+      printf ("%s\n", oidstr);
+   } else {
+      printf ("Document is missing _id.\n");
+   }
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data_at_offset.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data_at_offset.html new file mode 100644 index 0000000..7ed6d4c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_init_from_data_at_offset.html @@ -0,0 +1,158 @@ + + + + + + + + bson_iter_init_from_data_at_offset() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_init_from_data_at_offset()

+
+

Synopsis

+
bool
+bson_iter_init_from_data_at_offset (bson_iter_t *iter,
+                                    const uint8_t *data,
+                                    size_t length,
+                                    uint32_t offset,
+                                    uint32_t keylen);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • data: A buffer to initialize with. This is not validated.
  • +
  • length: The length of data in bytes. This is not validated.
  • +
  • offset: The offset of the field to start iterating. This is not validated. This should be an offset previously obtained from bson_iter_offset().
  • +
  • keylen: The string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained from bson_iter_key_len().
  • +
+
+
+

Description

+

Creates a bson_iter_t and starts iteration on a field at the offset.

+

bson_iter_init_from_data_at_offset() is useful for situations where the +progress of a bson_iter_t must be saved and restored without relying +on the bson_iter_t data layout. Saving the progress could be +accomplished by:

+ +

Then later, these saved values can be passed to +bson_iter_init_from_data_at_offset() to reconstruct the +bson_iter_t in constant time.

+
+ +
+

Returns

+

Returns true if the iter was successfully initialized.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int32.html new file mode 100644 index 0000000..20176ba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int32.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_int32() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_int32()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_INT32(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT32)
+
+int32_t
+bson_iter_int32 (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the value from a BSON_TYPE_INT32 element. You should verify that the field is a BSON_TYPE_INT32 field before calling this function.

+
+
+

Returns

+

A 32-bit integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int64.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int64.html new file mode 100644 index 0000000..24698f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_int64.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_int64() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_int64()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_INT64(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT64)
+
+int64_t
+bson_iter_int64 (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the value from a BSON_TYPE_INT64 field. You should verify that this is a BSON_TYPE_INT64 field before calling this function.

+
+
+

Returns

+

A 64-bit integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key.html new file mode 100644 index 0000000..44a4f7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key.html @@ -0,0 +1,133 @@ + + + + + + + + bson_iter_key() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_key()

+
+

Synopsis

+
const char *
+bson_iter_key (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the key for the current element observed by iter.

+
+
+

See Also

+

bson_iter_key_len() to retrieve the length of the key in constant time.

+
+
+

Returns

+

A string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key_len.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key_len.html new file mode 100644 index 0000000..16ef454 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_key_len.html @@ -0,0 +1,133 @@ + + + + + + + + bson_iter_key_len() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_key_len()

+
+

Synopsis

+
uint32_t
+bson_iter_key_len (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the length of the key for the current element observed by iter. This is a constant time computation, and therefore faster than calling strlen() on a key returned by bson_iter_key().

+
+
+

See Also

+

bson_iter_key() to retrieve current key.

+
+
+

Returns

+

An integer representing the key length.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_next.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_next.html new file mode 100644 index 0000000..070d5d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_next.html @@ -0,0 +1,130 @@ + + + + + + + + bson_iter_next() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_next()

+
+

Synopsis

+
bool
+bson_iter_next (bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Advances iter to the next element in the document.

+
+
+

Returns

+

true if iter was advanced. Returns false if iter has passed the last element in the document or encountered invalid BSON.

+

It is a programming error to use iter after this function has returned false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_offset.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_offset.html new file mode 100644 index 0000000..50bea05 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_offset.html @@ -0,0 +1,133 @@ + + + + + + + + bson_iter_offset() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_offset()

+
+

Synopsis

+
uint32_t
+bson_iter_offset (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the offset for the current element observed by iter.

+
+
+

See Also

+

bson_iter_init_from_data_at_offset() to use this offset to reconstruct a bson_iter_t in constant time.

+
+
+

Returns

+

An unsigned integer representing the offset in the BSON data of the current element.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_oid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_oid.html new file mode 100644 index 0000000..9e619e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_oid.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_oid() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_oid()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_OID(iter) (bson_iter_type ((iter)) == BSON_TYPE_OID)
+
+const bson_oid_t *
+bson_iter_oid (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the bson_oid_t for a BSON_TYPE_OID element. You should verify it is an element of type BSON_TYPE_OID before calling this function.

+
+
+

Returns

+

A bson_oid_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_bool.html new file mode 100644 index 0000000..da2a6cd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_bool.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_bool() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_bool()

+
+

Synopsis

+
void
+bson_iter_overwrite_bool (bson_iter_t *iter, bool value);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • value: A bool containing the new value.
  • +
+
+
+

Description

+

The bson_iter_overwrite_bool() function shall overwrite the contents of a BSON_TYPE_BOOL element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_BOOL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_date_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_date_time.html new file mode 100644 index 0000000..efdf339 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_date_time.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_date_time() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_date_time()

+
+

Synopsis

+
void
+bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • value: The date and time as specified in milliseconds since the UNIX epoch.
  • +
+
+
+

Description

+

The bson_iter_overwrite_date_time() function shall overwrite the contents of a BSON_TYPE_DATE_TIME element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_DATE_TIME.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_decimal128.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_decimal128.html new file mode 100644 index 0000000..afb9609 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_decimal128.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_decimal128() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_decimal128()

+
+

Synopsis

+
bool
+bson_iter_overwrite_decimal128 (bson_iter_t *iter, bson_decimal128_t *value);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • value: The new Decimal128 value.
  • +
+
+
+

Description

+

The bson_iter_overwrite_decimal128() function shall overwrite the contents of a BSON_TYPE_DECIMAL128 element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_DECIMAL128.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_double.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_double.html new file mode 100644 index 0000000..47cadce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_double.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_double() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_double()

+
+

Synopsis

+
void
+bson_iter_overwrite_double (bson_iter_t *iter, double value);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_overwrite_double() function shall overwrite the contents of a BSON_TYPE_DOUBLE element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_DOUBLE.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int32.html new file mode 100644 index 0000000..c5d876a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int32.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_int32() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_int32()

+
+

Synopsis

+
void
+bson_iter_overwrite_int32 (bson_iter_t *iter, int32_t value);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_overwrite_int32() function shall overwrite the contents of a BSON_TYPE_INT32 element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_BOOL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int64.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int64.html new file mode 100644 index 0000000..46b4764 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_int64.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_int64() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_int64()

+
+

Synopsis

+
void
+bson_iter_overwrite_int64 (bson_iter_t *iter, int64_t value);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_overwrite_int64() function shall overwrite the contents of a BSON_TYPE_INT64 element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_INT64.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_oid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_oid.html new file mode 100644 index 0000000..0ee2989 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_oid.html @@ -0,0 +1,128 @@ + + + + + + + + bson_iter_overwrite_oid() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_oid()

+
+

Synopsis

+
void
+bson_iter_overwrite_oid (bson_iter_t *iter, const bson_oid_t *value);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_overwrite_oid() function shall overwrite the contents of a BSON_TYPE_OID element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_OID.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_timestamp.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_timestamp.html new file mode 100644 index 0000000..031d686 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_overwrite_timestamp.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_overwrite_timestamp() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_overwrite_timestamp()

+
+

Synopsis

+
void
+bson_iter_overwrite_timestamp (bson_iter_t *iter,
+                               uint32_t timestamp,
+                               uint32_t increment);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • timestamp: A uint32_t.
  • +
  • increment: A uint32_t.
  • +
+
+
+

Description

+

The bson_iter_overwrite_timestamp() function shall overwrite the contents of a BSON_TYPE_TIMESTAMP element in place.

+

This may only be done when the underlying bson document allows mutation.

+

It is a programming error to call this function when iter is not observing an element of type BSON_TYPE_TIMESTAMP.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_recurse.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_recurse.html new file mode 100644 index 0000000..7da9cc9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_recurse.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_recurse() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_recurse()

+
+

Synopsis

+
bool
+bson_iter_recurse (const bson_iter_t *iter, bson_iter_t *child);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_recurse() function shall initialize child using the embedded document or array currently observed by iter.

+

If there was a failure to initialize the iter, false is returned and both iter and child should be considered invalid.

+

This should only be called when observing an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT.

+
+
+

Returns

+

If iter observes an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT, then child is initialized and the function returns true. Otherwise, the function returns false and child is invalid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_regex.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_regex.html new file mode 100644 index 0000000..fc7df5a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_regex.html @@ -0,0 +1,131 @@ + + + + + + + + bson_iter_regex() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_regex()

+
+

Synopsis

+
const char *
+bson_iter_regex (const bson_iter_t *iter, const char **options);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_regex() function shall retrieve the contents of a BSON_TYPE_REGEX element currently observed by iter.

+

It is invalid to call this function when not observing an element of type BSON_TYPE_REGEX.

+
+
+

Returns

+

A string containing the regex which should not be modified or freed. options is set to the options provided for the regex.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_symbol.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_symbol.html new file mode 100644 index 0000000..db229a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_symbol.html @@ -0,0 +1,132 @@ + + + + + + + + bson_iter_symbol() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_symbol()

+
+

Synopsis

+
const char *
+bson_iter_symbol (const bson_iter_t *iter, uint32_t *length);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The symbol element type is DEPRECATED in the bson specification at http://bsonspec.org.

+

The bson_iter_symbol() function shall return the contents of a BSON_TYPE_SYMBOL element.

+

If non-NULL, length will be set to the length of the resulting string.

+
+
+

Returns

+

The symbol and length is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_t.html new file mode 100644 index 0000000..543aba3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_t.html @@ -0,0 +1,268 @@ + + + + + + + + bson_iter_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_t

+

BSON Document Iterator

+
+

Synopsis

+
#include <bson/bson.h>
+
+#define BSON_ITER_HOLDS_DOUBLE(iter) /* ... */
+
+#define BSON_ITER_HOLDS_UTF8(iter) /* ... */
+
+#define BSON_ITER_HOLDS_DOCUMENT(iter) /* ... */
+
+#define BSON_ITER_HOLDS_ARRAY(iter) /* ... */
+
+#define BSON_ITER_HOLDS_BINARY(iter) /* ... */
+
+#define BSON_ITER_HOLDS_UNDEFINED(iter) /* ... */
+
+#define BSON_ITER_HOLDS_OID(iter) /* ... */
+
+#define BSON_ITER_HOLDS_BOOL(iter) /* ... */
+
+#define BSON_ITER_HOLDS_DATE_TIME(iter) /* ... */
+
+#define BSON_ITER_HOLDS_NULL(iter) /* ... */
+
+#define BSON_ITER_HOLDS_REGEX(iter) /* ... */
+
+#define BSON_ITER_HOLDS_DBPOINTER(iter) /* ... */
+
+#define BSON_ITER_HOLDS_CODE(iter) /* ... */
+
+#define BSON_ITER_HOLDS_SYMBOL(iter) /* ... */
+
+#define BSON_ITER_HOLDS_CODEWSCOPE(iter) /* ... */
+
+#define BSON_ITER_HOLDS_INT32(iter) /* ... */
+
+#define BSON_ITER_HOLDS_TIMESTAMP(iter) /* ... */
+
+#define BSON_ITER_HOLDS_INT64(iter) /* ... */
+
+#define BSON_ITER_HOLDS_DECIMAL128(iter) /* ... */
+
+#define BSON_ITER_HOLDS_MAXKEY(iter) /* ... */
+
+#define BSON_ITER_HOLDS_MINKEY(iter) /* ... */
+
+#define BSON_ITER_HOLDS_INT(iter) \
+   (BSON_ITER_HOLDS_INT32 (iter) || BSON_ITER_HOLDS_INT64 (iter))
+
+#define BSON_ITER_HOLDS_NUMBER(iter) \
+   (BSON_ITER_HOLDS_INT (iter) || BSON_ITER_HOLDS_DOUBLE (iter))
+
+#define BSON_ITER_IS_KEY(iter, key) \
+   (0 == strcmp ((key), bson_iter_key ((iter))))
+
+typedef struct {
+   /*< private >*/
+} bson_iter_t;
+
+
+
+
+

Description

+

bson_iter_t is a structure used to iterate through the elements of a bson_t. It is meant to be used on the stack and can be discarded at any time as it contains no external allocation. The contents of the structure should be considered private and may change between releases, however the structure size will not change.

+

The bson_t MUST be valid for the lifetime of the iter and it is an error to modify the bson_t while using the iter.

+
+ +
+

Examples

+
bson_iter_t iter;
+
+if (bson_iter_init (&iter, my_bson_doc)) {
+   while (bson_iter_next (&iter)) {
+      printf ("Found a field named: %s\n", bson_iter_key (&iter));
+   }
+}
+
+
+
bson_iter_t iter;
+
+if (bson_iter_init (&iter, my_bson_doc) && bson_iter_find (&iter, "my_field")) {
+   printf ("Found the field named: %s\n", bson_iter_key (&iter));
+}
+
+
+
bson_iter_t iter;
+bson_iter_t sub_iter;
+
+if (bson_iter_init_find (&iter, my_bson_doc, "mysubdoc") &&
+    (BSON_ITER_HOLDS_DOCUMENT (&iter) || BSON_ITER_HOLDS_ARRAY (&iter)) &&
+    bson_iter_recurse (&iter, &sub_iter)) {
+   while (bson_iter_next (&sub_iter)) {
+      printf ("Found key \"%s\" in sub document.\n", bson_iter_key (&sub_iter));
+   }
+}
+
+
+
bson_iter_t iter;
+
+if (bson_iter_init (&iter, my_doc) &&
+    bson_iter_find_descendant (&iter, "a.b.c.d", &sub_iter)) {
+   printf ("The type of a.b.c.d is: %d\n", (int) bson_iter_type (&sub_iter));
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_time_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_time_t.html new file mode 100644 index 0000000..27907da --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_time_t.html @@ -0,0 +1,129 @@ + + + + + + + + bson_iter_time_t() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_time_t()

+
+

Synopsis

+
time_t
+bson_iter_time_t (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_time_t() function shall return the number of seconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element.

+
+
+

Returns

+

A time_t containing the number of seconds since the UNIX epoch.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timestamp.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timestamp.html new file mode 100644 index 0000000..fdd447c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timestamp.html @@ -0,0 +1,134 @@ + + + + + + + + bson_iter_timestamp() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_timestamp()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_TIMESTAMP(iter) \
+   (bson_iter_type ((iter)) == BSON_TYPE_TIMESTAMP)
+
+void
+bson_iter_timestamp (const bson_iter_t *iter,
+                     uint32_t *timestamp,
+                     uint32_t *increment);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • timestamp: A uint32_t.
  • +
  • increment: A uint32_t.
  • +
+
+
+

Description

+

The BSON_TYPE_TIMESTAMP type is not a date/time and is typically used for intra-server communication.

+

You probably want bson_iter_date_time().

+

The bson_iter_timestamp() function shall return the contents of a BSON_TYPE_TIMESTAMP element. It is invalid to call this function while observing an element that is not of type BSON_TYPE_TIMESTAMP.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timeval.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timeval.html new file mode 100644 index 0000000..5fc15cd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_timeval.html @@ -0,0 +1,126 @@ + + + + + + + + bson_iter_timeval() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_timeval()

+
+

Synopsis

+
void
+bson_iter_timeval (const bson_iter_t *iter, struct timeval *tv);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_timeval() function shall return the number of seconds and microseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element into tv.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_type.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_type.html new file mode 100644 index 0000000..aae24c2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_type.html @@ -0,0 +1,153 @@ + + + + + + + + bson_iter_type() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_type()

+
+

Synopsis

+
typedef enum {
+   BSON_TYPE_EOD = 0x00,
+   BSON_TYPE_DOUBLE = 0x01,
+   BSON_TYPE_UTF8 = 0x02,
+   BSON_TYPE_DOCUMENT = 0x03,
+   BSON_TYPE_ARRAY = 0x04,
+   BSON_TYPE_BINARY = 0x05,
+   BSON_TYPE_UNDEFINED = 0x06,
+   BSON_TYPE_OID = 0x07,
+   BSON_TYPE_BOOL = 0x08,
+   BSON_TYPE_DATE_TIME = 0x09,
+   BSON_TYPE_NULL = 0x0A,
+   BSON_TYPE_REGEX = 0x0B,
+   BSON_TYPE_DBPOINTER = 0x0C,
+   BSON_TYPE_CODE = 0x0D,
+   BSON_TYPE_SYMBOL = 0x0E,
+   BSON_TYPE_CODEWSCOPE = 0x0F,
+   BSON_TYPE_INT32 = 0x10,
+   BSON_TYPE_TIMESTAMP = 0x11,
+   BSON_TYPE_INT64 = 0x12,
+   BSON_TYPE_MAXKEY = 0x7F,
+   BSON_TYPE_MINKEY = 0xFF,
+} bson_type_t;
+
+bson_type_t
+bson_iter_type (const bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_iter_type() function shall return the type of the observed element in a bson document.

+
+
+

Returns

+

A bson_type_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_utf8.html new file mode 100644 index 0000000..6d81987 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_utf8.html @@ -0,0 +1,135 @@ + + + + + + + + bson_iter_utf8() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_utf8()

+
+

Synopsis

+
#define BSON_ITER_HOLDS_UTF8(iter) (bson_iter_type ((iter)) == BSON_TYPE_UTF8)
+
+const char *
+bson_iter_utf8 (const bson_iter_t *iter, uint32_t *length);
+
+
+
+
+

Parameters

+
    +
  • iter: A bson_iter_t.
  • +
  • length: An optional location for the length of the resulting UTF-8 encoded string.
  • +
+
+
+

Description

+

The bson_iter_utf8() function shall retrieve the contents of a BSON_TYPE_UTF8 element currently observed by iter.

+

It is invalid to call this function while observing an element other than BSON_TYPE_UTF8.

+
+
+

Returns

+

A UTF-8 encoded string that has not been modified or freed.

+

It is suggested that the caller validate the content is valid UTF-8 before using this in other places. That can be done by calling bson_utf8_validate() or validating the underlying bson_t before iterating it.

+

Note that not all drivers use multi-byte representation for \0 in UTF-8 encodings (commonly referred to as modified-UTF8). You probably want to take a look at the length field when marshaling to other runtimes.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_value.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_value.html new file mode 100644 index 0000000..e20654b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_value.html @@ -0,0 +1,129 @@ + + + + + + + + bson_iter_value() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_value()

+
+

Synopsis

+
const bson_value_t *
+bson_iter_value (bson_iter_t *iter);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the value for the currently observed type as a boxed type. This allows passing around the value without knowing the type at runtime.

+
+
+

Returns

+

A bson_value_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_visit_all.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_visit_all.html new file mode 100644 index 0000000..c2377ca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_iter_visit_all.html @@ -0,0 +1,134 @@ + + + + + + + + bson_iter_visit_all() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_iter_visit_all()

+
+

Synopsis

+
bool
+bson_iter_visit_all (bson_iter_t *iter,
+                     const bson_visitor_t *visitor,
+                     void *data);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

A convenience function to iterate all remaining fields of iter using the callback vtable provided by visitor.

+
+
+

Returns

+

Returns true if visitation was prematurely stopped by a callback function. Returns false either because all elements were visited or due to corrupt BSON.

+

See bson_visitor_t for examples of how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_ingest.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_ingest.html new file mode 100644 index 0000000..ec78c96 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_ingest.html @@ -0,0 +1,129 @@ + + + + + + + + bson_json_data_reader_ingest() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_data_reader_ingest()

+
+

Synopsis

+
void
+bson_json_data_reader_ingest (bson_json_reader_t *reader,
+                              const uint8_t *data,
+                              size_t len);
+
+
+
+
+

Parameters

+
    +
  • reader: A bson_json_reader_t.
  • +
  • data: A uint8_t containing data to feed.
  • +
  • len: A size_t containing the length of data.
  • +
+
+
+

Description

+

Feed data to a memory based json reader.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_new.html new file mode 100644 index 0000000..eef6208 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_data_reader_new.html @@ -0,0 +1,131 @@ + + + + + + + + bson_json_data_reader_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_data_reader_new()

+
+

Synopsis

+
bson_json_reader_t *
+bson_json_data_reader_new (bool allow_multiple, size_t size);
+
+
+
+
+

Parameters

+
    +
  • allow_multiple: Unused.
  • +
  • size: A requested buffer size.
  • +
+
+
+

Description

+

Creates a new streaming JSON reader that will convert JSON documents to BSON.

+

The allow_multiple parameter is unused.

+
+
+

Returns

+

A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_destroy.html new file mode 100644 index 0000000..426662f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_destroy.html @@ -0,0 +1,125 @@ + + + + + + + + bson_json_reader_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_destroy()

+
+

Synopsis

+
void
+bson_json_reader_destroy (bson_json_reader_t *reader);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees a bson_json_reader_t. Does nothing if reader is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new.html new file mode 100644 index 0000000..802fb5d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new.html @@ -0,0 +1,138 @@ + + + + + + + + bson_json_reader_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_new()

+
+

Synopsis

+
bson_json_reader_t *
+bson_json_reader_new (void *data,
+                      bson_json_reader_cb cb,
+                      bson_json_destroy_cb dcb,
+                      bool allow_multiple,
+                      size_t buf_size);
+
+
+
+
+

Parameters

+
    +
  • data: A user-defined pointer.
  • +
  • cb: A bson_json_reader_cb.
  • +
  • dcb: A bson_json_destroy_cb.
  • +
  • allow_multiple: Unused.
  • +
  • buf_size: A size_t containing the requested internal buffer size.
  • +
+
+
+

Description

+

Creates a new bson_json_reader_t that can read from an arbitrary data source in a streaming fashion.

+

The allow_multiple parameter is unused.

+
+
+

Returns

+

A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_fd.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_fd.html new file mode 100644 index 0000000..b83d6c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_fd.html @@ -0,0 +1,130 @@ + + + + + + + + bson_json_reader_new_from_fd() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_new_from_fd()

+
+

Synopsis

+
bson_json_reader_t *
+bson_json_reader_new_from_fd (int fd, bool close_on_destroy);
+
+
+
+
+

Parameters

+
    +
  • fd: An open file-descriptor.
  • +
  • close_on_destroy: Whether close() should be called on fd when the reader is destroyed.
  • +
+
+
+

Description

+

Creates a new JSON to BSON converter that will be reading from the file-descriptor fd.

+
+
+

Returns

+

A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_file.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_file.html new file mode 100644 index 0000000..2db884e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_new_from_file.html @@ -0,0 +1,134 @@ + + + + + + + + bson_json_reader_new_from_file() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_new_from_file()

+
+

Synopsis

+
bson_json_reader_t *
+bson_json_reader_new_from_file (const char *filename, bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • filename: A file-name in the system file-name encoding.
  • +
  • error: A bson_error_t.
  • +
+
+
+

Description

+

Creates a new bson_json_reader_t using the underlying file found at filename.

+
+
+

Errors

+

Errors are propagated via error.

+
+
+

Returns

+

A newly allocated bson_json_reader_t if successful, otherwise NULL and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_read.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_read.html new file mode 100644 index 0000000..4097e51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_read.html @@ -0,0 +1,143 @@ + + + + + + + + bson_json_reader_read() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_read()

+
+

Synopsis

+
int
+bson_json_reader_read (bson_json_reader_t *reader,
+                       bson_t *bson,
+                       bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Reads the next BSON document from the underlying JSON source.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

1 if successful and data was read. 0 if successful and no data was read. -1 if there was an error.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_t.html new file mode 100644 index 0000000..034effb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_json_reader_t.html @@ -0,0 +1,236 @@ + + + + + + + + bson_json_reader_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_json_reader_t

+

Bulk JSON to BSON conversion

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct _bson_json_reader_t bson_json_reader_t;
+
+typedef enum {
+   BSON_JSON_ERROR_READ_CORRUPT_JS = 1,
+   BSON_JSON_ERROR_READ_INVALID_PARAM,
+   BSON_JSON_ERROR_READ_CB_FAILURE,
+} bson_json_error_code_t;
+
+
+
+
+

Description

+

The bson_json_reader_t structure is used for reading a sequence of JSON documents and transforming them to bson_t documents.

+

This can often be useful if you want to perform bulk operations that are defined in a file containing JSON documents.

+
+

Tip

+

bson_json_reader_t works upon JSON documents formatted in MongoDB extended JSON format.

+
+
+ +
+

Example

+
/*
+ * Copyright 2013 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * This program will print each JSON document contained in the provided files
+ * as a BSON string to STDOUT.
+ */
+
+
+#include <bson/bson.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   bson_json_reader_t *reader;
+   bson_error_t error;
+   const char *filename;
+   bson_t doc = BSON_INITIALIZER;
+   int i;
+   int b;
+
+   /*
+    * Print program usage if no arguments are provided.
+    */
+   if (argc == 1) {
+      fprintf (stderr, "usage: %s FILE...\n", argv[0]);
+      return 1;
+   }
+
+   /*
+    * Process command line arguments expecting each to be a filename.
+    */
+   for (i = 1; i < argc; i++) {
+      filename = argv[i];
+
+      /*
+       * Open the filename provided in command line arguments.
+       */
+      if (0 == strcmp (filename, "-")) {
+         reader = bson_json_reader_new_from_fd (STDIN_FILENO, false);
+      } else {
+         if (!(reader = bson_json_reader_new_from_file (filename, &error))) {
+            fprintf (
+               stderr, "Failed to open \"%s\": %s\n", filename, error.message);
+            continue;
+         }
+      }
+
+      /*
+       * Convert each incoming document to BSON and print to stdout.
+       */
+      while ((b = bson_json_reader_read (reader, &doc, &error))) {
+         if (b < 0) {
+            fprintf (stderr, "Error in json parsing:\n%s\n", error.message);
+            abort ();
+         }
+
+         if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) {
+            fprintf (stderr, "Failed to write to stdout, exiting.\n");
+            exit (1);
+         }
+         bson_reinit (&doc);
+      }
+
+      bson_json_reader_destroy (reader);
+      bson_destroy (&doc);
+   }
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc.html new file mode 100644 index 0000000..748e3a1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc.html @@ -0,0 +1,135 @@ + + + + + + + + bson_malloc() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_malloc()

+
+

Synopsis

+
void *
+bson_malloc (size_t num_bytes);
+
+
+
+
+

Parameters

+
    +
  • num_bytes: A size_t containing the number of bytes to allocate.
  • +
+
+
+

Description

+

This is a portable malloc() wrapper.

+

In general, this function will return an allocation at least sizeof(void*) bytes or bigger.

+

If there was a failure to allocate num_bytes bytes, the process will be aborted.

+
+

Warning

+

This function will abort on failure to allocate memory.

+
+
+
+

Returns

+

A pointer to a memory region which HAS NOT been zeroed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc0.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc0.html new file mode 100644 index 0000000..a06e3af --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_malloc0.html @@ -0,0 +1,135 @@ + + + + + + + + bson_malloc0() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_malloc0()

+
+

Synopsis

+
void *
+bson_malloc0 (size_t num_bytes);
+
+
+
+
+

Parameters

+
    +
  • num_bytes: A size_t.
  • +
+
+
+

Description

+

This is a portable malloc() wrapper that also sets the memory to zero. Similar to calloc().

+

In general, this function will return an allocation at least sizeof(void*) bytes or bigger.

+

If there was a failure to allocate num_bytes bytes, the process will be aborted.

+
+

Warning

+

This function will abort on failure to allocate memory.

+
+
+
+

Returns

+

A pointer to a memory region which HAS been zeroed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_append.html new file mode 100644 index 0000000..ea3777c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_append.html @@ -0,0 +1,134 @@ + + + + + + + + bson_md5_append() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_md5_append()

+
+

Deprecated

+

All MD5 APIs are deprecated in libbson.

+
+
+

Synopsis

+
void
+bson_md5_append (bson_md5_t *pms,
+                 const uint8_t *data,
+                 uint32_t nbytes) BSON_GNUC_DEPRECATED;
+
+
+
+
+

Parameters

+
    +
  • pms: A bson_md5_t.
  • +
  • data: A memory region to feed to the md5 algorithm.
  • +
  • nbytes: The length of data in bytes.
  • +
+
+
+

Description

+

Feeds more data into the MD5 algorithm.

+

This function is deprecated and should not be used in new code.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_finish.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_finish.html new file mode 100644 index 0000000..0757f84 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_finish.html @@ -0,0 +1,131 @@ + + + + + + + + bson_md5_finish() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_md5_finish()

+
+

Deprecated

+

All MD5 APIs are deprecated in libbson.

+
+
+

Synopsis

+
void
+bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) BSON_GNUC_DEPRECATED;
+
+
+
+
+

Parameters

+
    +
  • pms: A bson_md5_t.
  • +
  • digest: A location for the digest.
  • +
+
+
+

Description

+

Completes the MD5 algorithm and stores the digest in digest.

+

This function is deprecated and should not be used in new code.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_init.html new file mode 100644 index 0000000..afce341 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_init.html @@ -0,0 +1,130 @@ + + + + + + + + bson_md5_init() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_md5_init()

+
+

Deprecated

+

All MD5 APIs are deprecated in libbson.

+
+
+

Synopsis

+
void
+bson_md5_init (bson_md5_t *pms) BSON_GNUC_DEPRECATED;
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Initialize a new instance of the MD5 algorithm.

+

This function is deprecated and should not be used in new code.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_t.html new file mode 100644 index 0000000..20141c3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_md5_t.html @@ -0,0 +1,135 @@ + + + + + + + + bson_md5_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_md5_t

+

BSON MD5 Abstraction

+
+

Deprecated

+

All MD5 APIs are deprecated in libbson.

+
+
+

Synopsis

+
typedef struct {
+   uint32_t count[2]; /* message length in bits, lsw first */
+   uint32_t abcd[4];  /* digest buffer */
+   uint8_t buf[64];   /* accumulate block */
+} bson_md5_t;
+
+
+
+
+

Description

+

bson_md5_t encapsulates an implementation of the MD5 algorithm.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_restore_vtable.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_restore_vtable.html new file mode 100644 index 0000000..22cba5f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_restore_vtable.html @@ -0,0 +1,123 @@ + + + + + + + + bson_mem_restore_vtable() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_mem_restore_vtable()

+
+

Synopsis

+
void
+bson_mem_restore_vtable (void);
+
+
+
+
+

Description

+

This function shall restore the default memory allocator to be used by Libbson.

+
+

Warning

+

This function MUST be called at the end of the process. Failure to do so will result in memory being freed by the wrong allocator.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_set_vtable.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_set_vtable.html new file mode 100644 index 0000000..4389e0e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_mem_set_vtable.html @@ -0,0 +1,137 @@ + + + + + + + + bson_mem_set_vtable() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_mem_set_vtable()

+
+

Synopsis

+
typedef struct _bson_mem_vtable_t {
+   void *(*malloc) (size_t num_bytes);
+   void *(*calloc) (size_t n_members, size_t num_bytes);
+   void *(*realloc) (void *mem, size_t num_bytes);
+   void (*free) (void *mem);
+   void *padding[4];
+} bson_mem_vtable_t;
+
+void
+bson_mem_set_vtable (const bson_mem_vtable_t *vtable);
+
+
+
+
+

Parameters

+
    +
  • vtable: A bson_mem_vtable_t with every non-padding field set.
  • +
+
+
+

Description

+

This function shall install a new memory allocator to be used by Libbson.

+
+

Warning

+

This function MUST be called at the beginning of the process. Failure to do so will result in memory being freed by the wrong allocator.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_memory.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_memory.html new file mode 100644 index 0000000..3342b5e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_memory.html @@ -0,0 +1,128 @@ + + + + + + + + Memory Management — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Memory Management

+

BSON Memory Abstraction.

+
+

Description

+

Libbson contains a lightweight memory abstraction to make portability to new platforms easier. Additionally, it helps us integrate with interesting higher-level languages. One caveat, however, is that Libbson is not designed to deal with Out of Memory (OOM) situations. Doing so requires extreme diligence throughout the application stack that has rarely been implemented correctly. This may change in the future. As it stands now, Libbson will abort() under OOM situations.

+

To aid in language binding integration, Libbson allows for setting a custom memory allocator via bson_mem_set_vtable(). This allocation may be reversed via bson_mem_restore_vtable().

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new.html new file mode 100644 index 0000000..48aa783 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new.html @@ -0,0 +1,137 @@ + + + + + + + + bson_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_new()

+
+

Synopsis

+
bson_t *
+bson_new (void);
+
+
+
+
+

Description

+

The bson_new() function shall create a new bson_t structure on the heap. It should be freed with bson_destroy() when it is no longer in use.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_buffer.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_buffer.html new file mode 100644 index 0000000..055814f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_buffer.html @@ -0,0 +1,151 @@ + + + + + + + + bson_new_from_buffer() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_new_from_buffer()

+
+

Synopsis

+
bson_t *
+bson_new_from_buffer (uint8_t **buf,
+                      size_t *buf_len,
+                      bson_realloc_func realloc_func,
+                      void *realloc_func_ctx);
+
+
+
+
+

Parameters

+
    +
  • buf: An out-pointer to a buffer containing a serialized BSON document, or to NULL.
  • +
  • buf_len: An out-pointer to the length of the buffer in bytes.
  • +
  • realloc_func: Optional bson_realloc_func for reallocating the buffer.
  • +
  • realloc_func_ctx: Optional pointer that will be passed as ctx to realloc_func.
  • +
+
+
+

Description

+

Creates a new bson_t using the data provided.

+

The realloc_func, if provided, is called to resize buf if the document is later expanded, for example by a call to one of the bson_append functions.

+

If *buf is initially NULL then it is allocated, using realloc_func or the default allocator, and initialized with an empty BSON document, and *buf_len is set to 5, the size of an empty document.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_data.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_data.html new file mode 100644 index 0000000..bbb79d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_data.html @@ -0,0 +1,144 @@ + + + + + + + + bson_new_from_data() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_new_from_data()

+
+

Synopsis

+
bson_t *
+bson_new_from_data (const uint8_t *data, size_t length);
+
+
+
+
+

Parameters

+
    +
  • data: A BSON encoded document buffer.
  • +
  • length: The length of data in bytes.
  • +
+
+
+

Description

+

The bson_new_from_data() function shall create a new bson_t on the heap and copy the contents of data. This may be helpful when working with language bindings but is generally expected to be slower.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_json.html new file mode 100644 index 0000000..e83a548 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_new_from_json.html @@ -0,0 +1,151 @@ + + + + + + + + bson_new_from_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_new_from_json()

+
+

Synopsis

+
bson_t *
+bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • data: A UTF-8 encoded string containing valid JSON.
  • +
  • len: The length of data in bytes excluding a trailing \0 or -1 to determine the length with strlen().
  • +
  • error: An optional location for a bson_error_t.
  • +
+
+
+

Description

+

The bson_new_from_json() function allocates and initialize a new bson_t by parsing the JSON found in data. Only a single JSON object may exist in data or an error will be set and NULL returned.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A newly allocated bson_t if successful, otherwise NULL and error is set.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_compare.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_compare.html new file mode 100644 index 0000000..36a92ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_compare.html @@ -0,0 +1,130 @@ + + + + + + + + bson_oid_compare() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_compare()

+
+

Synopsis

+
int
+bson_oid_compare (const bson_oid_t *oid1, const bson_oid_t *oid2);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_oid_compare() function shall return a qsort() style value of a lexicographical sort of _oid1_ and _oid2_.

+
+
+

Returns

+

less than 0, 0, or greater than 0 based on the comparison.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_copy.html new file mode 100644 index 0000000..131d647 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_copy.html @@ -0,0 +1,126 @@ + + + + + + + + bson_oid_copy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_copy()

+
+

Synopsis

+
void
+bson_oid_copy (const bson_oid_t *src, bson_oid_t *dst);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Copies the contents of src into dst.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_equal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_equal.html new file mode 100644 index 0000000..33cb58b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_equal.html @@ -0,0 +1,130 @@ + + + + + + + + bson_oid_equal() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_equal()

+
+

Synopsis

+
bool
+bson_oid_equal (const bson_oid_t *oid1, const bson_oid_t *oid2);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Checks if two bson_oid_t contain the same bytes.

+
+
+

Returns

+

true if they are equal, otherwise false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_get_time_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_get_time_t.html new file mode 100644 index 0000000..320fde5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_get_time_t.html @@ -0,0 +1,129 @@ + + + + + + + + bson_oid_get_time_t() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_get_time_t()

+
+

Synopsis

+
time_t
+bson_oid_get_time_t (const bson_oid_t *oid);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the generation time in seconds since the UNIX Epoch of oid.

+
+
+

Returns

+

A time_t containing the seconds since the UNIX epoch of oid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_hash.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_hash.html new file mode 100644 index 0000000..d155376 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_hash.html @@ -0,0 +1,129 @@ + + + + + + + + bson_oid_hash() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_hash()

+
+

Synopsis

+
uint32_t
+bson_oid_hash (const bson_oid_t *oid);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Generates a hash code for oid suitable for a hashtable.

+
+
+

Returns

+

A 32-bit hash code.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init.html new file mode 100644 index 0000000..66e0494 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init.html @@ -0,0 +1,126 @@ + + + + + + + + bson_oid_init() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_init()

+
+

Synopsis

+
void
+bson_oid_init (bson_oid_t *oid, bson_context_t *context);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Generates a new bson_oid_t using either context or the default bson_context_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_data.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_data.html new file mode 100644 index 0000000..fa49fbd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_data.html @@ -0,0 +1,126 @@ + + + + + + + + bson_oid_init_from_data() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_init_from_data()

+
+

Synopsis

+
void
+bson_oid_init_from_data (bson_oid_t *oid, const uint8_t *data);
+
+
+
+
+

Parameters

+
    +
  • oid: A bson_oid_t.
  • +
  • data: A buffer containing 12 bytes for the oid.
  • +
+
+
+

Description

+

Initializes a bson_oid_t using the raw buffer provided.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_string.html new file mode 100644 index 0000000..daa3b47 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_from_string.html @@ -0,0 +1,132 @@ + + + + + + + + bson_oid_init_from_string() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_init_from_string()

+
+

Synopsis

+
void
+bson_oid_init_from_string (bson_oid_t *oid, const char *str);
+
+
+
+
+

Parameters

+
    +
  • oid: A bson_oid_t.
  • +
  • str: A string containing a hex encoded version of the oid.
  • +
+
+
+

Description

+

Parses the string containing hex encoded oid and initialize the bytes in oid.

+
+
+

Example

+
bson_oid_init_from_string (&oid, "012345678901234567890123");
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_sequence.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_sequence.html new file mode 100644 index 0000000..a1207a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_init_sequence.html @@ -0,0 +1,130 @@ + + + + + + + + bson_oid_init_sequence() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_init_sequence()

+
+

Synopsis

+
void
+bson_oid_init_sequence (bson_oid_t *oid, bson_context_t *context);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Generates a new ObjectID using the 64-bit sequence.

+
+

Warning

+

This form of ObjectID is generally used by MongoDB replica peers only.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_is_valid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_is_valid.html new file mode 100644 index 0000000..c35cc77 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_is_valid.html @@ -0,0 +1,130 @@ + + + + + + + + bson_oid_is_valid() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_is_valid()

+
+

Synopsis

+
bool
+bson_oid_is_valid (const char *str, size_t length);
+
+
+
+
+

Parameters

+
    +
  • str: A string.
  • +
  • length: The length of str.
  • +
+
+
+

Description

+

Checks if a string containing a hex encoded string is a valid BSON ObjectID.

+
+
+

Returns

+

true if str could be parsed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_t.html new file mode 100644 index 0000000..411601d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_t.html @@ -0,0 +1,188 @@ + + + + + + + + bson_oid_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_t

+

BSON ObjectID Abstraction

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct {
+   uint8_t bytes[12];
+} bson_oid_t;
+
+
+
+
+

Description

+

The bson_oid_t structure contains the 12-byte ObjectId notation defined by the BSON ObjectID specification.

+

ObjectId is a 12-byte BSON type, constructed using:

+
    +
  • a 4-byte value representing the seconds since the Unix epoch (in Big Endian)
  • +
  • a 3-byte machine identifier
  • +
  • a 2-byte process id (Big Endian), and
  • +
  • a 3-byte counter (Big Endian), starting with a random value.
  • +
+
+
+

String Conversion

+

You can convert an Object ID to a string using bson_oid_to_string() and back with bson_oid_init_from_string().

+
+
+

Hashing

+

A bson_oid_t can be used in hashtables using the function bson_oid_hash() and bson_oid_equal().

+
+
+

Comparing

+

A bson_oid_t can be compared to another using bson_oid_compare() for qsort() style comparing and bson_oid_equal() for direct equality.

+
+
+

Validating

+

You can validate that a string containing a hex-encoded ObjectID is valid using the function bson_oid_is_valid().

+
+ +
+

Example

+
#include <bson.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   bson_oid_t oid;
+   char str[25];
+
+   bson_oid_init (&oid, NULL);
+   bson_oid_to_string (&oid, str);
+   printf ("%s\n", str);
+
+   if (bson_oid_is_valid (str, sizeof str)) {
+      bson_oid_init_from_string (&oid, str);
+   }
+
+   printf ("The UNIX time was: %u\n", (unsigned) bson_oid_get_time_t (&oid));
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_to_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_to_string.html new file mode 100644 index 0000000..793cc9b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_oid_to_string.html @@ -0,0 +1,126 @@ + + + + + + + + bson_oid_to_string() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_oid_to_string()

+
+

Synopsis

+
void
+bson_oid_to_string (const bson_oid_t *oid, char str[25]);
+
+
+
+
+

Parameters

+
    +
  • oid: A bson_oid_t.
  • +
  • str: A location for the resulting string.
  • +
+
+
+

Description

+

Converts oid into a hex encoded string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy.html new file mode 100644 index 0000000..1ca8c0d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy.html @@ -0,0 +1,125 @@ + + + + + + + + bson_reader_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_destroy()

+
+

Synopsis

+
void
+bson_reader_destroy (bson_reader_t *reader);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Destroys and releases all resources associated with reader. Does nothing if reader is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy_func_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy_func_t.html new file mode 100644 index 0000000..2065bfb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_destroy_func_t.html @@ -0,0 +1,125 @@ + + + + + + + + bson_reader_destroy_func_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_destroy_func_t

+
+

Synopsis

+
typedef void (*bson_reader_destroy_func_t) (void *handle);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

An optional callback function that will be called when a bson_reader_t created with bson_reader_new_from_handle() is destroyed with bson_reader_destroy().

+

The handle used when creating the reader is passed to this callback.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_data.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_data.html new file mode 100644 index 0000000..8211986 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_data.html @@ -0,0 +1,130 @@ + + + + + + + + bson_reader_new_from_data() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_new_from_data()

+
+

Synopsis

+
bson_reader_t *
+bson_reader_new_from_data (const uint8_t *data, size_t length);
+
+
+
+
+

Parameters

+
    +
  • data: A uint8_t.
  • +
  • length: A size_t.
  • +
+
+
+

Description

+

The bson_reader_new_from_data() function shall create a new bson_reader_t using the buffer supplied. data is not copied and MUST be valid for the lifetime of the resulting bson_reader_t.

+
+
+

Returns

+

A newly allocated bson_reader_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_fd.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_fd.html new file mode 100644 index 0000000..93ad276 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_fd.html @@ -0,0 +1,132 @@ + + + + + + + + bson_reader_new_from_fd() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_new_from_fd()

+
+

Synopsis

+
bson_reader_t *
+bson_reader_new_from_fd (int fd, bool close_on_destroy);
+
+
+
+
+

Parameters

+
    +
  • fd: A valid file-descriptor.
  • +
  • close_on_destroy: Whether close() should be called on fd when the reader is destroyed.
  • +
+
+
+

Description

+

The bson_reader_new_from_fd() function shall create a new bson_reader_t that will read from the provided file-descriptor.

+

fd MUST be in blocking mode.

+

If close_fd is true, then fd will be closed when the bson_reader_t is destroyed with bson_reader_destroy().

+
+
+

Returns

+

A newly allocated bson_reader_t that should be freed with bson_reader_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_file.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_file.html new file mode 100644 index 0000000..0c27264 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_file.html @@ -0,0 +1,134 @@ + + + + + + + + bson_reader_new_from_file() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_new_from_file()

+
+

Synopsis

+
bson_reader_t *
+bson_reader_new_from_file (const char *path, bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • path: A filename in the host filename encoding.
  • +
  • error: A bson_error_t.
  • +
+
+
+

Description

+

Creates a new bson_reader_t using the file denoted by filename.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A newly allocated bson_reader_t on success, otherwise NULL and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_handle.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_handle.html new file mode 100644 index 0000000..c257350 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_new_from_handle.html @@ -0,0 +1,133 @@ + + + + + + + + bson_reader_new_from_handle() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_new_from_handle()

+
+

Synopsis

+
bson_reader_t *
+bson_reader_new_from_handle (void *handle,
+                             bson_reader_read_func_t rf,
+                             bson_reader_destroy_func_t df);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function allows for a pluggable data stream for the reader. This can be used to read from sockets, files, memory, or other arbitrary sources.

+
+
+

Returns

+

A newly allocated bson_reader_t if successful; otherwise NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read.html new file mode 100644 index 0000000..efbd31c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read.html @@ -0,0 +1,148 @@ + + + + + + + + bson_reader_read() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_read()

+
+

Synopsis

+
const bson_t *
+bson_reader_read (bson_reader_t *reader, bool *reached_eof);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_reader_read() function shall read the next document from the underlying file-descriptor or buffer.

+

If there are no further documents or a failure was detected, then NULL is returned.

+

If we reached the end of the sequence, reached_eof is set to true.

+

To detect an error, check for NULL and reached_of is false.

+
+
+

Returns

+

A bson_t that should not be modified or freed.

+
+
+

Example

+
const bson_t *doc;
+bool reached_eof = false;
+
+while ((doc = bson_reader_read (reader, &reached_eof))) {
+   /* do something */
+}
+
+if (!reached_eof) {
+   fprintf (stderr, "Failed to read all documents.\n");
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read_func_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read_func_t.html new file mode 100644 index 0000000..fb36bec --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_read_func_t.html @@ -0,0 +1,135 @@ + + + + + + + + bson_reader_read_func_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_read_func_t

+
+

Synopsis

+
typedef ssize_t (*bson_reader_read_func_t) (void *handle,
+                                            void *buf,
+                                            size_t count);
+
+
+
+
+

Parameters

+
    +
  • handle: The handle to read from.
  • +
  • buf: The buffer to read into.
  • +
  • count: The number of bytes to read.
  • +
+
+
+

Description

+

A callback function that will be called by bson_reader_t to read the next chunk of data from the underlying opaque file descriptor.

+

This function is meant to operate similar to the read(2) function as part of libc on UNIX-like systems.

+
+
+

Returns

+

0 for end of stream.

+

-1 for a failure on read.

+

A value greater than zero for the number of bytes read into buf.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_reset.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_reset.html new file mode 100644 index 0000000..c7b183f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_reset.html @@ -0,0 +1,125 @@ + + + + + + + + bson_reader_reset() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_reset()

+
+

Synopsis

+
void
+bson_reader_reset (bson_reader_t *reader);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Seeks to the beginning of the underlying buffer. Valid only for a reader created from a buffer with bson_reader_new_from_data(), not one created from a file, file descriptor, or handle.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_destroy_func.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_destroy_func.html new file mode 100644 index 0000000..810e2e2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_destroy_func.html @@ -0,0 +1,127 @@ + + + + + + + + bson_reader_set_destroy_func() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_set_destroy_func()

+
+

Synopsis

+
void
+bson_reader_set_destroy_func (bson_reader_t *reader,
+                              bson_reader_destroy_func_t func);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Allows for setting a callback to be executed when a reader is destroyed. This should only be used by implementations implementing their own read callbacks.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_read_func.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_read_func.html new file mode 100644 index 0000000..be0bf5e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_set_read_func.html @@ -0,0 +1,126 @@ + + + + + + + + bson_reader_set_read_func() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_set_read_func()

+
+

Synopsis

+
void
+bson_reader_set_read_func (bson_reader_t *reader, bson_reader_read_func_t func);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the function to read more data from the underlying stream in a custom bson_reader_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_t.html new file mode 100644 index 0000000..2dc10a3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_t.html @@ -0,0 +1,235 @@ + + + + + + + + bson_reader_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_t

+

Streaming BSON Document Reader

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct _bson_reader_t bson_reader_t;
+
+bson_reader_t *
+bson_reader_new_from_handle (void *handle,
+                             bson_reader_read_func_t rf,
+                             bson_reader_destroy_func_t df);
+bson_reader_t *
+bson_reader_new_from_fd (int fd, bool close_on_destroy);
+bson_reader_t *
+bson_reader_new_from_file (const char *path, bson_error_t *error);
+bson_reader_t *
+bson_reader_new_from_data (const uint8_t *data, size_t length);
+
+void
+bson_reader_destroy (bson_reader_t *reader);
+
+
+
+
+

Description

+

bson_reader_t is a structure used for reading a sequence of BSON documents. The sequence can come from a file-descriptor, memory region, or custom callbacks.

+
+ +
+

Example

+
/*
+ * Copyright 2013 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * This program will print each BSON document contained in the provided files
+ * as a JSON string to STDOUT.
+ */
+
+
+#include <bson/bson.h>
+#include <stdio.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   bson_reader_t *reader;
+   const bson_t *b;
+   bson_error_t error;
+   const char *filename;
+   char *str;
+   int i;
+
+   /*
+    * Print program usage if no arguments are provided.
+    */
+   if (argc == 1) {
+      fprintf (stderr, "usage: %s [FILE | -]...\nUse - for STDIN.\n", argv[0]);
+      return 1;
+   }
+
+   /*
+    * Process command line arguments expecting each to be a filename.
+    */
+   for (i = 1; i < argc; i++) {
+      filename = argv[i];
+
+      if (strcmp (filename, "-") == 0) {
+         reader = bson_reader_new_from_fd (STDIN_FILENO, false);
+      } else {
+         if (!(reader = bson_reader_new_from_file (filename, &error))) {
+            fprintf (
+               stderr, "Failed to open \"%s\": %s\n", filename, error.message);
+            continue;
+         }
+      }
+
+      /*
+       * Convert each incoming document to JSON and print to stdout.
+       */
+      while ((b = bson_reader_read (reader, NULL))) {
+         str = bson_as_canonical_extended_json (b, NULL);
+         fprintf (stdout, "%s\n", str);
+         bson_free (str);
+      }
+
+      /*
+       * Cleanup after our reader, which closes the file descriptor.
+       */
+      bson_reader_destroy (reader);
+   }
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_tell.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_tell.html new file mode 100644 index 0000000..dd7dc12 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reader_tell.html @@ -0,0 +1,129 @@ + + + + + + + + bson_reader_tell() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reader_tell()

+
+

Synopsis

+
off_t
+bson_reader_tell (bson_reader_t *reader);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Tells the current position within the underlying stream.

+
+
+

Returns

+

-1 on failure, otherwise the offset within the underlying stream.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc.html new file mode 100644 index 0000000..0047909 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc.html @@ -0,0 +1,136 @@ + + + + + + + + bson_realloc() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_realloc()

+
+

Synopsis

+
void *
+bson_realloc (void *mem, size_t num_bytes);
+
+
+
+
+

Parameters

+
    +
  • mem: A memory region.
  • +
  • num_bytes: A size_t containing the new requested size.
  • +
+
+
+

Description

+

This is a portable realloc() wrapper.

+

In general, this function will return an allocation at least sizeof(void*) bytes or bigger. If num_bytes is 0, then the allocation will be freed.

+

If there was a failure to allocate num_bytes bytes, the process will be aborted.

+
+

Warning

+

This function will abort on failure to allocate memory.

+
+
+
+

Returns

+

A pointer to a memory region which HAS NOT been zeroed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_ctx.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_ctx.html new file mode 100644 index 0000000..4e52723 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_ctx.html @@ -0,0 +1,127 @@ + + + + + + + + bson_realloc_ctx() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_realloc_ctx()

+
+

Synopsis

+
void *
+bson_realloc_ctx (void *mem, size_t num_bytes, void *ctx);
+
+
+
+
+

Parameters

+
    +
  • mem: A memory region.
  • +
  • num_bytes: A size_t containing the requested size.
  • +
  • ctx: A consumer-specific pointer or NULL.
  • +
+
+
+

Description

+

This function is identical to bson_realloc() except it takes a context parameter. This is useful when working with pooled or specific memory allocators.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_func.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_func.html new file mode 100644 index 0000000..d5be572 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_realloc_func.html @@ -0,0 +1,126 @@ + + + + + + + + bson_realloc_func — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_realloc_func

+
+

Synopsis

+
typedef void *(*bson_realloc_func) (void *mem, size_t num_bytes, void *ctx);
+
+
+
+
+

Parameters

+
    +
  • mem: A memory region.
  • +
  • num_bytes: A size_t containing the requested size.
  • +
  • ctx: A consumer-specific pointer or NULL.
  • +
+
+
+

Description

+

This is a prototype for pluggable realloc functions used through the Libbson library. If you wish to use a custom allocator this is one way to do it. Additionally, bson_realloc_ctx() is a default implementation of this prototype.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reinit.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reinit.html new file mode 100644 index 0000000..cab0b65 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reinit.html @@ -0,0 +1,140 @@ + + + + + + + + bson_reinit() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reinit()

+
+

Synopsis

+
void
+bson_reinit (bson_t *b);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The bson_reinit() function shall be equivalent to calling bson_destroy() and bson_init().

+

However, if the bson_t structure contains a malloc()’d buffer, it may be reused. To be certain that any buffer is freed, always call bson_destroy() on any bson_t structure, whether initialized or reinitialized, after its final use.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reserve_buffer.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reserve_buffer.html new file mode 100644 index 0000000..97f69f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_reserve_buffer.html @@ -0,0 +1,219 @@ + + + + + + + + bson_reserve_buffer() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_reserve_buffer()

+
+

Synopsis

+
uint8_t *
+bson_reserve_buffer (bson_t *bson, uint32_t size);
+
+
+
+
+

Parameters

+
    +
  • bson: An initialized bson_t.
  • +
  • size: The length in bytes of the new buffer.
  • +
+
+
+

Description

+

Grow the internal buffer of bson to size and set the document length to size. Useful for eliminating copies when reading BSON bytes from a stream.

+

First, initialize bson with bson_init() or bson_new(), then call this function. After it returns, the length of bson is set to size but its contents are uninitialized memory: you must fill the contents with a BSON document of the correct length before any other operations.

+

The document must be freed with bson_destroy().

+
+
+

Returns

+

A pointer to the internal buffer, which is at least size bytes, or NULL if the space could not be allocated.

+
+
+

Example

+

Use bson_reserve_buffer to write a function that takes a bson_t pointer and reads a file into it directly:

+
#include <stdio.h>
+#include <bson/bson.h>
+
+bool
+read_into (bson_t *bson, FILE *fp)
+{
+   uint8_t *buffer;
+   long size;
+
+   if (fseek (fp, 0L, SEEK_END) < 0) {
+      perror ("Couldn't get file size");
+      return 1;
+   }
+
+   size = ftell (fp);
+   if (size == EOF) {
+      perror ("Couldn't get file size");
+      return 1;
+   }
+
+   if (size > INT32_MAX) {
+      fprintf (stderr, "File too large\n");
+      return 1;
+   }
+
+   /* reserve buffer space - bson is temporarily invalid */
+   buffer = bson_reserve_buffer (bson, (uint32_t) size);
+   if (!buffer) {
+      fprintf (stderr, "Couldn't reserve %ld bytes", size);
+      return false;
+   }
+
+   /* read file directly into the buffer */
+   rewind (fp);
+   if (fread ((void *) buffer, 1, (size_t) size, fp) < (size_t) size) {
+      perror ("Couldn't read file");
+      return false;
+   }
+
+   return true;
+}
+
+int
+main ()
+{
+   FILE *fp;
+   char *json;
+
+   /* stack-allocated, initialized bson_t */
+   bson_t bson = BSON_INITIALIZER;
+
+   if (!(fp = fopen ("document.bson", "rb"))) {
+      perror ("Couldn't read file");
+      return 1;
+   }
+
+   read_into (&bson, fp);
+   fclose (fp);
+
+   json = bson_as_canonical_extended_json (&bson, NULL);
+   printf ("%s\n", json);
+
+   bson_free (json);
+   bson_destroy (&bson);
+
+   return 0;
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_set_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_set_error.html new file mode 100644 index 0000000..ab8882c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_set_error.html @@ -0,0 +1,130 @@ + + + + + + + + bson_set_error() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_set_error()

+
+

Synopsis

+
void
+bson_set_error (
+   bson_error_t *error, uint32_t domain, uint32_t code, const char *format, ...)
+   BSON_GNUC_PRINTF (4, 5);
+
+
+
+
+

Parameters

+
    +
  • error: A bson_error_t.
  • +
  • domain: A uint32_t.
  • +
  • code: A uint32_t.
  • +
  • format: A printf() style format string.
  • +
+
+
+

Description

+

This is a helper function to set the parameters of a bson_error_t. It handles the case where error is NULL by doing nothing.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_sized_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_sized_new.html new file mode 100644 index 0000000..d1a911b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_sized_new.html @@ -0,0 +1,143 @@ + + + + + + + + bson_sized_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_sized_new()

+
+

Synopsis

+
bson_t *
+bson_sized_new (size_t size);
+
+
+
+
+

Parameters

+
    +
  • size: The size to pre-allocate for the underlying buffer.
  • +
+
+
+

Description

+

The bson_sized_new() function shall create a new bson_t on the heap with a preallocated buffer. This is useful if you have a good idea of the size of the resulting document.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_snprintf.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_snprintf.html new file mode 100644 index 0000000..4c1967d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_snprintf.html @@ -0,0 +1,132 @@ + + + + + + + + bson_snprintf() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_snprintf()

+
+

Synopsis

+
int
+bson_snprintf (char *str, size_t size, const char *format, ...)
+   BSON_GNUC_PRINTF (3, 4);
+
+
+
+
+

Parameters

+
    +
  • str: The destination buffer.
  • +
  • size: The size of str.
  • +
  • format: A printf style format string.
  • +
+
+
+

Description

+

This is a portable wrapper around snprintf(). It also enforces a trailing \0 in the resulting string.

+
+
+

Returns

+

The number of bytes written to str.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_steal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_steal.html new file mode 100644 index 0000000..e44bc91 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_steal.html @@ -0,0 +1,176 @@ + + + + + + + + bson_steal() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_steal()

+
+

Synopsis

+
bool
+bson_steal (bson_t *dst, bson_t *src);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Efficiently transfer the contents of src to dst and destroy src.

+

Before calling this function, src must be initialized and dst must be uninitialized. After this function returns successfully, src is destroyed, and dst is initialized and must be freed with bson_destroy().

+

For example, if you have a higher-level structure that wraps a bson_t, use bson_steal to transfer BSON data into it:

+
typedef struct {
+   bson_t bson;
+} bson_wrapper_t;
+
+
+bson_wrapper_t *
+wrap_bson (bson_t *b)
+{
+   bson_wrapper_t *wrapper = bson_malloc (sizeof (bson_wrapper_t));
+
+   if (bson_steal (&wrapper->bson, b)) {
+      return wrapper;
+   }
+
+   bson_free (wrapper);
+   return NULL;
+}
+
+
+void
+bson_wrapper_destroy (bson_wrapper_t *wrapper)
+{
+   bson_destroy (&wrapper->bson);
+   bson_free (wrapper);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+   bson_t bson = BSON_INITIALIZER;
+   bson_wrapper_t *wrapper;
+
+   BSON_APPEND_UTF8 (&bson, "key", "value");
+
+   /* now "bson" is destroyed */
+   wrapper = wrap_bson (&bson);
+
+   /* clean up */
+   bson_wrapper_destroy (wrapper);
+}
+
+
+

See also bson_destroy_with_steal(), a lower-level function that returns the raw contents of a bson_t.

+
+
+

Returns

+

Returns true if src was successfully moved to dst, false if src is invalid, or was statically initialized, or another error occurred.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strcasecmp.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strcasecmp.html new file mode 100644 index 0000000..f3d3307 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strcasecmp.html @@ -0,0 +1,132 @@ + + + + + + + + bson_strcasecmp() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strcasecmp()

+
+

Synopsis

+
int
+bson_strcasecmp (const char *s1, const char *s2);
+
+
+
+
+

Parameters

+
    +
  • s1: A string.
  • +
  • s2: A string.
  • +
+
+
+

Description

+

A portable version of strcasecmp().

+
+
+

Returns

+

Returns a negative integer if s1 sorts lexicographically before s2, a positive +integer if it sorts after, or 0 if they are equivalent, after translating both +strings to lower case.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup.html new file mode 100644 index 0000000..6045318 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup.html @@ -0,0 +1,129 @@ + + + + + + + + bson_strdup() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strdup()

+
+

Synopsis

+
char *
+bson_strdup (const char *str);
+
+
+
+
+

Parameters

+
    +
  • str: A string.
  • +
+
+
+

Description

+

Copies str into a new string. If str is NULL, then NULL is returned.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup_printf.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup_printf.html new file mode 100644 index 0000000..5cb6205 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdup_printf.html @@ -0,0 +1,129 @@ + + + + + + + + bson_strdup_printf() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strdup_printf()

+
+

Synopsis

+
char *
+bson_strdup_printf (const char *format, ...) BSON_GNUC_PRINTF (1, 2);
+
+
+
+
+

Parameters

+
    +
  • format: A printf style format string.
  • +
+
+
+

Description

+

This function performs a printf style format but into a newly allocated string.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdupv_printf.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdupv_printf.html new file mode 100644 index 0000000..a2a5fc9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strdupv_printf.html @@ -0,0 +1,130 @@ + + + + + + + + bson_strdupv_printf() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strdupv_printf()

+
+

Synopsis

+
char *
+bson_strdupv_printf (const char *format, va_list args) BSON_GNUC_PRINTF (1, 0);
+
+
+
+
+

Parameters

+
    +
  • format: A printf style format string.
  • +
  • args: A va_list.
  • +
+
+
+

Description

+

This function is like bson_strdup_printf() except takes a va_list of parameters.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strerror_r.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strerror_r.html new file mode 100644 index 0000000..80ee3d5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strerror_r.html @@ -0,0 +1,131 @@ + + + + + + + + bson_strerror_r() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strerror_r()

+
+

Synopsis

+
char *
+bson_strerror_r (int err_code, char *buf, size_t buflen);
+
+
+
+
+

Parameters

+
    +
  • err_code: An errno.
  • +
  • buf: A location to store the string.
  • +
  • buflen: The size of buf.
  • +
+
+
+

Description

+

This is a portability wrapper around strerror().

+
+
+

Returns

+

The passed in buf parameter or an internal string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strfreev.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strfreev.html new file mode 100644 index 0000000..2a014b1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strfreev.html @@ -0,0 +1,125 @@ + + + + + + + + bson_strfreev() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strfreev()

+
+

Synopsis

+
void
+bson_strfreev (char **strv);
+
+
+
+
+

Parameters

+
    +
  • strv: A NULL-terminated array of strings to free, including the array.
  • +
+
+
+

Description

+

This will free each string in a NULL-terminated array of strings and then the array itself.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append.html new file mode 100644 index 0000000..77b18d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append.html @@ -0,0 +1,126 @@ + + + + + + + + bson_string_append() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_append()

+
+

Synopsis

+
void
+bson_string_append (bson_string_t *string, const char *str);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Appends the ASCII or UTF-8 encoded string str to string. This is not suitable for embedding NULLs in strings.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_c.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_c.html new file mode 100644 index 0000000..d16f286 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_c.html @@ -0,0 +1,126 @@ + + + + + + + + bson_string_append_c() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_append_c()

+
+

Synopsis

+
void
+bson_string_append_c (bson_string_t *string, char str);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Appends c to the string builder string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_printf.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_printf.html new file mode 100644 index 0000000..4d96d31 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_printf.html @@ -0,0 +1,127 @@ + + + + + + + + bson_string_append_printf() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_append_printf()

+
+

Synopsis

+
void
+bson_string_append_printf (bson_string_t *string, const char *format, ...)
+   BSON_GNUC_PRINTF (2, 3);
+
+
+
+
+

Parameters

+
    +
  • string: A bson_string_t.
  • +
  • format: A printf style format string.
  • +
+
+
+

Description

+

Like bson_string_append() but formats a printf style string and then appends that to string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_unichar.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_unichar.html new file mode 100644 index 0000000..e2c9315 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_append_unichar.html @@ -0,0 +1,126 @@ + + + + + + + + bson_string_append_unichar() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_append_unichar()

+
+

Synopsis

+
void
+bson_string_append_unichar (bson_string_t *string, bson_unichar_t unichar);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Appends a unicode character to string. The character will be encoded into its multi-byte UTF-8 representation.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_free.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_free.html new file mode 100644 index 0000000..836cc4e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_free.html @@ -0,0 +1,130 @@ + + + + + + + + bson_string_free() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_free()

+
+

Synopsis

+
char *
+bson_string_free (bson_string_t *string, bool free_segment);
+
+
+
+
+

Parameters

+
    +
  • string: A bson_string_t.
  • +
  • free_segment: A bool indicating if str->str should be returned.
  • +
+
+
+

Description

+

Frees the bson_string_t structure and optionally the string itself.

+
+
+

Returns

+

str->str if free_segment is true, otherwise NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_new.html new file mode 100644 index 0000000..ed64083 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_new.html @@ -0,0 +1,129 @@ + + + + + + + + bson_string_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_new()

+
+

Synopsis

+
bson_string_t *
+bson_string_new (const char *str);
+
+
+
+
+

Parameters

+
    +
  • str: A string to be copied or NULL.
  • +
+
+
+

Description

+

Creates a new string builder, which uses power-of-two growth of buffers. Use the various bson_string_append*() functions to append to the string.

+
+
+

Returns

+

A newly allocated bson_string_t that should be freed with bson_string_free() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_t.html new file mode 100644 index 0000000..dc03cda --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_t.html @@ -0,0 +1,154 @@ + + + + + + + + bson_string_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_t

+

String Building Abstraction

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct {
+   char *str;
+   uint32_t len;
+   uint32_t alloc;
+} bson_string_t;
+
+
+
+
+

Description

+

bson_string_t is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two.

+

This API is useful if you need to build UTF-8 encoded strings.

+
+ +
+

Example

+
bson_string_t *str;
+
+str = bson_string_new (NULL);
+bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123);
+printf ("%s\n", str->str);
+
+bson_string_free (str, true);
+
+
+
+

Tip

+

You can call bson_string_free() with false if you would like to take ownership of str->str. Some APIs that do this might call return bson_string_free (str, false); after building the string.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_truncate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_truncate.html new file mode 100644 index 0000000..e04aedf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_string_truncate.html @@ -0,0 +1,127 @@ + + + + + + + + bson_string_truncate() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_string_truncate()

+
+

Synopsis

+
void
+bson_string_truncate (bson_string_t *string, uint32_t len);
+
+
+
+
+

Parameters

+
    +
  • string: A bson_string_t.
  • +
  • len: The new length of the string, excluding the trailing \0.
  • +
+
+
+

Description

+

Truncates the string so that it is len bytes in length. This must be smaller or equal to the current length of the string.

+

A \0 byte will be placed where the end of the string occurs.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strncpy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strncpy.html new file mode 100644 index 0000000..929af95 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strncpy.html @@ -0,0 +1,129 @@ + + + + + + + + bson_strncpy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strncpy()

+
+

Synopsis

+
void
+bson_strncpy (char *dst, const char *src, size_t size);
+
+
+
+
+

Parameters

+
    +
  • dst: The destination buffer.
  • +
  • src: The src buffer.
  • +
  • size: The number of bytes to copy into dst, which must be at least that size.
  • +
+
+
+

Description

+

Copies up to size bytes from src into dst. dst must be at least size bytes in size. A trailing \0 is always set.

+

Does nothing if size is zero.

+

bson_strncpy matches the behavior of the C11 standard strncpy_s, rather than strncpy. This means that bson_strncpy always writes a null terminator to dst, even if dst is too short to fit the entire string from src. If there is additional space left in dst after copying src, bson_strncpy does not fill the remaining space with null characters.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strndup.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strndup.html new file mode 100644 index 0000000..b5800e5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strndup.html @@ -0,0 +1,130 @@ + + + + + + + + bson_strndup() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strndup()

+
+

Synopsis

+
char *
+bson_strndup (const char *str, size_t n_bytes);
+
+
+
+
+

Parameters

+
    +
  • str: A string to copy.
  • +
  • n_bytes: A size_t.
  • +
+
+
+

Description

+

Allocates a new string and copies up to n_bytes from str into it. A trailing \0 is always set.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strnlen.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strnlen.html new file mode 100644 index 0000000..f508eda --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_strnlen.html @@ -0,0 +1,130 @@ + + + + + + + + bson_strnlen() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_strnlen()

+
+

Synopsis

+
size_t
+bson_strnlen (const char *s, size_t maxlen);
+
+
+
+
+

Parameters

+
    +
  • s: A string.
  • +
  • maxlen: The maximum size of string to check.
  • +
+
+
+

Description

+

A portable version of strnlen().

+
+
+

Returns

+

The length of s in bytes or maxlen if no \0 was found.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_subtype_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_subtype_t.html new file mode 100644 index 0000000..ffea748 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_subtype_t.html @@ -0,0 +1,141 @@ + + + + + + + + bson_subtype_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_subtype_t

+

Binary Field Subtype

+
+

Synopsis

+
#include <bson/bson.h>
+
+
+typedef enum {
+   BSON_SUBTYPE_BINARY = 0x00,
+   BSON_SUBTYPE_FUNCTION = 0x01,
+   BSON_SUBTYPE_BINARY_DEPRECATED = 0x02,
+   BSON_SUBTYPE_UUID_DEPRECATED = 0x03,
+   BSON_SUBTYPE_UUID = 0x04,
+   BSON_SUBTYPE_MD5 = 0x05,
+   BSON_SUBTYPE_USER = 0x80,
+} bson_subtype_t;
+
+
+
+
+

Description

+

This enumeration contains the various subtypes that may be used in a binary field. See http://bsonspec.org for more information.

+
+
+

Functions

+
+
+
+
+

Example

+
bson_t doc = BSON_INITIALIZER;
+
+BSON_APPEND_BINARY (&doc, "binary", BSON_SUBTYPE_BINARY, data, data_len);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_t.html new file mode 100644 index 0000000..611f884 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_t.html @@ -0,0 +1,323 @@ + + + + + + + + bson_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_t

+

BSON Document Abstraction

+
+

Synopsis

+
#include <bson/bson.h>
+
+/**
+ * bson_empty:
+ * @b: a bson_t.
+ *
+ * Checks to see if @b is an empty BSON document. An empty BSON document is
+ * a 5 byte document which contains the length (4 bytes) and a single NUL
+ * byte indicating end of fields.
+ */
+#define bson_empty(b) /* ... */
+
+/**
+ * bson_empty0:
+ *
+ * Like bson_empty() but treats NULL the same as an empty bson_t document.
+ */
+#define bson_empty0(b) /* ... */
+
+/**
+ * bson_clear:
+ *
+ * Easily free a bson document and set it to NULL. Use like:
+ *
+ * bson_t *doc = bson_new();
+ * bson_clear (&doc);
+ * BSON_ASSERT (doc == NULL);
+ */
+#define bson_clear(bptr) /* ... */
+
+/**
+ * BSON_MAX_SIZE:
+ *
+ * The maximum size in bytes of a BSON document.
+ */
+#define BSON_MAX_SIZE /* ... */
+
+#define BSON_APPEND_ARRAY(b, key, val) \
+   bson_append_array (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \
+   bson_append_array_begin (b, key, (int) strlen (key), child)
+
+#define BSON_APPEND_BINARY(b, key, subtype, val, len) \
+   bson_append_binary (b, key, (int) strlen (key), subtype, val, len)
+
+#define BSON_APPEND_BOOL(b, key, val) \
+   bson_append_bool (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_CODE(b, key, val) \
+   bson_append_code (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \
+   bson_append_code_with_scope (b, key, (int) strlen (key), val, scope)
+
+#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \
+   bson_append_dbpointer (b, key, (int) strlen (key), coll, oid)
+
+#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \
+   bson_append_document_begin (b, key, (int) strlen (key), child)
+
+#define BSON_APPEND_DOUBLE(b, key, val) \
+   bson_append_double (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_DOCUMENT(b, key, val) \
+   bson_append_document (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_INT32(b, key, val) \
+   bson_append_int32 (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_INT64(b, key, val) \
+   bson_append_int64 (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_MINKEY(b, key) \
+   bson_append_minkey (b, key, (int) strlen (key))
+
+#define BSON_APPEND_DECIMAL128(b, key, val) \
+   bson_append_decimal128 (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_MAXKEY(b, key) \
+   bson_append_maxkey (b, key, (int) strlen (key))
+
+#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key))
+
+#define BSON_APPEND_OID(b, key, val) \
+   bson_append_oid (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_REGEX(b, key, val, opt) \
+   bson_append_regex (b, key, (int) strlen (key), val, opt)
+
+#define BSON_APPEND_UTF8(b, key, val) \
+   bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val))
+
+#define BSON_APPEND_SYMBOL(b, key, val) \
+   bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val))
+
+#define BSON_APPEND_TIME_T(b, key, val) \
+   bson_append_time_t (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_TIMEVAL(b, key, val) \
+   bson_append_timeval (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_DATE_TIME(b, key, val) \
+   bson_append_date_time (b, key, (int) strlen (key), val)
+
+#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \
+   bson_append_timestamp (b, key, (int) strlen (key), val, inc)
+
+#define BSON_APPEND_UNDEFINED(b, key) \
+   bson_append_undefined (b, key, (int) strlen (key))
+
+#define BSON_APPEND_VALUE(b, key, val) \
+   bson_append_value (b, key, (int) strlen (key), (val))
+
+BSON_ALIGNED_BEGIN (128)
+typedef struct {
+   uint32_t flags;       /* Internal flags for the bson_t. */
+   uint32_t len;         /* Length of BSON data. */
+   uint8_t padding[120]; /* Padding for stack allocation. */
+} bson_t BSON_ALIGNED_END (128);
+
+
+
+
+

Description

+

The bson_t structure represents a BSON document. This structure manages the underlying BSON encoded buffer. For mutable documents, it can append new data to the document.

+
+
+

Performance Notes

+

The bson_t structure attempts to use an inline allocation within the structure to speed up performance of small documents. When this internal buffer has been exhausted, a heap allocated buffer will be dynamically allocated. Therefore, it is essential to call bson_destroy() on allocated documents.

+
+ +
+

Example

+
static void
+create_on_heap (void)
+{
+   bson_t *b = bson_new ();
+
+   BSON_APPEND_INT32 (b, "foo", 123);
+   BSON_APPEND_UTF8 (b, "bar", "foo");
+   BSON_APPEND_DOUBLE (b, "baz", 1.23f);
+
+   bson_destroy (b);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_type_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_type_t.html new file mode 100644 index 0000000..58f90e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_type_t.html @@ -0,0 +1,158 @@ + + + + + + + + bson_type_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_type_t

+

BSON Type Enumeration

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef enum {
+   BSON_TYPE_EOD = 0x00,
+   BSON_TYPE_DOUBLE = 0x01,
+   BSON_TYPE_UTF8 = 0x02,
+   BSON_TYPE_DOCUMENT = 0x03,
+   BSON_TYPE_ARRAY = 0x04,
+   BSON_TYPE_BINARY = 0x05,
+   BSON_TYPE_UNDEFINED = 0x06,
+   BSON_TYPE_OID = 0x07,
+   BSON_TYPE_BOOL = 0x08,
+   BSON_TYPE_DATE_TIME = 0x09,
+   BSON_TYPE_NULL = 0x0A,
+   BSON_TYPE_REGEX = 0x0B,
+   BSON_TYPE_DBPOINTER = 0x0C,
+   BSON_TYPE_CODE = 0x0D,
+   BSON_TYPE_SYMBOL = 0x0E,
+   BSON_TYPE_CODEWSCOPE = 0x0F,
+   BSON_TYPE_INT32 = 0x10,
+   BSON_TYPE_TIMESTAMP = 0x11,
+   BSON_TYPE_INT64 = 0x12,
+   BSON_TYPE_DECIMAL128 = 0x13,
+   BSON_TYPE_MAXKEY = 0x7F,
+   BSON_TYPE_MINKEY = 0xFF,
+} bson_type_t;
+
+
+
+
+

Description

+

The bson_type_t enumeration contains all of the types from the BSON Specification. It can be used to determine the type of a field at runtime.

+
+
+

Functions

+
+
+
+
+

Example

+
bson_iter_t iter;
+
+if (bson_iter_init_find (&iter, doc, "foo") &&
+    (BSON_TYPE_INT32 == bson_iter_type (&iter))) {
+   printf ("'foo' is an int32.\n");
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_uint32_to_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_uint32_to_string.html new file mode 100644 index 0000000..32f2869 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_uint32_to_string.html @@ -0,0 +1,152 @@ + + + + + + + + bson_uint32_to_string() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_uint32_to_string()

+
+

Synopsis

+
size_t
+bson_uint32_to_string (uint32_t value,
+                       const char **strptr,
+                       char *str,
+                       size_t size);
+
+
+
+
+

Parameters

+
    +
  • value: A uint32_t.
  • +
  • strptr: A location for the resulting string pointer.
  • +
  • str: A location to buffer the string.
  • +
  • size: A size_t containing the size of str.
  • +
+
+
+

Description

+

Converts value to a string.

+

If value is from 0 to 999, it will use a constant string in the data section of the library.

+

If not, a string will be formatted using str and snprintf().

+

strptr will always be set. It will either point to str or a constant string. Use this as your key.

+
+
+

Array Element Key Building

+

Each element in a BSON array has a monotonic string key like "0", "1", etc. This function is optimized for generating such string keys.

+
char str[16];
+const char *key;
+uint32_t i;
+
+for (i = 0; i < 10; i++) {
+   bson_uint32_to_string (i, &key, str, sizeof str);
+   printf ("Key: %s\n", key);
+}
+
+
+
+
+

Returns

+

The number of bytes in the resulting string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_unichar_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_unichar_t.html new file mode 100644 index 0000000..83b56d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_unichar_t.html @@ -0,0 +1,137 @@ + + + + + + + + bson_unichar_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_unichar_t

+

Unicode Character Abstraction

+
+

Synopsis

+
typedef uint32_t bson_unichar_t;
+
+
+
+
+

Description

+

bson_unichar_t provides an abstraction on a single unicode character. It is the 32-bit representation of a character. As UTF-8 can contain multi-byte characters, this should be used when iterating through UTF-8 text.

+
+
+

Functions

+
+
+
+
+

Example

+
static void
+print_each_char (const char *str)
+{
+   bson_unichar_t c;
+
+   for (; *str; str = bson_utf8_next_char (str)) {
+      c = bson_utf8_get_char (str);
+      printf ("The numberic value is %u.\n", (unsigned) c);
+   }
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_escape_for_json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_escape_for_json.html new file mode 100644 index 0000000..a93c90b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_escape_for_json.html @@ -0,0 +1,135 @@ + + + + + + + + bson_utf8_escape_for_json() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_utf8_escape_for_json()

+
+

Synopsis

+
char *
+bson_utf8_escape_for_json (const char *utf8, ssize_t utf8_len);
+
+
+
+
+

Parameters

+
    +
  • utf8: A UTF-8 encoded string.
  • +
  • utf8_len: The length of utf8 in bytes or -1 if it is NULL terminated.
  • +
+
+
+

Description

+

Allocates a new string matching utf8 except that special +characters in JSON are escaped. The resulting string is also +UTF-8 encoded.

+

Both ” and \ characters will be backslash-escaped. If a NUL +byte is found before utf8_len bytes, it is converted to +“\u0000”. Other non-ASCII characters in the input are preserved.

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_from_unichar.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_from_unichar.html new file mode 100644 index 0000000..6bd0fe6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_from_unichar.html @@ -0,0 +1,127 @@ + + + + + + + + bson_utf8_from_unichar() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_utf8_from_unichar()

+
+

Synopsis

+
void
+bson_utf8_from_unichar (bson_unichar_t unichar, char utf8[6], uint32_t *len);
+
+
+
+
+

Parameters

+
    +
  • unichar: A bson_unichar_t.
  • +
  • utf8: A location for the utf8 sequence.
  • +
  • len: A location for the number of bytes in the resulting utf8 sequence.
  • +
+
+
+

Description

+

Converts a single unicode character to a multi-byte UTF-8 sequence. The result is stored in utf8 and the number of bytes used in len.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_get_char.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_get_char.html new file mode 100644 index 0000000..2484209 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_get_char.html @@ -0,0 +1,129 @@ + + + + + + + + bson_utf8_get_char() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_utf8_get_char()

+
+

Synopsis

+
bson_unichar_t
+bson_utf8_get_char (const char *utf8);
+
+
+
+
+

Parameters

+
    +
  • utf8: A UTF-8 encoded string.
  • +
+
+
+

Description

+

Converts the current character in a UTF-8 sequence to a bson_unichar_t, the 32-bit representation of the multi-byte character.

+
+
+

Returns

+

A bson_unichar_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_next_char.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_next_char.html new file mode 100644 index 0000000..3afb633 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_next_char.html @@ -0,0 +1,130 @@ + + + + + + + + bson_utf8_next_char() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_utf8_next_char()

+
+

Synopsis

+
const char *
+bson_utf8_next_char (const char *utf8);
+
+
+
+
+

Parameters

+
    +
  • utf8: A UTF-8 encoded string.
  • +
+
+
+

Description

+

Advances within utf8 to the next UTF-8 character, which may be multiple bytes offset from utf8. A pointer to the next character is returned.

+

It is invalid to call this function on a string whose current character is \0.

+
+
+

Returns

+

A pointer to the beginning of the next character in the UTF-8 encoded string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_validate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_validate.html new file mode 100644 index 0000000..776cbac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_utf8_validate.html @@ -0,0 +1,131 @@ + + + + + + + + bson_utf8_validate() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_utf8_validate()

+
+

Synopsis

+
bool
+bson_utf8_validate (const char *utf8, size_t utf8_len, bool allow_null);
+
+
+
+
+

Parameters

+
    +
  • utf8: A string to verify.
  • +
  • utf8_len: The length of utf8 in bytes.
  • +
  • allow_null: A bool indicating that embedded \0 bytes are allowed.
  • +
+
+
+

Description

+

Validates that the content within utf8 is valid UTF-8 (by the RFC 3629 standard). If allow_null is true, then embedded NULL bytes are allowed (\0).

+
+
+

Returns

+

true if utf8 contains valid UTF-8.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate.html new file mode 100644 index 0000000..9fbbe2f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate.html @@ -0,0 +1,132 @@ + + + + + + + + bson_validate() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_validate()

+
+

Synopsis

+
bool
+bson_validate (const bson_t *bson, bson_validate_flags_t flags, size_t *offset);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • flags: A bitwise-or of all desired bson_validate_flags_t.
  • +
  • offset: A location for the offset within bson where the error occurred.
  • +
+
+
+

Description

+

Validates a BSON document by walking through the document and inspecting the keys and values for valid content.

+

You can modify how the validation occurs through the use of the flags parameter, see bson_validate_with_error() for details.

+
+
+

Returns

+

Returns true if bson is valid; otherwise false and offset is set to the byte offset where the error was detected.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate_with_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate_with_error.html new file mode 100644 index 0000000..4cfedbd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_validate_with_error.html @@ -0,0 +1,153 @@ + + + + + + + + bson_validate_with_error() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_validate_with_error()

+
+

Synopsis

+
typedef enum {
+   BSON_VALIDATE_NONE = 0,
+   BSON_VALIDATE_UTF8 = (1 << 0),
+   BSON_VALIDATE_DOLLAR_KEYS = (1 << 1),
+   BSON_VALIDATE_DOT_KEYS = (1 << 2),
+   BSON_VALIDATE_UTF8_ALLOW_NULL = (1 << 3),
+   BSON_VALIDATE_EMPTY_KEYS = (1 << 4),
+} bson_validate_flags_t;
+
+bool
+bson_validate_with_error (const bson_t *bson,
+                          bson_validate_flags_t flags,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • bson: A bson_t.
  • +
  • flags: A bitwise-or of all desired validation flags.
  • +
  • error: Optional bson_error_t.
  • +
+
+
+

Description

+

Validates a BSON document by walking through the document and inspecting the keys and values for valid content.

+

You can modify how the validation occurs through the use of the flags parameter. A description of their effect is below.

+
    +
  • BSON_VALIDATE_NONE Basic validation of BSON length and structure.
  • +
  • BSON_VALIDATE_UTF8 All keys and string values are checked for invalid UTF-8.
  • +
  • BSON_VALIDATE_UTF8_ALLOW_NULL String values are allowed to have embedded NULL bytes.
  • +
  • BSON_VALIDATE_DOLLAR_KEYS Prohibit keys that start with $ outside of a “DBRef” subdocument.
  • +
  • BSON_VALIDATE_DOT_KEYS Prohibit keys that contain . anywhere in the string.
  • +
  • BSON_VALIDATE_EMPTY_KEYS Prohibit zero-length keys.
  • +
+

See also bson_validate().

+
+
+

Returns

+

Returns true if bson is valid; otherwise false and error is filled out.

+

The bson_error_t domain is set to BSON_ERROR_INVALID. Its code is set to one of the bson_validate_flags_t flags indicating which validation failed; for example, if a key contains invalid UTF-8, then the code is set to BSON_VALIDATE_UTF8, but if the basic structure of the BSON document is corrupt, the code is set to BSON_VALIDATE_NONE. The error message is filled out, and gives more detail if possible.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_copy.html new file mode 100644 index 0000000..9a5bf47 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_copy.html @@ -0,0 +1,126 @@ + + + + + + + + bson_value_copy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_value_copy()

+
+

Synopsis

+
void
+bson_value_copy (const bson_value_t *src, bson_value_t *dst);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function will copy the boxed content in src into dst. dst must be freed with bson_value_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_destroy.html new file mode 100644 index 0000000..8df9c23 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_destroy.html @@ -0,0 +1,125 @@ + + + + + + + + bson_value_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_value_destroy()

+
+

Synopsis

+
void
+bson_value_destroy (bson_value_t *value);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Releases any resources associated with value. Does nothing if value is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_t.html new file mode 100644 index 0000000..585d94d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_value_t.html @@ -0,0 +1,191 @@ + + + + + + + + bson_value_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_value_t

+

BSON Boxed Container Type

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct _bson_value_t {
+   bson_type_t value_type;
+   union {
+      bson_oid_t v_oid;
+      int64_t v_int64;
+      int32_t v_int32;
+      int8_t v_int8;
+      double v_double;
+      bool v_bool;
+      int64_t v_datetime;
+      struct {
+         uint32_t timestamp;
+         uint32_t increment;
+      } v_timestamp;
+      struct {
+         uint32_t len;
+         char *str;
+      } v_utf8;
+      struct {
+         uint32_t data_len;
+         uint8_t *data;
+      } v_doc;
+      struct {
+         uint32_t data_len;
+         uint8_t *data;
+         bson_subtype_t subtype;
+      } v_binary;
+      struct {
+         char *regex;
+         char *options;
+      } v_regex;
+      struct {
+         char *collection;
+         uint32_t collection_len;
+         bson_oid_t oid;
+      } v_dbpointer;
+      struct {
+         uint32_t code_len;
+         char *code;
+      } v_code;
+      struct {
+         uint32_t code_len;
+         char *code;
+         uint32_t scope_len;
+         uint8_t *scope_data;
+      } v_codewscope;
+      struct {
+         uint32_t len;
+         char *symbol;
+      } v_symbol;
+   } value;
+} bson_value_t;
+
+
+
+
+

Description

+

The bson_value_t structure is a boxed type for encapsulating a runtime determined type.

+
+ +
+

Example

+
const bson_value_t *value;
+
+value = bson_iter_value (&iter);
+
+if (value->value_type == BSON_TYPE_INT32) {
+   printf ("%d\n", value->value.v_int32);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_visitor_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_visitor_t.html new file mode 100644 index 0000000..22c5844 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_visitor_t.html @@ -0,0 +1,313 @@ + + + + + + + + bson_visitor_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_visitor_t

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct {
+   /* run before / after descending into a document */
+   bool (*visit_before) (const bson_iter_t *iter, const char *key, void *data);
+   bool (*visit_after) (const bson_iter_t *iter, const char *key, void *data);
+   /* corrupt BSON, or unsupported type and visit_unsupported_type not set */
+   void (*visit_corrupt) (const bson_iter_t *iter, void *data);
+   /* normal bson field callbacks */
+   bool (*visit_double) (const bson_iter_t *iter,
+                         const char *key,
+                         double v_double,
+                         void *data);
+   bool (*visit_utf8) (const bson_iter_t *iter,
+                       const char *key,
+                       size_t v_utf8_len,
+                       const char *v_utf8,
+                       void *data);
+   bool (*visit_document) (const bson_iter_t *iter,
+                           const char *key,
+                           const bson_t *v_document,
+                           void *data);
+   bool (*visit_array) (const bson_iter_t *iter,
+                        const char *key,
+                        const bson_t *v_array,
+                        void *data);
+   bool (*visit_binary) (const bson_iter_t *iter,
+                         const char *key,
+                         bson_subtype_t v_subtype,
+                         size_t v_binary_len,
+                         const uint8_t *v_binary,
+                         void *data);
+   /* normal field with deprecated "Undefined" BSON type */
+   bool (*visit_undefined) (const bson_iter_t *iter,
+                            const char *key,
+                            void *data);
+   bool (*visit_oid) (const bson_iter_t *iter,
+                      const char *key,
+                      const bson_oid_t *v_oid,
+                      void *data);
+   bool (*visit_bool) (const bson_iter_t *iter,
+                       const char *key,
+                       bool v_bool,
+                       void *data);
+   bool (*visit_date_time) (const bson_iter_t *iter,
+                            const char *key,
+                            int64_t msec_since_epoch,
+                            void *data);
+   bool (*visit_null) (const bson_iter_t *iter, const char *key, void *data);
+   bool (*visit_regex) (const bson_iter_t *iter,
+                        const char *key,
+                        const char *v_regex,
+                        const char *v_options,
+                        void *data);
+   bool (*visit_dbpointer) (const bson_iter_t *iter,
+                            const char *key,
+                            size_t v_collection_len,
+                            const char *v_collection,
+                            const bson_oid_t *v_oid,
+                            void *data);
+   bool (*visit_code) (const bson_iter_t *iter,
+                       const char *key,
+                       size_t v_code_len,
+                       const char *v_code,
+                       void *data);
+   bool (*visit_symbol) (const bson_iter_t *iter,
+                         const char *key,
+                         size_t v_symbol_len,
+                         const char *v_symbol,
+                         void *data);
+   bool (*visit_codewscope) (const bson_iter_t *iter,
+                             const char *key,
+                             size_t v_code_len,
+                             const char *v_code,
+                             const bson_t *v_scope,
+                             void *data);
+   bool (*visit_int32) (const bson_iter_t *iter,
+                        const char *key,
+                        int32_t v_int32,
+                        void *data);
+   bool (*visit_timestamp) (const bson_iter_t *iter,
+                            const char *key,
+                            uint32_t v_timestamp,
+                            uint32_t v_increment,
+                            void *data);
+   bool (*visit_int64) (const bson_iter_t *iter,
+                        const char *key,
+                        int64_t v_int64,
+                        void *data);
+   bool (*visit_maxkey) (const bson_iter_t *iter, const char *key, void *data);
+   bool (*visit_minkey) (const bson_iter_t *iter, const char *key, void *data);
+   /* if set, called instead of visit_corrupt when an apparently valid BSON
+    * includes an unrecognized field type (reading future version of BSON) */
+   void (*visit_unsupported_type) (const bson_iter_t *iter,
+                                   const char *key,
+                                   uint32_t type_code,
+                                   void *data);
+   bool (*visit_decimal128) (const bson_iter_t *iter,
+                             const char *key,
+                             const bson_decimal128_t *v_decimal128,
+                             void *data);
+
+   void *padding[7];
+} bson_visitor_t bson_visitor_t;
+
+
+
+
+

Description

+

The bson_visitor_t structure provides a series of callbacks that can be called while iterating a BSON document. This may simplify the conversion of a bson_t to a higher level language structure.

+

If the optional callback visit_unsupported_type is set, it is called instead of visit_corrupt in the specific case of an unrecognized field type. (Parsing is aborted in either case.) Use this callback to report an error like “unrecognized type” instead of simply “corrupt BSON”. This future-proofs code that may use an older version of libbson to parse future BSON formats.

+
+
+

Functions

+
+
+
+
+

Example

+
#include <bson.h>
+#include <stdio.h>
+
+static bool
+my_visit_before (const bson_iter_t *iter, const char *key, void *data)
+{
+   int *count = (int *) data;
+
+   (*count)++;
+
+   /* returning true stops further iteration of the document */
+
+   return false;
+}
+
+static void
+count_fields (bson_t *doc)
+{
+   bson_visitor_t visitor = {0};
+   bson_iter_t iter;
+   int count = 0;
+
+   visitor.visit_before = my_visit_before;
+
+   if (bson_iter_init (&iter, doc)) {
+      bson_iter_visit_all (&iter, &visitor, &count);
+   }
+
+   printf ("Found %d fields.\n", count);
+}
+
+
+

The example below demonstrates how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries.

+
+
+

Example

+
#include <bson.h>
+#include <stdio.h>
+
+typedef struct {
+   ssize_t *err_offset;
+} my_state_t;
+
+static void
+my_visit_corrupt (const bson_iter_t *iter, void *data)
+{
+   *(((my_state_t *) data)->err_offset) = iter->off;
+}
+
+static void
+my_visit_unsupported_type (const bson_iter_t *iter,
+                           const char *key,
+                           uint32_t type_code,
+                           void *data)
+{
+   *(((my_state_t *) data)->err_offset) = iter->off;
+}
+
+static void
+find_error_location (bson_t *doc)
+{
+   bson_visitor_t visitors = {0};
+   bson_iter_t iter;
+   my_state_t state;
+   ssize_t err_offset = -1;
+
+   visitors.visit_corrupt = my_visit_corrupt;
+   visitors.visit_unsupported_type = my_visit_unsupported_type;
+   /* provide additional visitors as needed based on your requirements */
+   state.err_offset = &err_offset;
+
+   if (!bson_iter_init (&iter, doc)) {
+      printf ("Could not initialize iterator!");
+      exit (1);
+   }
+
+   if (bson_iter_visit_all (&iter, &visitors, &state) ||
+       err_offset != -1) {
+      printf ("Found error at offset %d.\n", err_offset);
+   } else {
+      printf ("BSON document had no errors.\n");
+   }
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_vsnprintf.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_vsnprintf.html new file mode 100644 index 0000000..bd63285 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_vsnprintf.html @@ -0,0 +1,133 @@ + + + + + + + + bson_vsnprintf() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_vsnprintf()

+
+

Synopsis

+
int
+bson_vsnprintf (char *str, size_t size, const char *format, va_list ap)
+   BSON_GNUC_PRINTF (3, 0);
+
+
+
+
+

Parameters

+
    +
  • str: A location for the resulting string.
  • +
  • size: The size of str in bytes.
  • +
  • format: A printf style format string.
  • +
  • ap: A va_list of parameters for the format.
  • +
+
+
+

Description

+

Like bson_snprintf() but allows for variadic parameters.

+
+
+

Returns

+

The number of bytes written to str excluding the \0 byte.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_begin.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_begin.html new file mode 100644 index 0000000..02998fd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_begin.html @@ -0,0 +1,130 @@ + + + + + + + + bson_writer_begin() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_begin()

+
+

Synopsis

+
bool
+bson_writer_begin (bson_writer_t *writer, bson_t **bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Begins writing a new document. The caller may use the bson structure to write out a new BSON document. When completed, the caller must call either bson_writer_end() or bson_writer_rollback().

+
+
+

Returns

+

true if there was space in the underlying buffers to begin the document.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_destroy.html new file mode 100644 index 0000000..35d81e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_destroy.html @@ -0,0 +1,125 @@ + + + + + + + + bson_writer_destroy() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_destroy()

+
+

Synopsis

+
void
+bson_writer_destroy (bson_writer_t *writer);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Cleanup after writer and release any allocated memory. Does nothing if writer is NULL. Note that the buffer supplied to bson_writer_new() is NOT freed from this method. The caller is responsible for that.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_end.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_end.html new file mode 100644 index 0000000..6295d6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_end.html @@ -0,0 +1,125 @@ + + + + + + + + bson_writer_end() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_end()

+
+

Synopsis

+
void
+bson_writer_end (bson_writer_t *writer);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Complete writing of a bson_writer_t to the buffer supplied.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_get_length.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_get_length.html new file mode 100644 index 0000000..e56ceb7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_get_length.html @@ -0,0 +1,130 @@ + + + + + + + + bson_writer_get_length() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_get_length()

+
+

Synopsis

+
size_t
+bson_writer_get_length (bson_writer_t *writer);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the current length of the content written by the buffer (including the initial offset). This includes a partly written document currently being written.

+

This is useful if you want to check to see if you’ve passed a given memory boundary that cannot be sent in a packet. See bson_writer_rollback() to abort the current document being written.

+
+
+

Returns

+

The length of the underlying buffer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_new.html new file mode 100644 index 0000000..5981162 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_new.html @@ -0,0 +1,138 @@ + + + + + + + + bson_writer_new() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_new()

+
+

Synopsis

+
bson_writer_t *
+bson_writer_new (uint8_t **buf,
+                 size_t *buflen,
+                 size_t offset,
+                 bson_realloc_func realloc_func,
+                 void *realloc_func_ctx);
+
+
+
+
+

Parameters

+
    +
  • buf: A uint8_t.
  • +
  • buflen: A size_t.
  • +
  • offset: A size_t.
  • +
  • realloc_func: A bson_realloc_func.
  • +
  • realloc_func_ctx: A bson_realloc_func.
  • +
+
+
+

Description

+

Creates a new instance of bson_writer_t using the buffer, length, offset, and _realloc()_ function supplied.

+

The caller is expected to clean up the structure when finished using bson_writer_destroy().

+
+
+

Returns

+

A newly allocated bson_writer_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_rollback.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_rollback.html new file mode 100644 index 0000000..af55203 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_rollback.html @@ -0,0 +1,125 @@ + + + + + + + + bson_writer_rollback() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_rollback()

+
+

Synopsis

+
void
+bson_writer_rollback (bson_writer_t *writer);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Abort the appending of the current bson_t to the memory region managed by writer. This is useful if you detected that you went past a particular memory limit. For example, MongoDB has 48MB message limits.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_t.html new file mode 100644 index 0000000..350f6a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_writer_t.html @@ -0,0 +1,170 @@ + + + + + + + + bson_writer_t — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_writer_t

+

Bulk BSON serialization Abstraction

+
+

Synopsis

+
#include <bson/bson.h>
+
+typedef struct _bson_writer_t bson_writer_t;
+
+bson_writer_t *
+bson_writer_new (uint8_t **buf,
+                 size_t *buflen,
+                 size_t offset,
+                 bson_realloc_func realloc_func,
+                 void *realloc_func_ctx);
+void
+bson_writer_destroy (bson_writer_t *writer);
+
+
+
+
+

Description

+

The bson_writer_t API provides an abstraction for serializing many BSON documents to a single memory region. The memory region may be dynamically allocated and re-allocated as more memory is demanded. This can be useful when building network packets from a high-level language. For example, you can serialize a Python Dictionary directly to a single buffer destined for a TCP packet.

+
+ +
+

Example

+
#include <bson/bson.h>
+
+int
+main (int argc, char *argv[])
+{
+   bson_writer_t *writer;
+   uint8_t *buf = NULL;
+   size_t buflen = 0;
+   bson_t *doc;
+
+   writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL);
+
+   for (i = 0; i < 1000; i++) {
+      bson_writer_begin (writer, &doc);
+      BSON_APPEND_INT32 (&doc, "i", i);
+      bson_writer_end (writer);
+   }
+
+   bson_writer_destroy (writer);
+
+   bson_free (buf);
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_zero_free.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_zero_free.html new file mode 100644 index 0000000..36addef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/bson_zero_free.html @@ -0,0 +1,126 @@ + + + + + + + + bson_zero_free() — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

bson_zero_free()

+
+

Synopsis

+
void
+bson_zero_free (void *mem, size_t size);
+
+
+
+
+

Parameters

+
    +
  • mem: A memory region.
  • +
  • size: The size of mem.
  • +
+
+
+

Description

+

This function behaves like bson_free() except that it zeroes the memory first. This can be useful if you are storing passwords or other similarly important data. Note that if it truly is important, you probably want a page protected with mlock() as well to prevent it swapping to disk.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/character_and_string_routines.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/character_and_string_routines.html new file mode 100644 index 0000000..4025481 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/character_and_string_routines.html @@ -0,0 +1,131 @@ + + + + + + + + Character and String Routines — libbson 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/creating.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/creating.html new file mode 100644 index 0000000..7eed388 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/creating.html @@ -0,0 +1,175 @@ + + + + + + + + Creating a BSON Document — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Creating a BSON Document

+
+

The bson_t structure

+

BSON documents are created using the bson_t structure. This structure encapsulates the necessary logic for encoding using the BSON Specification. At the core, bson_t is a buffer manager and set of encoding routines.

+
+

Tip

+

BSON documents can live on the stack or the heap based on the performance needs or preference of the consumer.

+
+

Let’s start by creating a new BSON document on the stack. Whenever using libbson, make sure you #include <bson/bson.h>.

+
bson_t b;
+
+bson_init (&b);
+
+
+

This creates an empty document. In JSON, this would be the same as {}.

+

We can now proceed to adding items to the BSON document. A variety of functions prefixed with bson_append_ can be used based on the type of field you want to append. Let’s append a UTF-8 encoded string.

+
bson_append_utf8 (&b, "key", -1, "value", -1);
+
+
+

Notice the two -1 parameters. The first indicates that the length of key in bytes should be determined with strlen(). Alternatively, we could have passed the number 3. The same goes for the second -1, but for value.

+

Libbson provides macros to make this less tedious when using string literals. The following two appends are identical.

+
bson_append_utf8 (&b, "key", -1, "value", -1);
+BSON_APPEND_UTF8 (&b, "key", "value");
+
+
+

Now let’s take a look at an example that adds a few different field types to a BSON document.

+
bson_t b = BSON_INITIALIZER;
+
+BSON_APPEND_INT32 (&b, "a", 1);
+BSON_APPEND_UTF8 (&b, "hello", "world");
+BSON_APPEND_BOOL (&b, "bool", true);
+
+
+

Notice that we omitted the call to bson_init(). By specifying BSON_INITIALIZER we can remove the need to initialize the structure to a base state.

+
+
+

Sub-Documents and Sub-Arrays

+

To simplify the creation of sub-documents and arrays, bson_append_document_begin() and bson_append_array_begin() exist. These can be used to build a sub-document using the parent documents memory region as the destination buffer.

+
bson_t parent;
+bson_t child;
+char *str;
+
+bson_init (&parent);
+bson_append_document_begin (&parent, "foo", 3, &child);
+bson_append_int32 (&child, "baz", 3, 1);
+bson_append_document_end (&parent, &child);
+
+str = bson_as_canonical_extended_json (&parent, NULL);
+printf ("%s\n", str);
+bson_free (str);
+
+bson_destroy (&parent);
+
+
+
{ "foo" : { "baz" : 1 } }
+
+
+
+
+

Simplified BSON C Object Notation

+

Creating BSON documents by hand can be tedious and time consuming. BCON, or BSON C Object Notation, was added to allow for the creation of BSON documents in a format that looks closer to the destination format.

+

The following example shows the use of BCON. Notice that values for fields are wrapped in the BCON_* macros. These are required for the variadic processor to determine the parameter type.

+
bson_t *doc;
+
+doc = BCON_NEW ("foo",
+                "{",
+                "int",
+                BCON_INT32 (1),
+                "array",
+                "[",
+                BCON_INT32 (100),
+                "{",
+                "sub",
+                BCON_UTF8 ("value"),
+                "}",
+                "]",
+                "}");
+
+
+

Creates the following document

+
{ "foo" : { "int" : 1, "array" : [ 100, { "sub" : "value" } ] } }
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/cross-platform-notes.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/cross-platform-notes.html new file mode 100644 index 0000000..9c0bcce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/cross-platform-notes.html @@ -0,0 +1,92 @@ + + + + + + + + Cross Platform Notes — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Cross Platform Notes

+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/endianness.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/endianness.html new file mode 100644 index 0000000..9a3dccf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/endianness.html @@ -0,0 +1,89 @@ + + + + + + + + Endianness — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Endianness

+

The BSON specification dictates that the encoding format is in little-endian. Many implementations simply ignore endianness altogether and expect that they are to be run on little-endian. Libbson supports both Big and Little Endian systems. This means we use memcpy() when appropriate instead of dereferencing and properly convert to and from the host endian format. We expect the compiler intrinsics to optimize it to a dereference when possible.

+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/errors.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/errors.html new file mode 100644 index 0000000..262d84a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/errors.html @@ -0,0 +1,93 @@ + + + + + + + + Handling Errors — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Handling Errors

+
+

Description

+

Many libbson functions report errors by returning NULL or -1 and filling out a bson_error_t structure with an error domain, error code, and message.

+
    +
  • error.domain names the subsystem that generated the error.
  • +
  • error.code is a domain-specific error type.
  • +
  • error.message describes the error.
  • +
+

Some error codes overlap with others; always check both the domain and code to determine the type of error.

+ +++++ + + + + + + + + + + +
BSON_ERROR_JSONBSON_JSON_ERROR_READ_CORRUPT_JS +BSON_JSON_ERROR_READ_INVALID_PARAM +BSON_JSON_ERROR_READ_CB_FAILUREbson_json_reader_t tried to parse invalid MongoDB Extended JSON. +Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. +An internal callback failure during JSON parsing.
BSON_ERROR_READERBSON_ERROR_READER_BADFDbson_json_reader_new_from_file() could not open the file.
+
+
+ + +
+ +
+
+
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/full_index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/full_index.html new file mode 100644 index 0000000..8c261b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/full_index.html @@ -0,0 +1,364 @@ + + + + + + + + Index — libbson 1.13.1 + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Index

+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/genindex.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/genindex.html new file mode 100644 index 0000000..845f239 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/genindex.html @@ -0,0 +1,82 @@ + + + + + + + + + Index — libbson 1.13.1 + + + + + + + + + + + + + + +
+
+
+
+ + + + + +

Index

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/guides.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/guides.html new file mode 100644 index 0000000..1fd600e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/guides.html @@ -0,0 +1,94 @@ + + + + + + + + Guides — libbson 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/include-and-link.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/include-and-link.html new file mode 100644 index 0000000..0b77f99 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/include-and-link.html @@ -0,0 +1,166 @@ + + + + + + + + Using libbson In Your C Program — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/index.html new file mode 100644 index 0000000..ca2c1b8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/index.html @@ -0,0 +1,137 @@ + + + + + + + + Libbson — libbson 1.13.1 + + + + + + + + + + + + + + + +
+
+
+
+ + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/json.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/json.html new file mode 100644 index 0000000..d9bd721 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/json.html @@ -0,0 +1,321 @@ + + + + + + + + JSON — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

JSON

+

Libbson provides routines for converting to and from the JSON format. In particular, it supports the MongoDB extended JSON format.

+
+

Converting BSON to JSON

+

There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the functions bson_as_canonical_extended_json() and bson_as_relaxed_extended_json(). The canonical format preserves BSON type information for values that may have ambiguous representations in JSON (e.g. numeric types).

+
bson_t *b;
+size_t len;
+char *str;
+
+b = BCON_NEW ("a", BCON_INT32 (1));
+
+str = bson_as_canonical_extended_json (b, &len);
+printf ("%s\n", str);
+bson_free (str);
+
+bson_destroy (b);
+
+
+
{ "a" : { "$numberInt": "1" } }
+
+
+

The relaxed format prefers JSON primitives for numeric values and may be used if type fidelity is not required.

+
bson_t *b;
+size_t len;
+char *str;
+
+b = BCON_NEW ("a", BCON_INT32 (1));
+
+str = bson_as_relaxed_extended_json (b, &len);
+printf ("%s\n", str);
+bson_free (str);
+
+bson_destroy (b);
+
+
+
{ "a" : 1 }
+
+
+
+
+

Converting JSON to BSON

+

Converting back from JSON is also useful and common enough that we added bson_init_from_json() and bson_new_from_json().

+

The following example creates a new bson_t from the JSON string {"a":1}.

+
bson_t *b;
+bson_error_t error;
+
+b = bson_new_from_json ("{\"a\":1}", -1, &error);
+
+if (!b) {
+   printf ("Error: %s\n", error.message);
+} else {
+   bson_destroy (b);
+}
+
+
+
+
+

Streaming JSON Parsing

+

Libbson provides bson_json_reader_t to allow for parsing a sequence of JSON documents into BSON. The interface is similar to bson_reader_t but expects the input to be in the MongoDB extended JSON format.

+
/*
+ * Copyright 2013 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * This program will print each JSON document contained in the provided files
+ * as a BSON string to STDOUT.
+ */
+
+
+#include <bson/bson.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   bson_json_reader_t *reader;
+   bson_error_t error;
+   const char *filename;
+   bson_t doc = BSON_INITIALIZER;
+   int i;
+   int b;
+
+   /*
+    * Print program usage if no arguments are provided.
+    */
+   if (argc == 1) {
+      fprintf (stderr, "usage: %s FILE...\n", argv[0]);
+      return 1;
+   }
+
+   /*
+    * Process command line arguments expecting each to be a filename.
+    */
+   for (i = 1; i < argc; i++) {
+      filename = argv[i];
+
+      /*
+       * Open the filename provided in command line arguments.
+       */
+      if (0 == strcmp (filename, "-")) {
+         reader = bson_json_reader_new_from_fd (STDIN_FILENO, false);
+      } else {
+         if (!(reader = bson_json_reader_new_from_file (filename, &error))) {
+            fprintf (
+               stderr, "Failed to open \"%s\": %s\n", filename, error.message);
+            continue;
+         }
+      }
+
+      /*
+       * Convert each incoming document to BSON and print to stdout.
+       */
+      while ((b = bson_json_reader_read (reader, &doc, &error))) {
+         if (b < 0) {
+            fprintf (stderr, "Error in json parsing:\n%s\n", error.message);
+            abort ();
+         }
+
+         if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) {
+            fprintf (stderr, "Failed to write to stdout, exiting.\n");
+            exit (1);
+         }
+         bson_reinit (&doc);
+      }
+
+      bson_json_reader_destroy (reader);
+      bson_destroy (&doc);
+   }
+
+   return 0;
+}
+
+
+
+
+

Examples

+

The following example reads BSON documents from stdin and prints them to stdout as JSON.

+
/*
+ * Copyright 2013 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * This program will print each BSON document contained in the provided files
+ * as a JSON string to STDOUT.
+ */
+
+
+#include <bson/bson.h>
+#include <stdio.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   bson_reader_t *reader;
+   const bson_t *b;
+   bson_error_t error;
+   const char *filename;
+   char *str;
+   int i;
+
+   /*
+    * Print program usage if no arguments are provided.
+    */
+   if (argc == 1) {
+      fprintf (stderr, "usage: %s [FILE | -]...\nUse - for STDIN.\n", argv[0]);
+      return 1;
+   }
+
+   /*
+    * Process command line arguments expecting each to be a filename.
+    */
+   for (i = 1; i < argc; i++) {
+      filename = argv[i];
+
+      if (strcmp (filename, "-") == 0) {
+         reader = bson_reader_new_from_fd (STDIN_FILENO, false);
+      } else {
+         if (!(reader = bson_reader_new_from_file (filename, &error))) {
+            fprintf (
+               stderr, "Failed to open \"%s\": %s\n", filename, error.message);
+            continue;
+         }
+      }
+
+      /*
+       * Convert each incoming document to JSON and print to stdout.
+       */
+      while ((b = bson_reader_read (reader, NULL))) {
+         str = bson_as_canonical_extended_json (b, NULL);
+         fprintf (stdout, "%s\n", str);
+         bson_free (str);
+      }
+
+      /*
+       * Cleanup after our reader, which closes the file descriptor.
+       */
+      bson_reader_destroy (reader);
+   }
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/objects.inv b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/objects.inv new file mode 100644 index 0000000..755ef01 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/objects.inv differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/oid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/oid.html new file mode 100644 index 0000000..5447e42 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/oid.html @@ -0,0 +1,154 @@ + + + + + + + + ObjectIDs — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

ObjectIDs

+

Libbson provides a simple way to generate ObjectIDs. It can be used in a single-threaded or multi-threaded manner depending on your requirements.

+

The bson_oid_t structure represents an ObjectID in MongoDB. It is a 96-bit identifier that includes various information about the system generating the OID.

+
+

Composition

+
    +
  • 4 bytes : The UNIX timestamp in big-endian format.
  • +
  • 3 bytes : A hash of the hostname.
  • +
  • 2 bytes : The pid_t of the current process. Alternatively the task-id if configured.
  • +
  • 3 bytes : A 24-bit monotonic counter incrementing from rand() in big-endian.
  • +
+
+
+

Sorting ObjectIDs

+

The typical way to sort in C is using qsort(). Therefore, Libbson provides a qsort() compatible callback function named bson_oid_compare(). It returns less than 1, greater than 1, or 0 depending on the equality of two bson_oid_t structures.

+
+
+

Comparing Object IDs

+

If you simply want to compare two bson_oid_t structures for equality, use bson_oid_equal().

+
+
+

Generating

+

To generate a bson_oid_t, you may use the following.

+
bson_oid_t oid;
+
+bson_oid_init (&oid, NULL);
+
+
+
+
+

Parsing ObjectID Strings

+

You can also parse a string containing a bson_oid_t. The input string MUST be 24 characters or more in length.

+
bson_oid_t oid;
+
+bson_oid_init_from_string (&oid, "123456789012345678901234");
+
+
+

If you need to parse may bson_oid_t in a tight loop and can guarantee the data is safe, you might consider using the inline variant. It will be inlined into your code and reduce the need for a foreign function call.

+
bson_oid_t oid;
+
+bson_oid_init_from_string_unsafe (&oid, "123456789012345678901234");
+
+
+
+
+

Hashing ObjectIDs

+

If you need to store items in a hashtable, you may want to use the bson_oid_t as the key. Libbson provides a hash function for just this purpose. It is based on DJB hash.

+
unsigned hash;
+
+hash = bson_oid_hash (oid);
+
+
+
+
+

Fetching ObjectID Creation Time

+

You can easily fetch the time that a bson_oid_t was generated using bson_oid_get_time_t().

+
time_t t;
+
+t = bson_oid_get_time_t (oid);
+printf ("The OID was generated at %u\n", (unsigned) t);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/parsing.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/parsing.html new file mode 100644 index 0000000..7dd41ce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/parsing.html @@ -0,0 +1,192 @@ + + + + + + + + Parsing and Iterating BSON Documents — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Parsing and Iterating BSON Documents

+
+

Parsing

+

BSON documents are lazily parsed as necessary. To begin parsing a BSON document, use one of the provided Libbson functions to create a new bson_t from existing data such as bson_new_from_data(). This will make a copy of the data so that additional mutations may occur to the BSON document.

+
+

Tip

+

If you only want to parse a BSON document and have no need to mutate it, you may use bson_init_static() to avoid making a copy of the data.

+
+
bson_t *b;
+
+b = bson_new_from_data (my_data, my_data_len);
+if (!b) {
+   fprintf (stderr, "The specified length embedded in <my_data> did not match "
+                    "<my_data_len>\n");
+   return;
+}
+
+bson_destroy (b);
+
+
+

Only two checks are performed when creating a new bson_t from an existing buffer. First, the document must begin with the buffer length, matching what was expected by the caller. Second, the document must end with the expected trailing \0 byte.

+

To parse the document further we use a bson_iter_t to iterate the elements within the document. Let’s print all of the field names in the document.

+
bson_t *b;
+bson_iter_t iter;
+
+if ((b = bson_new_from_data (my_data, my_data_len))) {
+   if (bson_iter_init (&iter, b)) {
+      while (bson_iter_next (&iter)) {
+         printf ("Found element key: \"%s\"\n", bson_iter_key (&iter));
+      }
+   }
+   bson_destroy (b);
+}
+
+
+

Converting a document to JSON uses a bson_iter_t and bson_visitor_t to iterate all fields of a BSON document recursively and generate a UTF-8 encoded JSON string.

+
bson_t *b;
+char *json;
+
+if ((b = bson_new_from_data (my_data, my_data_len))) {
+   if ((json = bson_as_canonical_extended_json (b, NULL))) {
+      printf ("%s\n", json);
+      bson_free (json);
+   }
+   bson_destroy (b);
+}
+
+
+
+
+

Recursing into Sub-Documents

+

Libbson provides convenient sub-iterators to dive down into a sub-document or sub-array. Below is an example that will dive into a sub-document named “foo” and print it’s field names.

+
bson_iter_t iter;
+bson_iter_t child;
+char *json;
+
+if (bson_iter_init_find (&iter, doc, "foo") &&
+    BSON_ITER_HOLDS_DOCUMENT (&iter) && bson_iter_recurse (&iter, &child)) {
+   while (bson_iter_next (&child)) {
+      printf ("Found sub-key of \"foo\" named \"%s\"\n",
+              bson_iter_key (&child));
+   }
+}
+
+
+
+
+

Finding Fields using Dot Notation

+

Using the bson_iter_recurse() function exemplified above, bson_iter_find_descendant() can find a field for you using the MongoDB style path notation such as “foo.bar.0.baz”.

+

Let’s create a document like {"foo": {"bar": [{"baz: 1}]}} and locate the "baz" field.

+
bson_t *b;
+bson_iter_t iter;
+bson_iter_t baz;
+
+b =
+   BCON_NEW ("foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}");
+
+if (bson_iter_init (&iter, b) &&
+    bson_iter_find_descendant (&iter, "foo.bar.0.baz", &baz) &&
+    BSON_ITER_HOLDS_INT32 (&baz)) {
+   printf ("baz = %d\n", bson_iter_int32 (&baz));
+}
+
+bson_destroy (b);
+
+
+
+
+

Validating a BSON Document

+

If all you want to do is validate that a BSON document is valid, you can use bson_validate().

+
size_t err_offset;
+
+if (!bson_validate (doc, BSON_VALIDATE_NONE, &err_offset)) {
+   fprintf (stderr,
+            "The document failed to validate at offset: %u\n",
+            (unsigned) err_offset);
+}
+
+
+

See the bson_validate() documentation for more information and examples.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/search.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/search.html new file mode 100644 index 0000000..c26d673 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/search.html @@ -0,0 +1,106 @@ + + + + + + + + Search — libbson 1.13.1 + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/searchindex.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/searchindex.js new file mode 100644 index 0000000..815c86a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({docnames:["api","bson_append_array","bson_append_array_begin","bson_append_array_end","bson_append_binary","bson_append_bool","bson_append_code","bson_append_code_with_scope","bson_append_date_time","bson_append_dbpointer","bson_append_decimal128","bson_append_document","bson_append_document_begin","bson_append_document_end","bson_append_double","bson_append_int32","bson_append_int64","bson_append_iter","bson_append_maxkey","bson_append_minkey","bson_append_now_utc","bson_append_null","bson_append_oid","bson_append_regex","bson_append_regex_w_len","bson_append_symbol","bson_append_time_t","bson_append_timestamp","bson_append_timeval","bson_append_undefined","bson_append_utf8","bson_append_value","bson_array_as_json","bson_as_canonical_extended_json","bson_as_json","bson_as_relaxed_extended_json","bson_ascii_strtoll","bson_check_version","bson_compare","bson_concat","bson_context_destroy","bson_context_get_default","bson_context_new","bson_context_t","bson_copy","bson_copy_to","bson_copy_to_excluding","bson_copy_to_excluding_noinit","bson_count_keys","bson_decimal128_from_string","bson_decimal128_from_string_w_len","bson_decimal128_t","bson_decimal128_to_string","bson_destroy","bson_destroy_with_steal","bson_equal","bson_error_t","bson_free","bson_get_data","bson_get_major_version","bson_get_micro_version","bson_get_minor_version","bson_get_monotonic_time","bson_get_version","bson_has_field","bson_init","bson_init_from_json","bson_init_static","bson_iter_array","bson_iter_as_bool","bson_iter_as_double","bson_iter_as_int64","bson_iter_binary","bson_iter_bool","bson_iter_code","bson_iter_codewscope","bson_iter_date_time","bson_iter_dbpointer","bson_iter_decimal128","bson_iter_document","bson_iter_double","bson_iter_dup_utf8","bson_iter_find","bson_iter_find_case","bson_iter_find_descendant","bson_iter_find_w_len","bson_iter_init","bson_iter_init_find","bson_iter_init_find_case","bson_iter_init_find_w_len","bson_iter_init_from_data","bson_iter_init_from_data_at_offset","bson_iter_int32","bson_iter_int64","bson_iter_key","bson_iter_key_len","bson_iter_next","bson_iter_offset","bson_iter_oid","bson_iter_overwrite_bool","bson_iter_overwrite_date_time","bson_iter_overwrite_decimal128","bson_iter_overwrite_double","bson_iter_overwrite_int32","bson_iter_overwrite_int64","bson_iter_overwrite_oid","bson_iter_overwrite_timestamp","bson_iter_recurse","bson_iter_regex","bson_iter_symbol","bson_iter_t","bson_iter_time_t","bson_iter_timestamp","bson_iter_timeval","bson_iter_type","bson_iter_utf8","bson_iter_value","bson_iter_visit_all","bson_json_data_reader_ingest","bson_json_data_reader_new","bson_json_reader_destroy","bson_json_reader_new","bson_json_reader_new_from_fd","bson_json_reader_new_from_file","bson_json_reader_read","bson_json_reader_t","bson_malloc","bson_malloc0","bson_md5_append","bson_md5_finish","bson_md5_init","bson_md5_t","bson_mem_restore_vtable","bson_mem_set_vtable","bson_memory","bson_new","bson_new_from_buffer","bson_new_from_data","bson_new_from_json","bson_oid_compare","bson_oid_copy","bson_oid_equal","bson_oid_get_time_t","bson_oid_hash","bson_oid_init","bson_oid_init_from_data","bson_oid_init_from_string","bson_oid_init_sequence","bson_oid_is_valid","bson_oid_t","bson_oid_to_string","bson_reader_destroy","bson_reader_destroy_func_t","bson_reader_new_from_data","bson_reader_new_from_fd","bson_reader_new_from_file","bson_reader_new_from_handle","bson_reader_read","bson_reader_read_func_t","bson_reader_reset","bson_reader_set_destroy_func","bson_reader_set_read_func","bson_reader_t","bson_reader_tell","bson_realloc","bson_realloc_ctx","bson_realloc_func","bson_reinit","bson_reserve_buffer","bson_set_error","bson_sized_new","bson_snprintf","bson_steal","bson_strcasecmp","bson_strdup","bson_strdup_printf","bson_strdupv_printf","bson_strerror_r","bson_strfreev","bson_string_append","bson_string_append_c","bson_string_append_printf","bson_string_append_unichar","bson_string_free","bson_string_new","bson_string_t","bson_string_truncate","bson_strncpy","bson_strndup","bson_strnlen","bson_subtype_t","bson_t","bson_type_t","bson_uint32_to_string","bson_unichar_t","bson_utf8_escape_for_json","bson_utf8_from_unichar","bson_utf8_get_char","bson_utf8_next_char","bson_utf8_validate","bson_validate","bson_validate_with_error","bson_value_copy","bson_value_destroy","bson_value_t","bson_visitor_t","bson_vsnprintf","bson_writer_begin","bson_writer_destroy","bson_writer_end","bson_writer_get_length","bson_writer_new","bson_writer_rollback","bson_writer_t","bson_zero_free","character_and_string_routines","creating","cross-platform-notes","endianness","errors","full_index","guides","include-and-link","index","json","oid","parsing","streaming-bson","threading","tutorial","utf8","valgrind","version"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:55},filenames:["api.rst","bson_append_array.rst","bson_append_array_begin.rst","bson_append_array_end.rst","bson_append_binary.rst","bson_append_bool.rst","bson_append_code.rst","bson_append_code_with_scope.rst","bson_append_date_time.rst","bson_append_dbpointer.rst","bson_append_decimal128.rst","bson_append_document.rst","bson_append_document_begin.rst","bson_append_document_end.rst","bson_append_double.rst","bson_append_int32.rst","bson_append_int64.rst","bson_append_iter.rst","bson_append_maxkey.rst","bson_append_minkey.rst","bson_append_now_utc.rst","bson_append_null.rst","bson_append_oid.rst","bson_append_regex.rst","bson_append_regex_w_len.rst","bson_append_symbol.rst","bson_append_time_t.rst","bson_append_timestamp.rst","bson_append_timeval.rst","bson_append_undefined.rst","bson_append_utf8.rst","bson_append_value.rst","bson_array_as_json.rst","bson_as_canonical_extended_json.rst","bson_as_json.rst","bson_as_relaxed_extended_json.rst","bson_ascii_strtoll.rst","bson_check_version.rst","bson_compare.rst","bson_concat.rst","bson_context_destroy.rst","bson_context_get_default.rst","bson_context_new.rst","bson_context_t.rst","bson_copy.rst","bson_copy_to.rst","bson_copy_to_excluding.rst","bson_copy_to_excluding_noinit.rst","bson_count_keys.rst","bson_decimal128_from_string.rst","bson_decimal128_from_string_w_len.rst","bson_decimal128_t.rst","bson_decimal128_to_string.rst","bson_destroy.rst","bson_destroy_with_steal.rst","bson_equal.rst","bson_error_t.rst","bson_free.rst","bson_get_data.rst","bson_get_major_version.rst","bson_get_micro_version.rst","bson_get_minor_version.rst","bson_get_monotonic_time.rst","bson_get_version.rst","bson_has_field.rst","bson_init.rst","bson_init_from_json.rst","bson_init_static.rst","bson_iter_array.rst","bson_iter_as_bool.rst","bson_iter_as_double.rst","bson_iter_as_int64.rst","bson_iter_binary.rst","bson_iter_bool.rst","bson_iter_code.rst","bson_iter_codewscope.rst","bson_iter_date_time.rst","bson_iter_dbpointer.rst","bson_iter_decimal128.rst","bson_iter_document.rst","bson_iter_double.rst","bson_iter_dup_utf8.rst","bson_iter_find.rst","bson_iter_find_case.rst","bson_iter_find_descendant.rst","bson_iter_find_w_len.rst","bson_iter_init.rst","bson_iter_init_find.rst","bson_iter_init_find_case.rst","bson_iter_init_find_w_len.rst","bson_iter_init_from_data.rst","bson_iter_init_from_data_at_offset.rst","bson_iter_int32.rst","bson_iter_int64.rst","bson_iter_key.rst","bson_iter_key_len.rst","bson_iter_next.rst","bson_iter_offset.rst","bson_iter_oid.rst","bson_iter_overwrite_bool.rst","bson_iter_overwrite_date_time.rst","bson_iter_overwrite_decimal128.rst","bson_iter_overwrite_double.rst","bson_iter_overwrite_int32.rst","bson_iter_overwrite_int64.rst","bson_iter_overwrite_oid.rst","bson_iter_overwrite_timestamp.rst","bson_iter_recurse.rst","bson_iter_regex.rst","bson_iter_symbol.rst","bson_iter_t.rst","bson_iter_time_t.rst","bson_iter_timestamp.rst","bson_iter_timeval.rst","bson_iter_type.rst","bson_iter_utf8.rst","bson_iter_value.rst","bson_iter_visit_all.rst","bson_json_data_reader_ingest.rst","bson_json_data_reader_new.rst","bson_json_reader_destroy.rst","bson_json_reader_new.rst","bson_json_reader_new_from_fd.rst","bson_json_reader_new_from_file.rst","bson_json_reader_read.rst","bson_json_reader_t.rst","bson_malloc.rst","bson_malloc0.rst","bson_md5_append.rst","bson_md5_finish.rst","bson_md5_init.rst","bson_md5_t.rst","bson_mem_restore_vtable.rst","bson_mem_set_vtable.rst","bson_memory.rst","bson_new.rst","bson_new_from_buffer.rst","bson_new_from_data.rst","bson_new_from_json.rst","bson_oid_compare.rst","bson_oid_copy.rst","bson_oid_equal.rst","bson_oid_get_time_t.rst","bson_oid_hash.rst","bson_oid_init.rst","bson_oid_init_from_data.rst","bson_oid_init_from_string.rst","bson_oid_init_sequence.rst","bson_oid_is_valid.rst","bson_oid_t.rst","bson_oid_to_string.rst","bson_reader_destroy.rst","bson_reader_destroy_func_t.rst","bson_reader_new_from_data.rst","bson_reader_new_from_fd.rst","bson_reader_new_from_file.rst","bson_reader_new_from_handle.rst","bson_reader_read.rst","bson_reader_read_func_t.rst","bson_reader_reset.rst","bson_reader_set_destroy_func.rst","bson_reader_set_read_func.rst","bson_reader_t.rst","bson_reader_tell.rst","bson_realloc.rst","bson_realloc_ctx.rst","bson_realloc_func.rst","bson_reinit.rst","bson_reserve_buffer.rst","bson_set_error.rst","bson_sized_new.rst","bson_snprintf.rst","bson_steal.rst","bson_strcasecmp.rst","bson_strdup.rst","bson_strdup_printf.rst","bson_strdupv_printf.rst","bson_strerror_r.rst","bson_strfreev.rst","bson_string_append.rst","bson_string_append_c.rst","bson_string_append_printf.rst","bson_string_append_unichar.rst","bson_string_free.rst","bson_string_new.rst","bson_string_t.rst","bson_string_truncate.rst","bson_strncpy.rst","bson_strndup.rst","bson_strnlen.rst","bson_subtype_t.rst","bson_t.rst","bson_type_t.rst","bson_uint32_to_string.rst","bson_unichar_t.rst","bson_utf8_escape_for_json.rst","bson_utf8_from_unichar.rst","bson_utf8_get_char.rst","bson_utf8_next_char.rst","bson_utf8_validate.rst","bson_validate.rst","bson_validate_with_error.rst","bson_value_copy.rst","bson_value_destroy.rst","bson_value_t.rst","bson_visitor_t.rst","bson_vsnprintf.rst","bson_writer_begin.rst","bson_writer_destroy.rst","bson_writer_end.rst","bson_writer_get_length.rst","bson_writer_new.rst","bson_writer_rollback.rst","bson_writer_t.rst","bson_zero_free.rst","character_and_string_routines.rst","creating.rst","cross-platform-notes.rst","endianness.rst","errors.rst","full_index.rst","guides.rst","include-and-link.rst","index.rst","json.rst","oid.rst","parsing.rst","streaming-bson.rst","threading.rst","tutorial.rst","utf8.rst","valgrind.rst","version.rst"],objects:{},objnames:{},objtypes:{},terms:{"0x00":[114,190,192],"0x01":[114,190,192],"0x02":[114,190,192],"0x03":[114,190,192],"0x04":[114,190,192],"0x05":[114,190,192],"0x06":[114,192],"0x07":[114,192],"0x08":[114,192],"0x09":[114,192],"0x0a":[114,192],"0x0b":[114,192],"0x0c":[114,192],"0x0d":[114,192],"0x0e":[114,192],"0x0f":[114,192],"0x10":[114,192],"0x11":[114,192],"0x12":[114,192],"0x13":192,"0x7f":[114,192],"0x80":190,"0xff":[114,192],"23f":191,"48mb":212,"abstract":[51,62,131,134,149,185,191,194,213],"boolean":[5,69,73],"byte":[1,4,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,49,50,66,67,79,90,91,115,126,127,128,136,137,138,141,145,146,149,158,164,168,171,182,186,187,189,191,193,194,195,196,197,198,199,200,201,206,216,225,226,230,231],"case":[23,24,42,82,83,85,169,173,205],"catch":231,"char":[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,43,46,47,49,50,51,52,56,63,64,66,74,75,77,81,82,83,84,85,86,87,88,89,90,94,108,109,115,123,125,146,148,149,150,155,162,168,169,171,172,173,174,175,176,177,178,179,180,181,183,184,185,187,188,189,193,194,195,196,197,198,199,204,205,206,213,216,222,224,226,227],"const":[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,44,45,46,47,48,49,50,52,55,58,63,64,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,105,107,108,109,111,112,113,114,115,116,117,118,123,125,128,133,137,138,139,140,141,142,143,145,146,148,150,153,155,157,162,169,171,173,174,175,176,179,181,184,187,188,189,193,194,195,197,198,199,200,201,202,204,205,206,222,224,227],"default":[41,43,132,136,144,166,222],"enum":[43,114,125,190,192,201],"final":167,"function":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,38,39,40,41,44,45,46,47,48,53,54,55,57,58,65,66,67,68,71,72,73,74,75,76,78,79,81,82,84,85,86,87,88,89,90,92,93,96,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,114,115,117,126,127,128,129,130,132,133,135,136,137,138,139,152,153,154,156,157,158,161,164,165,166,167,168,169,170,172,175,176,184,193,198,202,211,214,216,219,222,224,225,226,227,230],"import":214,"int":[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,37,38,43,47,50,51,59,60,61,62,85,89,110,122,124,125,139,149,154,162,168,171,172,173,177,191,205,206,213,216,222,224,227],"long":168,"new":[4,5,6,8,10,14,15,16,21,22,23,24,25,27,29,31,42,44,46,47,66,77,99,101,102,119,121,122,123,128,129,130,133,134,135,136,137,138,144,147,153,154,155,164,168,170,174,184,186,188,191,195,207,211,216,224,226],"null":[4,6,7,17,32,33,34,35,36,40,43,46,47,50,53,54,72,74,108,109,120,123,136,137,138,144,149,151,155,156,157,162,165,166,168,169,172,174,178,179,183,184,185,187,191,195,199,201,203,208,213,216,219,222,224,225,226,227,230],"return":[43,51,72,112,113,125,149,162,185,205,213,219,222,224,225,226,227],"short":187,"static":[86,90,172,191,194,205,222,232],"true":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,37,39,49,50,55,64,66,67,69,73,78,82,83,84,85,86,90,91,96,107,117,141,148,154,157,168,172,183,185,199,200,201,205,207,216,230],"void":[40,41,43,45,46,47,52,53,57,59,60,61,62,63,65,68,72,77,79,86,90,99,100,102,103,104,105,106,112,113,117,118,120,121,126,127,128,129,130,132,133,135,136,140,144,145,146,147,150,151,152,156,158,159,160,161,162,164,165,166,167,168,169,172,178,179,180,181,182,186,187,191,194,196,202,203,205,208,209,211,212,213,214,232],"while":[110,112,115,125,157,162,205,224,226,227],Doing:[2,134],For:[2,43,82,85,172,191,212,213,220,221,223,230],HAS:[126,127,164],IDs:43,Its:201,NOT:[126,164,208,228],One:134,That:115,The:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,50,51,53,54,55,56,58,59,60,61,62,65,66,67,68,70,71,72,73,74,75,76,77,79,82,83,84,85,86,90,91,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,119,121,125,128,135,136,137,138,139,148,149,152,153,154,157,158,162,167,168,170,171,177,182,186,187,189,191,192,193,194,195,196,199,201,204,205,206,207,208,210,211,213,214,218,222,224,225,226,227,232],Then:91,There:224,These:216,Use:[12,168,184,191,193,205,220,221,222,223,230],Useful:168,Using:[220,223,226,229],With:231,_bson_context_t:43,_bson_json_reader_t:125,_bson_mem_vtable_t:133,_bson_reader_t:162,_bson_value_t:204,_bson_writer_t:213,_id:[86,90],_memcmp:38,_oid1_:139,_oid2_:139,_qsort:38,_realloc:211,abcd:131,abort:[125,126,127,134,164,205,210,212,224],about:[117,205,225],abov:226,accept:64,access:228,accomplish:91,accord:36,accumul:131,act:75,add:[12,216],add_execut:222,added:[185,216,224],adding:216,addit:[43,187,205,226,231],addition:[134,166],address:36,advanc:[82,83,84,85,86,90,96,198],after:[3,13,87,88,89,96,162,167,168,172,173,185,187,205,208,224,227],against:232,agre:[125,162,224],aid:134,algorithm:[128,129,130,131],all:[34,40,46,47,82,83,85,115,117,128,129,130,131,151,157,192,200,201,215,222,226,228,231],alloc:[32,33,34,35,40,42,44,53,56,81,110,119,121,122,123,126,127,132,133,134,135,136,137,138,153,154,155,156,164,165,166,168,170,174,175,176,184,185,188,191,195,208,211,213,231],allow:[2,7,30,43,99,100,101,102,103,104,105,106,116,134,156,160,199,201,206,216,224,230],allow_multipl:[119,121],allow_nul:199,also:[54,64,75,127,171,172,195,201,223,224,225,227],altern:[86,216,225],altogeth:218,alwai:[53,69,167,187,188,193,219,230],ambigu:224,among:222,ani:[70,110,125,162,167,168,203,208,224],anoth:[17,39,54,149,172],anyth:230,anywher:201,apach:[125,162,224],api:[128,129,130,131,185,213,220,223,227,230],appar:205,append:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,179,180,181,182,184,191,212,216],appli:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31],applic:[43,125,134,162,224],appropri:218,arbitrari:[121,156],arg:176,argc:[43,51,125,149,162,172,213,222,224,227],argument:[125,162,224],argv:[43,51,125,149,162,172,213,222,224,227],around:[58,116,171,177],arrai:[1,2,3,9,32,68,107,178,226],array_len:68,ascii:[1,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,49,50,83,179,180,195],assert:227,assign:36,associ:[40,151,203],assum:8,atom:228,attempt:191,avail:[215,222],avoid:[12,45,67,226],back:[149,224],backslash:195,bar:[32,34,191,226],base:[36,43,118,139,205,216,225,232],basi:[125,162,224],basic:201,baz:[191,216,226],bcon:216,bcon_:216,bcon_int32:[216,224,226],bcon_new:[216,222,224,226],bcon_utf8:[216,222],becaus:117,been:[115,126,127,134,164,191],befor:[78,86,90,92,93,98,115,168,172,173,195,205],begin:[2,12,133,159,198,207,226],behav:214,behavior:187,being:[132,133,210],below:[201,205,226],better:2,between:[31,110],big:[149,218,225],bigger:[126,127,164],binari:[4,72,190],binary_len:72,bind:[134,137],bit:[15,16,36,71,76,92,93,131,143,147,194,197,225],bitwis:[200,201],block:[131,154,232],bool:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,37,39,49,50,54,55,64,66,67,69,70,73,78,82,83,84,85,86,87,88,89,90,91,96,99,101,107,117,119,121,122,141,148,154,157,162,168,172,183,199,200,201,204,205,207,216,227],both:[55,84,107,173,195,218,219],boundari:210,box:[31,116,202,204],bptr:191,bson2:47,bson:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,43,44,47,48,51,53,54,55,56,58,62,64,66,75,77,86,87,88,89,90,96,97,99,100,101,102,103,104,105,106,109,110,114,117,119,122,124,125,131,134,136,137,148,149,162,168,172,185,190,191,192,193,200,201,204,205,207,213,218,220,221,223,229],bson_aligned_begin:191,bson_aligned_end:191,bson_append:136,bson_append_:216,bson_append_arrai:[0,191,220],bson_append_array_begin:[0,3,54,191,216,220],bson_append_array_end:[0,2,191,220],bson_append_binari:[0,190,191,220],bson_append_bool:[0,191,216,220],bson_append_cod:[0,7,191,220],bson_append_code_with_scop:[0,191,220],bson_append_date_tim:[0,20,27,191,220],bson_append_dbpoint:[0,191,220],bson_append_decimal128:[0,191,220],bson_append_docu:[0,191,220],bson_append_document_begin:[0,13,54,191,216,220],bson_append_document_end:[0,12,191,216,220],bson_append_doubl:[0,191,220],bson_append_int32:[0,47,191,213,216,220,227],bson_append_int64:[0,191,220],bson_append_it:[0,191,220],bson_append_maxkei:[0,191,220],bson_append_minkei:[0,191,220],bson_append_now_utc:[0,191,220],bson_append_nul:[0,191,220],bson_append_oid:[0,191,220],bson_append_regex:[0,191,220],bson_append_regex_w_len:[0,191,220],bson_append_symbol:[0,191,220],bson_append_time_t:[0,191,220],bson_append_timestamp:[0,191,220],bson_append_timev:[0,191,220],bson_append_undefin:[0,191,220],bson_append_utf8:[0,32,34,172,191,216,220],bson_append_valu:[0,191,220],bson_array_as_json:[0,33,34,35,191,220],bson_as_canonical_extended_json:[0,32,34,35,162,168,191,216,220,222,224,226,227],bson_as_json:[0,32,33,35,47,191,220],bson_as_relaxed_extended_json:[0,32,33,34,191,220,224],bson_ascii_strtol:[0,215,220],bson_assert:191,bson_big_endian:51,bson_byte_ord:51,bson_check_vers:[0,220,232],bson_clear:191,bson_compar:[0,191,220],bson_concat:[0,65,66,67,135,136,137,138,167,168,170,191,220],bson_context_destroi:[0,42,43,220],bson_context_disable_host_cach:43,bson_context_disable_pid_cach:43,bson_context_flags_t:[42,43],bson_context_get_default:[0,42,43,220],bson_context_new:[0,40,43,220],bson_context_non:43,bson_context_t:[0,40,41,42,144,147,220,223],bson_context_thread_saf:43,bson_context_use_task_id:43,bson_copi:[0,191,220],bson_copy_to:[0,191,220],bson_copy_to_exclud:[0,47,191,220],bson_copy_to_excluding_noinit:[0,46,191,220],bson_count_kei:[0,191,220],bson_decimal128_from_str:[0,51,220],bson_decimal128_from_string_w_len:[0,51,220],bson_decimal128_inf:51,bson_decimal128_nan:51,bson_decimal128_str:[51,52],bson_decimal128_t:[0,10,49,50,52,78,101,205,220,223],bson_decimal128_to_str:[0,51,220],bson_definit:222,bson_destroi:[0,32,34,44,47,54,66,125,135,167,168,170,172,191,216,220,222,224,226,231],bson_destroy_with_st:[0,172,191,220],bson_empti:191,bson_empty0:191,bson_equ:[0,191,220],bson_error_invalid:201,bson_error_json:219,bson_error_read:219,bson_error_reader_badfd:219,bson_error_t:[0,66,123,124,125,138,155,162,169,201,219,220,223,224,227],bson_fre:[0,32,33,34,35,47,54,81,134,162,168,172,174,175,176,188,195,213,214,216,220,222,224,226,227],bson_get_data:[0,91,125,191,220,224],bson_get_major_vers:[0,220,232],bson_get_micro_vers:[0,220,232],bson_get_minor_vers:[0,220,232],bson_get_monotonic_tim:62,bson_get_vers:[0,220,232],bson_gettimeofdai:62,bson_gnuc_const:43,bson_gnuc_deprec:[128,129,130],bson_gnuc_deprecated_for:46,bson_gnuc_null_termin:[46,47],bson_gnuc_printf:[169,171,175,176,181,206],bson_has_field:[0,191,220],bson_have_syscall_tid:43,bson_include_dir:222,bson_init:[0,32,34,39,46,47,66,67,135,136,137,138,167,168,170,191,216,220],bson_init_from_json:[0,39,65,67,124,135,136,137,138,167,168,170,191,220,224],bson_init_stat:[0,39,65,66,75,135,136,137,138,167,168,170,191,220,226],bson_initi:[65,125,168,172,190,216,224],bson_iter_arrai:[0,110,220],bson_iter_as_bool:[0,110,220],bson_iter_as_doubl:[0,110,220],bson_iter_as_int64:[0,110,220],bson_iter_binari:[0,110,220],bson_iter_bool:[0,110,220],bson_iter_cod:[0,75,110,220],bson_iter_codewscop:[0,110,220],bson_iter_date_tim:[0,110,112,220],bson_iter_dbpoint:[0,110,220],bson_iter_decimal128:[0,110,220],bson_iter_docu:[0,110,220],bson_iter_doubl:[0,110,220],bson_iter_dup_utf8:[0,110,220],bson_iter_find:[0,86,87,90,110,220],bson_iter_find_cas:[0,82,85,86,88,90,110,220],bson_iter_find_descend:[0,110,220,226],bson_iter_find_w_len:[0,89,110,220],bson_iter_holds_arrai:[68,110],bson_iter_holds_binari:[72,110],bson_iter_holds_bool:[73,110],bson_iter_holds_cod:[74,110],bson_iter_holds_codewscop:[75,110],bson_iter_holds_date_tim:[76,110],bson_iter_holds_dbpoint:110,bson_iter_holds_decimal128:[78,110],bson_iter_holds_docu:[79,110,226],bson_iter_holds_doubl:[80,110],bson_iter_holds_int32:[92,110,226],bson_iter_holds_int64:[93,110],bson_iter_holds_int:110,bson_iter_holds_maxkei:110,bson_iter_holds_minkei:110,bson_iter_holds_nul:110,bson_iter_holds_numb:110,bson_iter_holds_oid:[86,90,98,110],bson_iter_holds_regex:110,bson_iter_holds_symbol:110,bson_iter_holds_timestamp:[110,112],bson_iter_holds_undefin:110,bson_iter_holds_utf8:[110,115],bson_iter_init:[0,87,88,89,90,110,205,220,226],bson_iter_init_find:[0,86,88,89,90,110,192,220,226],bson_iter_init_find_cas:[0,86,87,89,90,110,220],bson_iter_init_find_w_len:[0,86,87,88,90,110,220],bson_iter_init_from_data:[0,86,87,88,89,110,220],bson_iter_init_from_data_at_offset:[0,97,110,220],bson_iter_int32:[0,110,220,226],bson_iter_int64:[0,110,220],bson_iter_is_kei:110,bson_iter_kei:[0,17,95,110,220,226],bson_iter_key_len:[0,91,94,110,220],bson_iter_next:[0,86,90,110,220,226],bson_iter_offset:[0,91,110,220],bson_iter_oid:[0,86,90,110,220],bson_iter_overwrite_bool:[0,110,220],bson_iter_overwrite_date_tim:[0,110,220],bson_iter_overwrite_decimal128:[0,110,220],bson_iter_overwrite_doubl:[0,110,220],bson_iter_overwrite_int32:[0,110,220],bson_iter_overwrite_int64:[0,110,220],bson_iter_overwrite_oid:[0,110,220],bson_iter_overwrite_timestamp:[0,110,220],bson_iter_recurs:[0,110,220,226],bson_iter_regex:[0,110,220],bson_iter_symbol:[0,110,220],bson_iter_t:[0,17,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,114,115,116,117,192,205,220,223,226],bson_iter_time_t:[0,110,220],bson_iter_timestamp:[0,110,220],bson_iter_timev:[0,110,220],bson_iter_typ:[0,68,72,73,74,75,76,78,79,80,92,93,98,110,112,115,192,220],bson_iter_utf8:[0,81,110,220],bson_iter_valu:[0,110,204,220],bson_iter_visit_al:[0,110,205,220],bson_json_data_reader_ingest:[0,125,220],bson_json_data_reader_new:[0,125,220],bson_json_destroy_cb:121,bson_json_error_code_t:125,bson_json_error_read_cb_failur:[125,219],bson_json_error_read_corrupt_j:[125,219],bson_json_error_read_invalid_param:[125,219],bson_json_reader_cb:121,bson_json_reader_destroi:[0,119,121,122,125,220,224],bson_json_reader_new:[0,125,220],bson_json_reader_new_from_fd:[0,125,220,224],bson_json_reader_new_from_fil:[0,125,219,220,224],bson_json_reader_read:[0,66,125,138,220,224],bson_json_reader_t:[0,118,119,120,121,122,123,124,219,220,223,224],bson_librari:222,bson_little_endian:51,bson_major_vers:[59,232],bson_malloc0:[0,134,220],bson_malloc:[0,134,172,220],bson_max_s:191,bson_md5_append:[0,131,220],bson_md5_finish:[0,131,220],bson_md5_init:[0,131,220],bson_md5_t:[0,128,129,130,220,223],bson_mem_restore_vt:[0,134,220],bson_mem_set_vt:[0,134,220],bson_mem_vtable_t:133,bson_memcheck:231,bson_micro_vers:[60,232],bson_minor_vers:[61,232],bson_new:[0,39,65,66,67,136,137,138,167,168,170,191,220],bson_new_from_buff:[0,39,65,66,67,135,137,138,167,168,170,191,220],bson_new_from_data:[0,39,65,66,67,135,136,138,167,168,170,191,220,226],bson_new_from_json:[0,39,65,66,67,124,135,136,137,167,168,170,191,220,224],bson_oid_compar:[0,149,220,225],bson_oid_copi:[0,149,220],bson_oid_equ:[0,149,220,225],bson_oid_get_time_t:[0,149,220,225],bson_oid_hash:[0,149,220,225],bson_oid_init:[0,43,149,220,225],bson_oid_init_from_data:[0,149,220],bson_oid_init_from_str:[0,149,220,225],bson_oid_init_from_string_unsaf:225,bson_oid_init_sequ:[0,149,220],bson_oid_is_valid:[0,149,220],bson_oid_t:[0,9,22,43,77,86,90,98,105,139,140,141,142,143,144,145,146,147,150,204,205,220,223,225],bson_oid_to_str:[0,86,90,149,220],bson_reader_destroi:[0,152,154,162,220,224,227],bson_reader_destroy_func_t:[0,156,160,162,220],bson_reader_new_from_data:[0,159,162,220,227],bson_reader_new_from_fd:[0,162,220,224,227],bson_reader_new_from_fil:[0,56,162,220,224,227],bson_reader_new_from_handl:[0,152,162,220],bson_reader_read:[0,162,220,224,227],bson_reader_read_func_t:[0,156,161,162,220],bson_reader_reset:[0,162,220],bson_reader_set_destroy_func:[0,162,220],bson_reader_set_read_func:[0,162,220],bson_reader_t:[0,56,151,152,153,154,155,156,157,158,159,160,161,163,220,223,224,227],bson_reader_tel:[0,162,220,227],bson_realloc:[0,134,165,220],bson_realloc_ctx:[0,134,166,213,220,227],bson_realloc_func:[0,134,136,211,213,220],bson_reinit:[0,39,65,66,67,125,135,136,137,138,168,170,191,220,224],bson_reserve_buff:[0,39,65,66,67,135,136,137,138,167,170,191,220],bson_set_error:[0,56,220],bson_sized_new:[0,39,65,66,67,135,136,137,138,167,168,191,220],bson_snprintf:[0,206,215,220],bson_static_definit:222,bson_static_include_dir:222,bson_static_librari:222,bson_static_vers:222,bson_steal:[0,54,191,220],bson_strcasecmp:[0,215,220],bson_strdup:[0,215,220],bson_strdup_printf:[0,176,215,220],bson_strdupv_printf:[0,215,220],bson_strerror_r:[0,56,220],bson_strfreev:[0,215,220],bson_string_append:[0,181,184,185,220],bson_string_append_c:[0,185,220],bson_string_append_printf:[0,185,220],bson_string_append_unichar:[0,185,220],bson_string_fre:[0,184,185,220],bson_string_new:[0,185,220],bson_string_t:[0,179,180,181,182,183,184,186,220,223],bson_string_trunc:[0,185,220],bson_strncpi:[0,215,220],bson_strndup:[0,81,215,220],bson_strnlen:[0,215,220],bson_subtype_binari:190,bson_subtype_binary_deprec:190,bson_subtype_funct:190,bson_subtype_md5:190,bson_subtype_t:[0,4,72,204,205,220,223],bson_subtype_us:190,bson_subtype_uuid:190,bson_subtype_uuid_deprec:190,bson_t:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,39,44,45,46,47,48,53,54,55,58,64,65,66,67,72,75,86,87,88,89,91,110,115,124,125,135,136,137,138,157,162,167,168,170,172,190,200,201,205,207,212,213,220,222,223,224,226,227,231],bson_type_arrai:[68,107,114,192],bson_type_binari:[72,114,192],bson_type_bool:[69,70,71,73,99,103,114,192],bson_type_cod:[74,114,192],bson_type_codewscop:[75,114,192],bson_type_date_tim:[20,76,100,111,113,114,192],bson_type_dbpoint:[77,114,192],bson_type_decimal128:[78,101,192],bson_type_docu:[79,107,114,192],bson_type_doubl:[69,70,71,80,102,114,192],bson_type_eod:[114,192],bson_type_int32:[69,70,71,92,103,114,192,204],bson_type_int64:[69,70,71,93,104,114,192],bson_type_maxkei:[18,114,192],bson_type_minkei:[19,114,192],bson_type_nul:[21,69,114,192],bson_type_oid:[22,98,105,114,192],bson_type_regex:[23,24,108,114,192],bson_type_symbol:[25,109,114,192],bson_type_t:[0,114,204,220,223],bson_type_timestamp:[27,106,112,114,192],bson_type_undefin:[29,69,114,192],bson_type_utf8:[69,114,115,192],bson_uint32_to_str:[0,2,215,220],bson_unichar_t:[0,182,196,197,220,223],bson_utf8_escape_for_json:[0,215,220],bson_utf8_from_unichar:[0,215,220],bson_utf8_get_char:[0,194,215,220],bson_utf8_next_char:[0,194,215,220],bson_utf8_valid:[0,115,215,220,230],bson_valid:[0,191,201,220,226],bson_validate_dollar_kei:201,bson_validate_dot_kei:201,bson_validate_empty_kei:201,bson_validate_flags_t:[200,201],bson_validate_non:[201,226],bson_validate_utf8:201,bson_validate_utf8_allow_nul:201,bson_validate_with_error:[0,191,200,220],bson_value_copi:[0,204,220],bson_value_destroi:[0,202,204,220],bson_value_t:[0,31,116,202,203,220,223],bson_vers:222,bson_version_:232,bson_version_hex:232,bson_visitor_t:[0,117,220,223,226],bson_vsnprintf:[0,215,220],bson_wrapper_destroi:172,bson_wrapper_t:172,bson_writer_begin:[0,54,213,220,227],bson_writer_destroi:[0,211,213,220],bson_writer_end:[0,207,213,220,227],bson_writer_get_length:[0,213,220],bson_writer_new:[0,208,213,220,227],bson_writer_rollback:[0,207,210,213,220],bson_writer_t:[0,207,208,209,210,211,212,220,223,227],bson_zero_fre:[0,134,220],bsonspec:[109,190],buf:[131,136,158,177,211,213,227],buf_len:136,buf_siz:121,buffer:[2,4,54,58,67,68,72,75,79,90,91,119,121,131,136,137,145,153,157,158,159,167,168,170,171,184,187,191,193,207,208,209,210,211,213,216,226,227,231],buflen:[177,211,213,227],build:[2,185,213,216,223,227],builder:[180,184],built:228,bulk:[125,213],c11:187,cach:43,call:[2,3,12,13,20,32,33,34,35,40,43,46,47,53,54,72,73,74,78,81,86,90,92,93,95,98,99,100,101,102,103,104,105,106,107,108,112,115,122,132,133,136,152,154,158,167,168,172,185,191,198,205,207,216,225,231],callback:[117,152,158,160,162,205,219,225],caller:[1,2,32,33,34,35,56,86,90,115,207,208,211,226],calloc:[127,133],can:[38,43,58,67,68,72,73,75,79,91,110,115,121,125,149,156,162,185,191,192,194,200,201,205,213,214,216,222,225,226,227,230,231,232],cannot:[43,210],canon:[33,224],cast:[70,71],caus:[30,231],caveat:134,certain:[167,232],cflag:222,chang:[110,134],charact:[0,23,24,36,182,187,194,195,196,197,198,220,223,225],check:[37,64,72,73,141,148,157,189,191,201,210,219,220,221,223,226,232],child:[2,3,11,12,13,107,191,216,226],chunk:[158,185],clean:[172,211],cleanup:[162,208,224],clock:[0,220,223],close:[122,154,162,224],close_fd:154,close_on_destroi:[122,154,162],closer:216,cmake:231,cmakelist:222,code:[7,25,29,46,47,56,75,77,128,129,130,143,169,201,204,205,219,225,231],code_len:204,coll:[9,191],collect:[9,77,204],collection_len:[77,204],come:162,command:[125,162,222,224],common:[29,224],commonli:115,commun:[27,30,112],compar:38,comparison:139,compat:[223,225],compil:[59,60,61,218,232],complet:[3,12,13,129,207,209],complianc:[125,162,224],comput:95,condit:[125,162,224],configur:[43,225,231],conjunct:[38,58],consid:[82,84,85,107,110,225],constant:[91,94,95,97,193],construct:149,consum:[165,166,216],contain:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,49,50,54,64,66,75,76,82,83,85,90,99,108,110,111,113,118,121,125,126,134,136,138,141,142,145,146,148,149,162,164,165,166,167,190,191,192,193,194,199,201,204,224,225,230,231],content:[39,44,45,54,71,74,77,80,99,100,101,102,103,104,105,106,108,109,110,112,115,137,140,168,172,199,200,201,202,210],context:[40,43,144,147,165],continu:[32,125,162,224],control:43,conveni:[117,215,224,226,227],convers:[36,125,205],convert:[36,52,119,122,125,149,150,162,193,195,196,197,218,223,226],copi:[31,44,45,46,47,58,67,125,137,140,153,162,168,174,184,187,188,202,224,226],copyright:[125,162,224],core:216,correct:168,correctli:134,corrupt:[117,201,205,227],could:[30,91,148,168,205,216,219,227],couldn:168,count:[48,131,158,205],count_field:205,counter:[149,225],creat:[42,91,119,121,122,123,135,136,137,152,153,154,155,159,170,184,211,220,223,224,226,229],create_on_heap:191,creation:216,cross:[62,220,223],ctx:[43,136,165,166],current:[17,20,69,70,71,83,91,94,95,97,107,108,115,116,163,186,197,198,210,212,225],custom:[134,161,162,166],dangl:67,data:[4,51,66,67,72,90,91,97,117,118,121,124,128,136,137,138,145,153,156,158,161,162,172,190,191,193,204,205,214,220,221,223,225,226,228],data_len:[190,204],date:[8,20,100,112],dbpointer:9,dbref:201,dbson_memcheck:231,dcb:121,dcmake_c_flag:231,deal:134,debug:224,dec:[49,50,52,78],decim:10,decimal128:[49,50,51,101],decimal128_str:52,decimal128t:52,defin:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,21,22,23,25,26,27,28,29,30,31,51,68,72,73,74,75,76,78,79,80,92,93,98,110,112,115,121,125,149,191,232],demand:213,demonstr:205,denot:155,depend:[23,24,225,231],deprec:[9,25,29,77,109,205],derefer:218,dereferenc:218,descend:[84,205],describ:219,descriptor:[122,154,157,158,159,162,224,227],design:134,desir:[200,201],destin:[171,187,213,216],destroi:[54,122,151,152,154,160,172,231],detail:[200,201],detect:[17,39,43,157,200,212,231],determin:[1,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,66,69,83,138,192,204,216,219],dev:63,dictat:218,dictionari:213,did:226,differ:[27,62,216],digest:[129,131],digit:36,dilig:134,direct:149,directli:[168,213],disabl:43,discard:110,disk:214,distribut:[125,162,224,230],dive:226,djb:225,do_someth:232,doc:[33,35,86,125,157,190,191,192,205,213,216,224,226,227],document:[7,8,9,11,12,13,14,17,18,19,31,32,38,39,44,54,55,58,75,79,86,90,96,99,100,101,102,103,104,105,106,107,110,114,117,119,124,125,136,137,157,162,168,170,191,200,201,205,207,210,213,219,220,223,224,229],document_len:79,doe:[40,47,53,56,120,151,187,203,208],doing:169,domain:[56,169,201,219],done:[2,53,99,100,101,102,103,104,105,106,115],dot:84,dotal:[23,24],dotkei:[64,84],doubl:[14,70,80,102,204,205],down:226,driver:[34,115,223],dst:[39,45,46,47,140,172,187,202],due:117,dump:56,dure:[219,231],dynam:[191,213,222],each:[125,162,178,193,224],easier:134,easili:[191,225],effect:201,effici:[54,172],einval:36,either:[73,117,125,144,162,193,205,207,224],element:[2,4,5,6,7,8,10,12,14,15,16,17,18,19,20,21,22,27,29,32,48,64,68,71,72,73,75,76,77,79,82,83,85,86,90,92,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,117,226],elif:51,elimin:168,els:[86,90,125,162,205,224,230],emb:4,embed:[30,107,179,199,201,226],empti:[136,191,216],enabl:232,encapsul:[56,131,204,216],encod:[6,7,30,32,33,34,35,49,50,66,74,75,81,115,123,137,138,146,148,149,150,155,179,182,185,191,195,197,198,216,218,226],encount:[36,96],end:[132,157,158,186,191,226,230],endian:[149,217,220,223,225],endif:[43,51,232],endptr:36,enforc:171,enough:224,ensur:1,entir:[36,187],entri:[117,205],enumer:[190,192],environ:231,eof:[168,227],epoch:[8,26,28,76,100,111,113,142,149],equal:[37,38,55,141,149,186,225],equat:69,equival:[54,65,167,173],erang:36,err_cod:177,err_offset:[205,226],errno:[36,177],error:[54,56,72,73,96,99,100,101,102,103,104,105,106,110,125,157,162,169,172,200,201,205,220,223,224,227,229],escap:195,essenti:191,etc:193,even:187,everi:[133,231],everyth:[23,24],exact:[49,50],exampl:[117,136,172,201,212,216,226],except:[7,32,46,47,75,81,125,162,165,176,195,214,224],exclud:[30,46,47,66,138,186,206],execut:160,exemplifi:226,exhaust:[82,83,84,85,191],exist:[66,138,216,226],exit:[125,205,224],expand:136,expect:[125,137,162,211,218,224,226,230],express:[125,162,224],extend:[33,34,35,66,125,219,224],extern:[30,110],extrem:134,fail:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,67,125,157,162,201,224,226,227,230,231],failur:[32,33,34,35,107,126,127,132,133,157,158,163,164,219],fallback:228,fals:[5,17,39,49,50,54,64,66,67,73,78,82,84,85,96,107,117,125,141,157,162,168,172,185,200,201,205,224,230],fashion:121,faster:95,fclose:168,featur:232,feed:[118,128],fetch:[69,70,77,78,80,92,93,94,95,97,98,116,142,210],few:216,fidel:224,field:[1,2,3,5,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,46,47,64,69,70,72,74,77,78,80,83,91,92,93,110,115,117,133,190,191,192,205,216],file:[122,123,125,154,155,156,157,158,159,162,168,219,222,224,227],filedescriptor:227,filenam:[123,125,155,162,224],fill:[168,187,201,219],find:222,find_error_loc:205,find_packag:222,finish:211,first:[36,46,47,59,86,90,131,168,214,216,226],first_exclud:[46,47],fit:187,flag:[42,43,191,200,201,231],fold:[82,83,85],follow:[69,70,84,216,224,225,230,232],foo:[32,34,191,192,216,226],fopen:168,foreign:225,forget:231,fork:43,form:[7,147],format:[1,8,32,33,34,35,49,50,63,66,125,169,171,175,176,181,193,205,206,216,218,223,224,225,230],forth:1,forward:227,found:[64,66,82,83,84,85,110,123,138,189,195,205,222,226,227],four:222,fprintf:[56,125,157,162,168,224,226,227],fragment:7,fread:168,free:[32,33,34,35,53,54,56,57,63,120,133,178,183,191],free_seg:183,freed:[42,44,54,58,66,72,74,75,81,94,98,108,115,116,119,121,122,132,133,135,154,157,164,167,168,170,172,174,175,176,184,188,195,202,208],from:[36,46,47,68,69,78,79,91,92,93,121,122,124,154,156,157,158,159,161,162,168,187,188,192,193,198,202,208,213,218,223,224,225,226,228],fseek:168,ftell:168,func:[160,161],further:[157,205,226],futur:[134,205],fwrite:[125,224],gcc:222,gener:[2,43,47,126,127,137,142,143,144,147,164,193,219,226,228],get:[20,59,60,61,168],gettimeofdai:62,give:201,given:[36,210],goe:216,good:170,govern:[125,162,224],greater:[37,38,139,158,225],grow:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,168,227],growth:184,guarante:225,guid:[220,223],had:205,hand:216,handl:[56,62,152,156,158,159,162,169,220,223,229],has:[43,67,96,115,134,191,193,212,230],hash:143,hashtabl:[143,149,225],have:[40,170,172,201,216,224,226],header:[222,227],heap:[135,137,170,191,216,231],hello:[216,222],hello_bson:222,help:[134,137,224],helper:[20,26,28,169,230],hex:[146,148,149,150],high:[51,213],higher:[54,134,172,205,227],host:[155,218],hostnam:225,how:[43,69,117,200,201,205],howev:[29,110,134,167],http:[109,125,162,190,224],idea:170,ident:[87,88,89,165,216],identifi:[9,149,225],ieee:51,ifdef:43,ignor:[36,218],immut:[68,72,75],implement:[30,62,131,134,160,166,218,228],impli:[125,162,224],inc:[27,125,162,191,224],includ:[23,24,27,32,34,43,47,51,56,71,110,125,149,162,168,178,185,190,191,192,204,205,210,213,216,224,225,227],incom:[125,162,224],increment:[2,27,62,106,112,204,225],indic:[4,54,85,89,183,191,199,201,216,230],infer:36,infin:51,inform:[8,56,117,190,205,224,225,226,227,230],initi:[3,12,13,45,49,50,54,65,66,67,84,86,87,88,89,90,91,107,130,136,138,145,146,167,168,172,205,210,216,227],inlin:[191,225],input:[195,224,225],insensit:[23,24],inspect:[200,201,227],instal:[133,222],instanc:[130,211],instead:[26,28,54,205,218,222],int32:192,int32_max:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,168],int32_t:[15,92,103,204,205],int64_t:[8,16,36,62,71,76,93,100,104,204,205],int8_t:204,integ:[15,16,32,36,48,71,76,85,89,92,93,95,97,173],integr:134,interact:9,interchang:224,interest:134,interfac:[224,228],intern:[20,38,67,121,168,177,191,219,231],intra:[27,112],intrins:218,invalid:[3,13,17,36,39,66,67,74,82,84,85,96,107,108,112,115,168,172,198,201,219,230],issu:30,item:[216,225],iter:[17,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,192,194,204,205,220,223,227,229],its:[36,167,168,182,231],itself:[178,183],javascript:[6,7,29,75],json:[32,33,34,35,66,118,119,122,124,125,138,162,168,195,216,219,220,221,223,226],just:[225,227],kei:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,46,47,64,82,83,84,85,87,88,89,91,94,95,110,172,191,200,201,205,216,225,226],key_length:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],keylen:[85,89,91],kind:[125,162,224],know:[31,69,116,230],known:231,languag:[125,134,137,162,205,213,224,227],larg:168,larger:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31],last:96,later:[91,136],law:[125,162,224],layer:223,layout:91,lazili:226,lead:36,leak:[12,45,220,221,223],least:[126,127,164,168,187,231],left:187,legaci:[9,32,34],len:[4,50,58,66,91,118,125,138,185,186,191,196,204,224],length:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,50,52,54,66,67,68,72,74,75,77,79,81,85,89,90,91,94,95,109,115,118,128,131,136,137,138,148,153,162,168,186,189,191,195,199,201,210,211,216,225,226,230],less:[38,139,216,225],let:[216,226],level:[54,134,172,205,213,227],lexicograph:[139,173],lib:222,libbson:[0,32,34,37,59,60,61,62,63,128,129,130,131,132,133,134,166,205,216,218,219,220,224,225,226,228,229,230],libc:[30,158],librari:[62,166,193,222,223,228,232],licens:[125,162,224],lifetim:[67,110,153],lightweight:134,like:[7,63,84,158,176,181,185,191,193,205,206,214,226,228],limit:[125,162,212,224],line:[125,162,222,224],link:222,list:[46,47],liter:216,littl:218,live:216,llong_max:36,llong_min:36,load:75,local:[23,24,43,83],locat:[17,32,33,34,35,52,54,66,68,72,74,75,77,78,79,81,83,87,88,89,115,117,129,138,150,177,193,196,200,205,206,226],logic:216,longer:[40,54,135,184,202],look:[115,216],loop:225,low:51,lower:[172,173],lsw:131,machin:149,macro:[68,72,79,216],made:67,mai:[8,66,99,100,101,102,103,104,105,106,110,125,134,137,138,162,167,190,198,205,207,213,224,225,226,230,232],main:[32,34,43,47,51,125,149,162,168,172,213,222,224,227],major:[37,59,60,61,232],make:[23,24,134,215,216,226],malloc:[126,127,133,167,231],manag:[0,191,212,216,220,223,227],mani:[30,213,218,219],manipul:215,manner:225,marshal:115,match:[23,24,83,187,195,226],maximum:[17,39,189,191],maxlen:189,md5:[128,129,130,131],mean:[50,187,218],meant:[110,158],meet:37,mem:[57,133,164,165,166,214],memcpi:218,memori:[0,12,45,57,118,126,127,128,132,133,156,162,164,165,166,168,208,210,212,213,214,216,220,223,227],messag:[56,125,131,162,201,212,219,222,224],method:208,micro:[37,59,60,61,232],microsecond:[62,113],middl:61,might:[185,224,225,231],millisecond:[8,26,28,76,100],minimum:[37,222],minor:[37,59,60,61,232],miss:[86,90],mlock:214,mode:[23,24,154],modifi:[30,58,63,72,74,75,94,98,108,110,115,116,157,200,201],mongoc_test_valgrind:231,mongodb:[18,19,27,33,34,35,66,84,125,147,162,212,219,223,224,225,226],mongodbextend:219,monoton:[62,193,225],more:[128,161,190,201,213,225,226,227,230],most:42,move:172,msec_since_epoch:205,multi:[115,182,194,196,197,225],multipl:[23,24,198],must:[2,4,6,12,22,30,36,45,63,66,67,68,79,86,90,91,110,132,133,153,154,168,172,186,187,202,207,225,226,230],mutabl:191,mutat:[99,100,101,102,103,104,105,106,226,228],my_bson_doc:110,my_data:226,my_data_len:226,my_doc:110,my_field:110,my_state_t:205,my_str:230,my_string_len:230,my_visit_befor:205,my_visit_corrupt:205,my_visit_unsupported_typ:205,mycollect:227,mysubdoc:110,n_byte:188,n_member:133,name:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,46,47,64,77,82,83,85,110,123,219,225,226],nan:[49,50,51],nativ:[223,228],nbyte:128,necessari:[216,226,231],need:[42,47,185,205,216,225,226,230],neg:[8,173],network:[213,227],newer:232,newli:[32,33,34,35,42,44,81,119,121,122,123,135,136,137,138,153,154,155,156,170,174,175,176,184,188,195,211],next:[96,124,157,158,198],non:[32,33,34,35,54,69,74,109,133,195],normal:[32,205],notat:[64,84,149],note:[115,208,214,220,223],noth:[40,53,120,151,169,187,203,208],notic:[216,230],now:[82,84,85,134,172,216],nul:[191,195],num_byt:[126,127,133,164,165,166],number:[30,36,48,59,60,61,76,111,113,126,158,171,187,193,194,196,206,215,216],numberint:224,numer:224,nuse:[162,224],object:[43,66,138,149],objectid:[43,147,148,149,220,223,228,229],observ:[83,94,95,97,99,100,101,102,103,104,105,106,107,108,112,114,115,116],obtain:[91,125,162,224],occur:[43,172,186,200,201,226],off:205,off_t:163,offset:[91,97,163,198,200,205,210,211,213,226],often:[125,224],oid1:[139,141],oid2:[139,141],oid:[9,22,43,77,86,90,105,142,143,144,145,146,147,149,150,191,204,225],oidstr:[86,90],older:205,omit:216,one:[54,136,159,166,201,222,226,228,231],onli:[9,27,62,66,67,72,99,100,101,102,103,104,105,106,107,138,147,159,160,226,231,232],oom:134,opaqu:[152,158],open:[122,125,162,219,224,227],oper:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,125,158,168,228],opt:[23,191],optim:[193,218],option:[7,17,23,24,32,33,34,35,66,75,81,108,115,117,136,138,144,147,152,183,201,204,205],org:[109,125,162,190,224],other:[34,38,55,70,73,115,156,168,195,214,219],otherwis:[7,49,50,53,64,66,67,78,107,123,137,138,141,155,156,163,183,200,201],our:[162,224],out:[36,56,78,134,136,201,207,219],outermost:32,outsid:201,over:47,overflow:[17,39],overlap:219,overrid:43,overwrit:[99,100,101,102,103,104,105,106],own:[117,160,205],ownership:185,packag:222,packet:[210,213,227],pad:[133,191,205],page:214,paramet:[56,216],parent:216,pars:[49,50,66,125,138,146,148,205,219,220,223,229],part:158,particular:[212,224],partli:210,pass:[36,56,91,96,116,136,152,177,210,216,230],password:214,past:212,path:[155,162,222,226],peer:147,perform:[2,7,125,175,185,216,226,232],permiss:[125,162,224],perror:168,pid:43,pid_t:225,place:[65,86,90,99,100,101,102,103,104,105,106,115,186],platform:[62,134,215,220,223,228],pleas:46,pluggabl:[156,166],pms:[128,129,130],point:[72,193],pointer:[22,66,67,72,75,91,121,126,127,136,156,164,165,166,168,193,198],pool:165,portabl:[36,126,127,134,164,171,173,177,189],posit:[17,48,163,173],posix:228,possibl:[201,218],potenti:231,power:[184,185],pre:170,prealloc:170,precis:27,prefer:[47,216,224],prefix:216,prematur:117,preprocessor:232,preserv:[195,224],prevent:214,previous:91,primarili:[18,19,27],primit:224,print:[32,34,47,125,162,224,226],print_doc_id:[86,90],print_each_char:194,printabl:52,printf:[32,33,34,35,47,51,86,90,110,149,168,169,171,175,176,181,185,192,193,194,204,205,206,216,222,224,225,226,227,230],privat:[110,222],probabl:[112,115,214],proce:216,process:[41,125,126,127,132,133,149,162,164,224,225],processor:216,program:[54,72,73,96,99,100,101,102,103,104,105,106,125,162,220,223,224,229,231],progress:91,prohibit:201,proof:205,propag:[66,123,124,138,155],properli:[1,218],properti:58,protect:214,prototyp:166,provid:[4,5,6,7,49,50,62,67,75,108,117,125,136,145,152,154,156,162,194,205,213,215,216,223,224,225,226,227,228,230],pthread:[222,228],purpos:225,python:213,qsort:[38,139,149,225],queri:[18,19],rand:225,random:149,rang:36,rare:[42,134],rather:[32,187],raw:[58,68,75,79,145,172],reach:157,reached_eof:157,reached_of:157,read:[67,121,122,124,125,154,156,157,158,160,161,162,168,205,224],read_into:168,reader:[56,118,119,120,122,124,125,151,152,154,156,157,159,160,161,162,163,224,227],realloc:[133,136,164,166,227],realloc_func:[136,211,213],realloc_func_ctx:[136,211,213],reconstruct:[91,97],recurs:84,reduc:225,refer:[67,115,220,223,230],regex:[23,24,108,204],regex_length:24,region:[57,126,127,128,162,164,165,166,212,213,214,216,227],reiniti:167,relax:[35,224],releas:[37,40,59,60,61,110,151,203,208],reli:91,remain:[67,117,187],rememb:30,remov:216,replica:147,report:[205,219],repres:[51,95,97,149,191,225],represent:[30,63,115,182,194,197,224],request:[82,84,85,119,121,164,165,166],requir:[37,43,56,57,125,134,162,205,216,222,224,225,228],required_major:37,required_micro:37,required_minor:37,reserv:168,resiz:136,resourc:[40,151,203],respons:[1,32,33,34,35,208,228],restor:[91,132],result:[32,33,34,35,36,44,52,54,57,67,75,81,109,115,132,133,150,153,170,171,193,195,196,206],retriev:[68,79,94,95,108,115],reus:167,revers:134,rewind:168,rfc:199,routin:[0,216,220,223,224],run:[205,218,231],runtim:[31,37,115,116,192,204],safe:[41,225,228],same:[34,38,47,141,191,216],sampl:222,save:91,scope:[7,75,191],scope_data:204,scope_len:[75,204],second:[27,111,113,142,149,216,226],section:193,see:[2,49,50,54,56,64,82,85,117,125,162,172,190,191,200,201,210,224,226,227,230],seek:159,seek_end:168,semant:38,sensit:[82,83,85],sent:210,sequenc:[125,147,157,162,196,197,224],sequenti:[32,227],seri:205,serial:[2,136,213,227],serv:42,server:[27,112],set:[32,33,34,35,36,49,50,54,66,108,109,117,123,127,133,134,136,138,155,157,160,161,168,169,187,188,191,193,200,201,205,216,222,231],shall:[1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,18,19,21,22,27,29,30,32,34,38,39,40,41,44,45,46,47,48,53,54,55,57,58,65,67,68,71,72,73,76,79,82,84,85,86,90,99,100,101,102,103,104,105,106,107,108,109,111,112,113,114,115,132,133,135,137,139,153,154,157,167,170],share:222,should:[9,23,24,25,29,40,42,44,47,53,54,56,57,58,66,74,75,77,78,81,82,84,85,91,92,93,94,98,107,108,110,116,119,121,122,128,129,130,135,154,157,160,170,174,175,176,183,184,188,194,195,216,230],show:216,sign:[15,16,36,71],similar:[27,75,81,127,158,224],similarli:214,simpl:225,simpli:[205,218,222,225],simplifi:205,sinc:[8,26,28,76,100,111,113,142,149],singl:[2,66,138,191,194,196,213,225],situat:[47,91,134],size:[17,39,110,119,121,136,164,165,166,168,170,171,177,187,189,191,193,206,214,231],size_t:[32,33,34,35,67,90,91,118,119,121,126,127,133,136,137,148,153,158,162,164,165,166,168,170,171,177,187,188,189,193,199,200,205,206,210,211,213,214,224,226,227],sizeof:[126,127,149,164,172,193],skip:231,slower:137,small:[191,215,231],smaller:186,snprintf:[171,193],socket:156,softwar:[125,162,224],some:[30,185,219],someth:[63,157],sort:[139,173],sourc:[121,124,156],space:[168,187,207],spec:77,special:[43,47,195],specif:[49,50,109,125,149,162,165,166,192,205,216,218,219,224],specifi:[1,8,11,43,46,47,53,100,216,222,226],speed:191,src:[39,45,46,47,140,172,187,202],ssize_t:[66,138,158,195,205],stack:[56,65,67,110,134,168,191,216,231],stand:134,standard:[84,187,199],start:[3,32,36,46,47,91,149,201,216],state:[17,39,205,216],stderr:[56,125,157,162,168,224,226,227],stdin:[162,224],stdin_fileno:[125,162,224],stdio:[51,125,149,162,168,205,222,224,227],stdlib:[125,224],stdout:[125,162,224],steal:54,stolen:54,stop:[117,205],storag:231,store:[18,19,54,74,75,129,177,196,214,225],str:[32,33,34,35,36,47,52,146,148,149,150,162,171,174,179,180,183,184,185,188,193,194,204,206,216,224,227],strcasecmp:173,strcmp:[110,125,162,224],stream:[119,121,156,158,161,162,163,168,220,221,223],strerror:177,string:[0,1,2,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,49,50,51,52,63,64,66,74,75,81,82,83,85,89,91,94,108,109,115,125,138,146,148,150,162,169,171,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,193,195,197,198,199,201,206,216,220,223,224,226,230],strlen:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,66,95,138,191,216],strncpy:187,strncpy_:187,strnlen:189,strptr:193,strtoll:36,struct:[28,43,51,56,62,91,110,113,125,131,133,149,162,172,185,191,204,205,213,231],structur:[43,51,53,54,56,110,125,135,149,162,167,172,183,191,201,204,205,207,211,219,225,228],strv:178,style:[38,139,149,169,171,175,176,181,206,226],sub:[2,11,12,68,79,110],sub_it:110,subdocu:[84,201],substitut:215,subsystem:219,subtyp:[4,72,190,191,204],success:[3,13,17,32,33,34,35,39,66,123,124,136,137,138,155,156],successfulli:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,67,86,90,91,172],suggest:[30,115],suitabl:[143,179],supersed:34,suppli:[57,153,208,209,211],support:[30,71,218,224,227],sure:216,swap:214,symbol:[25,109,204],system:[0,9,30,123,158,218,220,223,225,228],take:[26,28,115,165,168,176,185,216],target:9,target_compile_definit:222,target_include_directori:222,target_link_librari:222,task:225,tcp:213,tediou:216,tell:163,temporarili:168,termin:[6,7,30,36,46,47,50,178,187,195,230],test:[222,231],text:[194,230],than:[1,2,4,5,6,7,8,9,10,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,37,38,73,95,115,139,158,187,225],thei:[27,141,173,218],them:[125,224],therefor:[67,95,191,225,231],thi:[2,3,7,13,18,19,20,25,27,29,30,31,34,37,38,40,42,43,46,47,53,54,57,58,64,65,68,72,73,74,78,79,81,87,88,89,91,92,93,95,96,97,98,99,100,101,102,103,104,105,106,107,108,112,115,116,125,126,127,128,129,130,132,133,134,137,147,152,156,158,160,162,164,165,166,168,169,170,171,172,175,176,177,178,179,185,186,187,190,191,193,194,198,202,205,208,210,212,213,214,216,218,224,225,226,227,231,232],third:60,those:[46,47,54,215],thread:[41,217,220,223,225],through:[110,166,194,200,201,230],throughout:134,tight:225,time:[8,20,91,94,95,97,100,110,112,142,149,216,224,228,231],time_t:[26,111,142,225],timeout:62,timestamp:[27,106,112,204,225],timev:[28,62,113],timezon:[8,62],too:[168,187],top:54,trail:[30,66,138,171,186,187,188,226],transfer:[54,172],transform:125,translat:173,treat:191,tri:219,truli:214,truncat:186,tutori:[220,223],two:[38,141,184,185,216,225,226],txt:222,type:[1,7,9,11,14,18,19,21,22,23,24,25,27,29,31,51,68,69,70,72,74,77,78,79,98,99,100,101,102,103,104,105,106,107,108,109,110,112,114,116,149,192,204,205,216,219,222,224],type_cod:205,typedef:[43,51,56,110,114,125,131,133,149,152,158,162,166,172,185,190,191,192,194,201,204,205,213],typic:[112,225],u0000:195,uint32_t:[4,27,48,54,56,68,72,74,75,77,79,81,91,95,97,106,109,112,115,128,131,143,168,169,185,186,191,193,194,196,204,205],uint64_t:51,uint8_t:[4,54,58,67,68,72,75,79,90,91,118,128,129,131,136,137,138,145,149,153,162,168,191,204,205,211,213,227],undefin:[29,205],under:[125,134,162,224],underli:[54,99,100,101,102,103,104,105,106,115,123,124,157,158,159,161,163,170,191,207,210,227],unichar:[182,196],unicod:[23,24,182,194,196],uniniti:[12,45,66,168,172],union:204,uniqu:228,unittest:231,unix:[8,26,28,76,100,111,113,142,149,158,222,225,228],unknown:157,unless:[53,125,162,224],unlik:[18,19],unrecogn:205,unsign:[97,149,194,225,226,227],unsupport:[117,205],until:[31,72,83],unus:[119,121],upon:[32,33,34,35,86,90,125,227],usag:[125,162,224],use:[4,5,6,17,30,34,36,42,43,46,54,96,97,115,125,135,162,166,167,172,184,191,193,200,201,202,205,207,216,218,222,224,225,226,230],used:[9,18,19,25,27,29,30,56,57,58,77,110,112,125,128,129,130,132,133,147,149,152,156,160,162,166,190,192,194,196,216,224,225,228,232],useful:[31,38,91,125,165,170,185,210,212,213,214,224,227,232],user:[121,156],uses:[17,30,38,184,226,228],using:[1,6,11,32,34,40,67,75,83,107,110,115,117,123,136,144,145,147,149,153,155,193,211,216,222,225],utc:[8,20],utf8:[115,195,196,197,198,199],utf8_len:[195,199],utf:[6,7,30,32,33,34,35,66,74,75,81,115,138,179,182,185,194,195,196,197,198,199,201,215,216,220,223,226,229],v_arrai:205,v_binari:[204,205],v_binary_len:205,v_bool:[204,205],v_code:[204,205],v_code_len:205,v_codewscop:204,v_collect:205,v_collection_len:205,v_datetim:204,v_dbpointer:204,v_decimal128:205,v_doc:204,v_document:205,v_doubl:[204,205],v_increment:205,v_int32:[204,205],v_int64:[204,205],v_int8:204,v_oid:[204,205],v_option:205,v_regex:[204,205],v_scope:205,v_subtyp:205,v_symbol:[204,205],v_symbol_len:205,v_timestamp:[204,205],v_utf8:[204,205],v_utf8_len:205,va_list:[176,206],val:[1,4,5,6,7,8,10,11,14,15,16,22,23,25,26,27,28,30,31,191],valgrind:[220,221,223],valid:[23,24,30,36,49,50,66,67,72,91,110,115,138,148,153,154,159,199,200,201,205,219],valu:[5,8,10,11,14,15,16,17,18,19,20,21,25,26,27,28,29,30,31,32,36,51,59,60,61,69,70,73,78,91,92,93,99,100,101,102,103,104,105,116,139,149,158,172,193,194,200,201,203,204,216,224],value_typ:204,variabl:231,variad:[46,47,206,216],variant:225,varieti:216,variou:[184,190,225,230,232],verbos:[23,24],veri:47,verifi:[68,78,79,92,93,98,199,231],version:[0,36,37,59,60,61,63,82,85,125,146,162,173,189,205,220,222,223,224],via:[43,66,123,124,134,138,155],visit:117,visit_aft:205,visit_arrai:205,visit_befor:205,visit_binari:205,visit_bool:205,visit_cod:205,visit_codewscop:205,visit_corrupt:205,visit_date_tim:205,visit_dbpoint:205,visit_decimal128:205,visit_docu:205,visit_doubl:205,visit_int32:205,visit_int64:205,visit_maxkei:205,visit_minkei:205,visit_nul:205,visit_oid:205,visit_regex:205,visit_symbol:205,visit_timestamp:205,visit_undefin:205,visit_unsupported_typ:205,visit_utf8:205,visitor:[117,205],vtabl:[117,133],wai:[47,62,166,225],walk:[200,201,230],want:[31,58,112,115,125,210,214,216,224,225,226,227,232],warranti:[125,162,224],well:[62,214,224],went:212,were:[69,70,71,117],what:226,when:[2,9,12,18,19,40,43,53,54,59,60,61,99,100,101,102,103,104,105,106,107,108,115,122,135,137,152,154,160,165,168,184,191,194,202,205,207,211,213,216,218,226],whenev:216,where:[91,169,186,200,224],whether:[122,154,167],which:[30,34,36,58,74,75,90,94,108,126,127,162,164,168,184,187,191,198,201,224,227],whitespac:36,whose:198,window:228,wish:166,within:[30,48,62,64,163,191,198,199,200,226,230],without:[91,116,125,162,224,228],work:[47,125,137,165,230],world:216,would:[17,39,185,216],wrap:[172,216],wrap_bson:172,wrapper:[126,127,164,171,172,177],write:[125,162,168,187,207,209,224],writer:[207,208,209,210,212,213,227],written:[171,206,210],wrong:[132,133],www:[125,162,224],yet:227,yield:2,you:[2,31,40,53,57,58,63,72,73,78,92,93,98,112,115,125,149,162,166,168,170,172,185,200,201,210,212,213,214,216,222,224,225,226,227,228,230,231,232],your:[117,193,205,220,223,225,228,229,231],zero:[36,38,48,54,69,126,127,158,164,187,201,214]},titles:["API Reference","bson_append_array()","bson_append_array_begin()","bson_append_array_end()","bson_append_binary()","bson_append_bool()","bson_append_code()","bson_append_code_with_scope()","bson_append_date_time()","bson_append_dbpointer()","bson_append_decimal128()","bson_append_document()","bson_append_document_begin()","bson_append_document_end()","bson_append_double()","bson_append_int32()","bson_append_int64()","bson_append_iter()","bson_append_maxkey()","bson_append_minkey()","bson_append_now_utc()","bson_append_null()","bson_append_oid()","bson_append_regex()","bson_append_regex_w_len()","bson_append_symbol()","bson_append_time_t()","bson_append_timestamp()","bson_append_timeval()","bson_append_undefined()","bson_append_utf8()","bson_append_value()","bson_array_as_json()","bson_as_canonical_extended_json()","bson_as_json()","bson_as_relaxed_extended_json()","bson_ascii_strtoll()","bson_check_version()","bson_compare()","bson_concat()","bson_context_destroy()","bson_context_get_default()","bson_context_new()","bson_context_t","bson_copy()","bson_copy_to()","bson_copy_to_excluding()","bson_copy_to_excluding_noinit()","bson_count_keys()","bson_decimal128_from_string()","bson_decimal128_from_string_w_len()","bson_decimal128_t","bson_decimal128_to_string()","bson_destroy()","bson_destroy_with_steal()","bson_equal()","bson_error_t","bson_free()","bson_get_data()","bson_get_major_version()","bson_get_micro_version()","bson_get_minor_version()","System Clock","bson_get_version()","bson_has_field()","bson_init()","bson_init_from_json()","bson_init_static()","bson_iter_array()","bson_iter_as_bool()","bson_iter_as_double()","bson_iter_as_int64()","bson_iter_binary()","bson_iter_bool()","bson_iter_code()","bson_iter_codewscope()","bson_iter_date_time()","bson_iter_dbpointer()","bson_iter_decimal128()","bson_iter_document()","bson_iter_double()","bson_iter_dup_utf8()","bson_iter_find()","bson_iter_find_case()","bson_iter_find_descendant()","bson_iter_find_w_len()","bson_iter_init()","bson_iter_init_find()","bson_iter_init_find_case()","bson_iter_init_find_w_len()","bson_iter_init_from_data()","bson_iter_init_from_data_at_offset()","bson_iter_int32()","bson_iter_int64()","bson_iter_key()","bson_iter_key_len()","bson_iter_next()","bson_iter_offset()","bson_iter_oid()","bson_iter_overwrite_bool()","bson_iter_overwrite_date_time()","bson_iter_overwrite_decimal128()","bson_iter_overwrite_double()","bson_iter_overwrite_int32()","bson_iter_overwrite_int64()","bson_iter_overwrite_oid()","bson_iter_overwrite_timestamp()","bson_iter_recurse()","bson_iter_regex()","bson_iter_symbol()","bson_iter_t","bson_iter_time_t()","bson_iter_timestamp()","bson_iter_timeval()","bson_iter_type()","bson_iter_utf8()","bson_iter_value()","bson_iter_visit_all()","bson_json_data_reader_ingest()","bson_json_data_reader_new()","bson_json_reader_destroy()","bson_json_reader_new()","bson_json_reader_new_from_fd()","bson_json_reader_new_from_file()","bson_json_reader_read()","bson_json_reader_t","bson_malloc()","bson_malloc0()","bson_md5_append()","bson_md5_finish()","bson_md5_init()","bson_md5_t","bson_mem_restore_vtable()","bson_mem_set_vtable()","Memory Management","bson_new()","bson_new_from_buffer()","bson_new_from_data()","bson_new_from_json()","bson_oid_compare()","bson_oid_copy()","bson_oid_equal()","bson_oid_get_time_t()","bson_oid_hash()","bson_oid_init()","bson_oid_init_from_data()","bson_oid_init_from_string()","bson_oid_init_sequence()","bson_oid_is_valid()","bson_oid_t","bson_oid_to_string()","bson_reader_destroy()","bson_reader_destroy_func_t","bson_reader_new_from_data()","bson_reader_new_from_fd()","bson_reader_new_from_file()","bson_reader_new_from_handle()","bson_reader_read()","bson_reader_read_func_t","bson_reader_reset()","bson_reader_set_destroy_func()","bson_reader_set_read_func()","bson_reader_t","bson_reader_tell()","bson_realloc()","bson_realloc_ctx()","bson_realloc_func","bson_reinit()","bson_reserve_buffer()","bson_set_error()","bson_sized_new()","bson_snprintf()","bson_steal()","bson_strcasecmp()","bson_strdup()","bson_strdup_printf()","bson_strdupv_printf()","bson_strerror_r()","bson_strfreev()","bson_string_append()","bson_string_append_c()","bson_string_append_printf()","bson_string_append_unichar()","bson_string_free()","bson_string_new()","bson_string_t","bson_string_truncate()","bson_strncpy()","bson_strndup()","bson_strnlen()","bson_subtype_t","bson_t","bson_type_t","bson_uint32_to_string()","bson_unichar_t","bson_utf8_escape_for_json()","bson_utf8_from_unichar()","bson_utf8_get_char()","bson_utf8_next_char()","bson_utf8_validate()","bson_validate()","bson_validate_with_error()","bson_value_copy()","bson_value_destroy()","bson_value_t","bson_visitor_t","bson_vsnprintf()","bson_writer_begin()","bson_writer_destroy()","bson_writer_end()","bson_writer_get_length()","bson_writer_new()","bson_writer_rollback()","bson_writer_t","bson_zero_free()","Character and String Routines","Creating a BSON Document","Cross Platform Notes","Endianness","Handling Errors","Index","Guides","Using libbson In Your C Program","Libbson","JSON","ObjectIDs","Parsing and Iterating BSON Documents","Streaming BSON","Threading","Tutorial","UTF-8","Use Valgrind to Check For BSON Data Leaks","Libbson Versioning"],titleterms:{"function":[43,51,56,62,110,125,131,134,149,162,185,190,191,192,194,204,205,213,215,232],"return":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,44,48,49,50,54,55,58,59,60,61,63,64,66,67,69,70,71,73,74,75,76,78,80,81,82,83,84,85,86,90,91,92,93,94,95,96,97,98,107,108,109,111,114,115,116,117,119,121,122,123,124,126,127,135,136,137,138,139,141,142,143,148,153,154,155,156,157,158,163,164,168,170,171,172,173,174,175,176,177,183,184,188,189,193,195,197,198,199,200,201,206,207,210,211],For:231,IDs:225,The:216,Use:231,Using:222,also:[32,33,34,35,39,65,66,67,86,87,88,89,90,91,94,95,97,124,135,136,137,138,167,168,170],api:0,arrai:[193,216],bson:[216,222,224,226,227,231],bson_append_arrai:1,bson_append_array_begin:2,bson_append_array_end:3,bson_append_binari:4,bson_append_bool:5,bson_append_cod:6,bson_append_code_with_scop:7,bson_append_date_tim:8,bson_append_dbpoint:9,bson_append_decimal128:10,bson_append_docu:11,bson_append_document_begin:12,bson_append_document_end:13,bson_append_doubl:14,bson_append_int32:15,bson_append_int64:16,bson_append_it:17,bson_append_maxkei:18,bson_append_minkei:19,bson_append_now_utc:20,bson_append_nul:21,bson_append_oid:22,bson_append_regex:23,bson_append_regex_w_len:24,bson_append_symbol:25,bson_append_time_t:26,bson_append_timestamp:27,bson_append_timev:28,bson_append_undefin:29,bson_append_utf8:30,bson_append_valu:31,bson_array_as_json:32,bson_as_canonical_extended_json:33,bson_as_json:34,bson_as_relaxed_extended_json:35,bson_ascii_strtol:36,bson_check_vers:37,bson_compar:38,bson_concat:39,bson_context_destroi:40,bson_context_get_default:41,bson_context_new:42,bson_context_t:43,bson_copi:44,bson_copy_to:45,bson_copy_to_exclud:46,bson_copy_to_excluding_noinit:47,bson_count_kei:48,bson_decimal128_from_str:49,bson_decimal128_from_string_w_len:50,bson_decimal128_t:51,bson_decimal128_to_str:52,bson_destroi:53,bson_destroy_with_st:54,bson_equ:55,bson_error_t:56,bson_fre:57,bson_get_data:58,bson_get_major_vers:59,bson_get_micro_vers:60,bson_get_minor_vers:61,bson_get_vers:63,bson_has_field:64,bson_init:65,bson_init_from_json:66,bson_init_stat:67,bson_iter_arrai:68,bson_iter_as_bool:69,bson_iter_as_doubl:70,bson_iter_as_int64:71,bson_iter_binari:72,bson_iter_bool:73,bson_iter_cod:74,bson_iter_codewscop:75,bson_iter_date_tim:76,bson_iter_dbpoint:77,bson_iter_decimal128:78,bson_iter_docu:79,bson_iter_doubl:80,bson_iter_dup_utf8:81,bson_iter_find:82,bson_iter_find_cas:83,bson_iter_find_descend:84,bson_iter_find_w_len:85,bson_iter_init:86,bson_iter_init_find:87,bson_iter_init_find_cas:88,bson_iter_init_find_w_len:89,bson_iter_init_from_data:90,bson_iter_init_from_data_at_offset:91,bson_iter_int32:92,bson_iter_int64:93,bson_iter_kei:94,bson_iter_key_len:95,bson_iter_next:96,bson_iter_offset:97,bson_iter_oid:98,bson_iter_overwrite_bool:99,bson_iter_overwrite_date_tim:100,bson_iter_overwrite_decimal128:101,bson_iter_overwrite_doubl:102,bson_iter_overwrite_int32:103,bson_iter_overwrite_int64:104,bson_iter_overwrite_oid:105,bson_iter_overwrite_timestamp:106,bson_iter_recurs:107,bson_iter_regex:108,bson_iter_symbol:109,bson_iter_t:110,bson_iter_time_t:111,bson_iter_timestamp:112,bson_iter_timev:113,bson_iter_typ:114,bson_iter_utf8:115,bson_iter_valu:116,bson_iter_visit_al:117,bson_json_data_reader_ingest:118,bson_json_data_reader_new:119,bson_json_reader_destroi:120,bson_json_reader_new:121,bson_json_reader_new_from_fd:122,bson_json_reader_new_from_fil:123,bson_json_reader_read:124,bson_json_reader_t:125,bson_malloc0:127,bson_malloc:126,bson_md5_append:128,bson_md5_finish:129,bson_md5_init:130,bson_md5_t:131,bson_mem_restore_vt:132,bson_mem_set_vt:133,bson_new:135,bson_new_from_buff:136,bson_new_from_data:137,bson_new_from_json:138,bson_oid_compar:139,bson_oid_copi:140,bson_oid_equ:141,bson_oid_get_time_t:142,bson_oid_hash:143,bson_oid_init:144,bson_oid_init_from_data:145,bson_oid_init_from_str:146,bson_oid_init_sequ:147,bson_oid_is_valid:148,bson_oid_t:149,bson_oid_to_str:150,bson_reader_destroi:151,bson_reader_destroy_func_t:152,bson_reader_new_from_data:153,bson_reader_new_from_fd:154,bson_reader_new_from_fil:155,bson_reader_new_from_handl:156,bson_reader_read:157,bson_reader_read_func_t:158,bson_reader_reset:159,bson_reader_set_destroy_func:160,bson_reader_set_read_func:161,bson_reader_t:162,bson_reader_tel:163,bson_realloc:164,bson_realloc_ctx:165,bson_realloc_func:166,bson_reinit:167,bson_reserve_buff:168,bson_set_error:169,bson_sized_new:170,bson_snprintf:171,bson_steal:172,bson_strcasecmp:173,bson_strdup:174,bson_strdup_printf:175,bson_strdupv_printf:176,bson_strerror_r:177,bson_strfreev:178,bson_string_append:179,bson_string_append_c:180,bson_string_append_printf:181,bson_string_append_unichar:182,bson_string_fre:183,bson_string_new:184,bson_string_t:185,bson_string_trunc:186,bson_strncpi:187,bson_strndup:188,bson_strnlen:189,bson_subtype_t:190,bson_t:[191,216],bson_type_t:192,bson_uint32_to_str:193,bson_unichar_t:194,bson_utf8_escape_for_json:195,bson_utf8_from_unichar:196,bson_utf8_get_char:197,bson_utf8_next_char:198,bson_utf8_valid:199,bson_valid:200,bson_validate_with_error:201,bson_value_copi:202,bson_value_destroi:203,bson_value_t:204,bson_visitor_t:205,bson_vsnprintf:206,bson_writer_begin:207,bson_writer_destroi:208,bson_writer_end:209,bson_writer_get_length:210,bson_writer_new:211,bson_writer_rollback:212,bson_writer_t:213,bson_zero_fre:214,build:193,charact:215,check:231,clock:62,cmake:222,compar:[149,225],composit:225,config:222,convers:149,convert:224,creat:216,creation:225,cross:217,data:231,deprec:[46,128,129,130,131],descript:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,219],document:[216,226,227],dot:226,element:193,encod:230,endian:218,error:[66,123,124,138,155,219],exampl:[32,33,34,35,43,47,49,50,51,52,56,86,90,110,125,146,149,157,162,168,185,190,191,192,194,204,205,213,224],fetch:225,field:226,find:226,from:227,gener:225,guid:221,handl:219,hash:[149,225],includ:222,index:220,introduct:223,iter:226,json:224,kei:193,leak:231,libbson:[222,223,232],macro:232,manag:134,memori:134,notat:[216,226],note:[191,217],object:[216,225],objectid:225,paramet:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,44,45,46,47,48,49,50,52,53,54,55,57,58,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,114,115,116,117,118,119,120,121,122,123,124,126,127,128,129,130,133,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,160,161,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,186,187,188,189,193,195,196,197,198,199,200,201,202,203,206,207,208,209,210,211,212,214],pars:[224,225,226],perform:191,pkg:222,platform:217,program:222,read:227,recurs:226,refer:0,routin:215,see:[32,33,34,35,39,65,66,67,86,87,88,89,90,91,94,95,97,124,135,136,137,138,167,168,170],sequenc:[227,230],simplifi:216,sort:225,stream:[224,227],string:[149,215,225],structur:216,sub:[216,226],synopsi:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,232],system:62,thread:228,time:225,tutori:229,using:226,utf:230,valgrind:231,valid:[149,226,230],version:232,write:227,your:222}}) \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/streaming-bson.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/streaming-bson.html new file mode 100644 index 0000000..2cf76bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/streaming-bson.html @@ -0,0 +1,169 @@ + + + + + + + + Streaming BSON — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Streaming BSON

+

bson_reader_t provides a streaming reader which can be initialized with a filedescriptor or memory region. bson_writer_t provides a streaming writer which can be initialized with a memory region. (Streaming BSON to a file descriptor is not yet supported.)

+
+

Reading from a BSON Stream

+

bson_reader_t provides a convenient API to read sequential BSON documents from a file-descriptor or memory buffer. The bson_reader_read() function will read forward in the underlying stream and return a bson_t that can be inspected and iterated upon.

+
#include <stdio.h>
+#include <bson/bson.h>
+
+int
+main (int argc, char *argv[])
+{
+   bson_reader_t *reader;
+   const bson_t *doc;
+   bson_error_t error;
+   bool eof;
+
+   reader = bson_reader_new_from_file ("mycollection.bson", &error);
+
+   if (!reader) {
+      fprintf (stderr, "Failed to open file.\n");
+      return 1;
+   }
+
+   while ((doc = bson_reader_read (reader, &eof))) {
+      char *str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   if (!eof) {
+      fprintf (stderr,
+               "corrupted bson document found at %u\n",
+               (unsigned) bson_reader_tell (reader));
+   }
+
+   bson_reader_destroy (reader);
+
+   return 0;
+}
+
+
+

See bson_reader_new_from_fd(), bson_reader_new_from_file(), and bson_reader_new_from_data() for more information.

+
+
+

Writing a sequence of BSON Documents

+

bson_writer_t provides a convenient API to write a sequence of BSON documents to a memory buffer that can grow with realloc(). The bson_writer_begin() and bson_writer_end() functions will manage the underlying buffer while building the sequence of documents.

+

This could also be useful if you want to write to a network packet while serializing the documents from a higher level language, (but do so just after the packets header).

+
#include <stdio.h>
+#include <bson/bson.h>
+#include <assert.h>
+
+int
+main (int argc, char *argv[])
+{
+   bson_writer_t *writer;
+   bson_t *doc;
+   uint8_t *buf = NULL;
+   size_t buflen = 0;
+   bool r;
+   int i;
+
+   writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL);
+
+   for (i = 0; i < 10000; i++) {
+      r = bson_writer_begin (writer, &doc);
+      assert (r);
+
+      r = BSON_APPEND_INT32 (doc, "i", i);
+      assert (r);
+
+      bson_writer_end (writer);
+   }
+
+   bson_free (buf);
+
+   return 0;
+}
+
+
+

See bson_writer_new() for more information.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/threading.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/threading.html new file mode 100644 index 0000000..8c708f0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/threading.html @@ -0,0 +1,90 @@ + + + + + + + + Threading — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Threading

+

Libbson’s data structures are NOT thread-safe. You are responsible for accessing and mutating these structures from one thread at a time.

+

Libbson requires POSIX threads (pthreads) on all UNIX-like platforms. On Windows, the native threading interface is used. Libbson uses your system’s threading library to safely generate unique ObjectIds, and to provide a fallback implementation for atomic operations on platforms without built-in atomics.

+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/tutorial.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/tutorial.html new file mode 100644 index 0000000..c18a676 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/tutorial.html @@ -0,0 +1,100 @@ + + + + + + + + Tutorial — libbson 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/utf8.html new file mode 100644 index 0000000..48e647e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/utf8.html @@ -0,0 +1,113 @@ + + + + + + + + UTF-8 — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

UTF-8

+
+

Encoding

+

Libbson expects that you are always working with UTF-8 encoded text. Anything else is invalid API use.

+

If you should need to walk through UTF-8 sequences, you can use the various UTF-8 helper functions distributed with Libbson.

+
+
+

Validating a UTF-8 Sequence

+

To validate the string contained in my_string, use the following. You may pass -1 for the string length if you know the string is NULL-terminated.

+
if (!bson_utf8_validate (my_string, -1, false)) {
+   printf ("Validation failed.\n");
+}
+
+
+

If my_string has NULL bytes within the string, you must provide the string length. Use the following format. Notice the true at the end indicating \0 is allowed.

+
if (!bson_utf8_validate (my_string, my_string_len, true)) {
+   printf ("Validation failed.\n");
+}
+
+
+

For more information see the API reference for bson_utf8_validate().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/valgrind.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/valgrind.html new file mode 100644 index 0000000..87cbc70 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/valgrind.html @@ -0,0 +1,96 @@ + + + + + + + + Use Valgrind to Check For BSON Data Leaks — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Use Valgrind to Check For BSON Data Leaks

+

A stack-allocated bson_t contains a small internal buffer; it only heap-allocates additional storage if necessary, depending on its data size. Therefore if you forget to call bson_destroy() on a stack-allocated bson_t, it might or might not cause a leak that can be detected by valgrind during testing.

+

To catch all potential BSON data leaks in your code, configure the BSON_MEMCHECK flag:

+
cmake -DCMAKE_C_FLAGS="-DBSON_MEMCHECK -g" .
+
+
+

With this flag set, every bson_t mallocs at least one byte. Run your program’s unittests with valgrind to verify all bson_t structs are destroyed.

+

Set the environment variable MONGOC_TEST_VALGRIND to on to skip timing-dependent tests known to fail with valgrind.

+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/version.html new file mode 100644 index 0000000..462b4ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/html/version.html @@ -0,0 +1,147 @@ + + + + + + + + Libbson Versioning — libbson 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Libbson Versioning

+

Versioning Macros and Functions

+
+

Macros

+

The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against. This may be useful if you only want to enable a feature on a certain version of the library.

+
+
+

Synopsis

+
#define BSON_CHECK_VERSION(major, minor, micro)
+
+#define BSON_MAJOR_VERSION (1)
+#define BSON_MINOR_VERSION (4)
+#define BSON_MICRO_VERSION (1)
+#define BSON_VERSION_S "1.4.1"
+
+#define BSON_VERSION_HEX                                  \
+   (BSON_MAJOR_VERSION << 24 | BSON_MINOR_VERSION << 16 | \
+    BSON_MICRO_VERSION << 8)
+
+
+

Only compile a block on Libbson 1.1.0 and newer.

+
#if BSON_CHECK_VERSION(1, 1, 0)
+static void
+do_something (void)
+{
+}
+#endif
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/include-and-link.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/include-and-link.rst new file mode 100644 index 0000000..f8cb746 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/include-and-link.rst @@ -0,0 +1,46 @@ +:man_page: bson_include_and_link + +Using libbson In Your C Program +=============================== + +Include bson.h +-------------- + +All libbson's functions and types are available in one header file. Simply include ``bson.h``: + +.. literalinclude:: ../examples/hello_bson.c + :caption: hello_bson.c + :start-after: -- sphinx-include-start -- + +CMake +----- + +The libbson installation includes a `CMake config-file package`_, so you can use CMake's `find_package`_ command to find libbson's header and library paths and link to libbson: + +.. literalinclude:: ../examples/cmake/find_package/CMakeLists.txt + :caption: CMakeLists.txt + :start-after: -- sphinx-include-start -- + +By default, libbson is dynamically linked. You can use libbson as a static library instead: Use the included ``libbson-static-1.0`` config-file package and (on Unix) link to ``pthread``: + +.. literalinclude:: ../examples/cmake/find_package_static/CMakeLists.txt + :start-after: -- sphinx-include-start -- + :emphasize-lines: 1, 6 + +.. _CMake config-file package: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages +.. _find_package: https://cmake.org/cmake/help/latest/command/find_package.html + +pkg-config +---------- + +If you're not using CMake, use `pkg-config`_ on the command line to set header and library paths: + +.. literalinclude:: ../examples/compile-with-pkg-config.sh + :start-after: -- sphinx-include-start -- + +Or to statically link to libbson: + +.. literalinclude:: ../examples/compile-with-pkg-config-static.sh + :start-after: -- sphinx-include-start -- + +.. _pkg-config: https://www.freedesktop.org/wiki/Software/pkg-config/ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/index.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/index.rst new file mode 100644 index 0000000..3ea12c1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/index.rst @@ -0,0 +1,30 @@ +Libbson +======= + +A Cross Platform BSON Library for C + +Introduction +------------ + +libbson builds, parses, and iterates `BSON `_ documents, the native data format of MongoDB. It also converts BSON to and from JSON, and provides a platform compatibility layer for `the MongoDB C Driver `_. + +.. toctree:: + :titlesonly: + + tutorial + +.. toctree:: + :titlesonly: + + guides + +.. toctree:: + :titlesonly: + + cross-platform-notes + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + api diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/json.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/json.rst new file mode 100644 index 0000000..9a52058 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/json.rst @@ -0,0 +1,251 @@ +:man_page: bson_json + +JSON +==== + +Libbson provides routines for converting to and from the JSON format. In particular, it supports the `MongoDB extended JSON `_ format. + +Converting BSON to JSON +----------------------- + +There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the functions :symbol:`bson_as_canonical_extended_json()` and :symbol:`bson_as_relaxed_extended_json()`. The canonical format preserves BSON type information for values that may have ambiguous representations in JSON (e.g. numeric types). + +.. code-block:: c + + bson_t *b; + size_t len; + char *str; + + b = BCON_NEW ("a", BCON_INT32 (1)); + + str = bson_as_canonical_extended_json (b, &len); + printf ("%s\n", str); + bson_free (str); + + bson_destroy (b); + +.. code-block:: none + + { "a" : { "$numberInt": "1" } } + +The relaxed format prefers JSON primitives for numeric values and may be used if type fidelity is not required. + +.. code-block:: c + + bson_t *b; + size_t len; + char *str; + + b = BCON_NEW ("a", BCON_INT32 (1)); + + str = bson_as_relaxed_extended_json (b, &len); + printf ("%s\n", str); + bson_free (str); + + bson_destroy (b); + +.. code-block:: none + + { "a" : 1 } + +Converting JSON to BSON +----------------------- + +Converting back from JSON is also useful and common enough that we added :symbol:`bson_init_from_json()` and :symbol:`bson_new_from_json()`. + +The following example creates a new :symbol:`bson_t` from the JSON string ``{"a":1}``. + +.. code-block:: c + + bson_t *b; + bson_error_t error; + + b = bson_new_from_json ("{\"a\":1}", -1, &error); + + if (!b) { + printf ("Error: %s\n", error.message); + } else { + bson_destroy (b); + } + +Streaming JSON Parsing +---------------------- + +Libbson provides :symbol:`bson_json_reader_t` to allow for parsing a sequence of JSON documents into BSON. The interface is similar to :symbol:`bson_reader_t` but expects the input to be in the `MongoDB extended JSON `_ format. + +.. code-block:: c + + /* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + /* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + + #include + #include + #include + + + int + main (int argc, char *argv[]) + { + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\n%s\n", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\n"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; + } + +Examples +-------- + +The following example reads BSON documents from ``stdin`` and prints them to ``stdout`` as JSON. + +.. code-block:: c + + /* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + /* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + + #include + #include + + + int + main (int argc, char *argv[]) + { + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | -]...\nUse - for STDIN.\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\n", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; + } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/CMakeLists.txt new file mode 100644 index 0000000..d193df9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/CMakeLists.txt @@ -0,0 +1,3 @@ +set_dist_list (src_libbson_doc_man_DIST + CMakeLists.txt +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array.3 new file mode 100644 index 0000000..4977423 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_ARRAY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_array \- bson_append_array() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_ARRAY(b, key, val) \e + bson_append_array (b, key, (int) strlen (key), val) + +bool +bson_append_array (bson_t *bson, + const char *key, + int key_length, + const bson_t *array); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBarray\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_array()\fP function shall append \fBarray\fP to \fBbson\fP using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of \fBarray\fP are properly formatted with string keys such as "0", "1", "2" and so forth. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function fails if appending the array grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_begin.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_begin.3 new file mode 100644 index 0000000..73909b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_begin.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_ARRAY_BEGIN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_array_begin \- bson_append_array_begin() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \e + bson_append_array_begin (b, key, (int) strlen (key), child) + +bool +bson_append_array_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A string containing the name for the key. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP or \-1 to call \fBstrlen()\fP\&. +.IP \(bu 2 +\fBchild\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_array_begin()\fP function shall begin appending an array field to \fBbson\fP\&. This allows for incrementally building a sub\-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub\-array, the caller \fIMUST\fP call \fBbson_append_array_end()\fP\&. +.sp +For generating array element keys, see \fBbson_uint32_to_string\fP\&. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the array grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_end.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_end.3 new file mode 100644 index 0000000..355b9b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_array_end.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_ARRAY_END" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_array_end \- bson_append_array_end() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_append_array_end (bson_t *bson, bson_t *child); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBchild\fP: The \fBbson_t\fP initialized in a call to \fBbson_append_array_begin()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_array_end()\fP function shall complete the appending of an array field started with \fBbson_append_array_begin()\fP\&. \fBchild\fP is invalid after calling this function. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_binary.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_binary.3 new file mode 100644 index 0000000..120b49e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_binary.3 @@ -0,0 +1,79 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_BINARY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_binary \- bson_append_binary() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_BINARY(b, key, subtype, val, len) \e + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + +bool +bson_append_binary (bson_t *bson, + const char *key, + int key_length, + bson_subtype_t subtype, + const uint8_t *binary, + uint32_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: The key name. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes or \-1 to use strlen(). +.IP \(bu 2 +\fBsubtype\fP: A bson_subtype_t indicating the binary subtype. +.IP \(bu 2 +\fBbinary\fP: A buffer to embed as binary data. Must not be \fBNULL\fP\&. +.IP \(bu 2 +\fBlength\fP: The length of \fBbuffer\fP in bytes. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_binary()\fP function shall append a new element to \fBbson\fP containing the binary data provided. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBbinary\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_bool.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_bool.3 new file mode 100644 index 0000000..65dc1ae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_bool.3 @@ -0,0 +1,70 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_BOOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_bool \- bson_append_bool() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_BOOL(b, key, val) \e + bson_append_bool (b, key, (int) strlen (key), val) + +bool +bson_append_bool (bson_t *bson, const char *key, int key_length, bool value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: The name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP or \-1 to use strlen(). +.IP \(bu 2 +\fBvalue\fP: true or false. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_bool()\fP function shall append a new element to \fBbson\fP containing the boolean provided. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code.3 new file mode 100644 index 0000000..d5c5bef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_CODE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_code \- bson_append_code() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_CODE(b, key, val) \e + bson_append_code (b, key, (int) strlen (key), val) + +bool +bson_append_code (bson_t *bson, + const char *key, + int key_length, + const char *javascript); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: The key name. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP or \-1 to use strlen(). +.IP \(bu 2 +\fBjavascript\fP: A UTF\-8 encoded string containing the javascript. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_code()\fP function shall append a new element to \fBbson\fP using the UTF\-8 encoded \fBjavascript\fP provided. \fBjavascript\fP must be a NULL terminated C string. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBjavascript\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code_with_scope.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code_with_scope.3 new file mode 100644 index 0000000..6738891 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_code_with_scope.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_CODE_WITH_SCOPE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_code_with_scope \- bson_append_code_with_scope() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \e + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + +bool +bson_append_code_with_scope (bson_t *bson, + const char *key, + int key_length, + const char *javascript, + const bson_t *scope); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBjavascript\fP: A NULL\-terminated UTF\-8 encoded string containing the javascript fragment. +.IP \(bu 2 +\fBscope\fP: Optional \fBbson_t\fP containing the scope for \fBjavascript\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_code_with_scope()\fP function shall perform like \fBbson_append_code()\fP except it allows providing a scope to the javascript function in the form of a bson document. +.sp +If \fBscope\fP is NULL, this function appends an element with BSON type "code", otherwise with BSON type "code with scope". +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBjavascript\fP and \fBscope\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_date_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_date_time.3 new file mode 100644 index 0000000..5261a24 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_date_time.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DATE_TIME" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_date_time \- bson_append_date_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DATE_TIME(b, key, val) \e + bson_append_date_time (b, key, (int) strlen (key), val) + +bool +bson_append_date_time (bson_t *bson, + const char *key, + int key_length, + int64_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: The date and time as specified in milliseconds since the UNIX epoch. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_date_time()\fP function shall append a new element to a \fBbson\fP document containing a date and time with no timezone information. \fBvalue\fP is assumed to be in UTC format of milliseconds since the UNIX epoch. \fBvalue\fP \fIMAY\fP be negative. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_dbpointer.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_dbpointer.3 new file mode 100644 index 0000000..a237e6b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_dbpointer.3 @@ -0,0 +1,81 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DBPOINTER" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_dbpointer \- bson_append_dbpointer() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \e + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + +bool +bson_append_dbpointer (bson_t *bson, + const char *key, + int key_length, + const char *collection, + const bson_oid_t *oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBcollection\fP: The target collection name. +.IP \(bu 2 +\fBoid\fP: The target document identifier. +.UNINDENT +.SH DESCRIPTION +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +The dbpointer field type is \fIDEPRECATED\fP and should only be used when interacting with legacy systems. +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the array grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_decimal128.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_decimal128.3 new file mode 100644 index 0000000..cb08131 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_decimal128.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DECIMAL128" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_decimal128 \- bson_append_decimal128() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DECIMAL128(b, key, val) \e + bson_append_decimal128 (b, key, (int) strlen (key), val) + +bool +bson_append_decimal128 (bson_t *bson, + const char *key, + int key_length, + const bson_decimal128_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A \fBbson_decimal128_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_decimal128()\fP function shall append a new element to \fBbson\fP containing a Decimal 128. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document.3 new file mode 100644 index 0000000..61c7843 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DOCUMENT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_document \- bson_append_document() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DOCUMENT(b, key, val) \e + bson_append_document (b, key, (int) strlen (key), val) + +bool +bson_append_document (bson_t *bson, + const char *key, + int key_length, + const bson_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A \fBbson_t\fP containing the sub\-document to append. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_document()\fP function shall append \fBchild\fP to \fBbson\fP using the specified key. The type of the field will be a document. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_begin.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_begin.3 new file mode 100644 index 0000000..5fbc4db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_begin.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DOCUMENT_BEGIN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_document_begin \- bson_append_document_begin() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \e + bson_append_document_begin (b, key, (int) strlen (key), child) + +bool +bson_append_document_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBchild\fP: An uninitialized \fBbson_t\fP to be initialized as the sub\-document. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_document_begin()\fP function shall begin appending a sub\-document to \fBbson\fP\&. Use \fBchild\fP to add fields to the sub\-document. When completed, call \fBbson_append_document_end()\fP to complete the element. +.sp +\fBchild\fP \fIMUST\fP be an uninitialized \fBbson_t\fP to avoid leaking memory. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if \fBbson\fP must grow larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_end.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_end.3 new file mode 100644 index 0000000..4f742e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_document_end.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DOCUMENT_END" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_document_end \- bson_append_document_end() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_append_document_end (bson_t *bson, bson_t *child); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBchild\fP: The child \fBbson_t\fP initialized in a call to \fBbson_append_document_begin()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_document_end()\fP function shall complete the appending of a document with \fBbson_append_document_begin()\fP\&. \fBchild\fP is invalid after calling this function. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_double.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_double.3 new file mode 100644 index 0000000..bfe124e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_double.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_DOUBLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_double \- bson_append_double() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_DOUBLE(b, key, val) \e + bson_append_double (b, key, (int) strlen (key), val) + +bool +bson_append_double (bson_t *bson, + const char *key, + int key_length, + double value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A double value to append. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_double()\fP function shall append a new element to a bson document of type \fBdouble\fP\&. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int32.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int32.3 new file mode 100644 index 0000000..2b408c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int32.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_INT32" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_int32 \- bson_append_int32() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_INT32(b, key, val) \e + bson_append_int32 (b, key, (int) strlen (key), val) + +bool +bson_append_int32 (bson_t *bson, + const char *key, + int key_length, + int32_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: An int32_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_int32()\fP function shall append a new element to \fBbson\fP containing a 32\-bit signed integer. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int64.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int64.3 new file mode 100644 index 0000000..2541fbd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_int64.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_INT64" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_int64 \- bson_append_int64() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_INT64(b, key, val) \e + bson_append_int64 (b, key, (int) strlen (key), val) + +bool +bson_append_int64 (bson_t *bson, + const char *key, + int key_length, + int64_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: An int64_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_int64()\fP function shall append a new element to \fBbson\fP containing a 64\-bit signed integer. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBvalue\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_iter.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_iter.3 new file mode 100644 index 0000000..d2a602c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_iter.3 @@ -0,0 +1,70 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_ITER" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_iter \- bson_append_iter() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_append_iter (bson_t *bson, + const char *key, + int key_length, + const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: Optional field name. If NULL, uses \fBbson_iter_key(iter)\fP\&. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP or \-1 to use strlen(). +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP located on the position of the element to append. +.UNINDENT +.SH DESCRIPTION +.sp +Appends the value at the current position of \fBiter\fP to the document. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful; \fBfalse\fP if the operation would overflow the maximum document size or another invalid state is detected. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_maxkey.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_maxkey.3 new file mode 100644 index 0000000..6127e17 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_maxkey.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_MAXKEY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_maxkey \- bson_append_maxkey() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_MAXKEY(b, key) \e + bson_append_maxkey (b, key, (int) strlen (key)) + +bool +bson_append_maxkey (bson_t *bson, const char *key, int key_length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_maxkey()\fP function shall append an element of type BSON_TYPE_MAXKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_minkey.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_minkey.3 new file mode 100644 index 0000000..39ccebd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_minkey.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_MINKEY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_minkey \- bson_append_minkey() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_MINKEY(b, key) \e + bson_append_minkey (b, key, (int) strlen (key)) + +bool +bson_append_minkey (bson_t *bson, const char *key, int key_length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_minkey()\fP function shall append an element of type BSON_TYPE_MINKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_now_utc.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_now_utc.3 new file mode 100644 index 0000000..38d3c56 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_now_utc.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_NOW_UTC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_now_utc \- bson_append_now_utc() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_append_now_utc (bson_t *bson, const char *key, int key_length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_now_utc()\fP function is a helper to get the current date and time in UTC and append it to \fBbson\fP as a BSON_TYPE_DATE_TIME element. +.sp +This function calls \fBbson_append_date_time()\fP internally. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_null.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_null.3 new file mode 100644 index 0000000..be6cafa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_null.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_NULL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_null \- bson_append_null() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + +bool +bson_append_null (bson_t *bson, const char *key, int key_length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_null()\fP function shall append a new element to \fBbson\fP of type BSON_TYPE_NULL. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_oid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_oid.3 new file mode 100644 index 0000000..f882417 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_oid.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_OID" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_oid \- bson_append_oid() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_OID(b, key, val) \e + bson_append_oid (b, key, (int) strlen (key), val) + +bool +bson_append_oid (bson_t *bson, + const char *key, + int key_length, + const bson_oid_t *oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBoid\fP: A bson_oid_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_oid()\fP function shall append a new element to \fBbson\fP of type BSON_TYPE_OID. \fBoid\fP \fIMUST\fP be a pointer to a \fBbson_oid_t\fP\&. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending \fBoid\fP grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex.3 new file mode 100644 index 0000000..bf16da5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex.3 @@ -0,0 +1,92 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_REGEX" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_regex \- bson_append_regex() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_REGEX(b, key, val, opt) \e + bson_append_regex (b, key, (int) strlen (key), val, opt) + +bool +bson_append_regex (bson_t *bson, + const char *key, + int key_length, + const char *regex, + const char *options); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBregex\fP: An ASCII string containing the regex. +.IP \(bu 2 +\fBoptions\fP: An optional string containing the regex options as a string. +.UNINDENT +.SH DESCRIPTION +.sp +Appends a new field to \fBbson\fP of type BSON_TYPE_REGEX. \fBregex\fP should be the regex string. \fBoptions\fP should contain the options for the regex. +.sp +Valid characters for \fBoptions\fP include: +.INDENT 0.0 +.IP \(bu 2 +\fB\(aqi\(aq\fP for case\-insensitive. +.IP \(bu 2 +\fB\(aqm\(aq\fP for multiple matching. +.IP \(bu 2 +\fB\(aqx\(aq\fP for verbose mode. +.IP \(bu 2 +\fB\(aql\(aq\fP to make w and W locale dependent. +.IP \(bu 2 +\fB\(aqs\(aq\fP for dotall mode (\(aq.\(aq matches everything) +.IP \(bu 2 +\fB\(aqu\(aq\fP to make w and W match unicode. +.UNINDENT +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the regex grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex_w_len.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex_w_len.3 new file mode 100644 index 0000000..ae2a70a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_regex_w_len.3 @@ -0,0 +1,92 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_REGEX_W_LEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_regex_w_len \- bson_append_regex_w_len() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_append_regex_w_len (bson_t *bson, + const char *key, + int key_length, + const char *regex, + int regex_length, + const char *options); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBregex\fP: An ASCII string containing the regex. +.IP \(bu 2 +\fBregex_length\fP: The length of \fBregex\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBoptions\fP: An optional string containing the regex options as a string. +.UNINDENT +.SH DESCRIPTION +.sp +Appends a new field to \fBbson\fP of type BSON_TYPE_REGEX. \fBregex\fP should be the regex string. \fBoptions\fP should contain the options for the regex. +.sp +Valid characters for \fBoptions\fP include: +.INDENT 0.0 +.IP \(bu 2 +\fB\(aqi\(aq\fP for case\-insensitive. +.IP \(bu 2 +\fB\(aqm\(aq\fP for multiple matching. +.IP \(bu 2 +\fB\(aqx\(aq\fP for verbose mode. +.IP \(bu 2 +\fB\(aql\(aq\fP to make w and W locale dependent. +.IP \(bu 2 +\fB\(aqs\(aq\fP for dotall mode (\(aq.\(aq matches everything) +.IP \(bu 2 +\fB\(aqu\(aq\fP to make w and W match unicode. +.UNINDENT +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the regex grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_symbol.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_symbol.3 new file mode 100644 index 0000000..4b5c076 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_symbol.3 @@ -0,0 +1,76 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_SYMBOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_symbol \- bson_append_symbol() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_SYMBOL(b, key, val) \e + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + +bool +bson_append_symbol (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: The symbol. +.IP \(bu 2 +\fBlength\fP: A length of \fBsymbol\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Appends a new field to \fBbson\fP of type BSON_TYPE_SYMBOL. This BSON type is deprecated and should not be used in new code. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_time_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_time_t.3 new file mode 100644 index 0000000..53b755a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_time_t.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_TIME_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_time_t \- bson_append_time_t() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_TIME_T(b, key, val) \e + bson_append_time_t (b, key, (int) strlen (key), val) + +bool +bson_append_time_t (bson_t *bson, + const char *key, + int key_length, + time_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A time_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_time_t()\fP function is a helper that takes a \fBtime_t\fP instead of milliseconds since the UNIX epoch. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timestamp.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timestamp.3 new file mode 100644 index 0000000..3917a8b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timestamp.3 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_TIMESTAMP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_timestamp \- bson_append_timestamp() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \e + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + +bool +bson_append_timestamp (bson_t *bson, + const char *key, + int key_length, + uint32_t timestamp, + uint32_t increment); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBtimestamp\fP: A uint32_t. +.IP \(bu 2 +\fBincrement\fP: A uint32_t. +.UNINDENT +.SH DESCRIPTION +.sp +This function is not similar in functionality to \fBbson_append_date_time()\fP\&. Timestamp elements are different in that they include only second precision and an increment field. +.sp +They are primarily used for intra\-MongoDB server communication. +.sp +The \fBbson_append_timestamp()\fP function shall append a new element of type BSON_TYPE_TIMESTAMP. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timeval.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timeval.3 new file mode 100644 index 0000000..7a832eb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_timeval.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_TIMEVAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_timeval \- bson_append_timeval() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_TIMEVAL(b, key, val) \e + bson_append_timeval (b, key, (int) strlen (key), val) + +bool +bson_append_timeval (bson_t *bson, + const char *key, + int key_length, + struct timeval *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A struct timeval. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_timeval()\fP function is a helper that takes a \fBstruct timeval\fP instead of milliseconds since the UNIX epoch. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_undefined.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_undefined.3 new file mode 100644 index 0000000..208d0a3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_undefined.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_UNDEFINED" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_undefined \- bson_append_undefined() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_UNDEFINED(b, key) \e + bson_append_undefined (b, key, (int) strlen (key)) + +bool +bson_append_undefined (bson_t *bson, const char *key, int key_length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_undefined()\fP function shall append a new element to \fBbson\fP of type BSON_TYPE_UNDEFINED. Undefined is common in Javascript. However, this element type is deprecated and should not be used in new code. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_utf8.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_utf8.3 new file mode 100644 index 0000000..645f9b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_utf8.3 @@ -0,0 +1,82 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_UTF8" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_utf8 \- bson_append_utf8() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_UTF8(b, key, val) \e + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + +bool +bson_append_utf8 (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A UTF\-8 encoded string. +.IP \(bu 2 +\fBlength\fP: The number of bytes in \fBvalue\fP excluding the trailing \fB\e0\fP, or \-1 to determine the length with \fBstrlen()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_append_utf8()\fP function shall append a UTF\-8 encoded string to \fBbson\fP\&. +.sp +\fBvalue\fP \fIMUST\fP be valid UTF\-8. +.sp +Some UTF\-8 implementations allow for \fB\e0\fP to be contained within the string (excluding the termination \fB\e0\fP\&. This is allowed, but remember that it could cause issues with communicating with external systems that do not support it. +.sp +It is suggested to use modified UTF\-8 which uses a 2 byte representation for embedded \fB\e0\fP within the string. This will allow these UTF\-8 encoded strings to used with many libc functions. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_value.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_value.3 new file mode 100644 index 0000000..d7e0039 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_append_value.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_APPEND_VALUE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_append_value \- bson_append_value() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_APPEND_VALUE(b, key, val) \e + bson_append_value (b, key, (int) strlen (key), (val)) + +bool +bson_append_value (bson_t *bson, + const char *key, + int key_length, + const bson_value_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII C string containing the name of the field. +.IP \(bu 2 +\fBkey_length\fP: The length of \fBkey\fP in bytes, or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBvalue\fP: A \fBbson_value_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Appends a new field to \fBbson\fP by determining the boxed type in \fBvalue\fP\&. This is useful if you want to copy fields between documents but do not know the field type until runtime. +.SH RETURNS +.sp +Returns \fBtrue\fP if the operation was applied successfully. The function will fail if appending the value grows \fBbson\fP larger than INT32_MAX. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_array_as_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_array_as_json.3 new file mode 100644 index 0000000..7681070 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_array_as_json.3 @@ -0,0 +1,104 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ARRAY_AS_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_array_as_json \- bson_array_as_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_array_as_json (const bson_t *bson, size_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_array_as_json()\fP function shall encode \fBbson\fP as a UTF\-8 +string using libbson\(aqs legacy JSON format, except the outermost element is +encoded as a JSON array, rather than a JSON document. +The caller is responsible for freeing the resulting UTF\-8 encoded string by +calling \fBbson_free()\fP with the result. +.sp +If non\-NULL, \fBlength\fP will be set to the length of the result in bytes. +.SH RETURNS +.sp +If successful, a newly allocated UTF\-8 encoded string and \fBlength\fP is set. +.sp +Upon failure, NULL is returned. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int main () +{ + bson_t bson; + char *str; + + bson_init (&bson); + /* BSON array is a normal BSON document with integer values for the keys, + * starting with 0 and continuing sequentially + */ + BSON_APPEND_UTF8 (&bson, "0", "foo"); + BSON_APPEND_UTF8 (&bson, "1", "bar"); + + str = bson_array_as_json (&bson, NULL); + /* Prints + * [ "foo", "bar" ] + */ + printf ("%s\en", str); + bson_free (str); + + bson_destroy (&bson); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_canonical_extended_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_canonical_extended_json.3 new file mode 100644 index 0000000..75a8b50 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_canonical_extended_json.3 @@ -0,0 +1,82 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_AS_CANONICAL_EXTENDED_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_as_canonical_extended_json \- bson_as_canonical_extended_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_as_canonical_extended_json (const bson_t *bson, size_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_as_canonical_extended_json()\fP encodes \fBbson\fP as a UTF\-8 string in the canonical \fI\%MongoDB Extended JSON format\fP\&. +.sp +The caller is responsible for freeing the resulting UTF\-8 encoded string by calling \fBbson_free()\fP with the result. +.sp +If non\-NULL, \fBlength\fP will be set to the length of the result in bytes. +.SH RETURNS +.sp +If successful, a newly allocated UTF\-8 encoded string and \fBlength\fP is set. +.sp +Upon failure, NULL is returned. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char *str = bson_as_canonical_extended_json (doc, NULL); +printf ("%s\en", str); +bson_free (str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_json.3 new file mode 100644 index 0000000..5e48418 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_json.3 @@ -0,0 +1,99 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_AS_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_as_json \- bson_as_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_as_json (const bson_t *bson, size_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_as_json()\fP function shall encode \fBbson\fP as a UTF\-8 string using libbson\(aqs legacy JSON format. This function is superseded by \fBbson_as_canonical_extended_json()\fP and \fBbson_as_relaxed_extended_json()\fP, which use the same \fI\%MongoDB Extended JSON format\fP as all other MongoDB drivers. +.sp +The caller is responsible for freeing the resulting UTF\-8 encoded string by calling \fBbson_free()\fP with the result. +.sp +If non\-NULL, \fBlength\fP will be set to the length of the result in bytes. +.SH RETURNS +.sp +If successful, a newly allocated UTF\-8 encoded string and \fBlength\fP is set. +.sp +Upon failure, NULL is returned. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int main () +{ + bson_t bson; + char *str; + + bson_init (&bson); + BSON_APPEND_UTF8 (&bson, "0", "foo"); + BSON_APPEND_UTF8 (&bson, "1", "bar"); + + str = bson_as_json (&bson, NULL); + /* Prints + * { "0" : "foo", "1" : "bar" } + */ + printf ("%s\en", str); + bson_free (str); + + bson_destroy (&bson); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_relaxed_extended_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_relaxed_extended_json.3 new file mode 100644 index 0000000..a662b51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_as_relaxed_extended_json.3 @@ -0,0 +1,82 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_AS_RELAXED_EXTENDED_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_as_relaxed_extended_json \- bson_as_relaxed_extended_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_as_relaxed_extended_json (const bson_t *bson, size_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_as_relaxed_extended_json()\fP encodes \fBbson\fP as a UTF\-8 string in the relaxed \fI\%MongoDB Extended JSON format\fP\&. +.sp +The caller is responsible for freeing the resulting UTF\-8 encoded string by calling \fBbson_free()\fP with the result. +.sp +If non\-NULL, \fBlength\fP will be set to the length of the result in bytes. +.SH RETURNS +.sp +If successful, a newly allocated UTF\-8 encoded string and \fBlength\fP is set. +.sp +Upon failure, NULL is returned. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char *str = bson_as_relaxed_extended_json (doc, NULL); +printf ("%s\en", str); +bson_free (str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_ascii_strtoll.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_ascii_strtoll.3 new file mode 100644 index 0000000..03c9369 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_ascii_strtoll.3 @@ -0,0 +1,79 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ASCII_STRTOLL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_ascii_strtoll \- bson_ascii_strtoll() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +bson_ascii_strtoll (const char *str, char **endptr, int base); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: The string to convert. +.IP \(bu 2 +\fBendptr\fP: Address of the first invalid character of \fBstr\fP, or null. +.IP \(bu 2 +\fBbase\fP: The base to use for the conversion. +.UNINDENT +.SH DESCRIPTION +.sp +A portable version of \fBstrtoll()\fP\&. +.sp +Converts a string to a 64\-bit signed integer according to the given \fBbase\fP, +which must be 16, 10, or 8. Leading whitespace will be ignored. +.sp +If base is 0 is passed in, the base is inferred from the string\(aqs leading +characters. Base\-16 numbers start with "0x" or "0X", base\-8 numbers start with +"0", base\-10 numbers start with a digit from 1 to 9. +.sp +If \fBendptr\fP is not NULL, it will be assigned the address of the first invalid +character of \fBstr\fP, or its null terminating byte if the entire string was valid. +.sp +If an invalid value is encountered, errno will be set to EINVAL and zero will +be returned. If the number is out of range, errno is set to ERANGE and +LLONG_MAX or LLONG_MIN is returned. +.SH RETURNS +.sp +The result of the conversion. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_character_and_string_routines.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_character_and_string_routines.3 new file mode 100644 index 0000000..0b98a45 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_character_and_string_routines.3 @@ -0,0 +1,40 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CHARACTER_AND_STRING_ROUTINES" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_character_and_string_routines \- Character and String Routines +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +We provide a small number of character and string routines to substitute for those that are not available on all platforms, and routines to make UTF\-8 character manipulation convenient. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_check_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_check_version.3 new file mode 100644 index 0000000..16d0e24 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_check_version.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CHECK_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_check_version \- bson_check_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_check_version (int required_major, int required_minor, int required_micro); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBrequired_major\fP: The minimum major version required. +.IP \(bu 2 +\fBrequired_minor\fP: The minimum minor version required. +.IP \(bu 2 +\fBrequired_micro\fP: The minimum micro version required. +.UNINDENT +.SH DESCRIPTION +.sp +Check at runtime if this release of libbson meets a required version. +.SH RETURNS +.sp +True if libbson\(aqs version is greater than or equal to the required version. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_compare.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_compare.3 new file mode 100644 index 0000000..2aac7a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_compare.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COMPARE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_compare \- bson_compare() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_compare (const bson_t *bson, const bson_t *other); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBother\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_compare()\fP function shall compare two bson documents for equality. +.sp +This can be useful in conjunction with _qsort()_. +.sp +If equal, 0 is returned. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +This function uses _memcmp()_ internally, so the semantics are the same. +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +less than zero, zero, or greater than zero in \fBqsort()\fP style. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_concat.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_concat.3 new file mode 100644 index 0000000..7ad3092 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_concat.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CONCAT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_concat \- bson_concat() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_concat (bson_t *dst, const bson_t *src); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdst\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBsrc\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_concat()\fP function shall append the contents of \fBsrc\fP to \fBdst\fP\&. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful; \fBfalse\fP if the operation would overflow the maximum document size or another invalid state is detected. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_destroy.3 new file mode 100644 index 0000000..c32766b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_destroy.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CONTEXT_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_context_destroy \- bson_context_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_context_destroy (bson_context_t *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcontext\fP: A \fBbson_context_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_context_destroy()\fP function shall release all resources associated with \fBcontext\fP\&. Does nothing if \fBcontext\fP is NULL. +.sp +This should be called when you are no longer using a \fBbson_context_t\fP that you have allocated with \fBbson_context_new()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_get_default.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_get_default.3 new file mode 100644 index 0000000..9a1c34b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_get_default.3 @@ -0,0 +1,53 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CONTEXT_GET_DEFAULT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_context_get_default \- bson_context_get_default() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_context_t * +bson_context_get_default (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +The \fBbson_context_get_default()\fP function shall return the default, thread\-safe, \fBbson_context_t\fP for the process. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_new.3 new file mode 100644 index 0000000..a495f8b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_new.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CONTEXT_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_context_new \- bson_context_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_context_t * +bson_context_new (bson_context_flags_t flags); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBflags\fP: A \fBbson_context_flags_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new \fBbson_context_t\fP\&. This is rarely needed as \fBbson_context_get_default()\fP serves most use\-cases. +.SH RETURNS +.sp +A newly allocated \fBbson_context_t\fP that should be freed with \fBbson_context_destroy\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_t.3 new file mode 100644 index 0000000..ad3d729 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_context_t.3 @@ -0,0 +1,103 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CONTEXT_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_context_t \- bson_context_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON OID Generation Context +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef enum { + BSON_CONTEXT_NONE = 0, + BSON_CONTEXT_THREAD_SAFE = (1 << 0), + BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1), + BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2), +#ifdef BSON_HAVE_SYSCALL_TID + BSON_CONTEXT_USE_TASK_ID = (1 << 3), +#endif +} bson_context_flags_t; + +typedef struct _bson_context_t bson_context_t; + +bson_context_t * +bson_context_get_default (void) BSON_GNUC_CONST; +bson_context_t * +bson_context_new (bson_context_flags_t flags); +void +bson_context_destroy (bson_context_t *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_context_t\fP structure is context for generation of BSON Object IDs. This context allows for specialized overriding of how ObjectIDs are generated based on the applications requirements. For example, disabling of PID caching can be configured if the application cannot detect when a call to \fBfork()\fP has occurred. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int +main (int argc, char *argv[]) +{ + bson_context_t *ctx = NULL; + bson_oid_t oid; + + /* use default context, via bson_context_get_default() */ + bson_oid_init (&oid, NULL); + + /* specify a local context for additional control */ + ctx = bson_context_new (BSON_CONTEXT_DISABLE_PID_CACHE | + BSON_CONTEXT_THREAD_SAFE); + bson_oid_init (&oid, ctx); + + bson_context_destroy (ctx); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy.3 new file mode 100644 index 0000000..26e0b9f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COPY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_copy \- bson_copy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_copy (const bson_t *bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_copy()\fP function shall copy the contents of a bson document into a new \fBbson_t\fP\&. +.sp +The resulting \fBbson_t\fP should be freed with \fBbson_destroy()\fP\&. +.SH RETURNS +.sp +A newly allocated \fBbson_t\fP that should be freed with \fBbson_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to.3 new file mode 100644 index 0000000..e37bdbd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COPY_TO" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_copy_to \- bson_copy_to() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_copy_to (const bson_t *src, bson_t *dst); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsrc\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBdst\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_copy_to()\fP function shall initialize \fBdst\fP with a copy of the contents of \fBsrc\fP\&. +.sp +\fBdst\fP \fIMUST\fP be an uninitialized \fBbson_t\fP to avoid leaking memory. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding.3 new file mode 100644 index 0000000..dd851a1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding.3 @@ -0,0 +1,82 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COPY_TO_EXCLUDING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_copy_to_excluding \- bson_copy_to_excluding() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_copy_to_excluding (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED + BSON_GNUC_DEPRECATED_FOR (bson_copy_to_excluding_noinit); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsrc\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBdst\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBfirst_exclude\fP: The first field name to exclude. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_copy_to_excluding()\fP function shall copy all fields from +\fBsrc\fP to \fBdst\fP except those specified by the variadic, NULL terminated list +of keys starting from \fBfirst_exclude\fP\&. +.SH DEPRECATED +.INDENT 0.0 +.INDENT 3.5 +This function is deprecated. Please use +\fBbson_copy_to_excluding_noinit\fP in new code. +.UNINDENT +.UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBbson_init\fP is called on \fBdst\fP\&. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding_noinit.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding_noinit.3 new file mode 100644 index 0000000..f496040 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_copy_to_excluding_noinit.3 @@ -0,0 +1,113 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COPY_TO_EXCLUDING_NOINIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_copy_to_excluding_noinit \- bson_copy_to_excluding_noinit() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_copy_to_excluding_noinit (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsrc\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBdst\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBfirst_exclude\fP: The first field name to exclude. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_copy_to_excluding_noinit()\fP function shall copy all fields +from \fBsrc\fP to \fBdst\fP except those specified by the variadic, NULL terminated +list of keys starting from \fBfirst_exclude\fP\&. +Works the same way as \fBbson_copy_to_excluding\fP, except does \fBnot\fP call +\fBbson_init\fP on \fBdst\fP\&. +This function should be preferred in new code over \fBbson_copy_to_excluding\fP\&. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This is generally not needed except in very special situations. +.UNINDENT +.UNINDENT +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int main () +{ + bson_t bson; + bson_t bson2; + char *str; + + bson_init (&bson); + bson_append_int32 (&bson, "a", 1, 1); + bson_append_int32 (&bson, "b", 1, 2); + bson_append_int32 (&bson, "c", 1, 2); + + bson_init (&bson2); + bson_copy_to_excluding_noinit (&bson, &bson2, "b", NULL); + + str = bson_as_json (&bson2, NULL); + /* Prints + * { "a" : 1, "c" : 2 } + */ + printf ("%s\en", str); + bson_free (str); + + bson_destroy (&bson); + bson_destroy (&bson2); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_count_keys.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_count_keys.3 new file mode 100644 index 0000000..fea1f5a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_count_keys.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_COUNT_KEYS" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_count_keys \- bson_count_keys() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +bson_count_keys (const bson_t *bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_count_keys()\fP function shall count the number of elements within \fBbson\fP\&. +.SH RETURNS +.sp +A positive integer or zero. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_creating.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_creating.3 new file mode 100644 index 0000000..c727aa2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_creating.3 @@ -0,0 +1,186 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CREATING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_creating \- Creating a BSON Document +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH THE BSON_T STRUCTURE +.sp +BSON documents are created using the \fBbson_t\fP structure. This structure encapsulates the necessary logic for encoding using the \fI\%BSON Specification\fP\&. At the core, \fBbson_t\fP is a buffer manager and set of encoding routines. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +BSON documents can live on the stack or the heap based on the performance needs or preference of the consumer. +.UNINDENT +.UNINDENT +.sp +Let\(aqs start by creating a new BSON document on the stack. Whenever using libbson, make sure you \fB#include \fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b; + +bson_init (&b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This creates an empty document. In JSON, this would be the same as \fB{}\fP\&. +.sp +We can now proceed to adding items to the BSON document. A variety of functions prefixed with \fBbson_append_\fP can be used based on the type of field you want to append. Let\(aqs append a UTF\-8 encoded string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice the two \fB\-1\fP parameters. The first indicates that the length of \fBkey\fP in bytes should be determined with \fBstrlen()\fP\&. Alternatively, we could have passed the number \fB3\fP\&. The same goes for the second \fB\-1\fP, but for \fBvalue\fP\&. +.sp +Libbson provides macros to make this less tedious when using string literals. The following two appends are identical. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +BSON_APPEND_UTF8 (&b, "key", "value"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Now let\(aqs take a look at an example that adds a few different field types to a BSON document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b = BSON_INITIALIZER; + +BSON_APPEND_INT32 (&b, "a", 1); +BSON_APPEND_UTF8 (&b, "hello", "world"); +BSON_APPEND_BOOL (&b, "bool", true); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice that we omitted the call to \fBbson_init()\fP\&. By specifying \fBBSON_INITIALIZER\fP we can remove the need to initialize the structure to a base state. +.SH SUB-DOCUMENTS AND SUB-ARRAYS +.sp +To simplify the creation of sub\-documents and arrays, \fBbson_append_document_begin()\fP and \fBbson_append_array_begin()\fP exist. These can be used to build a sub\-document using the parent documents memory region as the destination buffer. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t parent; +bson_t child; +char *str; + +bson_init (&parent); +bson_append_document_begin (&parent, "foo", 3, &child); +bson_append_int32 (&child, "baz", 3, 1); +bson_append_document_end (&parent, &child); + +str = bson_as_canonical_extended_json (&parent, NULL); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (&parent); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "baz" : 1 } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH SIMPLIFIED BSON C OBJECT NOTATION +.sp +Creating BSON documents by hand can be tedious and time consuming. BCON, or BSON C Object Notation, was added to allow for the creation of BSON documents in a format that looks closer to the destination format. +.sp +The following example shows the use of BCON. Notice that values for fields are wrapped in the \fBBCON_*\fP macros. These are required for the variadic processor to determine the parameter type. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *doc; + +doc = BCON_NEW ("foo", + "{", + "int", + BCON_INT32 (1), + "array", + "[", + BCON_INT32 (100), + "{", + "sub", + BCON_UTF8 ("value"), + "}", + "]", + "}"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Creates the following document +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "int" : 1, "array" : [ 100, { "sub" : "value" } ] } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_cross_platform_notes.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_cross_platform_notes.3 new file mode 100644 index 0000000..05f6bba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_cross_platform_notes.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_CROSS_PLATFORM_NOTES" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_cross_platform_notes \- Cross Platform Notes +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH ENDIANNESS +.sp +The BSON specification dictates that the encoding format is in little\-endian. Many implementations simply ignore endianness altogether and expect that they are to be run on little\-endian. Libbson supports both Big and Little Endian systems. This means we use \fBmemcpy()\fP when appropriate instead of dereferencing and properly convert to and from the host endian format. We expect the compiler intrinsics to optimize it to a dereference when possible. +.SH THREADING +.sp +Libbson\(aqs data structures are \fINOT\fP thread\-safe. You are responsible for accessing and mutating these structures from one thread at a time. +.sp +Libbson requires POSIX threads (pthreads) on all UNIX\-like platforms. On Windows, the native threading interface is used. Libbson uses your system\(aqs threading library to safely generate unique ObjectIds, and to provide a fallback implementation for atomic operations on platforms without built\-in atomics. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string.3 new file mode 100644 index 0000000..01c73f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DECIMAL128_FROM_STRING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_decimal128_from_string \- bson_decimal128_from_string() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_decimal128_from_string (const char *string, bson_decimal128_t *dec); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A string containing ASCII encoded Decimal128. +.IP \(bu 2 +\fBdec\fP: A \fBbson_decimal128_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Parses the string containing ascii encoded Decimal128 and initialize the bytes +in \fBdec\fP\&. See the \fI\%Decimal128 specification\fP +for the exact string format. +.SH RETURNS +.sp +Returns \fBtrue\fP if valid Decimal128 string was provided, otherwise \fBfalse\fP +and \fBdec\fP will be set to \fBNaN\fP\&. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_decimal128_t dec; +bson_decimal128_from_string ("1.00", &dec); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string_w_len.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string_w_len.3 new file mode 100644 index 0000000..b1eaf3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_from_string_w_len.3 @@ -0,0 +1,83 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DECIMAL128_FROM_STRING_W_LEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_decimal128_from_string_w_len \- bson_decimal128_from_string_w_len() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_decimal128_from_string_w_len (const char *string, + int len, + bson_decimal128_t *dec); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A string containing ASCII encoded Decimal128. +.IP \(bu 2 +\fBlen\fP: The length of \fBstring\fP in bytes, or \-1 meaning the string is null\-terminated. +.IP \(bu 2 +\fBdec\fP: A \fBbson_decimal128_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Parses the string containing ascii encoded Decimal128 and initialize the bytes +in \fBdec\fP\&. See the \fI\%Decimal128 specification\fP +for the exact string format. +.SH RETURNS +.sp +Returns \fBtrue\fP if valid Decimal128 string was provided, otherwise \fBfalse\fP +and \fBdec\fP will be set to \fBNaN\fP\&. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_decimal128_t dec; +bson_decimal128_from_string_w_len ("1.00", 4, &dec); +bson_decimal128_from_string_w_len ("1.00", \-1, &dec); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_t.3 new file mode 100644 index 0000000..16a82cf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_t.3 @@ -0,0 +1,94 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DECIMAL128_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_decimal128_t \- bson_decimal128_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Decimal128 Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +#define BSON_DECIMAL128_STRING 43 +#define BSON_DECIMAL128_INF "Infinity" +#define BSON_DECIMAL128_NAN "NaN" + +typedef struct { +#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN + uint64_t low; + uint64_t high; +#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN + uint64_t high; + uint64_t low; +#endif +} bson_decimal128_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_decimal128_t\fP structure +represents the IEEE\-754 Decimal128 data type. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + char string[BSON_DECIMAL128_STRING]; + bson_decimal128_t decimal128; + + bson_decimal128_from_string ("100.00", &decimal128); + bson_decimal128_to_string (&decimal128, string); + printf ("Decimal128 value: %s\en", string); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_to_string.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_to_string.3 new file mode 100644 index 0000000..c3b7ad3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_decimal128_to_string.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DECIMAL128_TO_STRING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_decimal128_to_string \- bson_decimal128_to_string() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_decimal128_to_string (const bson_decimal128_t *dec, char *str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdec\fP: A \fBbson_decimal128_t\fP\&. +.IP \(bu 2 +\fBstr\fP: A location of length BSON_DECIMAL128_STRING for the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +Converts \fBdec\fP into a printable string. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char decimal128_string[BSON_DECIMAL128_STRING]; +bson_decimal128_to_string (&decimal128t, decimal128_string); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy.3 new file mode 100644 index 0000000..a8db464 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_destroy \- bson_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_destroy (bson_t *bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_destroy()\fP function shall free an allocated \fBbson_t\fP structure. Does nothing if \fBbson\fP is NULL. +.sp +This function should always be called when you are done with a \fBbson_t\fP unless otherwise specified. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy_with_steal.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy_with_steal.3 new file mode 100644 index 0000000..5f95fc0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_destroy_with_steal.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_DESTROY_WITH_STEAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_destroy_with_steal \- bson_destroy_with_steal() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint8_t * +bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBsteal\fP: A bool indicating if the underlying buffer should be stolen. +.IP \(bu 2 +\fBlength\fP: A location for storing the resulting buffer length. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_destroy_with_steal()\fP function shall destroy a \fBbson_t\fP structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a \fBbson_t\fP that is not a top\-level \fBbson_t\fP, such as those initialized with \fBbson_append_document_begin()\fP, \fBbson_append_array_begin()\fP, and \fBbson_writer_begin()\fP\&. +.sp +See also \fBbson_steal\fP, a higher\-level function that efficiently transfers the contents of one \fBbson_t\fP to another. +.SH RETURNS +.sp +\fBbson_destroy_with_steal()\fP shall return a buffer containing the contents of the \fBbson_t\fP if \fBsteal\fP is non\-zero. This should be freed with \fBbson_free()\fP when no longer in use. \fBlength\fP will be set to the length of the bson document if non\-NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_endianness.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_endianness.3 new file mode 100644 index 0000000..2dd297b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_endianness.3 @@ -0,0 +1,40 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ENDIANNESS" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_endianness \- Endianness +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +The BSON specification dictates that the encoding format is in little\-endian. Many implementations simply ignore endianness altogether and expect that they are to be run on little\-endian. Libbson supports both Big and Little Endian systems. This means we use \fBmemcpy()\fP when appropriate instead of dereferencing and properly convert to and from the host endian format. We expect the compiler intrinsics to optimize it to a dereference when possible. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_equal.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_equal.3 new file mode 100644 index 0000000..cd1ce5b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_equal.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_EQUAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_equal \- bson_equal() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_equal (const bson_t *bson, const bson_t *other); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBother\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_equal()\fP function shall return true if both documents are equal. +.SH RETURNS +.sp +true if both documents are equal. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_error_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_error_t.3 new file mode 100644 index 0000000..c7e7435 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_error_t.3 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ERROR_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_error_t \- bson_error_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Error Encapsulation +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + uint32_t domain; + uint32_t code; + char message[504]; +} bson_error_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_error_t\fP structure is used as an out\-parameter to pass error information to the caller. It should be stack\-allocated and does not requiring freeing. +.sp +See Handling Errors\&. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t *reader; +bson_error_t error; + +reader = bson_reader_new_from_file ("dump.bson", &error); +if (!reader) { + fprintf ( + stderr, "ERROR: %d.%d: %s\en", error.domain, error.code, error.message); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_errors.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_errors.3 new file mode 100644 index 0000000..435479e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_errors.3 @@ -0,0 +1,76 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ERRORS" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_errors \- Handling Errors +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DESCRIPTION +.sp +Many libbson functions report errors by returning \fBNULL\fP or \-1 and filling out a \fBbson_error_t\fP structure with an error domain, error code, and message. +.INDENT 0.0 +.IP \(bu 2 +\fBerror.domain\fP names the subsystem that generated the error. +.IP \(bu 2 +\fBerror.code\fP is a domain\-specific error type. +.IP \(bu 2 +\fBerror.message\fP describes the error. +.UNINDENT +.sp +Some error codes overlap with others; always check both the domain and code to determine the type of error. +.TS +center; +|l|l|l|. +_ +T{ +\fBBSON_ERROR_JSON\fP +T} T{ +\fBBSON_JSON_ERROR_READ_CORRUPT_JS\fP +\fBBSON_JSON_ERROR_READ_INVALID_PARAM\fP +\fBBSON_JSON_ERROR_READ_CB_FAILURE\fP +T} T{ +\fBbson_json_reader_t\fP tried to parse invalid MongoDB Extended JSON. +Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. +An internal callback failure during JSON parsing. +T} +_ +T{ +\fBBSON_ERROR_READER\fP +T} T{ +\fBBSON_ERROR_READER_BADFD\fP +T} T{ +\fBbson_json_reader_new_from_file\fP could not open the file. +T} +_ +.TE +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_free.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_free.3 new file mode 100644 index 0000000..14bcb23 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_free.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_FREE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_free \- bson_free() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_free (void *mem); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBmem\fP: A memory region. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall free the memory supplied by \fBmem\fP\&. This should be used by functions that require you free the result with \fBbson_free()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_data.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_data.3 new file mode 100644 index 0000000..528a0c3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_data.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_DATA" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_data \- bson_get_data() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const uint8_t * +bson_get_data (const bson_t *bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_get_data()\fP function shall return the raw buffer of a bson document. This can be used in conjunction with the \fBlen\fP property of a \fBbson_t\fP if you want to copy the raw buffer around. +.SH RETURNS +.sp +A buffer which should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_major_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_major_version.3 new file mode 100644 index 0000000..5c60ca8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_major_version.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_MAJOR_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_major_version \- bson_get_major_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_get_major_version (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +Get the first number in libbson\(aqs MAJOR.MINOR.MICRO release version. +.SH RETURNS +.sp +The value of \fBBSON_MAJOR_VERSION\fP when Libbson was compiled. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_micro_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_micro_version.3 new file mode 100644 index 0000000..9884643 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_micro_version.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_MICRO_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_micro_version \- bson_get_micro_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_get_micro_version (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +Get the third number in libbson\(aqs MAJOR.MINOR.MICRO release version. +.SH RETURNS +.sp +The value of \fBBSON_MICRO_VERSION\fP when Libbson was compiled. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_minor_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_minor_version.3 new file mode 100644 index 0000000..42e687b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_minor_version.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_MINOR_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_minor_version \- bson_get_minor_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_get_minor_version (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +Get the middle number in libbson\(aqs MAJOR.MINOR.MICRO release version. +.SH RETURNS +.sp +The value of \fBBSON_MINOR_VERSION\fP when Libbson was compiled. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_monotonic_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_monotonic_time.3 new file mode 100644 index 0000000..ae0b72f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_monotonic_time.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_MONOTONIC_TIME" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_monotonic_time \- System Clock +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Clock Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +bson_get_monotonic_time (void); +int +bson_gettimeofday (struct timeval *tv, + struct timezone *tz); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The clock abstraction in Libbson provides a cross\-platform way to handle timeouts within the BSON library. It abstracts the differences in implementations of \fBgettimeofday()\fP as well as providing a monotonic (incrementing only) clock in microseconds. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_version.3 new file mode 100644 index 0000000..1ef6a70 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_get_version.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GET_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_get_version \- bson_get_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +bson_get_version (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +A string representation of Libbson\(aqs version, formatted something like "1.2.3" or "1.2.3\-dev". +.SH RETURNS +.sp +A string you must not modify or free. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_guides.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_guides.3 new file mode 100644 index 0000000..fb0e9a3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_guides.3 @@ -0,0 +1,435 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_GUIDES" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_guides \- Guides +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH STREAMING BSON +.sp +\fBbson_reader_t\fP provides a streaming reader which can be initialized with a filedescriptor or memory region. \fBbson_writer_t\fP provides a streaming writer which can be initialized with a memory region. (Streaming BSON to a file descriptor is not yet supported.) +.SS Reading from a BSON Stream +.sp +\fBbson_reader_t\fP provides a convenient API to read sequential BSON documents from a file\-descriptor or memory buffer. The \fBbson_reader_read()\fP function will read forward in the underlying stream and return a \fBbson_t\fP that can be inspected and iterated upon. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *doc; + bson_error_t error; + bool eof; + + reader = bson_reader_new_from_file ("mycollection.bson", &error); + + if (!reader) { + fprintf (stderr, "Failed to open file.\en"); + return 1; + } + + while ((doc = bson_reader_read (reader, &eof))) { + char *str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\en", str); + bson_free (str); + } + + if (!eof) { + fprintf (stderr, + "corrupted bson document found at %u\en", + (unsigned) bson_reader_tell (reader)); + } + + bson_reader_destroy (reader); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_reader_new_from_fd()\fP, \fBbson_reader_new_from_file()\fP, and \fBbson_reader_new_from_data()\fP for more information. +.SS Writing a sequence of BSON Documents +.sp +\fBbson_writer_t\fP provides a convenient API to write a sequence of BSON documents to a memory buffer that can grow with \fBrealloc()\fP\&. The \fBbson_writer_begin()\fP and \fBbson_writer_end()\fP functions will manage the underlying buffer while building the sequence of documents. +.sp +This could also be useful if you want to write to a network packet while serializing the documents from a higher level language, (but do so just after the packets header). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_writer_t *writer; + bson_t *doc; + uint8_t *buf = NULL; + size_t buflen = 0; + bool r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 10000; i++) { + r = bson_writer_begin (writer, &doc); + assert (r); + + r = BSON_APPEND_INT32 (doc, "i", i); + assert (r); + + bson_writer_end (writer); + } + + bson_free (buf); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_writer_new()\fP for more information. +.SH JSON +.sp +Libbson provides routines for converting to and from the JSON format. In particular, it supports the \fI\%MongoDB extended JSON\fP format. +.SS Converting BSON to JSON +.sp +There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the functions \fBbson_as_canonical_extended_json()\fP and \fBbson_as_relaxed_extended_json()\fP\&. The canonical format preserves BSON type information for values that may have ambiguous representations in JSON (e.g. numeric types). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_canonical_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : { "$numberInt": "1" } } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The relaxed format prefers JSON primitives for numeric values and may be used if type fidelity is not required. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_relaxed_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : 1 } +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Converting JSON to BSON +.sp +Converting back from JSON is also useful and common enough that we added \fBbson_init_from_json()\fP and \fBbson_new_from_json()\fP\&. +.sp +The following example creates a new \fBbson_t\fP from the JSON string \fB{"a":1}\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_error_t error; + +b = bson_new_from_json ("{\e"a\e":1}", \-1, &error); + +if (!b) { + printf ("Error: %s\en", error.message); +} else { + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Streaming JSON Parsing +.sp +Libbson provides \fBbson_json_reader_t\fP to allow for parsing a sequence of JSON documents into BSON. The interface is similar to \fBbson_reader_t\fP but expects the input to be in the \fI\%MongoDB extended JSON\fP format. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "\-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\en%s\en", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\en"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Examples +.sp +The following example reads BSON documents from \fBstdin\fP and prints them to \fBstdout\fP as JSON. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | \-]...\enUse \- for STDIN.\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "\-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH USE VALGRIND TO CHECK FOR BSON DATA LEAKS +.sp +A stack\-allocated \fBbson_t\fP contains a small internal buffer; it only heap\-allocates additional storage if necessary, depending on its data size. Therefore if you forget to call \fBbson_destroy\fP on a stack\-allocated \fBbson_t\fP, it might or might not cause a leak that can be detected by valgrind during testing. +.sp +To catch all potential BSON data leaks in your code, configure the BSON_MEMCHECK flag: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +cmake \-DCMAKE_C_FLAGS="\-DBSON_MEMCHECK \-g" . +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +With this flag set, every \fBbson_t\fP mallocs at least one byte. Run your program\(aqs unittests with valgrind to verify all \fBbson_t\fP structs are destroyed. +.sp +Set the environment variable \fBMONGOC_TEST_VALGRIND\fP to \fBon\fP to skip timing\-dependent tests known to fail with valgrind. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_has_field.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_has_field.3 new file mode 100644 index 0000000..3c38189 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_has_field.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_HAS_FIELD" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_has_field \- bson_has_field() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_has_field (const bson_t *bson, const char *key); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A string containing the name of the field to check for. +.UNINDENT +.SH DESCRIPTION +.sp +Checks to see if key contains an element named \fBkey\fP\&. This also accepts "dotkey" notation such as "a.b.c.d". +.SH RETURNS +.sp +true if \fBkey\fP was found within \fBbson\fP; otherwise false. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_include_and_link.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_include_and_link.3 new file mode 100644 index 0000000..de22c44 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_include_and_link.3 @@ -0,0 +1,145 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_INCLUDE_AND_LINK" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_include_and_link \- Using libbson In Your C Program +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH INCLUDE BSON.H +.sp +All libbson\(aqs functions and types are available in one header file. Simply include \fBbson.h\fP: +hello_bson.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, const char **argv) +{ + bson_t *b; + char *j; + + b = BCON_NEW ("hello", BCON_UTF8 ("bson!")); + j = bson_as_canonical_extended_json (b, NULL); + printf ("%s\en", j); + + bson_free (j); + bson_destroy (b); + + return 0; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CMAKE +.sp +The libbson installation includes a \fI\%CMake config\-file package\fP, so you can use CMake\(aqs \fI\%find_package\fP command to find libbson\(aqs header and library paths and link to libbson: +CMakeLists.txt.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-1.0 1.7 REQUIRED) + +message ("\-\- libbson found version \e"${BSON_VERSION}\e"") +message ("\-\- libbson include path \e"${BSON_INCLUDE_DIRS}\e"") +message ("\-\- libbson libraries \e"${BSON_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +By default, libbson is dynamically linked. You can use libbson as a static library instead: Use the included \fBlibbson\-static\-1.0\fP config\-file package and (on Unix) link to \fBpthread\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-static\-1.0 1.7 REQUIRED) + +message ("\-\- libbson\-static found version \e"${BSON_STATIC_VERSION}\e"") +message ("\-\- libbson\-static include path \e"${BSON_STATIC_INCLUDE_DIRS}\e"") +message ("\-\- libbson\-static libraries \e"${BSON_STATIC_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_STATIC_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_STATIC_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_STATIC_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PKG-CONFIG +.sp +If you\(aqre not using CMake, use \fI\%pkg\-config\fP on the command line to set header and library paths: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Or to statically link to libbson: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-static\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init.3 new file mode 100644 index 0000000..3f82a25 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_INIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_init \- bson_init() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_init (bson_t *b); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBb\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_init()\fP function shall initialize a \fBbson_t\fP that is placed on the stack. This is equivalent to initializing a \fBbson_t\fP to \fBBSON_INITIALIZER\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_from_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_from_json.3 new file mode 100644 index 0000000..b44bb94 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_from_json.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_INIT_FROM_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_init_from_json \- bson_init_from_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_init_from_json (bson_t *bson, + const char *data, + ssize_t len, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: Pointer to an uninitialized \fBbson_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A UTF\-8 encoded string containing valid JSON. +.IP \(bu 2 +\fBlen\fP: The length of \fBdata\fP in bytes excluding a trailing \fB\e0\fP or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_init_from_json()\fP function will initialize a new \fBbson_t\fP by parsing the JSON found in \fBdata\fP\&. Only a single JSON object may exist in \fBdata\fP or an error will be set and false returned. +.sp +\fBdata\fP should be in \fI\%MongoDB Extended JSON\fP format. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if valid JSON was parsed, otherwise \fBfalse\fP and \fBerror\fP is set. On success, \fBbson\fP is initialized and must be freed with \fBbson_destroy\fP, otherwise \fBbson\fP is invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_static.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_static.3 new file mode 100644 index 0000000..7a431c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_init_static.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_INIT_STATIC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_init_static \- bson_init_static() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_init_static (bson_t *b, const uint8_t *data, size_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBb\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A buffer to initialize with. +.IP \(bu 2 +\fBlength\fP: The length of \fBdata\fP in bytes. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_init_static()\fP function shall shall initialize a read\-only \fBbson_t\fP on the stack using the data provided. No copies of the data will be made and therefore must remain valid for the lifetime of the \fBbson_t\fP\&. +.sp +The resulting \fIbson_t\fP has internal references and therefore must not be copied to avoid dangling pointers in the copy. +.SH RETURNS +.sp +Returns \fBtrue\fP if \fBbson_t\fP was successfully initialized, otherwise \fBfalse\fP\&. The function can fail if \fBdata\fP or \fBlength\fP are invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_array.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_array.3 new file mode 100644 index 0000000..c4e5be6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_array.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_ARRAY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_array \- bson_iter_array() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_ARRAY(iter) (bson_iter_type ((iter)) == BSON_TYPE_ARRAY) + +void +bson_iter_array (const bson_iter_t *iter, + uint32_t *array_len, + const uint8_t **array); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBarray_len\fP: A location for the buffer length. +.IP \(bu 2 +\fBarray\fP: A location for the immutable buffer. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_array()\fP function shall retrieve the raw buffer of a sub\-array from \fBiter\fP\&. \fBiter\fP \fIMUST\fP be on an element that is of type BSON_TYPE_ARRAY. This can be verified with \fBbson_iter_type()\fP or the \fBBSON_ITER_HOLDS_ARRAY()\fP macro. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_bool.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_bool.3 new file mode 100644 index 0000000..d2d82d3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_bool.3 @@ -0,0 +1,81 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_AS_BOOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_as_bool \- bson_iter_as_bool() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_as_bool (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the current field as if it were a boolean. +.sp +\fBbson_iter_as_bool()\fP currently knows how to determine a boolean value from the following types: +.INDENT 0.0 +.IP \(bu 2 +BSON_TYPE_BOOL +.IP \(bu 2 +BSON_TYPE_DOUBLE +.IP \(bu 2 +BSON_TYPE_INT32 +.IP \(bu 2 +BSON_TYPE_INT64 +.IP \(bu 2 +BSON_TYPE_NULL +.IP \(bu 2 +BSON_TYPE_UNDEFINED +.IP \(bu 2 +BSON_TYPE_UTF8 +.UNINDENT +.sp +BSON_TYPE_UTF8 will always equate to \fBtrue\fP\&. +.SH RETURNS +.sp +true if the field equates to non\-zero. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_double.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_double.3 new file mode 100644 index 0000000..659f9d5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_double.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_AS_DOUBLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_as_double \- bson_iter_as_double() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_as_double (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the current field as if it were a double. +.sp +\fBbson_iter_as_double()\fP will cast the following types to double +.INDENT 0.0 +.IP \(bu 2 +BSON_TYPE_BOOL +.IP \(bu 2 +BSON_TYPE_DOUBLE +.IP \(bu 2 +BSON_TYPE_INT32 +.IP \(bu 2 +BSON_TYPE_INT64 +.UNINDENT +.sp +Any other value will return 0. +.SH RETURNS +.sp +The value type casted to double. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_int64.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_int64.3 new file mode 100644 index 0000000..ae6245a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_as_int64.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_AS_INT64" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_as_int64 \- bson_iter_as_int64() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +bson_iter_as_int64 (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_as_int64()\fP function shall return the contents of the current element as if it were a BSON_TYPE_INT64 element. The currently supported casts include: +.INDENT 0.0 +.IP \(bu 2 +BSON_TYPE_BOOL +.IP \(bu 2 +BSON_TYPE_DOUBLE +.IP \(bu 2 +BSON_TYPE_INT32 +.IP \(bu 2 +BSON_TYPE_INT64 +.UNINDENT +.SH RETURNS +.sp +A 64\-bit signed integer. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_binary.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_binary.3 new file mode 100644 index 0000000..0642f91 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_binary.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_BINARY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_binary \- bson_iter_binary() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_BINARY(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_BINARY) + +void +bson_iter_binary (const bson_iter_t *iter, + bson_subtype_t *subtype, + uint32_t *binary_len, + const uint8_t **binary); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBsubtype\fP: A location for a \fBbson_subtype_t\fP or NULL. +.IP \(bu 2 +\fBbinary_len\fP: A location for the length of \fBbinary\fP\&. +.IP \(bu 2 +\fBbinary\fP: A location for a pointer to the immutable buffer. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall return the binary data of a BSON_TYPE_BINARY element. It is a programming error to call this function on a field that is not of type BSON_TYPE_BINARY. You can check this with the BSON_ITER_HOLDS_BINARY() macro or \fBbson_iter_type()\fP\&. +.sp +The buffer that \fBbinary\fP points to is only valid until the iterator\(aqs \fBbson_t\fP is modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_bool.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_bool.3 new file mode 100644 index 0000000..1962312 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_bool.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_BOOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_bool \- bson_iter_bool() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_BOOL(iter) (bson_iter_type ((iter)) == BSON_TYPE_BOOL) + +bool +bson_iter_bool (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_bool()\fP function shall return the boolean value of a BSON_TYPE_BOOL element. It is a programming error to call this function on an element other than BSON_TYPE_BOOL. You can check this with \fBbson_iter_type()\fP or \fBBSON_ITER_HOLDS_BOOL()\fP\&. +.SH RETURNS +.sp +Either \fBtrue\fP or \fBfalse\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_code.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_code.3 new file mode 100644 index 0000000..7d64d87 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_code.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_CODE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_code \- bson_iter_code() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_CODE(iter) (bson_iter_type ((iter)) == BSON_TYPE_CODE) + +const char * +bson_iter_code (const bson_iter_t *iter, uint32_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBlength\fP: A location for the length of the UTF\-8 encoded string or NULL. +.UNINDENT +.SH DESCRIPTION +.sp +This function returns the contents of a BSON_TYPE_CODE field. The length of the string is stored in \fBlength\fP if non\-NULL. +.sp +It is invalid to call this function on a field that is not of type BSON_TYPE_CODE. +.SH RETURNS +.sp +A UTF\-8 encoded string which should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_codewscope.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_codewscope.3 new file mode 100644 index 0000000..b8ccf95 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_codewscope.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_CODEWSCOPE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_codewscope \- bson_iter_codewscope() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_CODEWSCOPE(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_CODEWSCOPE) + +const char * +bson_iter_codewscope (const bson_iter_t *iter, + uint32_t *length, + uint32_t *scope_len, + const uint8_t **scope); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting UTF\-8 encoded string. +.IP \(bu 2 +\fBscope_len\fP: A optional location for the length of \fBscope\fP\&. +.IP \(bu 2 +\fBscope\fP: An optional location to store the immutable raw scope BSON document. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_codewscope()\fP function acts similar to \fBbson_iter_code()\fP except for BSON_TYPE_CODEWSCOPE elements. It also will provide a pointer to the buffer for scope, which can be loaded into a \fBbson_t\fP using \fBbson_init_static()\fP\&. +.SH RETURNS +.sp +An UTF\-8 encoded string containing the JavaScript code which should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_date_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_date_time.3 new file mode 100644 index 0000000..58c7c5b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_date_time.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DATE_TIME" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_date_time \- bson_iter_date_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_DATE_TIME(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_DATE_TIME) + +int64_t +bson_iter_date_time (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The bson_iter_date_time() function shall return the number of milliseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element. +.SH RETURNS +.sp +A 64\-bit integer containing the number of milliseconds since the UNIX epoch. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dbpointer.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dbpointer.3 new file mode 100644 index 0000000..0e474ca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dbpointer.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DBPOINTER" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_dbpointer \- bson_iter_dbpointer() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_dbpointer (const bson_iter_t *iter, + uint32_t *collection_len, + const char **collection, + const bson_oid_t **oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBcollection_len\fP: A location for the length of the collection name. +.IP \(bu 2 +\fBcollection\fP: A location for the collection name.. +.IP \(bu 2 +\fBoid\fP: A location for a \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the contents of a BSON_TYPE_DBPOINTER element. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +The BSON_TYPE_DBPOINTER field type is deprecated by the BSON spec and should not be used in new code. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_decimal128.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_decimal128.3 new file mode 100644 index 0000000..a9e965c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_decimal128.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DECIMAL128" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_decimal128 \- bson_iter_decimal128() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_DECIMAL128(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_DECIMAL128) + +bool +bson_iter_decimal128 (const bson_iter_t *iter, /* IN */ + bson_decimal128_t *dec); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBdec\fP: A location for a \fBbson_decimal128_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the value from a BSON_TYPE_DECIMAL128 field. You should verify that this is a BSON_TYPE_DECIMAL128 field before calling this function. +.SH RETURNS +.sp +true if type was BSON_TYPE_DECIMAL128, otherwise false. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_document.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_document.3 new file mode 100644 index 0000000..ece3c92 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_document.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DOCUMENT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_document \- bson_iter_document() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_DOCUMENT(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_DOCUMENT) + +void +bson_iter_document (const bson_iter_t *iter, + uint32_t *document_len, + const uint8_t **document); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBdocument_len\fP: A location for the length of the document in bytes. +.IP \(bu 2 +\fBdocument\fP: A location for the document buffer. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_document()\fP function shall retrieve the raw buffer of a sub\-document from \fBiter\fP\&. \fBiter\fP \fIMUST\fP be on an element that is of type BSON_TYPE_DOCUMENT. This can be verified with \fBbson_iter_type()\fP or the \fBBSON_ITER_HOLDS_DOCUMENT()\fP macro. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_double.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_double.3 new file mode 100644 index 0000000..9835a68 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_double.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DOUBLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_double \- bson_iter_double() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_DOUBLE(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_DOUBLE) + +double +bson_iter_double (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the contents of a BSON_TYPE_DOUBLE field. +.SH RETURNS +.sp +A double. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dup_utf8.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dup_utf8.3 new file mode 100644 index 0000000..4963a1d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_dup_utf8.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_DUP_UTF8" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_dup_utf8 \- bson_iter_dup_utf8() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_iter_dup_utf8 (const bson_iter_t *iter, uint32_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the UTF\-8 encoded string. +.UNINDENT +.SH DESCRIPTION +.sp +This function is similar to \fBbson_iter_utf8()\fP except that it calls \fBbson_strndup()\fP on the result. +.SH RETURNS +.sp +A newly allocated string that should be freed with \fBbson_free()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find.3 new file mode 100644 index 0000000..d734470 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_FIND" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_find \- bson_iter_find() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_find (bson_iter_t *iter, const char *key); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A string containing the requested key. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_find()\fP function shall advance \fBiter\fP to the element named \fBkey\fP or exhaust all elements of \fBiter\fP\&. If \fBiter\fP is exhausted, false is returned and \fBiter\fP should be considered invalid. +.sp +\fBkey\fP is case\-sensitive. For a case\-folded version, see \fBbson_iter_find_case()\fP\&. +.SH RETURNS +.sp +true is returned if the requested key was found. If not, \fBiter\fP was exhausted and should now be considered invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_case.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_case.3 new file mode 100644 index 0000000..514a8c2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_case.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_FIND_CASE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_find_case \- bson_iter_find_case() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_find_case (bson_iter_t *iter, const char *key); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBkey\fP: An ASCII string containing the field to locate. +.UNINDENT +.SH DESCRIPTION +.sp +Advances \fBiter\fP until it is observing an element matching the name of \fBkey\fP or exhausting all elements. +.sp +\fBkey\fP is not case\-sensitive. The keys will be case\-folded to determine a match using the current locale. +.SH RETURNS +.sp +true if \fBkey\fP was found. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_descendant.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_descendant.3 new file mode 100644 index 0000000..c756482 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_descendant.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_FIND_DESCENDANT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_find_descendant \- bson_iter_find_descendant() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_find_descendant (bson_iter_t *iter, + const char *dotkey, + bson_iter_t *descendant); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBdotkey\fP: A dot\-notation key like \fB"a.b.c.d"\fP\&. +.IP \(bu 2 +\fBdescendant\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_find_descendant()\fP function shall follow standard MongoDB dot notation to recurse into subdocuments. \fBdescendant\fP will be initialized and advanced to the descendant. If false is returned, both \fBiter\fP and \fBdescendant\fP should be considered invalid. +.SH RETURNS +.sp +true is returned if the requested key was found. If not, false is returned and \fBiter\fP was exhausted and should now be considered invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_w_len.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_w_len.3 new file mode 100644 index 0000000..835999a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_find_w_len.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_FIND_W_LEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_find_w_len \- bson_iter_find_w_len() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_find_w_len (bson_iter_t *iter, const char *key, int keylen); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A string containing the requested key. +.IP \(bu 2 +\fBkeylen\fP: An integer indicating the length of the key string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_find_w_len()\fP function shall advance \fBiter\fP to the element named \fBkey\fP or exhaust all elements of \fBiter\fP\&. If \fBiter\fP is exhausted, false is returned and \fBiter\fP should be considered invalid. +.sp +\fBkey\fP is case\-sensitive. For a case\-folded version, see \fBbson_iter_find_case()\fP\&. +.SH RETURNS +.sp +true is returned if the requested key was found. If not, \fBiter\fP was exhausted and should now be considered invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init.3 new file mode 100644 index 0000000..d39889c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init.3 @@ -0,0 +1,107 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init \- bson_iter_init() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init (bson_iter_t *iter, const bson_t *bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_init()\fP function shall initialize \fBiter\fP to iterate upon the BSON document \fBbson\fP\&. Upon initialization, \fBiter\fP is placed before the first element. Callers must call \fBbson_iter_next()\fP, \fBbson_iter_find()\fP, or \fBbson_iter_find_case()\fP to advance to an element. +.SH RETURNS +.sp +Returns true if the iter was successfully initialized. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +print_doc_id (const bson_t *doc) +{ + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init (&iter, doc) && bson_iter_find (&iter, "_id") && + BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\en", oidstr); + } else { + printf ("Document is missing _id.\en"); + } +} + +/* alternatively */ + +static void +print_doc_id (const bson_t *doc) +{ + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init_find (&iter, doc, "_id") && BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\en", oidstr); + } else { + printf ("Document is missing _id.\en"); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find.3 new file mode 100644 index 0000000..003954a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT_FIND" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init_find \- bson_iter_init_find() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init_find (bson_iter_t *iter, const bson_t *bson, const char *key); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A key to locate after initializing the iter. +.UNINDENT +.SH DESCRIPTION +.sp +This function is identical to \fB(bson_iter_init() && bson_iter_find())\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_case.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_case.3 new file mode 100644 index 0000000..ef4c006 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_case.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT_FIND_CASE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init_find_case \- bson_iter_init_find_case() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init_find_case (bson_iter_t *iter, + const bson_t *bson, + const char *key); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A key to locate after initializing the iter. +.UNINDENT +.SH DESCRIPTION +.sp +This function is identical to \fBbson_iter_init() && bson_iter_find_case()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_w_len.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_w_len.3 new file mode 100644 index 0000000..8315597 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_find_w_len.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT_FIND_W_LEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init_find_w_len \- bson_iter_init_find_w_len() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init_find_w_len (bson_iter_t *iter, + const bson_t *bson, + const char *key, + int keylen); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBkey\fP: A key to locate after initializing the iter. +.IP \(bu 2 +\fBkeylen\fP: An integer indicating the length of the key string. +.UNINDENT +.SH DESCRIPTION +.sp +This function is identical to \fB(bson_iter_init() && bson_iter_find_w_len())\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data.3 new file mode 100644 index 0000000..11de833 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data.3 @@ -0,0 +1,91 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT_FROM_DATA" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init_from_data \- bson_iter_init_from_data() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init_from_data (bson_iter_t *iter, const uint8_t *data, size_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A buffer to initialize with. +.IP \(bu 2 +\fBlength\fP: The length of \fBdata\fP in bytes. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_init_from_data()\fP function shall initialize \fBiter\fP to iterate upon the buffer \fBdata\fP, which must contain a BSON document. Upon initialization, \fBiter\fP is placed before the first element. Callers must call \fBbson_iter_next()\fP, \fBbson_iter_find()\fP, or \fBbson_iter_find_case()\fP to advance to an element. +.SH RETURNS +.sp +Returns true if the iter was successfully initialized. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +print_doc_id (const uint8_t *data, size_t length) +{ + bson_iter_t iter; + bson_oid_t oid; + char oidstr[25]; + + if (bson_iter_init_from_data (&iter, data, length) && bson_iter_find (&iter, "_id") && + BSON_ITER_HOLDS_OID (&iter)) { + bson_iter_oid (&iter, &oid); + bson_oid_to_string (&oid, oidstr); + printf ("%s\en", oidstr); + } else { + printf ("Document is missing _id.\en"); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data_at_offset.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data_at_offset.3 new file mode 100644 index 0000000..3c547c3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_init_from_data_at_offset.3 @@ -0,0 +1,101 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INIT_FROM_DATA_AT_OFFSET" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_init_from_data_at_offset \- bson_iter_init_from_data_at_offset() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_init_from_data_at_offset (bson_iter_t *iter, + const uint8_t *data, + size_t length, + uint32_t offset, + uint32_t keylen); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A buffer to initialize with. This is not validated. +.IP \(bu 2 +\fBlength\fP: The length of \fBdata\fP in bytes. This is not validated. +.IP \(bu 2 +\fBoffset\fP: The offset of the field to start iterating. This is not validated. This should be an offset previously obtained from \fBbson_iter_offset()\fP\&. +.IP \(bu 2 +\fBkeylen\fP: The string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained from \fBbson_iter_key_len()\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a \fBbson_iter_t\fP and starts iteration on a field at the offset. +.sp +\fBbson_iter_init_from_data_at_offset\fP is useful for situations where the +progress of a \fBbson_iter_t\fP must be saved and restored without relying +on the \fBbson_iter_t\fP data layout. Saving the progress could be +accomplished by: +.INDENT 0.0 +.IP \(bu 2 +Saving the current field\(aqs key length with \fBbson_iter_key_len()\fP +.IP \(bu 2 +Saving the current offset with \fBbson_iter_offset()\fP +.IP \(bu 2 +Saving the data pointer of the iterated \fBbson_t\fP with \fBbson_get_data()\fP +.IP \(bu 2 +Saving the data length of the iterated \fBbson_t\fP with the \fBlen\fP struct field +.UNINDENT +.sp +Then later, these saved values can be passed to +\fBbson_iter_init_from_data_at_offset()\fP to reconstruct the +\fBbson_iter_t\fP in constant time. +.SH SEE ALSO +.INDENT 0.0 +.IP \(bu 2 +\fBbson_iter_key_len()\fP +.IP \(bu 2 +\fBbson_iter_offset()\fP +.IP \(bu 2 +\fBbson_get_data()\fP +.UNINDENT +.SH RETURNS +.sp +Returns true if the iter was successfully initialized. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int32.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int32.3 new file mode 100644 index 0000000..77f0200 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int32.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INT32" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_int32 \- bson_iter_int32() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_INT32(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT32) + +int32_t +bson_iter_int32 (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the value from a BSON_TYPE_INT32 element. You should verify that the field is a BSON_TYPE_INT32 field before calling this function. +.SH RETURNS +.sp +A 32\-bit integer. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int64.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int64.3 new file mode 100644 index 0000000..d3526eb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_int64.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_INT64" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_int64 \- bson_iter_int64() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_INT64(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT64) + +int64_t +bson_iter_int64 (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the value from a BSON_TYPE_INT64 field. You should verify that this is a BSON_TYPE_INT64 field before calling this function. +.SH RETURNS +.sp +A 64\-bit integer. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key.3 new file mode 100644 index 0000000..9ebd270 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_KEY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_key \- bson_iter_key() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +bson_iter_key (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the key for the current element observed by \fBiter\fP\&. +.SH SEE ALSO +.sp +\fBbson_iter_key_len()\fP to retrieve the length of the key in constant time. +.SH RETURNS +.sp +A string which should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key_len.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key_len.3 new file mode 100644 index 0000000..e52fa19 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_key_len.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_KEY_LEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_key_len \- bson_iter_key_len() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +bson_iter_key_len (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the length of the key for the current element observed by \fBiter\fP\&. This is a constant time computation, and therefore faster than calling \fBstrlen()\fP on a key returned by \fBbson_iter_key()\fP\&. +.SH SEE ALSO +.sp +\fBbson_iter_key()\fP to retrieve current key. +.SH RETURNS +.sp +An integer representing the key length. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_next.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_next.3 new file mode 100644 index 0000000..57c267e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_next.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_NEXT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_next \- bson_iter_next() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_next (bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Advances \fBiter\fP to the next element in the document. +.SH RETURNS +.sp +true if \fBiter\fP was advanced. Returns false if \fBiter\fP has passed the last element in the document or encountered invalid BSON. +.sp +It is a programming error to use \fBiter\fP after this function has returned false. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_offset.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_offset.3 new file mode 100644 index 0000000..3cd293a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_offset.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OFFSET" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_offset \- bson_iter_offset() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +bson_iter_offset (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the offset for the current element observed by \fBiter\fP\&. +.SH SEE ALSO +.sp +\fBbson_iter_init_from_data_at_offset()\fP to use this offset to reconstruct a \fBbson_iter_t\fP in constant time. +.SH RETURNS +.sp +An unsigned integer representing the offset in the BSON data of the current element. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_oid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_oid.3 new file mode 100644 index 0000000..21a4f0c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_oid.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OID" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_oid \- bson_iter_oid() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_OID(iter) (bson_iter_type ((iter)) == BSON_TYPE_OID) + +const bson_oid_t * +bson_iter_oid (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the \fBbson_oid_t\fP for a BSON_TYPE_OID element. You should verify it is an element of type BSON_TYPE_OID before calling this function. +.SH RETURNS +.sp +A \fBbson_oid_t\fP that should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_bool.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_bool.3 new file mode 100644 index 0000000..2d49240 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_bool.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_BOOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_bool \- bson_iter_overwrite_bool() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_bool (bson_iter_t *iter, bool value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: A bool containing the new value. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_bool()\fP function shall overwrite the contents of a BSON_TYPE_BOOL element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_BOOL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_date_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_date_time.3 new file mode 100644 index 0000000..e9801c9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_date_time.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_DATE_TIME" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_date_time \- bson_iter_overwrite_date_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: The date and time as specified in milliseconds since the UNIX epoch. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_date_time()\fP function shall overwrite the contents of a BSON_TYPE_DATE_TIME element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_DATE_TIME. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_decimal128.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_decimal128.3 new file mode 100644 index 0000000..cd20ee8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_decimal128.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_DECIMAL128" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_decimal128 \- bson_iter_overwrite_decimal128() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_overwrite_decimal128 (bson_iter_t *iter, bson_decimal128_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: The new Decimal128 value. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_decimal128()\fP function shall overwrite the contents of a BSON_TYPE_DECIMAL128 element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_DECIMAL128. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_double.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_double.3 new file mode 100644 index 0000000..48e174e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_double.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_DOUBLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_double \- bson_iter_overwrite_double() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_double (bson_iter_t *iter, double value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: The new double value. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_double()\fP function shall overwrite the contents of a BSON_TYPE_DOUBLE element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_DOUBLE. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int32.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int32.3 new file mode 100644 index 0000000..eef17d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int32.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_INT32" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_int32 \- bson_iter_overwrite_int32() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_int32 (bson_iter_t *iter, int32_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: A int32_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_int32()\fP function shall overwrite the contents of a BSON_TYPE_INT32 element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_BOOL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int64.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int64.3 new file mode 100644 index 0000000..a8dc2c2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_int64.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_INT64" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_int64 \- bson_iter_overwrite_int64() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_int64 (bson_iter_t *iter, int64_t value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvalue\fP: A int64_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_int64()\fP function shall overwrite the contents of a BSON_TYPE_INT64 element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_INT64. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_oid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_oid.3 new file mode 100644 index 0000000..2f9b5d6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_oid.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_OID" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_oid \- bson_iter_overwrite_oid() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_oid (bson_iter_t *iter, const bson_oid_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_oid()\fP function shall overwrite the contents of a BSON_TYPE_OID element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_OID. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_timestamp.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_timestamp.3 new file mode 100644 index 0000000..3ef362a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_overwrite_timestamp.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_OVERWRITE_TIMESTAMP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_overwrite_timestamp \- bson_iter_overwrite_timestamp() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_overwrite_timestamp (bson_iter_t *iter, + uint32_t timestamp, + uint32_t increment); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBtimestamp\fP: A uint32_t. +.IP \(bu 2 +\fBincrement\fP: A uint32_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_overwrite_timestamp()\fP function shall overwrite the contents of a BSON_TYPE_TIMESTAMP element in place. +.sp +This may only be done when the underlying bson document allows mutation. +.sp +It is a programming error to call this function when \fBiter\fP is not observing an element of type BSON_TYPE_TIMESTAMP. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_recurse.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_recurse.3 new file mode 100644 index 0000000..10c6c7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_recurse.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_RECURSE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_recurse \- bson_iter_recurse() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_recurse (const bson_iter_t *iter, bson_iter_t *child); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBchild\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_recurse()\fP function shall initialize \fBchild\fP using the embedded document or array currently observed by \fBiter\fP\&. +.sp +If there was a failure to initialize the \fBiter\fP, false is returned and both \fBiter\fP and \fBchild\fP should be considered invalid. +.sp +This should only be called when observing an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT. +.SH RETURNS +.sp +If \fBiter\fP observes an element of type BSON_TYPE_ARRAY or BSON_TYPE_DOCUMENT, then \fBchild\fP is initialized and the function returns \fBtrue\fP\&. Otherwise, the function returns \fBfalse\fP and \fBchild\fP is invalid. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_regex.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_regex.3 new file mode 100644 index 0000000..c78b828 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_regex.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_REGEX" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_regex \- bson_iter_regex() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +bson_iter_regex (const bson_iter_t *iter, const char **options); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBoptions\fP: A (null). +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_regex()\fP function shall retrieve the contents of a BSON_TYPE_REGEX element currently observed by \fBiter\fP\&. +.sp +It is invalid to call this function when not observing an element of type BSON_TYPE_REGEX. +.SH RETURNS +.sp +A string containing the regex which should not be modified or freed. \fBoptions\fP is set to the options provided for the regex. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_symbol.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_symbol.3 new file mode 100644 index 0000000..3a637c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_symbol.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_SYMBOL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_symbol \- bson_iter_symbol() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +bson_iter_symbol (const bson_iter_t *iter, uint32_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBlength\fP: A uint32_t. +.UNINDENT +.SH DESCRIPTION +.sp +The symbol element type is \fIDEPRECATED\fP in the bson specification at \fI\%http://bsonspec.org\fP\&. +.sp +The \fBbson_iter_symbol()\fP function shall return the contents of a BSON_TYPE_SYMBOL element. +.sp +If non\-NULL, \fBlength\fP will be set to the length of the resulting string. +.SH RETURNS +.sp +The symbol and \fBlength\fP is set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_t.3 new file mode 100644 index 0000000..45cd9fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_t.3 @@ -0,0 +1,176 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_t \- bson_iter_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Document Iterator +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +#define BSON_ITER_HOLDS_DOUBLE(iter) /* ... */ + +#define BSON_ITER_HOLDS_UTF8(iter) /* ... */ + +#define BSON_ITER_HOLDS_DOCUMENT(iter) /* ... */ + +#define BSON_ITER_HOLDS_ARRAY(iter) /* ... */ + +#define BSON_ITER_HOLDS_BINARY(iter) /* ... */ + +#define BSON_ITER_HOLDS_UNDEFINED(iter) /* ... */ + +#define BSON_ITER_HOLDS_OID(iter) /* ... */ + +#define BSON_ITER_HOLDS_BOOL(iter) /* ... */ + +#define BSON_ITER_HOLDS_DATE_TIME(iter) /* ... */ + +#define BSON_ITER_HOLDS_NULL(iter) /* ... */ + +#define BSON_ITER_HOLDS_REGEX(iter) /* ... */ + +#define BSON_ITER_HOLDS_DBPOINTER(iter) /* ... */ + +#define BSON_ITER_HOLDS_CODE(iter) /* ... */ + +#define BSON_ITER_HOLDS_SYMBOL(iter) /* ... */ + +#define BSON_ITER_HOLDS_CODEWSCOPE(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT32(iter) /* ... */ + +#define BSON_ITER_HOLDS_TIMESTAMP(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT64(iter) /* ... */ + +#define BSON_ITER_HOLDS_DECIMAL128(iter) /* ... */ + +#define BSON_ITER_HOLDS_MAXKEY(iter) /* ... */ + +#define BSON_ITER_HOLDS_MINKEY(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT(iter) \e + (BSON_ITER_HOLDS_INT32 (iter) || BSON_ITER_HOLDS_INT64 (iter)) + +#define BSON_ITER_HOLDS_NUMBER(iter) \e + (BSON_ITER_HOLDS_INT (iter) || BSON_ITER_HOLDS_DOUBLE (iter)) + +#define BSON_ITER_IS_KEY(iter, key) \e + (0 == strcmp ((key), bson_iter_key ((iter)))) + +typedef struct { + /*< private >*/ +} bson_iter_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +\fBbson_iter_t\fP is a structure used to iterate through the elements of a \fBbson_t\fP\&. It is meant to be used on the stack and can be discarded at any time as it contains no external allocation. The contents of the structure should be considered private and may change between releases, however the structure size will not change. +.sp +The \fBbson_t\fP \fIMUST\fP be valid for the lifetime of the iter and it is an error to modify the \fBbson_t\fP while using the iter. +.SH EXAMPLES +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_bson_doc)) { + while (bson_iter_next (&iter)) { + printf ("Found a field named: %s\en", bson_iter_key (&iter)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_bson_doc) && bson_iter_find (&iter, "my_field")) { + printf ("Found the field named: %s\en", bson_iter_key (&iter)); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; +bson_iter_t sub_iter; + +if (bson_iter_init_find (&iter, my_bson_doc, "mysubdoc") && + (BSON_ITER_HOLDS_DOCUMENT (&iter) || BSON_ITER_HOLDS_ARRAY (&iter)) && + bson_iter_recurse (&iter, &sub_iter)) { + while (bson_iter_next (&sub_iter)) { + printf ("Found key \e"%s\e" in sub document.\en", bson_iter_key (&sub_iter)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_doc) && + bson_iter_find_descendant (&iter, "a.b.c.d", &sub_iter)) { + printf ("The type of a.b.c.d is: %d\en", (int) bson_iter_type (&sub_iter)); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_time_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_time_t.3 new file mode 100644 index 0000000..09d640f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_time_t.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_TIME_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_time_t \- bson_iter_time_t() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +time_t +bson_iter_time_t (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_time_t()\fP function shall return the number of seconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element. +.SH RETURNS +.sp +A \fBtime_t\fP containing the number of seconds since the UNIX epoch. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timestamp.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timestamp.3 new file mode 100644 index 0000000..e96da10 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timestamp.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_TIMESTAMP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_timestamp \- bson_iter_timestamp() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_TIMESTAMP(iter) \e + (bson_iter_type ((iter)) == BSON_TYPE_TIMESTAMP) + +void +bson_iter_timestamp (const bson_iter_t *iter, + uint32_t *timestamp, + uint32_t *increment); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBtimestamp\fP: A uint32_t. +.IP \(bu 2 +\fBincrement\fP: A uint32_t. +.UNINDENT +.SH DESCRIPTION +.sp +The BSON_TYPE_TIMESTAMP type is not a date/time and is typically used for intra\-server communication. +.sp +You probably want \fBbson_iter_date_time()\fP\&. +.sp +The \fBbson_iter_timestamp()\fP function shall return the contents of a BSON_TYPE_TIMESTAMP element. It is invalid to call this function while observing an element that is not of type BSON_TYPE_TIMESTAMP. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timeval.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timeval.3 new file mode 100644 index 0000000..5801a62 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_timeval.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_TIMEVAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_timeval \- bson_iter_timeval() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_iter_timeval (const bson_iter_t *iter, struct timeval *tv); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBtv\fP: A struct timeval. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_timeval()\fP function shall return the number of seconds and microseconds since the UNIX epoch, as contained in the BSON_TYPE_DATE_TIME element into \fBtv\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_type.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_type.3 new file mode 100644 index 0000000..93002a6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_type.3 @@ -0,0 +1,85 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_TYPE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_type \- bson_iter_type() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, +} bson_type_t; + +bson_type_t +bson_iter_type (const bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_type()\fP function shall return the type of the observed element in a bson document. +.SH RETURNS +.sp +A \fBbson_type_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_utf8.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_utf8.3 new file mode 100644 index 0000000..e22a397 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_utf8.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_UTF8" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_utf8 \- bson_iter_utf8() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_ITER_HOLDS_UTF8(iter) (bson_iter_type ((iter)) == BSON_TYPE_UTF8) + +const char * +bson_iter_utf8 (const bson_iter_t *iter, uint32_t *length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBlength\fP: An optional location for the length of the resulting UTF\-8 encoded string. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_iter_utf8()\fP function shall retrieve the contents of a BSON_TYPE_UTF8 element currently observed by \fBiter\fP\&. +.sp +It is invalid to call this function while observing an element other than BSON_TYPE_UTF8. +.SH RETURNS +.sp +A UTF\-8 encoded string that has not been modified or freed. +.sp +It is suggested that the caller validate the content is valid UTF\-8 before using this in other places. That can be done by calling \fBbson_utf8_validate()\fP or validating the underlying \fBbson_t\fP before iterating it. +.sp +Note that not all drivers use multi\-byte representation for \fB\e0\fP in UTF\-8 encodings (commonly referred to as modified\-UTF8). You probably want to take a look at the length field when marshaling to other runtimes. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_value.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_value.3 new file mode 100644 index 0000000..9b463c8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_value.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_VALUE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_value \- bson_iter_value() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_value_t * +bson_iter_value (bson_iter_t *iter); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the value for the currently observed type as a boxed type. This allows passing around the value without knowing the type at runtime. +.SH RETURNS +.sp +A \fBbson_value_t\fP that should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_visit_all.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_visit_all.3 new file mode 100644 index 0000000..533ca65 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_iter_visit_all.3 @@ -0,0 +1,69 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ITER_VISIT_ALL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_iter_visit_all \- bson_iter_visit_all() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_iter_visit_all (bson_iter_t *iter, + const bson_visitor_t *visitor, + void *data); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBiter\fP: A \fBbson_iter_t\fP\&. +.IP \(bu 2 +\fBvisitor\fP: A \fBbson_visitor_t\fP\&. +.IP \(bu 2 +\fBdata\fP: Optional data for \fBvisitor\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +A convenience function to iterate all remaining fields of \fBiter\fP using the callback vtable provided by \fBvisitor\fP\&. +.SH RETURNS +.sp +Returns true if visitation was prematurely stopped by a callback function. Returns false either because all elements were visited \fIor\fP due to corrupt BSON. +.sp +See \fBbson_visitor_t\fP for examples of how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json.3 new file mode 100644 index 0000000..5910d0e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json.3 @@ -0,0 +1,318 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json \- JSON +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Libbson provides routines for converting to and from the JSON format. In particular, it supports the \fI\%MongoDB extended JSON\fP format. +.SH CONVERTING BSON TO JSON +.sp +There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the functions \fBbson_as_canonical_extended_json()\fP and \fBbson_as_relaxed_extended_json()\fP\&. The canonical format preserves BSON type information for values that may have ambiguous representations in JSON (e.g. numeric types). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_canonical_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : { "$numberInt": "1" } } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The relaxed format prefers JSON primitives for numeric values and may be used if type fidelity is not required. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_relaxed_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : 1 } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CONVERTING JSON TO BSON +.sp +Converting back from JSON is also useful and common enough that we added \fBbson_init_from_json()\fP and \fBbson_new_from_json()\fP\&. +.sp +The following example creates a new \fBbson_t\fP from the JSON string \fB{"a":1}\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_error_t error; + +b = bson_new_from_json ("{\e"a\e":1}", \-1, &error); + +if (!b) { + printf ("Error: %s\en", error.message); +} else { + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH STREAMING JSON PARSING +.sp +Libbson provides \fBbson_json_reader_t\fP to allow for parsing a sequence of JSON documents into BSON. The interface is similar to \fBbson_reader_t\fP but expects the input to be in the \fI\%MongoDB extended JSON\fP format. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "\-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\en%s\en", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\en"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH EXAMPLES +.sp +The following example reads BSON documents from \fBstdin\fP and prints them to \fBstdout\fP as JSON. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | \-]...\enUse \- for STDIN.\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "\-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_ingest.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_ingest.3 new file mode 100644 index 0000000..34e7863 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_ingest.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_DATA_READER_INGEST" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_data_reader_ingest \- bson_json_data_reader_ingest() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_json_data_reader_ingest (bson_json_reader_t *reader, + const uint8_t *data, + size_t len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_json_reader_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A uint8_t containing data to feed. +.IP \(bu 2 +\fBlen\fP: A size_t containing the length of \fBdata\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Feed data to a memory based json reader. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_new.3 new file mode 100644 index 0000000..c15bc2b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_data_reader_new.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_DATA_READER_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_data_reader_new \- bson_json_data_reader_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_json_reader_t * +bson_json_data_reader_new (bool allow_multiple, size_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBallow_multiple\fP: Unused. +.IP \(bu 2 +\fBsize\fP: A requested buffer size. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new streaming JSON reader that will convert JSON documents to BSON. +.sp +The \fBallow_multiple\fP parameter is unused. +.SH RETURNS +.sp +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_destroy.3 new file mode 100644 index 0000000..573489f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_destroy.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_destroy \- bson_json_reader_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_json_reader_destroy (bson_json_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_json_reader_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Frees a bson_json_reader_t. Does nothing if \fBreader\fP is NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new.3 new file mode 100644 index 0000000..da68111 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_new \- bson_json_reader_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_json_reader_t * +bson_json_reader_new (void *data, + bson_json_reader_cb cb, + bson_json_destroy_cb dcb, + bool allow_multiple, + size_t buf_size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdata\fP: A user\-defined pointer. +.IP \(bu 2 +\fBcb\fP: A bson_json_reader_cb. +.IP \(bu 2 +\fBdcb\fP: A bson_json_destroy_cb. +.IP \(bu 2 +\fBallow_multiple\fP: Unused. +.IP \(bu 2 +\fBbuf_size\fP: A size_t containing the requested internal buffer size. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new bson_json_reader_t that can read from an arbitrary data source in a streaming fashion. +.sp +The \fBallow_multiple\fP parameter is unused. +.SH RETURNS +.sp +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_fd.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_fd.3 new file mode 100644 index 0000000..923eecb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_fd.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_NEW_FROM_FD" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_new_from_fd \- bson_json_reader_new_from_fd() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_json_reader_t * +bson_json_reader_new_from_fd (int fd, bool close_on_destroy); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBfd\fP: An open file\-descriptor. +.IP \(bu 2 +\fBclose_on_destroy\fP: Whether \fBclose()\fP should be called on \fBfd\fP when the reader is destroyed. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new JSON to BSON converter that will be reading from the file\-descriptor \fBfd\fP\&. +.SH RETURNS +.sp +A newly allocated bson_json_reader_t that should be freed with bson_json_reader_destroy(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_file.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_file.3 new file mode 100644 index 0000000..7342dd9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_new_from_file.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_NEW_FROM_FILE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_new_from_file \- bson_json_reader_new_from_file() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_json_reader_t * +bson_json_reader_new_from_file (const char *filename, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBfilename\fP: A file\-name in the system file\-name encoding. +.IP \(bu 2 +\fBerror\fP: A \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new bson_json_reader_t using the underlying file found at \fBfilename\fP\&. +.SH ERRORS +.sp +Errors are propagated via \fBerror\fP\&. +.SH RETURNS +.sp +A newly allocated bson_json_reader_t if successful, otherwise NULL and error is set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_read.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_read.3 new file mode 100644 index 0000000..6fa34dc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_read.3 @@ -0,0 +1,70 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_READ" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_read \- bson_json_reader_read() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_json_reader_read (bson_json_reader_t *reader, + bson_t *bson, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_json_reader_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBerror\fP: A \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Reads the next BSON document from the underlying JSON source. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +1 if successful and data was read. 0 if successful and no data was read. \-1 if there was an error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_t.3 new file mode 100644 index 0000000..07868bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_json_reader_t.3 @@ -0,0 +1,168 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_JSON_READER_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_json_reader_t \- bson_json_reader_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Bulk JSON to BSON conversion +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_json_reader_t bson_json_reader_t; + +typedef enum { + BSON_JSON_ERROR_READ_CORRUPT_JS = 1, + BSON_JSON_ERROR_READ_INVALID_PARAM, + BSON_JSON_ERROR_READ_CB_FAILURE, +} bson_json_error_code_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_json_reader_t\fP structure is used for reading a sequence of JSON documents and transforming them to \fBbson_t\fP documents. +.sp +This can often be useful if you want to perform bulk operations that are defined in a file containing JSON documents. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBbson_json_reader_t\fP works upon JSON documents formatted in \fI\%MongoDB extended JSON\fP format. +.UNINDENT +.UNINDENT +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "\-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\en%s\en", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\en"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc.3 new file mode 100644 index 0000000..96fef49 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MALLOC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_malloc \- bson_malloc() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +bson_malloc (size_t num_bytes); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBnum_bytes\fP: A size_t containing the number of bytes to allocate. +.UNINDENT +.SH DESCRIPTION +.sp +This is a portable \fBmalloc()\fP wrapper. +.sp +In general, this function will return an allocation at least \fBsizeof(void*)\fP bytes or bigger. +.sp +If there was a failure to allocate \fBnum_bytes\fP bytes, the process will be aborted. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function will abort on failure to allocate memory. +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +A pointer to a memory region which \fIHAS NOT\fP been zeroed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc0.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc0.3 new file mode 100644 index 0000000..6614634 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_malloc0.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MALLOC0" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_malloc0 \- bson_malloc0() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +bson_malloc0 (size_t num_bytes); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBnum_bytes\fP: A size_t. +.UNINDENT +.SH DESCRIPTION +.sp +This is a portable \fBmalloc()\fP wrapper that also sets the memory to zero. Similar to \fBcalloc()\fP\&. +.sp +In general, this function will return an allocation at least \fBsizeof(void*)\fP bytes or bigger. +.sp +If there was a failure to allocate \fBnum_bytes\fP bytes, the process will be aborted. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function will abort on failure to allocate memory. +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +A pointer to a memory region which \fIHAS\fP been zeroed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_append.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_append.3 new file mode 100644 index 0000000..5cd6385 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_append.3 @@ -0,0 +1,69 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MD5_APPEND" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_md5_append \- bson_md5_append() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +All MD5 APIs are deprecated in libbson. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_md5_append (bson_md5_t *pms, + const uint8_t *data, + uint32_t nbytes) BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpms\fP: A \fBbson_md5_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A memory region to feed to the md5 algorithm. +.IP \(bu 2 +\fBnbytes\fP: The length of \fBdata\fP in bytes. +.UNINDENT +.SH DESCRIPTION +.sp +Feeds more data into the MD5 algorithm. +.sp +This function is deprecated and should not be used in new code. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_finish.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_finish.3 new file mode 100644 index 0000000..403f4a2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_finish.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MD5_FINISH" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_md5_finish \- bson_md5_finish() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +All MD5 APIs are deprecated in libbson. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpms\fP: A \fBbson_md5_t\fP\&. +.IP \(bu 2 +\fBdigest\fP: A location for the digest. +.UNINDENT +.SH DESCRIPTION +.sp +Completes the MD5 algorithm and stores the digest in \fBdigest\fP\&. +.sp +This function is deprecated and should not be used in new code. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_init.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_init.3 new file mode 100644 index 0000000..0c395da --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_init.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MD5_INIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_md5_init \- bson_md5_init() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +All MD5 APIs are deprecated in libbson. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_md5_init (bson_md5_t *pms) BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpms\fP: A \fBbson_md5_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Initialize a new instance of the MD5 algorithm. +.sp +This function is deprecated and should not be used in new code. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_t.3 new file mode 100644 index 0000000..ba1e7e5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_md5_t.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MD5_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_md5_t \- bson_md5_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON MD5 Abstraction +.SH DEPRECATED +.sp +All MD5 APIs are deprecated in libbson. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct { + uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t abcd[4]; /* digest buffer */ + uint8_t buf[64]; /* accumulate block */ +} bson_md5_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +bson_md5_t encapsulates an implementation of the MD5 algorithm. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_restore_vtable.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_restore_vtable.3 new file mode 100644 index 0000000..4999df2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_restore_vtable.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MEM_RESTORE_VTABLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_mem_restore_vtable \- bson_mem_restore_vtable() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_mem_restore_vtable (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +This function shall restore the default memory allocator to be used by Libbson. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function \fIMUST\fP be called at the end of the process. Failure to do so will result in memory being freed by the wrong allocator. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_set_vtable.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_set_vtable.3 new file mode 100644 index 0000000..12cb3c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_mem_set_vtable.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MEM_SET_VTABLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_mem_set_vtable \- bson_mem_set_vtable() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct _bson_mem_vtable_t { + void *(*malloc) (size_t num_bytes); + void *(*calloc) (size_t n_members, size_t num_bytes); + void *(*realloc) (void *mem, size_t num_bytes); + void (*free) (void *mem); + void *padding[4]; +} bson_mem_vtable_t; + +void +bson_mem_set_vtable (const bson_mem_vtable_t *vtable); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBvtable\fP: A bson_mem_vtable_t with every non\-padding field set. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall install a new memory allocator to be used by Libbson. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function \fIMUST\fP be called at the beginning of the process. Failure to do so will result in memory being freed by the wrong allocator. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_memory.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_memory.3 new file mode 100644 index 0000000..11c0baf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_memory.3 @@ -0,0 +1,45 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_MEMORY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_memory \- Memory Management +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Memory Abstraction. +.SH DESCRIPTION +.sp +Libbson contains a lightweight memory abstraction to make portability to new platforms easier. Additionally, it helps us integrate with interesting higher\-level languages. One caveat, however, is that Libbson is not designed to deal with Out of Memory (OOM) situations. Doing so requires extreme diligence throughout the application stack that has rarely been implemented correctly. This may change in the future. As it stands now, Libbson will \fBabort()\fP under OOM situations. +.sp +To aid in language binding integration, Libbson allows for setting a custom memory allocator via \fBbson_mem_set_vtable()\fP\&. This allocation may be reversed via \fBbson_mem_restore_vtable()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new.3 new file mode 100644 index 0000000..33d858e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_new \- bson_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_new (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_new()\fP function shall create a new \fBbson_t\fP structure on the heap. It should be freed with \fBbson_destroy()\fP when it is no longer in use. +.SH RETURNS +.sp +A newly allocated \fBbson_t\fP that should be freed with \fBbson_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_buffer.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_buffer.3 new file mode 100644 index 0000000..63b5928 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_buffer.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_NEW_FROM_BUFFER" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_new_from_buffer \- bson_new_from_buffer() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_new_from_buffer (uint8_t **buf, + size_t *buf_len, + bson_realloc_func realloc_func, + void *realloc_func_ctx); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbuf\fP: An out\-pointer to a buffer containing a serialized BSON document, or to NULL. +.IP \(bu 2 +\fBbuf_len\fP: An out\-pointer to the length of the buffer in bytes. +.IP \(bu 2 +\fBrealloc_func\fP: Optional \fBbson_realloc_func\fP for reallocating the buffer. +.IP \(bu 2 +\fBrealloc_func_ctx\fP: Optional pointer that will be passed as \fBctx\fP to \fBrealloc_func\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new \fBbson_t\fP using the data provided. +.sp +The \fBrealloc_func\fP, if provided, is called to resize \fBbuf\fP if the document is later expanded, for example by a call to one of the \fBbson_append\fP functions. +.sp +If \fB*buf\fP is initially NULL then it is allocated, using \fBrealloc_func\fP or the default allocator, and initialized with an empty BSON document, and \fB*buf_len\fP is set to 5, the size of an empty document. +.SH RETURNS +.sp +A newly\-allocated \fBbson_t\fP on success, or NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_data.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_data.3 new file mode 100644 index 0000000..64311d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_data.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_NEW_FROM_DATA" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_new_from_data \- bson_new_from_data() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_new_from_data (const uint8_t *data, size_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdata\fP: A BSON encoded document buffer. +.IP \(bu 2 +\fBlength\fP: The length of \fBdata\fP in bytes. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_new_from_data()\fP function shall create a new \fBbson_t\fP on the heap and copy the contents of \fBdata\fP\&. This may be helpful when working with language bindings but is generally expected to be slower. +.SH RETURNS +.sp +A newly allocated \fBbson_t\fP if successful, otherwise NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_json.3 new file mode 100644 index 0000000..59ef7b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_new_from_json.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_NEW_FROM_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_new_from_json \- bson_new_from_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdata\fP: A UTF\-8 encoded string containing valid JSON. +.IP \(bu 2 +\fBlen\fP: The length of \fBdata\fP in bytes excluding a trailing \fB\e0\fP or \-1 to determine the length with \fBstrlen()\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_new_from_json()\fP function allocates and initialize a new \fBbson_t\fP by parsing the JSON found in \fBdata\fP\&. Only a single JSON object may exist in \fBdata\fP or an error will be set and NULL returned. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +A newly allocated \fBbson_t\fP if successful, otherwise NULL and \fBerror\fP is set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid.3 new file mode 100644 index 0000000..e527301 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid.3 @@ -0,0 +1,134 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid \- ObjectIDs +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Libbson provides a simple way to generate ObjectIDs. It can be used in a single\-threaded or multi\-threaded manner depending on your requirements. +.sp +The \fBbson_oid_t\fP structure represents an \fBObjectID\fP in MongoDB. It is a 96\-bit identifier that includes various information about the system generating the OID. +.SH COMPOSITION +.INDENT 0.0 +.IP \(bu 2 +4 bytes : The UNIX timestamp in big\-endian format. +.IP \(bu 2 +3 bytes : A hash of the hostname. +.IP \(bu 2 +2 bytes : The \fBpid_t\fP of the current process. Alternatively the task\-id if configured. +.IP \(bu 2 +3 bytes : A 24\-bit monotonic counter incrementing from \fBrand()\fP in big\-endian. +.UNINDENT +.SH SORTING OBJECTIDS +.sp +The typical way to sort in C is using \fBqsort()\fP\&. Therefore, Libbson provides a \fBqsort()\fP compatible callback function named \fBbson_oid_compare()\fP\&. It returns \fBless than 1\fP, \fBgreater than 1\fP, or \fB0\fP depending on the equality of two \fBbson_oid_t\fP structures. +.SH COMPARING OBJECT IDS +.sp +If you simply want to compare two \fBbson_oid_t\fP structures for equality, use \fBbson_oid_equal()\fP\&. +.SH GENERATING +.sp +To generate a \fBbson_oid_t\fP, you may use the following. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init (&oid, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARSING OBJECTID STRINGS +.sp +You can also parse a string containing a \fBbson_oid_t\fP\&. The input string \fIMUST\fP be 24 characters or more in length. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If you need to parse may \fBbson_oid_t\fP in a tight loop and can guarantee the data is safe, you might consider using the inline variant. It will be inlined into your code and reduce the need for a foreign function call. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string_unsafe (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH HASHING OBJECTIDS +.sp +If you need to store items in a hashtable, you may want to use the \fBbson_oid_t\fP as the key. Libbson provides a hash function for just this purpose. It is based on DJB hash. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +unsigned hash; + +hash = bson_oid_hash (oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH FETCHING OBJECTID CREATION TIME +.sp +You can easily fetch the time that a \fBbson_oid_t\fP was generated using \fBbson_oid_get_time_t()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +time_t t; + +t = bson_oid_get_time_t (oid); +printf ("The OID was generated at %u\en", (unsigned) t); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_compare.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_compare.3 new file mode 100644 index 0000000..3681738 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_compare.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_COMPARE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_compare \- bson_oid_compare() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_oid_compare (const bson_oid_t *oid1, const bson_oid_t *oid2); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid1\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBoid2\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_oid_compare()\fP function shall return a qsort() style value of a lexicographical sort of _oid1_ and _oid2_. +.SH RETURNS +.sp +less than 0, 0, or greater than 0 based on the comparison. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_copy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_copy.3 new file mode 100644 index 0000000..27f88e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_copy.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_COPY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_copy \- bson_oid_copy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_copy (const bson_oid_t *src, bson_oid_t *dst); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsrc\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBdst\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Copies the contents of src into dst. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_equal.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_equal.3 new file mode 100644 index 0000000..fc04e9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_equal.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_EQUAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_equal \- bson_oid_equal() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_oid_equal (const bson_oid_t *oid1, const bson_oid_t *oid2); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid1\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBoid2\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Checks if two bson_oid_t contain the same bytes. +.SH RETURNS +.sp +true if they are equal, otherwise false. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_get_time_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_get_time_t.3 new file mode 100644 index 0000000..4d48e14 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_get_time_t.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_GET_TIME_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_get_time_t \- bson_oid_get_time_t() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +time_t +bson_oid_get_time_t (const bson_oid_t *oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the generation time in seconds since the UNIX Epoch of \fBoid\fP\&. +.SH RETURNS +.sp +A time_t containing the seconds since the UNIX epoch of \fBoid\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_hash.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_hash.3 new file mode 100644 index 0000000..2fc6d79 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_hash.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_HASH" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_hash \- bson_oid_hash() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +bson_oid_hash (const bson_oid_t *oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Generates a hash code for \fBoid\fP suitable for a hashtable. +.SH RETURNS +.sp +A 32\-bit hash code. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init.3 new file mode 100644 index 0000000..bfc4bf9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_INIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_init \- bson_oid_init() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_init (bson_oid_t *oid, bson_context_t *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBcontext\fP: An \fIoptional\fP \fBbson_context_t\fP or NULL. +.UNINDENT +.SH DESCRIPTION +.sp +Generates a new \fBbson_oid_t\fP using either \fBcontext\fP or the default \fBbson_context_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_data.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_data.3 new file mode 100644 index 0000000..afa2a13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_data.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_INIT_FROM_DATA" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_init_from_data \- bson_oid_init_from_data() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_init_from_data (bson_oid_t *oid, const uint8_t *data); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBdata\fP: A buffer containing 12 bytes for the oid. +.UNINDENT +.SH DESCRIPTION +.sp +Initializes a \fBbson_oid_t\fP using the raw buffer provided. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_string.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_string.3 new file mode 100644 index 0000000..a64dfbb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_from_string.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_INIT_FROM_STRING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_init_from_string \- bson_oid_init_from_string() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_init_from_string (bson_oid_t *oid, const char *str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBstr\fP: A string containing a hex encoded version of the oid. +.UNINDENT +.SH DESCRIPTION +.sp +Parses the string containing hex encoded oid and initialize the bytes in \fBoid\fP\&. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_init_from_string (&oid, "012345678901234567890123"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_sequence.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_sequence.3 new file mode 100644 index 0000000..0aa93a7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_init_sequence.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_INIT_SEQUENCE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_init_sequence \- bson_oid_init_sequence() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_init_sequence (bson_oid_t *oid, bson_context_t *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBcontext\fP: An optional \fBbson_context_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Generates a new ObjectID using the 64\-bit sequence. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This form of ObjectID is generally used by MongoDB replica peers only. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_is_valid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_is_valid.3 new file mode 100644 index 0000000..4e246b5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_is_valid.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_IS_VALID" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_is_valid \- bson_oid_is_valid() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_oid_is_valid (const char *str, size_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: A string. +.IP \(bu 2 +\fBlength\fP: The length of \fBstr\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Checks if a string containing a hex encoded string is a valid BSON ObjectID. +.SH RETURNS +.sp +true if \fBstr\fP could be parsed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_t.3 new file mode 100644 index 0000000..d64d880 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_t.3 @@ -0,0 +1,113 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_t \- bson_oid_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON ObjectID Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + uint8_t bytes[12]; +} bson_oid_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_oid_t\fP structure contains the 12\-byte ObjectId notation defined by the \fI\%BSON ObjectID specification\fP\&. +.sp +ObjectId is a 12\-byte BSON type, constructed using: +.INDENT 0.0 +.IP \(bu 2 +a 4\-byte value representing the seconds since the Unix epoch (in Big Endian) +.IP \(bu 2 +a 3\-byte machine identifier +.IP \(bu 2 +a 2\-byte process id (Big Endian), and +.IP \(bu 2 +a 3\-byte counter (Big Endian), starting with a random value. +.UNINDENT +.SH STRING CONVERSION +.sp +You can convert an Object ID to a string using \fBbson_oid_to_string()\fP and back with \fBbson_oid_init_from_string()\fP\&. +.SH HASHING +.sp +A \fBbson_oid_t\fP can be used in hashtables using the function \fBbson_oid_hash()\fP and \fBbson_oid_equal()\fP\&. +.SH COMPARING +.sp +A \fBbson_oid_t\fP can be compared to another using \fBbson_oid_compare()\fP for \fBqsort()\fP style comparing and \fBbson_oid_equal()\fP for direct equality. +.SH VALIDATING +.sp +You can validate that a string containing a hex\-encoded ObjectID is valid using the function \fBbson_oid_is_valid()\fP\&. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_oid_t oid; + char str[25]; + + bson_oid_init (&oid, NULL); + bson_oid_to_string (&oid, str); + printf ("%s\en", str); + + if (bson_oid_is_valid (str, sizeof str)) { + bson_oid_init_from_string (&oid, str); + } + + printf ("The UNIX time was: %u\en", (unsigned) bson_oid_get_time_t (&oid)); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_to_string.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_to_string.3 new file mode 100644 index 0000000..106a26c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_oid_to_string.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_OID_TO_STRING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_oid_to_string \- bson_oid_to_string() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_oid_to_string (const bson_oid_t *oid, char str[25]); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBoid\fP: A \fBbson_oid_t\fP\&. +.IP \(bu 2 +\fBstr\fP: A location for the resulting string. +.UNINDENT +.SH DESCRIPTION +.sp +Converts \fBoid\fP into a hex encoded string. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_parsing.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_parsing.3 new file mode 100644 index 0000000..40e6d22 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_parsing.3 @@ -0,0 +1,184 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_PARSING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_parsing \- Parsing and Iterating BSON Documents +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH PARSING +.sp +BSON documents are lazily parsed as necessary. To begin parsing a BSON document, use one of the provided Libbson functions to create a new \fBbson_t\fP from existing data such as \fBbson_new_from_data()\fP\&. This will make a copy of the data so that additional mutations may occur to the BSON document. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +If you only want to parse a BSON document and have no need to mutate it, you may use \fBbson_init_static()\fP to avoid making a copy of the data. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; + +b = bson_new_from_data (my_data, my_data_len); +if (!b) { + fprintf (stderr, "The specified length embedded in did not match " + "\en"); + return; +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Only two checks are performed when creating a new \fBbson_t\fP from an existing buffer. First, the document must begin with the buffer length, matching what was expected by the caller. Second, the document must end with the expected trailing \fB\e0\fP byte. +.sp +To parse the document further we use a \fBbson_iter_t\fP to iterate the elements within the document. Let\(aqs print all of the field names in the document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if (bson_iter_init (&iter, b)) { + while (bson_iter_next (&iter)) { + printf ("Found element key: \e"%s\e"\en", bson_iter_key (&iter)); + } + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Converting a document to JSON uses a \fBbson_iter_t\fP and \fBbson_visitor_t\fP to iterate all fields of a BSON document recursively and generate a UTF\-8 encoded JSON string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +char *json; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if ((json = bson_as_canonical_extended_json (b, NULL))) { + printf ("%s\en", json); + bson_free (json); + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH RECURSING INTO SUB-DOCUMENTS +.sp +Libbson provides convenient sub\-iterators to dive down into a sub\-document or sub\-array. Below is an example that will dive into a sub\-document named "foo" and print it\(aqs field names. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; +bson_iter_t child; +char *json; + +if (bson_iter_init_find (&iter, doc, "foo") && + BSON_ITER_HOLDS_DOCUMENT (&iter) && bson_iter_recurse (&iter, &child)) { + while (bson_iter_next (&child)) { + printf ("Found sub\-key of \e"foo\e" named \e"%s\e"\en", + bson_iter_key (&child)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH FINDING FIELDS USING DOT NOTATION +.sp +Using the \fBbson_iter_recurse()\fP function exemplified above, \fBbson_iter_find_descendant()\fP can find a field for you using the MongoDB style path notation such as "foo.bar.0.baz". +.sp +Let\(aqs create a document like \fB{"foo": {"bar": [{"baz: 1}]}}\fP and locate the \fB"baz"\fP field. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; +bson_iter_t baz; + +b = + BCON_NEW ("foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}"); + +if (bson_iter_init (&iter, b) && + bson_iter_find_descendant (&iter, "foo.bar.0.baz", &baz) && + BSON_ITER_HOLDS_INT32 (&baz)) { + printf ("baz = %d\en", bson_iter_int32 (&baz)); +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH VALIDATING A BSON DOCUMENT +.sp +If all you want to do is validate that a BSON document is valid, you can use \fBbson_validate()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t err_offset; + +if (!bson_validate (doc, BSON_VALIDATE_NONE, &err_offset)) { + fprintf (stderr, + "The document failed to validate at offset: %u\en", + (unsigned) err_offset); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See the \fBbson_validate()\fP documentation for more information and examples. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy.3 new file mode 100644 index 0000000..b95e13f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_destroy \- bson_reader_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_reader_destroy (bson_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Destroys and releases all resources associated with \fBreader\fP\&. Does nothing if \fBreader\fP is NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy_func_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy_func_t.3 new file mode 100644 index 0000000..c09da2a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_destroy_func_t.3 @@ -0,0 +1,59 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_DESTROY_FUNC_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_destroy_func_t \- bson_reader_destroy_func_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*bson_reader_destroy_func_t) (void *handle); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBhandle\fP: The opaque handle provided to \fBbson_reader_new_from_handle\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +An optional callback function that will be called when a \fBbson_reader_t\fP created with \fBbson_reader_new_from_handle\fP is destroyed with \fBbson_reader_destroy()\fP\&. +.sp +The handle used when creating the reader is passed to this callback. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_data.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_data.3 new file mode 100644 index 0000000..3083d98 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_data.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_NEW_FROM_DATA" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_new_from_data \- bson_reader_new_from_data() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t * +bson_reader_new_from_data (const uint8_t *data, size_t length); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdata\fP: A uint8_t. +.IP \(bu 2 +\fBlength\fP: A size_t. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_reader_new_from_data()\fP function shall create a new \fBbson_reader_t\fP using the buffer supplied. \fBdata\fP is not copied and \fIMUST\fP be valid for the lifetime of the resulting \fBbson_reader_t\fP\&. +.SH RETURNS +.sp +A newly allocated \fBbson_reader_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_fd.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_fd.3 new file mode 100644 index 0000000..418aefb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_fd.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_NEW_FROM_FD" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_new_from_fd \- bson_reader_new_from_fd() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t * +bson_reader_new_from_fd (int fd, bool close_on_destroy); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBfd\fP: A valid file\-descriptor. +.IP \(bu 2 +\fBclose_on_destroy\fP: Whether \fBclose()\fP should be called on \fBfd\fP when the reader is destroyed. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_reader_new_from_fd()\fP function shall create a new \fBbson_reader_t\fP that will read from the provided file\-descriptor. +.sp +fd \fIMUST\fP be in blocking mode. +.sp +If \fBclose_fd\fP is true, then \fBfd\fP will be closed when the \fBbson_reader_t\fP is destroyed with \fBbson_reader_destroy()\fP\&. +.SH RETURNS +.sp +A newly allocated \fBbson_reader_t\fP that should be freed with \fBbson_reader_destroy\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_file.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_file.3 new file mode 100644 index 0000000..e37281c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_file.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_NEW_FROM_FILE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_new_from_file \- bson_reader_new_from_file() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t * +bson_reader_new_from_file (const char *path, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpath\fP: A filename in the host filename encoding. +.IP \(bu 2 +\fBerror\fP: A \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new \fBbson_reader_t\fP using the file denoted by \fBfilename\fP\&. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +A newly allocated \fBbson_reader_t\fP on success, otherwise NULL and error is set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_handle.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_handle.3 new file mode 100644 index 0000000..58fea5e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_new_from_handle.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_NEW_FROM_HANDLE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_new_from_handle \- bson_reader_new_from_handle() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t * +bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBhandle\fP: A user\-provided pointer or NULL. +.IP \(bu 2 +\fBrf\fP: A \fBbson_reader_read_func_t\fP\&. +.IP \(bu 2 +\fBdf\fP: A \fBbson_reader_destroy_func_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function allows for a pluggable data stream for the reader. This can be used to read from sockets, files, memory, or other arbitrary sources. +.SH RETURNS +.sp +A newly allocated bson_reader_t if successful; otherwise NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read.3 new file mode 100644 index 0000000..e15a64a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read.3 @@ -0,0 +1,89 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_READ" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_read \- bson_reader_read() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +bson_reader_read (bson_reader_t *reader, bool *reached_eof); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.IP \(bu 2 +\fBreached_eof\fP: A UNKNOWN. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_reader_read()\fP function shall read the next document from the underlying file\-descriptor or buffer. +.sp +If there are no further documents or a failure was detected, then NULL is returned. +.sp +If we reached the end of the sequence, \fBreached_eof\fP is set to true. +.sp +To detect an error, check for NULL and \fBreached_of\fP is false. +.SH RETURNS +.sp +A \fBbson_t\fP that should not be modified or freed. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t *doc; +bool reached_eof = false; + +while ((doc = bson_reader_read (reader, &reached_eof))) { + /* do something */ +} + +if (!reached_eof) { + fprintf (stderr, "Failed to read all documents.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read_func_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read_func_t.3 new file mode 100644 index 0000000..c17d55f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_read_func_t.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_READ_FUNC_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_read_func_t \- bson_reader_read_func_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef ssize_t (*bson_reader_read_func_t) (void *handle, + void *buf, + size_t count); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBhandle\fP: The handle to read from. +.IP \(bu 2 +\fBbuf\fP: The buffer to read into. +.IP \(bu 2 +\fBcount\fP: The number of bytes to read. +.UNINDENT +.SH DESCRIPTION +.sp +A callback function that will be called by \fBbson_reader_t\fP to read the next chunk of data from the underlying opaque file descriptor. +.sp +This function is meant to operate similar to the \fBread(2)\fP function as part of libc on UNIX\-like systems. +.SH RETURNS +.sp +0 for end of stream. +.sp +\-1 for a failure on read. +.sp +A value greater than zero for the number of bytes read into \fBbuf\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_reset.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_reset.3 new file mode 100644 index 0000000..84b54d6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_reset.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_RESET" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_reset \- bson_reader_reset() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_reader_reset (bson_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Seeks to the beginning of the underlying buffer. Valid only for a reader created from a buffer with \fBbson_reader_new_from_data\fP, not one created from a file, file descriptor, or handle. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_destroy_func.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_destroy_func.3 new file mode 100644 index 0000000..ef0aae1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_destroy_func.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_SET_DESTROY_FUNC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_set_destroy_func \- bson_reader_set_destroy_func() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_reader_set_destroy_func (bson_reader_t *reader, + bson_reader_destroy_func_t func); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.IP \(bu 2 +\fBfunc\fP: A \fBbson_reader_destroy_func_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Allows for setting a callback to be executed when a reader is destroyed. This should only be used by implementations implementing their own read callbacks. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_read_func.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_read_func.3 new file mode 100644 index 0000000..064a0d9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_set_read_func.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_SET_READ_FUNC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_set_read_func \- bson_reader_set_read_func() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_reader_set_read_func (bson_reader_t *reader, bson_reader_read_func_t func); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.IP \(bu 2 +\fBfunc\fP: A \fBbson_reader_read_func_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Sets the function to read more data from the underlying stream in a custom bson_reader_t. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_t.3 new file mode 100644 index 0000000..0d15ac0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_t.3 @@ -0,0 +1,158 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_t \- bson_reader_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Streaming BSON Document Reader +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_reader_t bson_reader_t; + +bson_reader_t * +bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); +bson_reader_t * +bson_reader_new_from_fd (int fd, bool close_on_destroy); +bson_reader_t * +bson_reader_new_from_file (const char *path, bson_error_t *error); +bson_reader_t * +bson_reader_new_from_data (const uint8_t *data, size_t length); + +void +bson_reader_destroy (bson_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +\fBbson_reader_t\fP is a structure used for reading a sequence of BSON documents. The sequence can come from a file\-descriptor, memory region, or custom callbacks. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | \-]...\enUse \- for STDIN.\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "\-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_tell.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_tell.3 new file mode 100644 index 0000000..3914a4a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reader_tell.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_READER_TELL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reader_tell \- bson_reader_tell() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +off_t +bson_reader_tell (bson_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBreader\fP: A \fBbson_reader_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Tells the current position within the underlying stream. +.SH RETURNS +.sp +\-1 on failure, otherwise the offset within the underlying stream. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc.3 new file mode 100644 index 0000000..6a33c3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_REALLOC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_realloc \- bson_realloc() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +bson_realloc (void *mem, size_t num_bytes); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBmem\fP: A memory region. +.IP \(bu 2 +\fBnum_bytes\fP: A size_t containing the new requested size. +.UNINDENT +.SH DESCRIPTION +.sp +This is a portable \fBrealloc()\fP wrapper. +.sp +In general, this function will return an allocation at least \fBsizeof(void*)\fP bytes or bigger. If \fBnum_bytes\fP is 0, then the allocation will be freed. +.sp +If there was a failure to allocate \fBnum_bytes\fP bytes, the process will be aborted. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function will abort on failure to allocate memory. +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +A pointer to a memory region which \fIHAS NOT\fP been zeroed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_ctx.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_ctx.3 new file mode 100644 index 0000000..eb5a439 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_ctx.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_REALLOC_CTX" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_realloc_ctx \- bson_realloc_ctx() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +bson_realloc_ctx (void *mem, size_t num_bytes, void *ctx); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBmem\fP: A memory region. +.IP \(bu 2 +\fBnum_bytes\fP: A size_t containing the requested size. +.IP \(bu 2 +\fBctx\fP: A consumer\-specific pointer or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function is identical to \fBbson_realloc()\fP except it takes a context parameter. This is useful when working with pooled or specific memory allocators. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_func.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_func.3 new file mode 100644 index 0000000..f244b82 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_realloc_func.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_REALLOC_FUNC" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_realloc_func \- bson_realloc_func +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void *(*bson_realloc_func) (void *mem, size_t num_bytes, void *ctx); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBmem\fP: A memory region. +.IP \(bu 2 +\fBnum_bytes\fP: A size_t containing the requested size. +.IP \(bu 2 +\fBctx\fP: A consumer\-specific pointer or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This is a prototype for pluggable realloc functions used through the Libbson library. If you wish to use a custom allocator this is one way to do it. Additionally, \fBbson_realloc_ctx()\fP is a default implementation of this prototype. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reference.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reference.3 new file mode 100644 index 0000000..037c21c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reference.3 @@ -0,0 +1,2475 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_REFERENCE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reference \- Index +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH LIBBSON +.sp +A Cross Platform BSON Library for C +.SS Introduction +.sp +libbson builds, parses, and iterates \fI\%BSON\fP documents, the native data format of MongoDB. It also converts BSON to and from JSON, and provides a platform compatibility layer for \fI\%the MongoDB C Driver\fP\&. +.SS Tutorial +.SS Using libbson In Your C Program +.SS Include bson.h +.sp +All libbson\(aqs functions and types are available in one header file. Simply include \fBbson.h\fP: +hello_bson.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, const char **argv) +{ + bson_t *b; + char *j; + + b = BCON_NEW ("hello", BCON_UTF8 ("bson!")); + j = bson_as_canonical_extended_json (b, NULL); + printf ("%s\en", j); + + bson_free (j); + bson_destroy (b); + + return 0; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS CMake +.sp +The libbson installation includes a \fI\%CMake config\-file package\fP, so you can use CMake\(aqs \fI\%find_package\fP command to find libbson\(aqs header and library paths and link to libbson: +CMakeLists.txt.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-1.0 1.7 REQUIRED) + +message ("\-\- libbson found version \e"${BSON_VERSION}\e"") +message ("\-\- libbson include path \e"${BSON_INCLUDE_DIRS}\e"") +message ("\-\- libbson libraries \e"${BSON_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +By default, libbson is dynamically linked. You can use libbson as a static library instead: Use the included \fBlibbson\-static\-1.0\fP config\-file package and (on Unix) link to \fBpthread\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-static\-1.0 1.7 REQUIRED) + +message ("\-\- libbson\-static found version \e"${BSON_STATIC_VERSION}\e"") +message ("\-\- libbson\-static include path \e"${BSON_STATIC_INCLUDE_DIRS}\e"") +message ("\-\- libbson\-static libraries \e"${BSON_STATIC_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_STATIC_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_STATIC_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_STATIC_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS pkg\-config +.sp +If you\(aqre not using CMake, use \fI\%pkg\-config\fP on the command line to set header and library paths: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Or to statically link to libbson: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-static\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Creating a BSON Document +.SS The bson_t structure +.sp +BSON documents are created using the \fBbson_t\fP structure. This structure encapsulates the necessary logic for encoding using the \fI\%BSON Specification\fP\&. At the core, \fBbson_t\fP is a buffer manager and set of encoding routines. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +BSON documents can live on the stack or the heap based on the performance needs or preference of the consumer. +.UNINDENT +.UNINDENT +.sp +Let\(aqs start by creating a new BSON document on the stack. Whenever using libbson, make sure you \fB#include \fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b; + +bson_init (&b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This creates an empty document. In JSON, this would be the same as \fB{}\fP\&. +.sp +We can now proceed to adding items to the BSON document. A variety of functions prefixed with \fBbson_append_\fP can be used based on the type of field you want to append. Let\(aqs append a UTF\-8 encoded string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice the two \fB\-1\fP parameters. The first indicates that the length of \fBkey\fP in bytes should be determined with \fBstrlen()\fP\&. Alternatively, we could have passed the number \fB3\fP\&. The same goes for the second \fB\-1\fP, but for \fBvalue\fP\&. +.sp +Libbson provides macros to make this less tedious when using string literals. The following two appends are identical. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +BSON_APPEND_UTF8 (&b, "key", "value"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Now let\(aqs take a look at an example that adds a few different field types to a BSON document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b = BSON_INITIALIZER; + +BSON_APPEND_INT32 (&b, "a", 1); +BSON_APPEND_UTF8 (&b, "hello", "world"); +BSON_APPEND_BOOL (&b, "bool", true); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice that we omitted the call to \fBbson_init()\fP\&. By specifying \fBBSON_INITIALIZER\fP we can remove the need to initialize the structure to a base state. +.SS Sub\-Documents and Sub\-Arrays +.sp +To simplify the creation of sub\-documents and arrays, \fBbson_append_document_begin()\fP and \fBbson_append_array_begin()\fP exist. These can be used to build a sub\-document using the parent documents memory region as the destination buffer. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t parent; +bson_t child; +char *str; + +bson_init (&parent); +bson_append_document_begin (&parent, "foo", 3, &child); +bson_append_int32 (&child, "baz", 3, 1); +bson_append_document_end (&parent, &child); + +str = bson_as_canonical_extended_json (&parent, NULL); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (&parent); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "baz" : 1 } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Simplified BSON C Object Notation +.sp +Creating BSON documents by hand can be tedious and time consuming. BCON, or BSON C Object Notation, was added to allow for the creation of BSON documents in a format that looks closer to the destination format. +.sp +The following example shows the use of BCON. Notice that values for fields are wrapped in the \fBBCON_*\fP macros. These are required for the variadic processor to determine the parameter type. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *doc; + +doc = BCON_NEW ("foo", + "{", + "int", + BCON_INT32 (1), + "array", + "[", + BCON_INT32 (100), + "{", + "sub", + BCON_UTF8 ("value"), + "}", + "]", + "}"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Creates the following document +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "int" : 1, "array" : [ 100, { "sub" : "value" } ] } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Handling Errors +.SS Description +.sp +Many libbson functions report errors by returning \fBNULL\fP or \-1 and filling out a \fBbson_error_t\fP structure with an error domain, error code, and message. +.INDENT 0.0 +.IP \(bu 2 +\fBerror.domain\fP names the subsystem that generated the error. +.IP \(bu 2 +\fBerror.code\fP is a domain\-specific error type. +.IP \(bu 2 +\fBerror.message\fP describes the error. +.UNINDENT +.sp +Some error codes overlap with others; always check both the domain and code to determine the type of error. +.TS +center; +|l|l|l|. +_ +T{ +\fBBSON_ERROR_JSON\fP +T} T{ +\fBBSON_JSON_ERROR_READ_CORRUPT_JS\fP +\fBBSON_JSON_ERROR_READ_INVALID_PARAM\fP +\fBBSON_JSON_ERROR_READ_CB_FAILURE\fP +T} T{ +\fBbson_json_reader_t\fP tried to parse invalid MongoDB Extended JSON. +Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. +An internal callback failure during JSON parsing. +T} +_ +T{ +\fBBSON_ERROR_READER\fP +T} T{ +\fBBSON_ERROR_READER_BADFD\fP +T} T{ +\fBbson_json_reader_new_from_file\fP could not open the file. +T} +_ +.TE +.SS ObjectIDs +.sp +Libbson provides a simple way to generate ObjectIDs. It can be used in a single\-threaded or multi\-threaded manner depending on your requirements. +.sp +The \fBbson_oid_t\fP structure represents an \fBObjectID\fP in MongoDB. It is a 96\-bit identifier that includes various information about the system generating the OID. +.SS Composition +.INDENT 0.0 +.IP \(bu 2 +4 bytes : The UNIX timestamp in big\-endian format. +.IP \(bu 2 +3 bytes : A hash of the hostname. +.IP \(bu 2 +2 bytes : The \fBpid_t\fP of the current process. Alternatively the task\-id if configured. +.IP \(bu 2 +3 bytes : A 24\-bit monotonic counter incrementing from \fBrand()\fP in big\-endian. +.UNINDENT +.SS Sorting ObjectIDs +.sp +The typical way to sort in C is using \fBqsort()\fP\&. Therefore, Libbson provides a \fBqsort()\fP compatible callback function named \fBbson_oid_compare()\fP\&. It returns \fBless than 1\fP, \fBgreater than 1\fP, or \fB0\fP depending on the equality of two \fBbson_oid_t\fP structures. +.SS Comparing Object IDs +.sp +If you simply want to compare two \fBbson_oid_t\fP structures for equality, use \fBbson_oid_equal()\fP\&. +.SS Generating +.sp +To generate a \fBbson_oid_t\fP, you may use the following. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init (&oid, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Parsing ObjectID Strings +.sp +You can also parse a string containing a \fBbson_oid_t\fP\&. The input string \fIMUST\fP be 24 characters or more in length. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If you need to parse may \fBbson_oid_t\fP in a tight loop and can guarantee the data is safe, you might consider using the inline variant. It will be inlined into your code and reduce the need for a foreign function call. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string_unsafe (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Hashing ObjectIDs +.sp +If you need to store items in a hashtable, you may want to use the \fBbson_oid_t\fP as the key. Libbson provides a hash function for just this purpose. It is based on DJB hash. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +unsigned hash; + +hash = bson_oid_hash (oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Fetching ObjectID Creation Time +.sp +You can easily fetch the time that a \fBbson_oid_t\fP was generated using \fBbson_oid_get_time_t()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +time_t t; + +t = bson_oid_get_time_t (oid); +printf ("The OID was generated at %u\en", (unsigned) t); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Parsing and Iterating BSON Documents +.SS Parsing +.sp +BSON documents are lazily parsed as necessary. To begin parsing a BSON document, use one of the provided Libbson functions to create a new \fBbson_t\fP from existing data such as \fBbson_new_from_data()\fP\&. This will make a copy of the data so that additional mutations may occur to the BSON document. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +If you only want to parse a BSON document and have no need to mutate it, you may use \fBbson_init_static()\fP to avoid making a copy of the data. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; + +b = bson_new_from_data (my_data, my_data_len); +if (!b) { + fprintf (stderr, "The specified length embedded in did not match " + "\en"); + return; +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Only two checks are performed when creating a new \fBbson_t\fP from an existing buffer. First, the document must begin with the buffer length, matching what was expected by the caller. Second, the document must end with the expected trailing \fB\e0\fP byte. +.sp +To parse the document further we use a \fBbson_iter_t\fP to iterate the elements within the document. Let\(aqs print all of the field names in the document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if (bson_iter_init (&iter, b)) { + while (bson_iter_next (&iter)) { + printf ("Found element key: \e"%s\e"\en", bson_iter_key (&iter)); + } + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Converting a document to JSON uses a \fBbson_iter_t\fP and \fBbson_visitor_t\fP to iterate all fields of a BSON document recursively and generate a UTF\-8 encoded JSON string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +char *json; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if ((json = bson_as_canonical_extended_json (b, NULL))) { + printf ("%s\en", json); + bson_free (json); + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Recursing into Sub\-Documents +.sp +Libbson provides convenient sub\-iterators to dive down into a sub\-document or sub\-array. Below is an example that will dive into a sub\-document named "foo" and print it\(aqs field names. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; +bson_iter_t child; +char *json; + +if (bson_iter_init_find (&iter, doc, "foo") && + BSON_ITER_HOLDS_DOCUMENT (&iter) && bson_iter_recurse (&iter, &child)) { + while (bson_iter_next (&child)) { + printf ("Found sub\-key of \e"foo\e" named \e"%s\e"\en", + bson_iter_key (&child)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Finding Fields using Dot Notation +.sp +Using the \fBbson_iter_recurse()\fP function exemplified above, \fBbson_iter_find_descendant()\fP can find a field for you using the MongoDB style path notation such as "foo.bar.0.baz". +.sp +Let\(aqs create a document like \fB{"foo": {"bar": [{"baz: 1}]}}\fP and locate the \fB"baz"\fP field. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; +bson_iter_t baz; + +b = + BCON_NEW ("foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}"); + +if (bson_iter_init (&iter, b) && + bson_iter_find_descendant (&iter, "foo.bar.0.baz", &baz) && + BSON_ITER_HOLDS_INT32 (&baz)) { + printf ("baz = %d\en", bson_iter_int32 (&baz)); +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Validating a BSON Document +.sp +If all you want to do is validate that a BSON document is valid, you can use \fBbson_validate()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t err_offset; + +if (!bson_validate (doc, BSON_VALIDATE_NONE, &err_offset)) { + fprintf (stderr, + "The document failed to validate at offset: %u\en", + (unsigned) err_offset); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See the \fBbson_validate()\fP documentation for more information and examples. +.SS UTF\-8 +.SS Encoding +.sp +Libbson expects that you are always working with UTF\-8 encoded text. Anything else is \fBinvalid API use\fP\&. +.sp +If you should need to walk through UTF\-8 sequences, you can use the various UTF\-8 helper functions distributed with Libbson. +.SS Validating a UTF\-8 Sequence +.sp +To validate the string contained in \fBmy_string\fP, use the following. You may pass \fB\-1\fP for the string length if you know the string is NULL\-terminated. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, \-1, false)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If \fBmy_string\fP has NULL bytes within the string, you must provide the string length. Use the following format. Notice the \fBtrue\fP at the end indicating \fB\e0\fP is allowed. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, my_string_len, true)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For more information see the API reference for \fBbson_utf8_validate()\fP\&. +.SS Guides +.SS Streaming BSON +.sp +\fBbson_reader_t\fP provides a streaming reader which can be initialized with a filedescriptor or memory region. \fBbson_writer_t\fP provides a streaming writer which can be initialized with a memory region. (Streaming BSON to a file descriptor is not yet supported.) +.SS Reading from a BSON Stream +.sp +\fBbson_reader_t\fP provides a convenient API to read sequential BSON documents from a file\-descriptor or memory buffer. The \fBbson_reader_read()\fP function will read forward in the underlying stream and return a \fBbson_t\fP that can be inspected and iterated upon. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *doc; + bson_error_t error; + bool eof; + + reader = bson_reader_new_from_file ("mycollection.bson", &error); + + if (!reader) { + fprintf (stderr, "Failed to open file.\en"); + return 1; + } + + while ((doc = bson_reader_read (reader, &eof))) { + char *str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\en", str); + bson_free (str); + } + + if (!eof) { + fprintf (stderr, + "corrupted bson document found at %u\en", + (unsigned) bson_reader_tell (reader)); + } + + bson_reader_destroy (reader); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_reader_new_from_fd()\fP, \fBbson_reader_new_from_file()\fP, and \fBbson_reader_new_from_data()\fP for more information. +.SS Writing a sequence of BSON Documents +.sp +\fBbson_writer_t\fP provides a convenient API to write a sequence of BSON documents to a memory buffer that can grow with \fBrealloc()\fP\&. The \fBbson_writer_begin()\fP and \fBbson_writer_end()\fP functions will manage the underlying buffer while building the sequence of documents. +.sp +This could also be useful if you want to write to a network packet while serializing the documents from a higher level language, (but do so just after the packets header). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_writer_t *writer; + bson_t *doc; + uint8_t *buf = NULL; + size_t buflen = 0; + bool r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 10000; i++) { + r = bson_writer_begin (writer, &doc); + assert (r); + + r = BSON_APPEND_INT32 (doc, "i", i); + assert (r); + + bson_writer_end (writer); + } + + bson_free (buf); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_writer_new()\fP for more information. +.SS JSON +.sp +Libbson provides routines for converting to and from the JSON format. In particular, it supports the \fI\%MongoDB extended JSON\fP format. +.SS Converting BSON to JSON +.sp +There are often times where you might want to convert a BSON document to JSON. It is convenient for debugging as well as an interchange format. To help with this, Libbson contains the functions \fBbson_as_canonical_extended_json()\fP and \fBbson_as_relaxed_extended_json()\fP\&. The canonical format preserves BSON type information for values that may have ambiguous representations in JSON (e.g. numeric types). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_canonical_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : { "$numberInt": "1" } } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The relaxed format prefers JSON primitives for numeric values and may be used if type fidelity is not required. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +size_t len; +char *str; + +b = BCON_NEW ("a", BCON_INT32 (1)); + +str = bson_as_relaxed_extended_json (b, &len); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "a" : 1 } +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Converting JSON to BSON +.sp +Converting back from JSON is also useful and common enough that we added \fBbson_init_from_json()\fP and \fBbson_new_from_json()\fP\&. +.sp +The following example creates a new \fBbson_t\fP from the JSON string \fB{"a":1}\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_error_t error; + +b = bson_new_from_json ("{\e"a\e":1}", \-1, &error); + +if (!b) { + printf ("Error: %s\en", error.message); +} else { + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Streaming JSON Parsing +.sp +Libbson provides \fBbson_json_reader_t\fP to allow for parsing a sequence of JSON documents into BSON. The interface is similar to \fBbson_reader_t\fP but expects the input to be in the \fI\%MongoDB extended JSON\fP format. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "\-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\en%s\en", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\en"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Examples +.sp +The following example reads BSON documents from \fBstdin\fP and prints them to \fBstdout\fP as JSON. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | \-]...\enUse \- for STDIN.\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "\-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Use Valgrind to Check For BSON Data Leaks +.sp +A stack\-allocated \fBbson_t\fP contains a small internal buffer; it only heap\-allocates additional storage if necessary, depending on its data size. Therefore if you forget to call \fBbson_destroy\fP on a stack\-allocated \fBbson_t\fP, it might or might not cause a leak that can be detected by valgrind during testing. +.sp +To catch all potential BSON data leaks in your code, configure the BSON_MEMCHECK flag: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +cmake \-DCMAKE_C_FLAGS="\-DBSON_MEMCHECK \-g" . +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +With this flag set, every \fBbson_t\fP mallocs at least one byte. Run your program\(aqs unittests with valgrind to verify all \fBbson_t\fP structs are destroyed. +.sp +Set the environment variable \fBMONGOC_TEST_VALGRIND\fP to \fBon\fP to skip timing\-dependent tests known to fail with valgrind. +.SS Cross Platform Notes +.SS Endianness +.sp +The BSON specification dictates that the encoding format is in little\-endian. Many implementations simply ignore endianness altogether and expect that they are to be run on little\-endian. Libbson supports both Big and Little Endian systems. This means we use \fBmemcpy()\fP when appropriate instead of dereferencing and properly convert to and from the host endian format. We expect the compiler intrinsics to optimize it to a dereference when possible. +.SS Threading +.sp +Libbson\(aqs data structures are \fINOT\fP thread\-safe. You are responsible for accessing and mutating these structures from one thread at a time. +.sp +Libbson requires POSIX threads (pthreads) on all UNIX\-like platforms. On Windows, the native threading interface is used. Libbson uses your system\(aqs threading library to safely generate unique ObjectIds, and to provide a fallback implementation for atomic operations on platforms without built\-in atomics. +.SS API Reference +.SS bson_t +.sp +BSON Document Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +/** + * bson_empty: + * @b: a bson_t. + * + * Checks to see if @b is an empty BSON document. An empty BSON document is + * a 5 byte document which contains the length (4 bytes) and a single NUL + * byte indicating end of fields. + */ +#define bson_empty(b) /* ... */ + +/** + * bson_empty0: + * + * Like bson_empty() but treats NULL the same as an empty bson_t document. + */ +#define bson_empty0(b) /* ... */ + +/** + * bson_clear: + * + * Easily free a bson document and set it to NULL. Use like: + * + * bson_t *doc = bson_new(); + * bson_clear (&doc); + * BSON_ASSERT (doc == NULL); + */ +#define bson_clear(bptr) /* ... */ + +/** + * BSON_MAX_SIZE: + * + * The maximum size in bytes of a BSON document. + */ +#define BSON_MAX_SIZE /* ... */ + +#define BSON_APPEND_ARRAY(b, key, val) \e + bson_append_array (b, key, (int) strlen (key), val) + +#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \e + bson_append_array_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_BINARY(b, key, subtype, val, len) \e + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + +#define BSON_APPEND_BOOL(b, key, val) \e + bson_append_bool (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE(b, key, val) \e + bson_append_code (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \e + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + +#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \e + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + +#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \e + bson_append_document_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_DOUBLE(b, key, val) \e + bson_append_double (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DOCUMENT(b, key, val) \e + bson_append_document (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT32(b, key, val) \e + bson_append_int32 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT64(b, key, val) \e + bson_append_int64 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MINKEY(b, key) \e + bson_append_minkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_DECIMAL128(b, key, val) \e + bson_append_decimal128 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MAXKEY(b, key) \e + bson_append_maxkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + +#define BSON_APPEND_OID(b, key, val) \e + bson_append_oid (b, key, (int) strlen (key), val) + +#define BSON_APPEND_REGEX(b, key, val, opt) \e + bson_append_regex (b, key, (int) strlen (key), val, opt) + +#define BSON_APPEND_UTF8(b, key, val) \e + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_SYMBOL(b, key, val) \e + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_TIME_T(b, key, val) \e + bson_append_time_t (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMEVAL(b, key, val) \e + bson_append_timeval (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DATE_TIME(b, key, val) \e + bson_append_date_time (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \e + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + +#define BSON_APPEND_UNDEFINED(b, key) \e + bson_append_undefined (b, key, (int) strlen (key)) + +#define BSON_APPEND_VALUE(b, key, val) \e + bson_append_value (b, key, (int) strlen (key), (val)) + +BSON_ALIGNED_BEGIN (128) +typedef struct { + uint32_t flags; /* Internal flags for the bson_t. */ + uint32_t len; /* Length of BSON data. */ + uint8_t padding[120]; /* Padding for stack allocation. */ +} bson_t BSON_ALIGNED_END (128); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_t\fP structure represents a BSON document. This structure manages the underlying BSON encoded buffer. For mutable documents, it can append new data to the document. +.SS Performance Notes +.sp +The \fBbson_t\fP structure attempts to use an inline allocation within the structure to speed up performance of small documents. When this internal buffer has been exhausted, a heap allocated buffer will be dynamically allocated. Therefore, it is essential to call \fBbson_destroy()\fP on allocated documents. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +create_on_heap (void) +{ + bson_t *b = bson_new (); + + BSON_APPEND_INT32 (b, "foo", 123); + BSON_APPEND_UTF8 (b, "bar", "foo"); + BSON_APPEND_DOUBLE (b, "baz", 1.23f); + + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_context_t +.sp +BSON OID Generation Context +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef enum { + BSON_CONTEXT_NONE = 0, + BSON_CONTEXT_THREAD_SAFE = (1 << 0), + BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1), + BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2), +#ifdef BSON_HAVE_SYSCALL_TID + BSON_CONTEXT_USE_TASK_ID = (1 << 3), +#endif +} bson_context_flags_t; + +typedef struct _bson_context_t bson_context_t; + +bson_context_t * +bson_context_get_default (void) BSON_GNUC_CONST; +bson_context_t * +bson_context_new (bson_context_flags_t flags); +void +bson_context_destroy (bson_context_t *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_context_t\fP structure is context for generation of BSON Object IDs. This context allows for specialized overriding of how ObjectIDs are generated based on the applications requirements. For example, disabling of PID caching can be configured if the application cannot detect when a call to \fBfork()\fP has occurred. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int +main (int argc, char *argv[]) +{ + bson_context_t *ctx = NULL; + bson_oid_t oid; + + /* use default context, via bson_context_get_default() */ + bson_oid_init (&oid, NULL); + + /* specify a local context for additional control */ + ctx = bson_context_new (BSON_CONTEXT_DISABLE_PID_CACHE | + BSON_CONTEXT_THREAD_SAFE); + bson_oid_init (&oid, ctx); + + bson_context_destroy (ctx); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_decimal128_t +.sp +BSON Decimal128 Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +#define BSON_DECIMAL128_STRING 43 +#define BSON_DECIMAL128_INF "Infinity" +#define BSON_DECIMAL128_NAN "NaN" + +typedef struct { +#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN + uint64_t low; + uint64_t high; +#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN + uint64_t high; + uint64_t low; +#endif +} bson_decimal128_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_decimal128_t\fP structure +represents the IEEE\-754 Decimal128 data type. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + char string[BSON_DECIMAL128_STRING]; + bson_decimal128_t decimal128; + + bson_decimal128_from_string ("100.00", &decimal128); + bson_decimal128_to_string (&decimal128, string); + printf ("Decimal128 value: %s\en", string); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_error_t +.sp +BSON Error Encapsulation +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + uint32_t domain; + uint32_t code; + char message[504]; +} bson_error_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_error_t\fP structure is used as an out\-parameter to pass error information to the caller. It should be stack\-allocated and does not requiring freeing. +.sp +See Handling Errors\&. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_reader_t *reader; +bson_error_t error; + +reader = bson_reader_new_from_file ("dump.bson", &error); +if (!reader) { + fprintf ( + stderr, "ERROR: %d.%d: %s\en", error.domain, error.code, error.message); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_iter_t +.sp +BSON Document Iterator +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +#define BSON_ITER_HOLDS_DOUBLE(iter) /* ... */ + +#define BSON_ITER_HOLDS_UTF8(iter) /* ... */ + +#define BSON_ITER_HOLDS_DOCUMENT(iter) /* ... */ + +#define BSON_ITER_HOLDS_ARRAY(iter) /* ... */ + +#define BSON_ITER_HOLDS_BINARY(iter) /* ... */ + +#define BSON_ITER_HOLDS_UNDEFINED(iter) /* ... */ + +#define BSON_ITER_HOLDS_OID(iter) /* ... */ + +#define BSON_ITER_HOLDS_BOOL(iter) /* ... */ + +#define BSON_ITER_HOLDS_DATE_TIME(iter) /* ... */ + +#define BSON_ITER_HOLDS_NULL(iter) /* ... */ + +#define BSON_ITER_HOLDS_REGEX(iter) /* ... */ + +#define BSON_ITER_HOLDS_DBPOINTER(iter) /* ... */ + +#define BSON_ITER_HOLDS_CODE(iter) /* ... */ + +#define BSON_ITER_HOLDS_SYMBOL(iter) /* ... */ + +#define BSON_ITER_HOLDS_CODEWSCOPE(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT32(iter) /* ... */ + +#define BSON_ITER_HOLDS_TIMESTAMP(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT64(iter) /* ... */ + +#define BSON_ITER_HOLDS_DECIMAL128(iter) /* ... */ + +#define BSON_ITER_HOLDS_MAXKEY(iter) /* ... */ + +#define BSON_ITER_HOLDS_MINKEY(iter) /* ... */ + +#define BSON_ITER_HOLDS_INT(iter) \e + (BSON_ITER_HOLDS_INT32 (iter) || BSON_ITER_HOLDS_INT64 (iter)) + +#define BSON_ITER_HOLDS_NUMBER(iter) \e + (BSON_ITER_HOLDS_INT (iter) || BSON_ITER_HOLDS_DOUBLE (iter)) + +#define BSON_ITER_IS_KEY(iter, key) \e + (0 == strcmp ((key), bson_iter_key ((iter)))) + +typedef struct { + /*< private >*/ +} bson_iter_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +\fBbson_iter_t\fP is a structure used to iterate through the elements of a \fBbson_t\fP\&. It is meant to be used on the stack and can be discarded at any time as it contains no external allocation. The contents of the structure should be considered private and may change between releases, however the structure size will not change. +.sp +The \fBbson_t\fP \fIMUST\fP be valid for the lifetime of the iter and it is an error to modify the \fBbson_t\fP while using the iter. +.SS Examples +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_bson_doc)) { + while (bson_iter_next (&iter)) { + printf ("Found a field named: %s\en", bson_iter_key (&iter)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_bson_doc) && bson_iter_find (&iter, "my_field")) { + printf ("Found the field named: %s\en", bson_iter_key (&iter)); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; +bson_iter_t sub_iter; + +if (bson_iter_init_find (&iter, my_bson_doc, "mysubdoc") && + (BSON_ITER_HOLDS_DOCUMENT (&iter) || BSON_ITER_HOLDS_ARRAY (&iter)) && + bson_iter_recurse (&iter, &sub_iter)) { + while (bson_iter_next (&sub_iter)) { + printf ("Found key \e"%s\e" in sub document.\en", bson_iter_key (&sub_iter)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init (&iter, my_doc) && + bson_iter_find_descendant (&iter, "a.b.c.d", &sub_iter)) { + printf ("The type of a.b.c.d is: %d\en", (int) bson_iter_type (&sub_iter)); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_json_reader_t +.sp +Bulk JSON to BSON conversion +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_json_reader_t bson_json_reader_t; + +typedef enum { + BSON_JSON_ERROR_READ_CORRUPT_JS = 1, + BSON_JSON_ERROR_READ_INVALID_PARAM, + BSON_JSON_ERROR_READ_CB_FAILURE, +} bson_json_error_code_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_json_reader_t\fP structure is used for reading a sequence of JSON documents and transforming them to \fBbson_t\fP documents. +.sp +This can often be useful if you want to perform bulk operations that are defined in a file containing JSON documents. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBbson_json_reader_t\fP works upon JSON documents formatted in \fI\%MongoDB extended JSON\fP format. +.UNINDENT +.UNINDENT +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "\-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\en%s\en", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\en"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_md5_t +.sp +BSON MD5 Abstraction +.SS Deprecated +.sp +All MD5 APIs are deprecated in libbson. +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct { + uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t abcd[4]; /* digest buffer */ + uint8_t buf[64]; /* accumulate block */ +} bson_md5_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +bson_md5_t encapsulates an implementation of the MD5 algorithm. +.SS bson_oid_t +.sp +BSON ObjectID Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + uint8_t bytes[12]; +} bson_oid_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_oid_t\fP structure contains the 12\-byte ObjectId notation defined by the \fI\%BSON ObjectID specification\fP\&. +.sp +ObjectId is a 12\-byte BSON type, constructed using: +.INDENT 0.0 +.IP \(bu 2 +a 4\-byte value representing the seconds since the Unix epoch (in Big Endian) +.IP \(bu 2 +a 3\-byte machine identifier +.IP \(bu 2 +a 2\-byte process id (Big Endian), and +.IP \(bu 2 +a 3\-byte counter (Big Endian), starting with a random value. +.UNINDENT +.SS String Conversion +.sp +You can convert an Object ID to a string using \fBbson_oid_to_string()\fP and back with \fBbson_oid_init_from_string()\fP\&. +.SS Hashing +.sp +A \fBbson_oid_t\fP can be used in hashtables using the function \fBbson_oid_hash()\fP and \fBbson_oid_equal()\fP\&. +.SS Comparing +.sp +A \fBbson_oid_t\fP can be compared to another using \fBbson_oid_compare()\fP for \fBqsort()\fP style comparing and \fBbson_oid_equal()\fP for direct equality. +.SS Validating +.sp +You can validate that a string containing a hex\-encoded ObjectID is valid using the function \fBbson_oid_is_valid()\fP\&. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_oid_t oid; + char str[25]; + + bson_oid_init (&oid, NULL); + bson_oid_to_string (&oid, str); + printf ("%s\en", str); + + if (bson_oid_is_valid (str, sizeof str)) { + bson_oid_init_from_string (&oid, str); + } + + printf ("The UNIX time was: %u\en", (unsigned) bson_oid_get_time_t (&oid)); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_reader_t +.sp +Streaming BSON Document Reader +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_reader_t bson_reader_t; + +bson_reader_t * +bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); +bson_reader_t * +bson_reader_new_from_fd (int fd, bool close_on_destroy); +bson_reader_t * +bson_reader_new_from_file (const char *path, bson_error_t *error); +bson_reader_t * +bson_reader_new_from_data (const uint8_t *data, size_t length); + +void +bson_reader_destroy (bson_reader_t *reader); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +\fBbson_reader_t\fP is a structure used for reading a sequence of BSON documents. The sequence can come from a file\-descriptor, memory region, or custom callbacks. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE\-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | \-]...\enUse \- for STDIN.\en", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "\-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \e"%s\e": %s\en", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Character and String Routines +.sp +We provide a small number of character and string routines to substitute for those that are not available on all platforms, and routines to make UTF\-8 character manipulation convenient. +.SS bson_string_t +.sp +String Building Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + char *str; + uint32_t len; + uint32_t alloc; +} bson_string_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +\fBbson_string_t\fP is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two. +.sp +This API is useful if you need to build UTF\-8 encoded strings. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_string_t *str; + +str = bson_string_new (NULL); +bson_string_append_printf (str, "%d %s %f\en", 0, "some string", 0.123); +printf ("%s\en", str\->str); + +bson_string_free (str, true); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +You can call \fBbson_string_free()\fP with \fBfalse\fP if you would like to take ownership of \fBstr\->str\fP\&. Some APIs that do this might call \fBreturn bson_string_free (str, false);\fP after building the string. +.UNINDENT +.UNINDENT +.SS bson_subtype_t +.sp +Binary Field Subtype +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + + +typedef enum { + BSON_SUBTYPE_BINARY = 0x00, + BSON_SUBTYPE_FUNCTION = 0x01, + BSON_SUBTYPE_BINARY_DEPRECATED = 0x02, + BSON_SUBTYPE_UUID_DEPRECATED = 0x03, + BSON_SUBTYPE_UUID = 0x04, + BSON_SUBTYPE_MD5 = 0x05, + BSON_SUBTYPE_USER = 0x80, +} bson_subtype_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +This enumeration contains the various subtypes that may be used in a binary field. See \fI\%http://bsonspec.org\fP for more information. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t doc = BSON_INITIALIZER; + +BSON_APPEND_BINARY (&doc, "binary", BSON_SUBTYPE_BINARY, data, data_len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_type_t +.sp +BSON Type Enumeration +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_DECIMAL128 = 0x13, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, +} bson_type_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_type_t\fP enumeration contains all of the types from the \fI\%BSON Specification\fP\&. It can be used to determine the type of a field at runtime. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init_find (&iter, doc, "foo") && + (BSON_TYPE_INT32 == bson_iter_type (&iter))) { + printf ("\(aqfoo\(aq is an int32.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_unichar_t +.sp +Unicode Character Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef uint32_t bson_unichar_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +\fBbson_unichar_t\fP provides an abstraction on a single unicode character. It is the 32\-bit representation of a character. As UTF\-8 can contain multi\-byte characters, this should be used when iterating through UTF\-8 text. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +print_each_char (const char *str) +{ + bson_unichar_t c; + + for (; *str; str = bson_utf8_next_char (str)) { + c = bson_utf8_get_char (str); + printf ("The numberic value is %u.\en", (unsigned) c); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_value_t +.sp +BSON Boxed Container Type +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_value_t { + bson_type_t value_type; + union { + bson_oid_t v_oid; + int64_t v_int64; + int32_t v_int32; + int8_t v_int8; + double v_double; + bool v_bool; + int64_t v_datetime; + struct { + uint32_t timestamp; + uint32_t increment; + } v_timestamp; + struct { + uint32_t len; + char *str; + } v_utf8; + struct { + uint32_t data_len; + uint8_t *data; + } v_doc; + struct { + uint32_t data_len; + uint8_t *data; + bson_subtype_t subtype; + } v_binary; + struct { + char *regex; + char *options; + } v_regex; + struct { + char *collection; + uint32_t collection_len; + bson_oid_t oid; + } v_dbpointer; + struct { + uint32_t code_len; + char *code; + } v_code; + struct { + uint32_t code_len; + char *code; + uint32_t scope_len; + uint8_t *scope_data; + } v_codewscope; + struct { + uint32_t len; + char *symbol; + } v_symbol; + } value; +} bson_value_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_value_t\fP structure is a boxed type for encapsulating a runtime determined type. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_value_t *value; + +value = bson_iter_value (&iter); + +if (value\->value_type == BSON_TYPE_INT32) { + printf ("%d\en", value\->value.v_int32); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_visitor_t +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + /* run before / after descending into a document */ + bool (*visit_before) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_after) (const bson_iter_t *iter, const char *key, void *data); + /* corrupt BSON, or unsupported type and visit_unsupported_type not set */ + void (*visit_corrupt) (const bson_iter_t *iter, void *data); + /* normal bson field callbacks */ + bool (*visit_double) (const bson_iter_t *iter, + const char *key, + double v_double, + void *data); + bool (*visit_utf8) (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data); + bool (*visit_document) (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + bool (*visit_array) (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); + bool (*visit_binary) (const bson_iter_t *iter, + const char *key, + bson_subtype_t v_subtype, + size_t v_binary_len, + const uint8_t *v_binary, + void *data); + /* normal field with deprecated "Undefined" BSON type */ + bool (*visit_undefined) (const bson_iter_t *iter, + const char *key, + void *data); + bool (*visit_oid) (const bson_iter_t *iter, + const char *key, + const bson_oid_t *v_oid, + void *data); + bool (*visit_bool) (const bson_iter_t *iter, + const char *key, + bool v_bool, + void *data); + bool (*visit_date_time) (const bson_iter_t *iter, + const char *key, + int64_t msec_since_epoch, + void *data); + bool (*visit_null) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_regex) (const bson_iter_t *iter, + const char *key, + const char *v_regex, + const char *v_options, + void *data); + bool (*visit_dbpointer) (const bson_iter_t *iter, + const char *key, + size_t v_collection_len, + const char *v_collection, + const bson_oid_t *v_oid, + void *data); + bool (*visit_code) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + void *data); + bool (*visit_symbol) (const bson_iter_t *iter, + const char *key, + size_t v_symbol_len, + const char *v_symbol, + void *data); + bool (*visit_codewscope) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data); + bool (*visit_int32) (const bson_iter_t *iter, + const char *key, + int32_t v_int32, + void *data); + bool (*visit_timestamp) (const bson_iter_t *iter, + const char *key, + uint32_t v_timestamp, + uint32_t v_increment, + void *data); + bool (*visit_int64) (const bson_iter_t *iter, + const char *key, + int64_t v_int64, + void *data); + bool (*visit_maxkey) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_minkey) (const bson_iter_t *iter, const char *key, void *data); + /* if set, called instead of visit_corrupt when an apparently valid BSON + * includes an unrecognized field type (reading future version of BSON) */ + void (*visit_unsupported_type) (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data); + bool (*visit_decimal128) (const bson_iter_t *iter, + const char *key, + const bson_decimal128_t *v_decimal128, + void *data); + + void *padding[7]; +} bson_visitor_t bson_visitor_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_visitor_t\fP structure provides a series of callbacks that can be called while iterating a BSON document. This may simplify the conversion of a \fBbson_t\fP to a higher level language structure. +.sp +If the optional callback \fBvisit_unsupported_type\fP is set, it is called instead of \fBvisit_corrupt\fP in the specific case of an unrecognized field type. (Parsing is aborted in either case.) Use this callback to report an error like "unrecognized type" instead of simply "corrupt BSON". This future\-proofs code that may use an older version of libbson to parse future BSON formats. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +static bool +my_visit_before (const bson_iter_t *iter, const char *key, void *data) +{ + int *count = (int *) data; + + (*count)++; + + /* returning true stops further iteration of the document */ + + return false; +} + +static void +count_fields (bson_t *doc) +{ + bson_visitor_t visitor = {0}; + bson_iter_t iter; + int count = 0; + + visitor.visit_before = my_visit_before; + + if (bson_iter_init (&iter, doc)) { + bson_iter_visit_all (&iter, &visitor, &count); + } + + printf ("Found %d fields.\en", count); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The example below demonstrates how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +typedef struct { + ssize_t *err_offset; +} my_state_t; + +static void +my_visit_corrupt (const bson_iter_t *iter, void *data) +{ + *(((my_state_t *) data)\->err_offset) = iter\->off; +} + +static void +my_visit_unsupported_type (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data) +{ + *(((my_state_t *) data)\->err_offset) = iter\->off; +} + +static void +find_error_location (bson_t *doc) +{ + bson_visitor_t visitors = {0}; + bson_iter_t iter; + my_state_t state; + ssize_t err_offset = \-1; + + visitors.visit_corrupt = my_visit_corrupt; + visitors.visit_unsupported_type = my_visit_unsupported_type; + /* provide additional visitors as needed based on your requirements */ + state.err_offset = &err_offset; + + if (!bson_iter_init (&iter, doc)) { + printf ("Could not initialize iterator!"); + exit (1); + } + + if (bson_iter_visit_all (&iter, &visitors, &state) || + err_offset != \-1) { + printf ("Found error at offset %d.\en", err_offset); + } else { + printf ("BSON document had no errors.\en"); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS bson_writer_t +.sp +Bulk BSON serialization Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_writer_t bson_writer_t; + +bson_writer_t * +bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); +void +bson_writer_destroy (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The \fBbson_writer_t\fP API provides an abstraction for serializing many BSON documents to a single memory region. The memory region may be dynamically allocated and re\-allocated as more memory is demanded. This can be useful when building network packets from a high\-level language. For example, you can serialize a Python Dictionary directly to a single buffer destined for a TCP packet. +.SS Example +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int +main (int argc, char *argv[]) +{ + bson_writer_t *writer; + uint8_t *buf = NULL; + size_t buflen = 0; + bson_t *doc; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 1000; i++) { + bson_writer_begin (writer, &doc); + BSON_APPEND_INT32 (&doc, "i", i); + bson_writer_end (writer); + } + + bson_writer_destroy (writer); + + bson_free (buf); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS System Clock +.sp +BSON Clock Abstraction +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +bson_get_monotonic_time (void); +int +bson_gettimeofday (struct timeval *tv, + struct timezone *tz); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Description +.sp +The clock abstraction in Libbson provides a cross\-platform way to handle timeouts within the BSON library. It abstracts the differences in implementations of \fBgettimeofday()\fP as well as providing a monotonic (incrementing only) clock in microseconds. +.SS Memory Management +.sp +BSON Memory Abstraction. +.SS Description +.sp +Libbson contains a lightweight memory abstraction to make portability to new platforms easier. Additionally, it helps us integrate with interesting higher\-level languages. One caveat, however, is that Libbson is not designed to deal with Out of Memory (OOM) situations. Doing so requires extreme diligence throughout the application stack that has rarely been implemented correctly. This may change in the future. As it stands now, Libbson will \fBabort()\fP under OOM situations. +.sp +To aid in language binding integration, Libbson allows for setting a custom memory allocator via \fBbson_mem_set_vtable()\fP\&. This allocation may be reversed via \fBbson_mem_restore_vtable()\fP\&. +.SS Libbson Versioning +.sp +Versioning Macros and Functions +.SS Macros +.sp +The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against. This may be useful if you only want to enable a feature on a certain version of the library. +.SS Synopsis +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_CHECK_VERSION(major, minor, micro) + +#define BSON_MAJOR_VERSION (1) +#define BSON_MINOR_VERSION (4) +#define BSON_MICRO_VERSION (1) +#define BSON_VERSION_S "1.4.1" + +#define BSON_VERSION_HEX \e + (BSON_MAJOR_VERSION << 24 | BSON_MINOR_VERSION << 16 | \e + BSON_MICRO_VERSION << 8) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Only compile a block on Libbson 1.1.0 and newer. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#if BSON_CHECK_VERSION(1, 1, 0) +static void +do_something (void) +{ +} +#endif +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reinit.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reinit.3 new file mode 100644 index 0000000..5742945 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reinit.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_REINIT" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reinit \- bson_reinit() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_reinit (bson_t *b); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBb\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_reinit()\fP function shall be equivalent to calling \fBbson_destroy()\fP and \fBbson_init()\fP\&. +.sp +However, if the \fBbson_t\fP structure contains a malloc()\(aqd buffer, it may be reused. To be certain that any buffer is freed, always call \fBbson_destroy\fP on any \fBbson_t\fP structure, whether initialized or reinitialized, after its final use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reserve_buffer.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reserve_buffer.3 new file mode 100644 index 0000000..c1798d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_reserve_buffer.3 @@ -0,0 +1,146 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_RESERVE_BUFFER" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_reserve_buffer \- bson_reserve_buffer() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint8_t * +bson_reserve_buffer (bson_t *bson, uint32_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: An initialized \fBbson_t\fP\&. +.IP \(bu 2 +\fBsize\fP: The length in bytes of the new buffer. +.UNINDENT +.SH DESCRIPTION +.sp +Grow the internal buffer of \fBbson\fP to \fBsize\fP and set the document length to \fBsize\fP\&. Useful for eliminating copies when reading BSON bytes from a stream. +.sp +First, initialize \fBbson\fP with \fBbson_init\fP or \fBbson_new\fP, then call this function. After it returns, the length of \fBbson\fP is set to \fBsize\fP but its contents are uninitialized memory: you must fill the contents with a BSON document of the correct length before any other operations. +.sp +The document must be freed with \fBbson_destroy\fP\&. +.SH RETURNS +.sp +A pointer to the internal buffer, which is at least \fBsize\fP bytes, or NULL if the space could not be allocated. +.SH EXAMPLE +.sp +Use \fBbson_reserve_buffer\fP to write a function that takes a \fBbson_t\fP pointer and reads a file into it directly: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +bool +read_into (bson_t *bson, FILE *fp) +{ + uint8_t *buffer; + long size; + + if (fseek (fp, 0L, SEEK_END) < 0) { + perror ("Couldn\(aqt get file size"); + return 1; + } + + size = ftell (fp); + if (size == EOF) { + perror ("Couldn\(aqt get file size"); + return 1; + } + + if (size > INT32_MAX) { + fprintf (stderr, "File too large\en"); + return 1; + } + + /* reserve buffer space \- bson is temporarily invalid */ + buffer = bson_reserve_buffer (bson, (uint32_t) size); + if (!buffer) { + fprintf (stderr, "Couldn\(aqt reserve %ld bytes", size); + return false; + } + + /* read file directly into the buffer */ + rewind (fp); + if (fread ((void *) buffer, 1, (size_t) size, fp) < (size_t) size) { + perror ("Couldn\(aqt read file"); + return false; + } + + return true; +} + +int +main () +{ + FILE *fp; + char *json; + + /* stack\-allocated, initialized bson_t */ + bson_t bson = BSON_INITIALIZER; + + if (!(fp = fopen ("document.bson", "rb"))) { + perror ("Couldn\(aqt read file"); + return 1; + } + + read_into (&bson, fp); + fclose (fp); + + json = bson_as_canonical_extended_json (&bson, NULL); + printf ("%s\en", json); + + bson_free (json); + bson_destroy (&bson); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_set_error.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_set_error.3 new file mode 100644 index 0000000..d107dee --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_set_error.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_SET_ERROR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_set_error \- bson_set_error() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_set_error ( + bson_error_t *error, uint32_t domain, uint32_t code, const char *format, ...) + BSON_GNUC_PRINTF (4, 5); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBerror\fP: A \fBbson_error_t\fP\&. +.IP \(bu 2 +\fBdomain\fP: A \fBuint32_t\fP\&. +.IP \(bu 2 +\fBcode\fP: A \fBuint32_t\fP\&. +.IP \(bu 2 +\fBformat\fP: A \fBprintf()\fP style format string. +.UNINDENT +.SH DESCRIPTION +.sp +This is a helper function to set the parameters of a \fBbson_error_t\fP\&. It handles the case where \fBerror\fP is NULL by doing nothing. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_sized_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_sized_new.3 new file mode 100644 index 0000000..f76eb24 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_sized_new.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_SIZED_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_sized_new \- bson_sized_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t * +bson_sized_new (size_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsize\fP: The size to pre\-allocate for the underlying buffer. +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_sized_new()\fP function shall create a new \fBbson_t\fP on the heap with a preallocated buffer. This is useful if you have a good idea of the size of the resulting document. +.SH RETURNS +.sp +A newly allocated \fBbson_t\fP that should be freed with \fBbson_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_snprintf.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_snprintf.3 new file mode 100644 index 0000000..024ddda --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_snprintf.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_SNPRINTF" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_snprintf \- bson_snprintf() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_snprintf (char *str, size_t size, const char *format, ...) + BSON_GNUC_PRINTF (3, 4); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: The destination buffer. +.IP \(bu 2 +\fBsize\fP: The size of \fBstr\fP\&. +.IP \(bu 2 +\fBformat\fP: A printf style format string. +.UNINDENT +.SH DESCRIPTION +.sp +This is a portable wrapper around \fBsnprintf()\fP\&. It also enforces a trailing \fB\e0\fP in the resulting string. +.SH RETURNS +.sp +The number of bytes written to \fBstr\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_steal.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_steal.3 new file mode 100644 index 0000000..3ee4117 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_steal.3 @@ -0,0 +1,119 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STEAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_steal \- bson_steal() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_steal (bson_t *dst, bson_t *src); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdst\fP: An uninitialized \fBbson_t\fP\&. +.IP \(bu 2 +\fBsrc\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Efficiently transfer the contents of \fBsrc\fP to \fBdst\fP and destroy \fBsrc\fP\&. +.sp +Before calling this function, \fBsrc\fP must be initialized and \fBdst\fP must be uninitialized. After this function returns successfully, \fBsrc\fP is destroyed, and \fBdst\fP is initialized and must be freed with \fBbson_destroy\fP\&. +.sp +For example, if you have a higher\-level structure that wraps a \fBbson_t\fP, use \fBbson_steal\fP to transfer BSON data into it: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct { + bson_t bson; +} bson_wrapper_t; + + +bson_wrapper_t * +wrap_bson (bson_t *b) +{ + bson_wrapper_t *wrapper = bson_malloc (sizeof (bson_wrapper_t)); + + if (bson_steal (&wrapper\->bson, b)) { + return wrapper; + } + + bson_free (wrapper); + return NULL; +} + + +void +bson_wrapper_destroy (bson_wrapper_t *wrapper) +{ + bson_destroy (&wrapper\->bson); + bson_free (wrapper); +} + + +int +main (int argc, char *argv[]) +{ + bson_t bson = BSON_INITIALIZER; + bson_wrapper_t *wrapper; + + BSON_APPEND_UTF8 (&bson, "key", "value"); + + /* now "bson" is destroyed */ + wrapper = wrap_bson (&bson); + + /* clean up */ + bson_wrapper_destroy (wrapper); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See also \fBbson_destroy_with_steal\fP, a lower\-level function that returns the raw contents of a \fBbson_t\fP\&. +.SH RETURNS +.sp +Returns \fBtrue\fP if \fBsrc\fP was successfully moved to \fBdst\fP, \fBfalse\fP if \fBsrc\fP is invalid, or was statically initialized, or another error occurred. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strcasecmp.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strcasecmp.3 new file mode 100644 index 0000000..3da78d4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strcasecmp.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRCASECMP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strcasecmp \- bson_strcasecmp() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_strcasecmp (const char *s1, const char *s2); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBs1\fP: A string. +.IP \(bu 2 +\fBs2\fP: A string. +.UNINDENT +.SH DESCRIPTION +.sp +A portable version of \fBstrcasecmp()\fP\&. +.SH RETURNS +.sp +Returns a negative integer if s1 sorts lexicographically before s2, a positive +integer if it sorts after, or 0 if they are equivalent, after translating both +strings to lower case. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup.3 new file mode 100644 index 0000000..ad9e3b7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRDUP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strdup \- bson_strdup() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_strdup (const char *str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: A string. +.UNINDENT +.SH DESCRIPTION +.sp +Copies \fBstr\fP into a new string. If \fBstr\fP is NULL, then NULL is returned. +.SH RETURNS +.sp +A newly allocated string that should be freed with bson_free(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup_printf.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup_printf.3 new file mode 100644 index 0000000..bb36af6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdup_printf.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRDUP_PRINTF" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strdup_printf \- bson_strdup_printf() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_strdup_printf (const char *format, ...) BSON_GNUC_PRINTF (1, 2); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBformat\fP: A printf style format string. +.UNINDENT +.SH DESCRIPTION +.sp +This function performs a printf style format but into a newly allocated string. +.SH RETURNS +.sp +A newly allocated string that should be freed with bson_free(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdupv_printf.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdupv_printf.3 new file mode 100644 index 0000000..5b8e60a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strdupv_printf.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRDUPV_PRINTF" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strdupv_printf \- bson_strdupv_printf() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_strdupv_printf (const char *format, va_list args) BSON_GNUC_PRINTF (1, 0); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBformat\fP: A printf style format string. +.IP \(bu 2 +\fBargs\fP: A va_list. +.UNINDENT +.SH DESCRIPTION +.sp +This function is like \fBbson_strdup_printf()\fP except takes a va_list of parameters. +.SH RETURNS +.sp +A newly allocated string that should be freed with bson_free(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_streaming_bson.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_streaming_bson.3 new file mode 100644 index 0000000..21c149a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_streaming_bson.3 @@ -0,0 +1,134 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STREAMING_BSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_streaming_bson \- Streaming BSON +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +\fBbson_reader_t\fP provides a streaming reader which can be initialized with a filedescriptor or memory region. \fBbson_writer_t\fP provides a streaming writer which can be initialized with a memory region. (Streaming BSON to a file descriptor is not yet supported.) +.SH READING FROM A BSON STREAM +.sp +\fBbson_reader_t\fP provides a convenient API to read sequential BSON documents from a file\-descriptor or memory buffer. The \fBbson_reader_read()\fP function will read forward in the underlying stream and return a \fBbson_t\fP that can be inspected and iterated upon. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *doc; + bson_error_t error; + bool eof; + + reader = bson_reader_new_from_file ("mycollection.bson", &error); + + if (!reader) { + fprintf (stderr, "Failed to open file.\en"); + return 1; + } + + while ((doc = bson_reader_read (reader, &eof))) { + char *str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\en", str); + bson_free (str); + } + + if (!eof) { + fprintf (stderr, + "corrupted bson document found at %u\en", + (unsigned) bson_reader_tell (reader)); + } + + bson_reader_destroy (reader); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_reader_new_from_fd()\fP, \fBbson_reader_new_from_file()\fP, and \fBbson_reader_new_from_data()\fP for more information. +.SH WRITING A SEQUENCE OF BSON DOCUMENTS +.sp +\fBbson_writer_t\fP provides a convenient API to write a sequence of BSON documents to a memory buffer that can grow with \fBrealloc()\fP\&. The \fBbson_writer_begin()\fP and \fBbson_writer_end()\fP functions will manage the underlying buffer while building the sequence of documents. +.sp +This could also be useful if you want to write to a network packet while serializing the documents from a higher level language, (but do so just after the packets header). +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + bson_writer_t *writer; + bson_t *doc; + uint8_t *buf = NULL; + size_t buflen = 0; + bool r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 10000; i++) { + r = bson_writer_begin (writer, &doc); + assert (r); + + r = BSON_APPEND_INT32 (doc, "i", i); + assert (r); + + bson_writer_end (writer); + } + + bson_free (buf); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBbson_writer_new()\fP for more information. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strerror_r.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strerror_r.3 new file mode 100644 index 0000000..b2c3dad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strerror_r.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRERROR_R" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strerror_r \- bson_strerror_r() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_strerror_r (int err_code, char *buf, size_t buflen); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBerr_code\fP: An errno. +.IP \(bu 2 +\fBbuf\fP: A location to store the string. +.IP \(bu 2 +\fBbuflen\fP: The size of \fBbuf\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This is a portability wrapper around \fBstrerror()\fP\&. +.SH RETURNS +.sp +The passed in \fBbuf\fP parameter or an internal string. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strfreev.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strfreev.3 new file mode 100644 index 0000000..85290b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strfreev.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRFREEV" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strfreev \- bson_strfreev() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_strfreev (char **strv); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstrv\fP: A NULL\-terminated array of strings to free, including the array. +.UNINDENT +.SH DESCRIPTION +.sp +This will free each string in a NULL\-terminated array of strings and then the array itself. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append.3 new file mode 100644 index 0000000..4aff85e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_APPEND" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_append \- bson_string_append() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_string_append (bson_string_t *string, const char *str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBstr\fP: A string. +.UNINDENT +.SH DESCRIPTION +.sp +Appends the ASCII or UTF\-8 encoded string \fBstr\fP to \fBstring\fP\&. This is not suitable for embedding NULLs in strings. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_c.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_c.3 new file mode 100644 index 0000000..168e411 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_c.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_APPEND_C" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_append_c \- bson_string_append_c() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_string_append_c (bson_string_t *string, char str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBstr\fP: An ASCII char. +.UNINDENT +.SH DESCRIPTION +.sp +Appends \fBc\fP to the string builder \fBstring\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_printf.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_printf.3 new file mode 100644 index 0000000..55cc478 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_printf.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_APPEND_PRINTF" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_append_printf \- bson_string_append_printf() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_string_append_printf (bson_string_t *string, const char *format, ...) + BSON_GNUC_PRINTF (2, 3); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBformat\fP: A printf style format string. +.UNINDENT +.SH DESCRIPTION +.sp +Like bson_string_append() but formats a printf style string and then appends that to \fBstring\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_unichar.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_unichar.3 new file mode 100644 index 0000000..e3861e5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_append_unichar.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_APPEND_UNICHAR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_append_unichar \- bson_string_append_unichar() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_string_append_unichar (bson_string_t *string, bson_unichar_t unichar); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBunichar\fP: A \fBbson_unichar_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Appends a unicode character to string. The character will be encoded into its multi\-byte UTF\-8 representation. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_free.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_free.3 new file mode 100644 index 0000000..e0f6fec --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_free.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_FREE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_free \- bson_string_free() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_string_free (bson_string_t *string, bool free_segment); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBfree_segment\fP: A bool indicating if \fBstr\->str\fP should be returned. +.UNINDENT +.SH DESCRIPTION +.sp +Frees the bson_string_t structure and optionally the string itself. +.SH RETURNS +.sp +\fBstr\->str\fP if \fBfree_segment\fP is true, otherwise NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_new.3 new file mode 100644 index 0000000..c5e1b61 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_new.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_new \- bson_string_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_string_t * +bson_string_new (const char *str); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: A string to be copied or NULL. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new string builder, which uses power\-of\-two growth of buffers. Use the various bson_string_append*() functions to append to the string. +.SH RETURNS +.sp +A newly allocated bson_string_t that should be freed with bson_string_free() when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_t.3 new file mode 100644 index 0000000..53a60b8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_t.3 @@ -0,0 +1,86 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_t \- bson_string_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +String Building Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + char *str; + uint32_t len; + uint32_t alloc; +} bson_string_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +\fBbson_string_t\fP is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two. +.sp +This API is useful if you need to build UTF\-8 encoded strings. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_string_t *str; + +str = bson_string_new (NULL); +bson_string_append_printf (str, "%d %s %f\en", 0, "some string", 0.123); +printf ("%s\en", str\->str); + +bson_string_free (str, true); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +You can call \fBbson_string_free()\fP with \fBfalse\fP if you would like to take ownership of \fBstr\->str\fP\&. Some APIs that do this might call \fBreturn bson_string_free (str, false);\fP after building the string. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_truncate.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_truncate.3 new file mode 100644 index 0000000..8e576cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_string_truncate.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRING_TRUNCATE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_string_truncate \- bson_string_truncate() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_string_truncate (bson_string_t *string, uint32_t len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstring\fP: A \fBbson_string_t\fP\&. +.IP \(bu 2 +\fBlen\fP: The new length of the string, excluding the trailing \fB\e0\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Truncates the string so that it is \fBlen\fP bytes in length. This must be smaller or equal to the current length of the string. +.sp +A \fB\e0\fP byte will be placed where the end of the string occurs. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strncpy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strncpy.3 new file mode 100644 index 0000000..8d32f72 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strncpy.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRNCPY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strncpy \- bson_strncpy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_strncpy (char *dst, const char *src, size_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdst\fP: The destination buffer. +.IP \(bu 2 +\fBsrc\fP: The src buffer. +.IP \(bu 2 +\fBsize\fP: The number of bytes to copy into dst, which must be at least that size. +.UNINDENT +.SH DESCRIPTION +.sp +Copies up to \fBsize\fP bytes from \fBsrc\fP into \fBdst\fP\&. \fBdst\fP must be at least \fBsize\fP bytes in size. A trailing \fB\e0\fP is always set. +.sp +Does nothing if \fBsize\fP is zero. +.sp +\fBbson_strncpy\fP matches the behavior of the C11 standard \fBstrncpy_s\fP, rather than \fBstrncpy\fP\&. This means that \fBbson_strncpy\fP always writes a null terminator to \fBdst\fP, even if \fBdst\fP is too short to fit the entire string from \fBsrc\fP\&. If there is additional space left in \fBdst\fP after copying \fBsrc\fP, \fBbson_strncpy\fP does not fill the remaining space with null characters. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strndup.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strndup.3 new file mode 100644 index 0000000..200a249 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strndup.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRNDUP" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strndup \- bson_strndup() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_strndup (const char *str, size_t n_bytes); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: A string to copy. +.IP \(bu 2 +\fBn_bytes\fP: A size_t. +.UNINDENT +.SH DESCRIPTION +.sp +Allocates a new string and copies up to \fBn_bytes\fP from \fBstr\fP into it. A trailing \fB\e0\fP is always set. +.SH RETURNS +.sp +A newly allocated string that should be freed with bson_free(). +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strnlen.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strnlen.3 new file mode 100644 index 0000000..143f5a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_strnlen.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_STRNLEN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_strnlen \- bson_strnlen() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t +bson_strnlen (const char *s, size_t maxlen); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBs\fP: A string. +.IP \(bu 2 +\fBmaxlen\fP: The maximum size of string to check. +.UNINDENT +.SH DESCRIPTION +.sp +A portable version of \fBstrnlen()\fP\&. +.SH RETURNS +.sp +The length of \fBs\fP in bytes or \fBmaxlen\fP if no \fB\e0\fP was found. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_subtype_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_subtype_t.3 new file mode 100644 index 0000000..adb8316 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_subtype_t.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_SUBTYPE_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_subtype_t \- bson_subtype_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Binary Field Subtype +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + + +typedef enum { + BSON_SUBTYPE_BINARY = 0x00, + BSON_SUBTYPE_FUNCTION = 0x01, + BSON_SUBTYPE_BINARY_DEPRECATED = 0x02, + BSON_SUBTYPE_UUID_DEPRECATED = 0x03, + BSON_SUBTYPE_UUID = 0x04, + BSON_SUBTYPE_MD5 = 0x05, + BSON_SUBTYPE_USER = 0x80, +} bson_subtype_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +This enumeration contains the various subtypes that may be used in a binary field. See \fI\%http://bsonspec.org\fP for more information. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t doc = BSON_INITIALIZER; + +BSON_APPEND_BINARY (&doc, "binary", BSON_SUBTYPE_BINARY, data, data_len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_t.3 new file mode 100644 index 0000000..1dadf62 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_t.3 @@ -0,0 +1,197 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_t \- bson_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Document Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +/** + * bson_empty: + * @b: a bson_t. + * + * Checks to see if @b is an empty BSON document. An empty BSON document is + * a 5 byte document which contains the length (4 bytes) and a single NUL + * byte indicating end of fields. + */ +#define bson_empty(b) /* ... */ + +/** + * bson_empty0: + * + * Like bson_empty() but treats NULL the same as an empty bson_t document. + */ +#define bson_empty0(b) /* ... */ + +/** + * bson_clear: + * + * Easily free a bson document and set it to NULL. Use like: + * + * bson_t *doc = bson_new(); + * bson_clear (&doc); + * BSON_ASSERT (doc == NULL); + */ +#define bson_clear(bptr) /* ... */ + +/** + * BSON_MAX_SIZE: + * + * The maximum size in bytes of a BSON document. + */ +#define BSON_MAX_SIZE /* ... */ + +#define BSON_APPEND_ARRAY(b, key, val) \e + bson_append_array (b, key, (int) strlen (key), val) + +#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \e + bson_append_array_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_BINARY(b, key, subtype, val, len) \e + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + +#define BSON_APPEND_BOOL(b, key, val) \e + bson_append_bool (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE(b, key, val) \e + bson_append_code (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \e + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + +#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \e + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + +#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \e + bson_append_document_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_DOUBLE(b, key, val) \e + bson_append_double (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DOCUMENT(b, key, val) \e + bson_append_document (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT32(b, key, val) \e + bson_append_int32 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT64(b, key, val) \e + bson_append_int64 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MINKEY(b, key) \e + bson_append_minkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_DECIMAL128(b, key, val) \e + bson_append_decimal128 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MAXKEY(b, key) \e + bson_append_maxkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + +#define BSON_APPEND_OID(b, key, val) \e + bson_append_oid (b, key, (int) strlen (key), val) + +#define BSON_APPEND_REGEX(b, key, val, opt) \e + bson_append_regex (b, key, (int) strlen (key), val, opt) + +#define BSON_APPEND_UTF8(b, key, val) \e + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_SYMBOL(b, key, val) \e + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_TIME_T(b, key, val) \e + bson_append_time_t (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMEVAL(b, key, val) \e + bson_append_timeval (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DATE_TIME(b, key, val) \e + bson_append_date_time (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \e + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + +#define BSON_APPEND_UNDEFINED(b, key) \e + bson_append_undefined (b, key, (int) strlen (key)) + +#define BSON_APPEND_VALUE(b, key, val) \e + bson_append_value (b, key, (int) strlen (key), (val)) + +BSON_ALIGNED_BEGIN (128) +typedef struct { + uint32_t flags; /* Internal flags for the bson_t. */ + uint32_t len; /* Length of BSON data. */ + uint8_t padding[120]; /* Padding for stack allocation. */ +} bson_t BSON_ALIGNED_END (128); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_t\fP structure represents a BSON document. This structure manages the underlying BSON encoded buffer. For mutable documents, it can append new data to the document. +.SH PERFORMANCE NOTES +.sp +The \fBbson_t\fP structure attempts to use an inline allocation within the structure to speed up performance of small documents. When this internal buffer has been exhausted, a heap allocated buffer will be dynamically allocated. Therefore, it is essential to call \fBbson_destroy()\fP on allocated documents. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +create_on_heap (void) +{ + bson_t *b = bson_new (); + + BSON_APPEND_INT32 (b, "foo", 123); + BSON_APPEND_UTF8 (b, "bar", "foo"); + BSON_APPEND_DOUBLE (b, "baz", 1.23f); + + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_threading.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_threading.3 new file mode 100644 index 0000000..c2a916c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_threading.3 @@ -0,0 +1,42 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_THREADING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_threading \- Threading +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Libbson\(aqs data structures are \fINOT\fP thread\-safe. You are responsible for accessing and mutating these structures from one thread at a time. +.sp +Libbson requires POSIX threads (pthreads) on all UNIX\-like platforms. On Windows, the native threading interface is used. Libbson uses your system\(aqs threading library to safely generate unique ObjectIds, and to provide a fallback implementation for atomic operations on platforms without built\-in atomics. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_tutorial.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_tutorial.3 new file mode 100644 index 0000000..31c485b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_tutorial.3 @@ -0,0 +1,615 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_TUTORIAL" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_tutorial \- Tutorial +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH USING LIBBSON IN YOUR C PROGRAM +.SS Include bson.h +.sp +All libbson\(aqs functions and types are available in one header file. Simply include \fBbson.h\fP: +hello_bson.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, const char **argv) +{ + bson_t *b; + char *j; + + b = BCON_NEW ("hello", BCON_UTF8 ("bson!")); + j = bson_as_canonical_extended_json (b, NULL); + printf ("%s\en", j); + + bson_free (j); + bson_destroy (b); + + return 0; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS CMake +.sp +The libbson installation includes a \fI\%CMake config\-file package\fP, so you can use CMake\(aqs \fI\%find_package\fP command to find libbson\(aqs header and library paths and link to libbson: +CMakeLists.txt.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-1.0 1.7 REQUIRED) + +message ("\-\- libbson found version \e"${BSON_VERSION}\e"") +message ("\-\- libbson include path \e"${BSON_INCLUDE_DIRS}\e"") +message ("\-\- libbson libraries \e"${BSON_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +By default, libbson is dynamically linked. You can use libbson as a static library instead: Use the included \fBlibbson\-static\-1.0\fP config\-file package and (on Unix) link to \fBpthread\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +# Specify the minimum version you require. +find_package (libbson\-static\-1.0 1.7 REQUIRED) + +message ("\-\- libbson\-static found version \e"${BSON_STATIC_VERSION}\e"") +message ("\-\- libbson\-static include path \e"${BSON_STATIC_INCLUDE_DIRS}\e"") +message ("\-\- libbson\-static libraries \e"${BSON_STATIC_LIBRARIES}\e"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_STATIC_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_STATIC_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_STATIC_DEFINITIONS}) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS pkg\-config +.sp +If you\(aqre not using CMake, use \fI\%pkg\-config\fP on the command line to set header and library paths: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Or to statically link to libbson: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +gcc \-o hello_bson hello_bson.c $(pkg\-config \-\-libs \-\-cflags libbson\-static\-1.0) + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CREATING A BSON DOCUMENT +.SS The bson_t structure +.sp +BSON documents are created using the \fBbson_t\fP structure. This structure encapsulates the necessary logic for encoding using the \fI\%BSON Specification\fP\&. At the core, \fBbson_t\fP is a buffer manager and set of encoding routines. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +BSON documents can live on the stack or the heap based on the performance needs or preference of the consumer. +.UNINDENT +.UNINDENT +.sp +Let\(aqs start by creating a new BSON document on the stack. Whenever using libbson, make sure you \fB#include \fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b; + +bson_init (&b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This creates an empty document. In JSON, this would be the same as \fB{}\fP\&. +.sp +We can now proceed to adding items to the BSON document. A variety of functions prefixed with \fBbson_append_\fP can be used based on the type of field you want to append. Let\(aqs append a UTF\-8 encoded string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice the two \fB\-1\fP parameters. The first indicates that the length of \fBkey\fP in bytes should be determined with \fBstrlen()\fP\&. Alternatively, we could have passed the number \fB3\fP\&. The same goes for the second \fB\-1\fP, but for \fBvalue\fP\&. +.sp +Libbson provides macros to make this less tedious when using string literals. The following two appends are identical. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_append_utf8 (&b, "key", \-1, "value", \-1); +BSON_APPEND_UTF8 (&b, "key", "value"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Now let\(aqs take a look at an example that adds a few different field types to a BSON document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t b = BSON_INITIALIZER; + +BSON_APPEND_INT32 (&b, "a", 1); +BSON_APPEND_UTF8 (&b, "hello", "world"); +BSON_APPEND_BOOL (&b, "bool", true); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Notice that we omitted the call to \fBbson_init()\fP\&. By specifying \fBBSON_INITIALIZER\fP we can remove the need to initialize the structure to a base state. +.SS Sub\-Documents and Sub\-Arrays +.sp +To simplify the creation of sub\-documents and arrays, \fBbson_append_document_begin()\fP and \fBbson_append_array_begin()\fP exist. These can be used to build a sub\-document using the parent documents memory region as the destination buffer. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t parent; +bson_t child; +char *str; + +bson_init (&parent); +bson_append_document_begin (&parent, "foo", 3, &child); +bson_append_int32 (&child, "baz", 3, 1); +bson_append_document_end (&parent, &child); + +str = bson_as_canonical_extended_json (&parent, NULL); +printf ("%s\en", str); +bson_free (str); + +bson_destroy (&parent); +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "baz" : 1 } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Simplified BSON C Object Notation +.sp +Creating BSON documents by hand can be tedious and time consuming. BCON, or BSON C Object Notation, was added to allow for the creation of BSON documents in a format that looks closer to the destination format. +.sp +The following example shows the use of BCON. Notice that values for fields are wrapped in the \fBBCON_*\fP macros. These are required for the variadic processor to determine the parameter type. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *doc; + +doc = BCON_NEW ("foo", + "{", + "int", + BCON_INT32 (1), + "array", + "[", + BCON_INT32 (100), + "{", + "sub", + BCON_UTF8 ("value"), + "}", + "]", + "}"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Creates the following document +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "foo" : { "int" : 1, "array" : [ 100, { "sub" : "value" } ] } } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH HANDLING ERRORS +.SS Description +.sp +Many libbson functions report errors by returning \fBNULL\fP or \-1 and filling out a \fBbson_error_t\fP structure with an error domain, error code, and message. +.INDENT 0.0 +.IP \(bu 2 +\fBerror.domain\fP names the subsystem that generated the error. +.IP \(bu 2 +\fBerror.code\fP is a domain\-specific error type. +.IP \(bu 2 +\fBerror.message\fP describes the error. +.UNINDENT +.sp +Some error codes overlap with others; always check both the domain and code to determine the type of error. +.TS +center; +|l|l|l|. +_ +T{ +\fBBSON_ERROR_JSON\fP +T} T{ +\fBBSON_JSON_ERROR_READ_CORRUPT_JS\fP +\fBBSON_JSON_ERROR_READ_INVALID_PARAM\fP +\fBBSON_JSON_ERROR_READ_CB_FAILURE\fP +T} T{ +\fBbson_json_reader_t\fP tried to parse invalid MongoDB Extended JSON. +Tried to parse a valid JSON document that is invalid as MongoDBExtended JSON. +An internal callback failure during JSON parsing. +T} +_ +T{ +\fBBSON_ERROR_READER\fP +T} T{ +\fBBSON_ERROR_READER_BADFD\fP +T} T{ +\fBbson_json_reader_new_from_file\fP could not open the file. +T} +_ +.TE +.SH OBJECTIDS +.sp +Libbson provides a simple way to generate ObjectIDs. It can be used in a single\-threaded or multi\-threaded manner depending on your requirements. +.sp +The \fBbson_oid_t\fP structure represents an \fBObjectID\fP in MongoDB. It is a 96\-bit identifier that includes various information about the system generating the OID. +.SS Composition +.INDENT 0.0 +.IP \(bu 2 +4 bytes : The UNIX timestamp in big\-endian format. +.IP \(bu 2 +3 bytes : A hash of the hostname. +.IP \(bu 2 +2 bytes : The \fBpid_t\fP of the current process. Alternatively the task\-id if configured. +.IP \(bu 2 +3 bytes : A 24\-bit monotonic counter incrementing from \fBrand()\fP in big\-endian. +.UNINDENT +.SS Sorting ObjectIDs +.sp +The typical way to sort in C is using \fBqsort()\fP\&. Therefore, Libbson provides a \fBqsort()\fP compatible callback function named \fBbson_oid_compare()\fP\&. It returns \fBless than 1\fP, \fBgreater than 1\fP, or \fB0\fP depending on the equality of two \fBbson_oid_t\fP structures. +.SS Comparing Object IDs +.sp +If you simply want to compare two \fBbson_oid_t\fP structures for equality, use \fBbson_oid_equal()\fP\&. +.SS Generating +.sp +To generate a \fBbson_oid_t\fP, you may use the following. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init (&oid, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Parsing ObjectID Strings +.sp +You can also parse a string containing a \fBbson_oid_t\fP\&. The input string \fIMUST\fP be 24 characters or more in length. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If you need to parse may \fBbson_oid_t\fP in a tight loop and can guarantee the data is safe, you might consider using the inline variant. It will be inlined into your code and reduce the need for a foreign function call. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_oid_t oid; + +bson_oid_init_from_string_unsafe (&oid, "123456789012345678901234"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Hashing ObjectIDs +.sp +If you need to store items in a hashtable, you may want to use the \fBbson_oid_t\fP as the key. Libbson provides a hash function for just this purpose. It is based on DJB hash. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +unsigned hash; + +hash = bson_oid_hash (oid); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Fetching ObjectID Creation Time +.sp +You can easily fetch the time that a \fBbson_oid_t\fP was generated using \fBbson_oid_get_time_t()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +time_t t; + +t = bson_oid_get_time_t (oid); +printf ("The OID was generated at %u\en", (unsigned) t); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARSING AND ITERATING BSON DOCUMENTS +.SS Parsing +.sp +BSON documents are lazily parsed as necessary. To begin parsing a BSON document, use one of the provided Libbson functions to create a new \fBbson_t\fP from existing data such as \fBbson_new_from_data()\fP\&. This will make a copy of the data so that additional mutations may occur to the BSON document. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +If you only want to parse a BSON document and have no need to mutate it, you may use \fBbson_init_static()\fP to avoid making a copy of the data. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; + +b = bson_new_from_data (my_data, my_data_len); +if (!b) { + fprintf (stderr, "The specified length embedded in did not match " + "\en"); + return; +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Only two checks are performed when creating a new \fBbson_t\fP from an existing buffer. First, the document must begin with the buffer length, matching what was expected by the caller. Second, the document must end with the expected trailing \fB\e0\fP byte. +.sp +To parse the document further we use a \fBbson_iter_t\fP to iterate the elements within the document. Let\(aqs print all of the field names in the document. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if (bson_iter_init (&iter, b)) { + while (bson_iter_next (&iter)) { + printf ("Found element key: \e"%s\e"\en", bson_iter_key (&iter)); + } + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Converting a document to JSON uses a \fBbson_iter_t\fP and \fBbson_visitor_t\fP to iterate all fields of a BSON document recursively and generate a UTF\-8 encoded JSON string. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +char *json; + +if ((b = bson_new_from_data (my_data, my_data_len))) { + if ((json = bson_as_canonical_extended_json (b, NULL))) { + printf ("%s\en", json); + bson_free (json); + } + bson_destroy (b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Recursing into Sub\-Documents +.sp +Libbson provides convenient sub\-iterators to dive down into a sub\-document or sub\-array. Below is an example that will dive into a sub\-document named "foo" and print it\(aqs field names. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; +bson_iter_t child; +char *json; + +if (bson_iter_init_find (&iter, doc, "foo") && + BSON_ITER_HOLDS_DOCUMENT (&iter) && bson_iter_recurse (&iter, &child)) { + while (bson_iter_next (&child)) { + printf ("Found sub\-key of \e"foo\e" named \e"%s\e"\en", + bson_iter_key (&child)); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Finding Fields using Dot Notation +.sp +Using the \fBbson_iter_recurse()\fP function exemplified above, \fBbson_iter_find_descendant()\fP can find a field for you using the MongoDB style path notation such as "foo.bar.0.baz". +.sp +Let\(aqs create a document like \fB{"foo": {"bar": [{"baz: 1}]}}\fP and locate the \fB"baz"\fP field. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_t *b; +bson_iter_t iter; +bson_iter_t baz; + +b = + BCON_NEW ("foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}"); + +if (bson_iter_init (&iter, b) && + bson_iter_find_descendant (&iter, "foo.bar.0.baz", &baz) && + BSON_ITER_HOLDS_INT32 (&baz)) { + printf ("baz = %d\en", bson_iter_int32 (&baz)); +} + +bson_destroy (b); +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Validating a BSON Document +.sp +If all you want to do is validate that a BSON document is valid, you can use \fBbson_validate()\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t err_offset; + +if (!bson_validate (doc, BSON_VALIDATE_NONE, &err_offset)) { + fprintf (stderr, + "The document failed to validate at offset: %u\en", + (unsigned) err_offset); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See the \fBbson_validate()\fP documentation for more information and examples. +.SH UTF-8 +.SS Encoding +.sp +Libbson expects that you are always working with UTF\-8 encoded text. Anything else is \fBinvalid API use\fP\&. +.sp +If you should need to walk through UTF\-8 sequences, you can use the various UTF\-8 helper functions distributed with Libbson. +.SS Validating a UTF\-8 Sequence +.sp +To validate the string contained in \fBmy_string\fP, use the following. You may pass \fB\-1\fP for the string length if you know the string is NULL\-terminated. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, \-1, false)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If \fBmy_string\fP has NULL bytes within the string, you must provide the string length. Use the following format. Notice the \fBtrue\fP at the end indicating \fB\e0\fP is allowed. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, my_string_len, true)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For more information see the API reference for \fBbson_utf8_validate()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_type_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_type_t.3 new file mode 100644 index 0000000..453b4b8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_type_t.3 @@ -0,0 +1,95 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_TYPE_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_type_t \- bson_type_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Type Enumeration +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_DECIMAL128 = 0x13, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, +} bson_type_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_type_t\fP enumeration contains all of the types from the \fI\%BSON Specification\fP\&. It can be used to determine the type of a field at runtime. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_iter_t iter; + +if (bson_iter_init_find (&iter, doc, "foo") && + (BSON_TYPE_INT32 == bson_iter_type (&iter))) { + printf ("\(aqfoo\(aq is an int32.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_uint32_to_string.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_uint32_to_string.3 new file mode 100644 index 0000000..326b4a2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_uint32_to_string.3 @@ -0,0 +1,96 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UINT32_TO_STRING" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_uint32_to_string \- bson_uint32_to_string() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t +bson_uint32_to_string (uint32_t value, + const char **strptr, + char *str, + size_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBvalue\fP: A uint32_t. +.IP \(bu 2 +\fBstrptr\fP: A location for the resulting string pointer. +.IP \(bu 2 +\fBstr\fP: A location to buffer the string. +.IP \(bu 2 +\fBsize\fP: A size_t containing the size of \fBstr\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Converts \fBvalue\fP to a string. +.sp +If \fBvalue\fP is from 0 to 999, it will use a constant string in the data section of the library. +.sp +If not, a string will be formatted using \fBstr\fP and \fBsnprintf()\fP\&. +.sp +\fBstrptr\fP will always be set. It will either point to \fBstr\fP or a constant string. Use this as your key. +.SH ARRAY ELEMENT KEY BUILDING +.sp +Each element in a BSON array has a monotonic string key like \fB"0"\fP, \fB"1"\fP, etc. This function is optimized for generating such string keys. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char str[16]; +const char *key; +uint32_t i; + +for (i = 0; i < 10; i++) { + bson_uint32_to_string (i, &key, str, sizeof str); + printf ("Key: %s\en", key); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH RETURNS +.sp +The number of bytes in the resulting string. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_unichar_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_unichar_t.3 new file mode 100644 index 0000000..5a331f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_unichar_t.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UNICHAR_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_unichar_t \- bson_unichar_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Unicode Character Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef uint32_t bson_unichar_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +\fBbson_unichar_t\fP provides an abstraction on a single unicode character. It is the 32\-bit representation of a character. As UTF\-8 can contain multi\-byte characters, this should be used when iterating through UTF\-8 text. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +static void +print_each_char (const char *str) +{ + bson_unichar_t c; + + for (; *str; str = bson_utf8_next_char (str)) { + c = bson_utf8_get_char (str); + printf ("The numberic value is %u.\en", (unsigned) c); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8.3 new file mode 100644 index 0000000..49162e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8 \- UTF-8 +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH ENCODING +.sp +Libbson expects that you are always working with UTF\-8 encoded text. Anything else is \fBinvalid API use\fP\&. +.sp +If you should need to walk through UTF\-8 sequences, you can use the various UTF\-8 helper functions distributed with Libbson. +.SH VALIDATING A UTF-8 SEQUENCE +.sp +To validate the string contained in \fBmy_string\fP, use the following. You may pass \fB\-1\fP for the string length if you know the string is NULL\-terminated. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, \-1, false)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If \fBmy_string\fP has NULL bytes within the string, you must provide the string length. Use the following format. Notice the \fBtrue\fP at the end indicating \fB\e0\fP is allowed. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +if (!bson_utf8_validate (my_string, my_string_len, true)) { + printf ("Validation failed.\en"); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For more information see the API reference for \fBbson_utf8_validate()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_escape_for_json.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_escape_for_json.3 new file mode 100644 index 0000000..c392815 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_escape_for_json.3 @@ -0,0 +1,69 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8_ESCAPE_FOR_JSON" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8_escape_for_json \- bson_utf8_escape_for_json() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char * +bson_utf8_escape_for_json (const char *utf8, ssize_t utf8_len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fButf8\fP: A UTF\-8 encoded string. +.IP \(bu 2 +\fButf8_len\fP: The length of \fButf8\fP in bytes or \-1 if it is NULL terminated. +.UNINDENT +.SH DESCRIPTION +.sp +Allocates a new string matching \fButf8\fP except that special +characters in JSON are escaped. The resulting string is also +UTF\-8 encoded. +.sp +Both " and \e characters will be backslash\-escaped. If a NUL +byte is found before \fButf8_len\fP bytes, it is converted to +"\eu0000". Other non\-ASCII characters in the input are preserved. +.SH RETURNS +.sp +A newly allocated string that should be freed with \fBbson_free()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_from_unichar.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_from_unichar.3 new file mode 100644 index 0000000..474fa01 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_from_unichar.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8_FROM_UNICHAR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8_from_unichar \- bson_utf8_from_unichar() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_utf8_from_unichar (bson_unichar_t unichar, char utf8[6], uint32_t *len); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBunichar\fP: A \fBbson_unichar_t\fP\&. +.IP \(bu 2 +\fButf8\fP: A location for the utf8 sequence. +.IP \(bu 2 +\fBlen\fP: A location for the number of bytes in the resulting utf8 sequence. +.UNINDENT +.SH DESCRIPTION +.sp +Converts a single unicode character to a multi\-byte UTF\-8 sequence. The result is stored in \fButf8\fP and the number of bytes used in \fBlen\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_get_char.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_get_char.3 new file mode 100644 index 0000000..93c3497 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_get_char.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8_GET_CHAR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8_get_char \- bson_utf8_get_char() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_unichar_t +bson_utf8_get_char (const char *utf8); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fButf8\fP: A UTF\-8 encoded string. +.UNINDENT +.SH DESCRIPTION +.sp +Converts the current character in a UTF\-8 sequence to a bson_unichar_t, the 32\-bit representation of the multi\-byte character. +.SH RETURNS +.sp +A bson_unichar_t. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_next_char.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_next_char.3 new file mode 100644 index 0000000..8f42856 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_next_char.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8_NEXT_CHAR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8_next_char \- bson_utf8_next_char() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +bson_utf8_next_char (const char *utf8); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fButf8\fP: A UTF\-8 encoded string. +.UNINDENT +.SH DESCRIPTION +.sp +Advances within \fButf8\fP to the next UTF\-8 character, which may be multiple bytes offset from \fButf8\fP\&. A pointer to the next character is returned. +.sp +It is invalid to call this function on a string whose current character is \fB\e0\fP\&. +.SH RETURNS +.sp +A pointer to the beginning of the next character in the UTF\-8 encoded string. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_validate.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_validate.3 new file mode 100644 index 0000000..3196c8d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_utf8_validate.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_UTF8_VALIDATE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_utf8_validate \- bson_utf8_validate() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_utf8_validate (const char *utf8, size_t utf8_len, bool allow_null); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fButf8\fP: A string to verify. +.IP \(bu 2 +\fButf8_len\fP: The length of \fButf8\fP in bytes. +.IP \(bu 2 +\fBallow_null\fP: A bool indicating that embedded \fB\e0\fP bytes are allowed. +.UNINDENT +.SH DESCRIPTION +.sp +Validates that the content within \fButf8\fP is valid UTF\-8 (by the RFC 3629 standard). If \fBallow_null\fP is \fBtrue\fP, then embedded NULL bytes are allowed (\fB\e0\fP). +.SH RETURNS +.sp +true if \fButf8\fP contains valid UTF\-8. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_valgrind.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_valgrind.3 new file mode 100644 index 0000000..28d1779 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_valgrind.3 @@ -0,0 +1,56 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALGRIND" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_valgrind \- Use Valgrind to Check For BSON Data Leaks +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +A stack\-allocated \fBbson_t\fP contains a small internal buffer; it only heap\-allocates additional storage if necessary, depending on its data size. Therefore if you forget to call \fBbson_destroy\fP on a stack\-allocated \fBbson_t\fP, it might or might not cause a leak that can be detected by valgrind during testing. +.sp +To catch all potential BSON data leaks in your code, configure the BSON_MEMCHECK flag: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +cmake \-DCMAKE_C_FLAGS="\-DBSON_MEMCHECK \-g" . +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +With this flag set, every \fBbson_t\fP mallocs at least one byte. Run your program\(aqs unittests with valgrind to verify all \fBbson_t\fP structs are destroyed. +.sp +Set the environment variable \fBMONGOC_TEST_VALGRIND\fP to \fBon\fP to skip timing\-dependent tests known to fail with valgrind. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate.3 new file mode 100644 index 0000000..12ce951 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALIDATE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_validate \- bson_validate() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_validate (const bson_t *bson, bson_validate_flags_t flags, size_t *offset); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A bitwise\-or of all desired \fBbson_validate_flags_t\fP\&. +.IP \(bu 2 +\fBoffset\fP: A location for the offset within \fBbson\fP where the error occurred. +.UNINDENT +.SH DESCRIPTION +.sp +Validates a BSON document by walking through the document and inspecting the keys and values for valid content. +.sp +You can modify how the validation occurs through the use of the \fBflags\fP parameter, see \fBbson_validate_with_error()\fP for details. +.SH RETURNS +.sp +Returns true if \fBbson\fP is valid; otherwise false and \fBoffset\fP is set to the byte offset where the error was detected. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate_with_error.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate_with_error.3 new file mode 100644 index 0000000..cc07b1c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_validate_with_error.3 @@ -0,0 +1,96 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALIDATE_WITH_ERROR" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_validate_with_error \- bson_validate_with_error() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef enum { + BSON_VALIDATE_NONE = 0, + BSON_VALIDATE_UTF8 = (1 << 0), + BSON_VALIDATE_DOLLAR_KEYS = (1 << 1), + BSON_VALIDATE_DOT_KEYS = (1 << 2), + BSON_VALIDATE_UTF8_ALLOW_NULL = (1 << 3), + BSON_VALIDATE_EMPTY_KEYS = (1 << 4), +} bson_validate_flags_t; + +bool +bson_validate_with_error (const bson_t *bson, + bson_validate_flags_t flags, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A bitwise\-or of all desired validation flags. +.IP \(bu 2 +\fBerror\fP: Optional \fBbson_error_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Validates a BSON document by walking through the document and inspecting the keys and values for valid content. +.sp +You can modify how the validation occurs through the use of the \fBflags\fP parameter. A description of their effect is below. +.INDENT 0.0 +.IP \(bu 2 +\fBBSON_VALIDATE_NONE\fP Basic validation of BSON length and structure. +.IP \(bu 2 +\fBBSON_VALIDATE_UTF8\fP All keys and string values are checked for invalid UTF\-8. +.IP \(bu 2 +\fBBSON_VALIDATE_UTF8_ALLOW_NULL\fP String values are allowed to have embedded NULL bytes. +.IP \(bu 2 +\fBBSON_VALIDATE_DOLLAR_KEYS\fP Prohibit keys that start with \fB$\fP outside of a "DBRef" subdocument. +.IP \(bu 2 +\fBBSON_VALIDATE_DOT_KEYS\fP Prohibit keys that contain \fB\&.\fP anywhere in the string. +.IP \(bu 2 +\fBBSON_VALIDATE_EMPTY_KEYS\fP Prohibit zero\-length keys. +.UNINDENT +.sp +See also \fBbson_validate()\fP\&. +.SH RETURNS +.sp +Returns true if \fBbson\fP is valid; otherwise false and \fBerror\fP is filled out. +.sp +The \fBbson_error_t\fP domain is set to \fBBSON_ERROR_INVALID\fP\&. Its code is set to one of the \fBbson_validate_flags_t\fP flags indicating which validation failed; for example, if a key contains invalid UTF\-8, then the code is set to \fBBSON_VALIDATE_UTF8\fP, but if the basic structure of the BSON document is corrupt, the code is set to \fBBSON_VALIDATE_NONE\fP\&. The error message is filled out, and gives more detail if possible. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_copy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_copy.3 new file mode 100644 index 0000000..8457866 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_copy.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALUE_COPY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_value_copy \- bson_value_copy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_value_copy (const bson_value_t *src, bson_value_t *dst); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsrc\fP: A \fBbson_value_t\fP to copy from. +.IP \(bu 2 +\fBdst\fP: A \fBbson_value_t\fP to copy into. +.UNINDENT +.SH DESCRIPTION +.sp +This function will copy the boxed content in \fBsrc\fP into \fBdst\fP\&. \fBdst\fP must be freed with \fBbson_value_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_destroy.3 new file mode 100644 index 0000000..989cc83 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_destroy.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALUE_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_value_destroy \- bson_value_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_value_destroy (bson_value_t *value); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBvalue\fP: A \fBbson_value_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Releases any resources associated with \fBvalue\fP\&. Does nothing if \fBvalue\fP is NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_t.3 new file mode 100644 index 0000000..3fcda85 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_value_t.3 @@ -0,0 +1,124 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VALUE_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_value_t \- bson_value_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +BSON Boxed Container Type +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_value_t { + bson_type_t value_type; + union { + bson_oid_t v_oid; + int64_t v_int64; + int32_t v_int32; + int8_t v_int8; + double v_double; + bool v_bool; + int64_t v_datetime; + struct { + uint32_t timestamp; + uint32_t increment; + } v_timestamp; + struct { + uint32_t len; + char *str; + } v_utf8; + struct { + uint32_t data_len; + uint8_t *data; + } v_doc; + struct { + uint32_t data_len; + uint8_t *data; + bson_subtype_t subtype; + } v_binary; + struct { + char *regex; + char *options; + } v_regex; + struct { + char *collection; + uint32_t collection_len; + bson_oid_t oid; + } v_dbpointer; + struct { + uint32_t code_len; + char *code; + } v_code; + struct { + uint32_t code_len; + char *code; + uint32_t scope_len; + uint8_t *scope_data; + } v_codewscope; + struct { + uint32_t len; + char *symbol; + } v_symbol; + } value; +} bson_value_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_value_t\fP structure is a boxed type for encapsulating a runtime determined type. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_value_t *value; + +value = bson_iter_value (&iter); + +if (value\->value_type == BSON_TYPE_INT32) { + printf ("%d\en", value\->value.v_int32); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_version.3 new file mode 100644 index 0000000..114311c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_version.3 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VERSION" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_version \- Libbson Versioning +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Versioning Macros and Functions +.SH MACROS +.sp +The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against. This may be useful if you only want to enable a feature on a certain version of the library. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#define BSON_CHECK_VERSION(major, minor, micro) + +#define BSON_MAJOR_VERSION (1) +#define BSON_MINOR_VERSION (4) +#define BSON_MICRO_VERSION (1) +#define BSON_VERSION_S "1.4.1" + +#define BSON_VERSION_HEX \e + (BSON_MAJOR_VERSION << 24 | BSON_MINOR_VERSION << 16 | \e + BSON_MICRO_VERSION << 8) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Only compile a block on Libbson 1.1.0 and newer. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#if BSON_CHECK_VERSION(1, 1, 0) +static void +do_something (void) +{ +} +#endif +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_visitor_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_visitor_t.3 new file mode 100644 index 0000000..8597d48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_visitor_t.3 @@ -0,0 +1,256 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VISITOR_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_visitor_t \- bson_visitor_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct { + /* run before / after descending into a document */ + bool (*visit_before) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_after) (const bson_iter_t *iter, const char *key, void *data); + /* corrupt BSON, or unsupported type and visit_unsupported_type not set */ + void (*visit_corrupt) (const bson_iter_t *iter, void *data); + /* normal bson field callbacks */ + bool (*visit_double) (const bson_iter_t *iter, + const char *key, + double v_double, + void *data); + bool (*visit_utf8) (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data); + bool (*visit_document) (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + bool (*visit_array) (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); + bool (*visit_binary) (const bson_iter_t *iter, + const char *key, + bson_subtype_t v_subtype, + size_t v_binary_len, + const uint8_t *v_binary, + void *data); + /* normal field with deprecated "Undefined" BSON type */ + bool (*visit_undefined) (const bson_iter_t *iter, + const char *key, + void *data); + bool (*visit_oid) (const bson_iter_t *iter, + const char *key, + const bson_oid_t *v_oid, + void *data); + bool (*visit_bool) (const bson_iter_t *iter, + const char *key, + bool v_bool, + void *data); + bool (*visit_date_time) (const bson_iter_t *iter, + const char *key, + int64_t msec_since_epoch, + void *data); + bool (*visit_null) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_regex) (const bson_iter_t *iter, + const char *key, + const char *v_regex, + const char *v_options, + void *data); + bool (*visit_dbpointer) (const bson_iter_t *iter, + const char *key, + size_t v_collection_len, + const char *v_collection, + const bson_oid_t *v_oid, + void *data); + bool (*visit_code) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + void *data); + bool (*visit_symbol) (const bson_iter_t *iter, + const char *key, + size_t v_symbol_len, + const char *v_symbol, + void *data); + bool (*visit_codewscope) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data); + bool (*visit_int32) (const bson_iter_t *iter, + const char *key, + int32_t v_int32, + void *data); + bool (*visit_timestamp) (const bson_iter_t *iter, + const char *key, + uint32_t v_timestamp, + uint32_t v_increment, + void *data); + bool (*visit_int64) (const bson_iter_t *iter, + const char *key, + int64_t v_int64, + void *data); + bool (*visit_maxkey) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_minkey) (const bson_iter_t *iter, const char *key, void *data); + /* if set, called instead of visit_corrupt when an apparently valid BSON + * includes an unrecognized field type (reading future version of BSON) */ + void (*visit_unsupported_type) (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data); + bool (*visit_decimal128) (const bson_iter_t *iter, + const char *key, + const bson_decimal128_t *v_decimal128, + void *data); + + void *padding[7]; +} bson_visitor_t bson_visitor_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_visitor_t\fP structure provides a series of callbacks that can be called while iterating a BSON document. This may simplify the conversion of a \fBbson_t\fP to a higher level language structure. +.sp +If the optional callback \fBvisit_unsupported_type\fP is set, it is called instead of \fBvisit_corrupt\fP in the specific case of an unrecognized field type. (Parsing is aborted in either case.) Use this callback to report an error like "unrecognized type" instead of simply "corrupt BSON". This future\-proofs code that may use an older version of libbson to parse future BSON formats. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +static bool +my_visit_before (const bson_iter_t *iter, const char *key, void *data) +{ + int *count = (int *) data; + + (*count)++; + + /* returning true stops further iteration of the document */ + + return false; +} + +static void +count_fields (bson_t *doc) +{ + bson_visitor_t visitor = {0}; + bson_iter_t iter; + int count = 0; + + visitor.visit_before = my_visit_before; + + if (bson_iter_init (&iter, doc)) { + bson_iter_visit_all (&iter, &visitor, &count); + } + + printf ("Found %d fields.\en", count); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The example below demonstrates how to set your own callbacks to provide information about the location of corrupt or unsupported BSON document entries. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +typedef struct { + ssize_t *err_offset; +} my_state_t; + +static void +my_visit_corrupt (const bson_iter_t *iter, void *data) +{ + *(((my_state_t *) data)\->err_offset) = iter\->off; +} + +static void +my_visit_unsupported_type (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data) +{ + *(((my_state_t *) data)\->err_offset) = iter\->off; +} + +static void +find_error_location (bson_t *doc) +{ + bson_visitor_t visitors = {0}; + bson_iter_t iter; + my_state_t state; + ssize_t err_offset = \-1; + + visitors.visit_corrupt = my_visit_corrupt; + visitors.visit_unsupported_type = my_visit_unsupported_type; + /* provide additional visitors as needed based on your requirements */ + state.err_offset = &err_offset; + + if (!bson_iter_init (&iter, doc)) { + printf ("Could not initialize iterator!"); + exit (1); + } + + if (bson_iter_visit_all (&iter, &visitors, &state) || + err_offset != \-1) { + printf ("Found error at offset %d.\en", err_offset); + } else { + printf ("BSON document had no errors.\en"); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_vsnprintf.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_vsnprintf.3 new file mode 100644 index 0000000..7c12173 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_vsnprintf.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_VSNPRINTF" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_vsnprintf \- bson_vsnprintf() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int +bson_vsnprintf (char *str, size_t size, const char *format, va_list ap) + BSON_GNUC_PRINTF (3, 0); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstr\fP: A location for the resulting string. +.IP \(bu 2 +\fBsize\fP: The size of str in bytes. +.IP \(bu 2 +\fBformat\fP: A printf style format string. +.IP \(bu 2 +\fBap\fP: A va_list of parameters for the format. +.UNINDENT +.SH DESCRIPTION +.sp +Like bson_snprintf() but allows for variadic parameters. +.SH RETURNS +.sp +The number of bytes written to \fBstr\fP excluding the \fB\e0\fP byte. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_begin.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_begin.3 new file mode 100644 index 0000000..6de5d7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_begin.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_BEGIN" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_begin \- bson_writer_begin() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +bson_writer_begin (bson_writer_t *writer, bson_t **bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBwriter\fP: A \fBbson_writer_t\fP\&. +.IP \(bu 2 +\fBbson\fP: A \fBbson_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Begins writing a new document. The caller may use the bson structure to write out a new BSON document. When completed, the caller must call either \fBbson_writer_end()\fP or \fBbson_writer_rollback()\fP\&. +.SH RETURNS +.sp +true if there was space in the underlying buffers to begin the document. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_destroy.3 new file mode 100644 index 0000000..04c4701 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_destroy.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_DESTROY" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_destroy \- bson_writer_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_writer_destroy (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBwriter\fP: A \fBbson_writer_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Cleanup after \fBwriter\fP and release any allocated memory. Does nothing if \fBwriter\fP is NULL. Note that the buffer supplied to \fBbson_writer_new()\fP is \fINOT\fP freed from this method. The caller is responsible for that. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_end.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_end.3 new file mode 100644 index 0000000..247e758 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_end.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_END" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_end \- bson_writer_end() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_writer_end (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBwriter\fP: A \fBbson_writer_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Complete writing of a \fBbson_writer_t\fP to the buffer supplied. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_get_length.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_get_length.3 new file mode 100644 index 0000000..b0744f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_get_length.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_GET_LENGTH" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_get_length \- bson_writer_get_length() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +size_t +bson_writer_get_length (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBwriter\fP: A \fBbson_writer_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the current length of the content written by the buffer (including the initial offset). This includes a partly written document currently being written. +.sp +This is useful if you want to check to see if you\(aqve passed a given memory boundary that cannot be sent in a packet. See \fBbson_writer_rollback()\fP to abort the current document being written. +.SH RETURNS +.sp +The length of the underlying buffer. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_new.3 new file mode 100644 index 0000000..0ff5172 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_new.3 @@ -0,0 +1,75 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_NEW" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_new \- bson_writer_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bson_writer_t * +bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbuf\fP: A uint8_t. +.IP \(bu 2 +\fBbuflen\fP: A size_t. +.IP \(bu 2 +\fBoffset\fP: A size_t. +.IP \(bu 2 +\fBrealloc_func\fP: A bson_realloc_func. +.IP \(bu 2 +\fBrealloc_func_ctx\fP: A bson_realloc_func. +.UNINDENT +.SH DESCRIPTION +.sp +Creates a new instance of \fBbson_writer_t\fP using the \fBbuffer\fP, \fBlength\fP, \fBoffset\fP, and _realloc()_ function supplied. +.sp +The caller is expected to clean up the structure when finished using \fBbson_writer_destroy()\fP\&. +.SH RETURNS +.sp +A newly allocated bson_writer_t. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_rollback.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_rollback.3 new file mode 100644 index 0000000..29c0bf4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_rollback.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_ROLLBACK" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_rollback \- bson_writer_rollback() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_writer_rollback (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBwriter\fP: A \fBbson_writer_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Abort the appending of the current bson_t to the memory region managed by \fBwriter\fP\&. This is useful if you detected that you went past a particular memory limit. For example, MongoDB has 48MB message limits. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_t.3 new file mode 100644 index 0000000..bb86886 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_writer_t.3 @@ -0,0 +1,99 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_WRITER_T" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_writer_t \- bson_writer_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Bulk BSON serialization Abstraction +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _bson_writer_t bson_writer_t; + +bson_writer_t * +bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); +void +bson_writer_destroy (bson_writer_t *writer); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +The \fBbson_writer_t\fP API provides an abstraction for serializing many BSON documents to a single memory region. The memory region may be dynamically allocated and re\-allocated as more memory is demanded. This can be useful when building network packets from a high\-level language. For example, you can serialize a Python Dictionary directly to a single buffer destined for a TCP packet. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int +main (int argc, char *argv[]) +{ + bson_writer_t *writer; + uint8_t *buf = NULL; + size_t buflen = 0; + bson_t *doc; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 1000; i++) { + bson_writer_begin (writer, &doc); + BSON_APPEND_INT32 (&doc, "i", i); + bson_writer_end (writer); + } + + bson_writer_destroy (writer); + + bson_free (buf); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_zero_free.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_zero_free.3 new file mode 100644 index 0000000..df19c40 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/man/bson_zero_free.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSON_ZERO_FREE" "3" "Jan 24, 2019" "1.13.1" "Libbson" +.SH NAME +bson_zero_free \- bson_zero_free() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +bson_zero_free (void *mem, size_t size); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBmem\fP: A memory region. +.IP \(bu 2 +\fBsize\fP: The size of \fBmem\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function behaves like \fBbson_free()\fP except that it zeroes the memory first. This can be useful if you are storing passwords or other similarly important data. Note that if it truly is important, you probably want a page protected with \fBmlock()\fP as well to prevent it swapping to disk. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/oid.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/oid.rst new file mode 100644 index 0000000..c20f80f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/oid.rst @@ -0,0 +1,80 @@ +:man_page: bson_oid + +ObjectIDs +========= + +Libbson provides a simple way to generate ObjectIDs. It can be used in a single-threaded or multi-threaded manner depending on your requirements. + +The :symbol:`bson_oid_t` structure represents an ``ObjectID`` in MongoDB. It is a 96-bit identifier that includes various information about the system generating the OID. + +Composition +----------- + +* 4 bytes : The UNIX timestamp in big-endian format. +* 3 bytes : A hash of the hostname. +* 2 bytes : The ``pid_t`` of the current process. Alternatively the task-id if configured. +* 3 bytes : A 24-bit monotonic counter incrementing from ``rand()`` in big-endian. + +Sorting ObjectIDs +----------------- + +The typical way to sort in C is using ``qsort()``. Therefore, Libbson provides a ``qsort()`` compatible callback function named :symbol:`bson_oid_compare()`. It returns ``less than 1``, ``greater than 1``, or ``0`` depending on the equality of two :symbol:`bson_oid_t` structures. + +Comparing Object IDs +-------------------- + +If you simply want to compare two :symbol:`bson_oid_t` structures for equality, use :symbol:`bson_oid_equal()`. + +Generating +---------- + +To generate a :symbol:`bson_oid_t`, you may use the following. + +.. code-block:: c + + bson_oid_t oid; + + bson_oid_init (&oid, NULL); + +Parsing ObjectID Strings +------------------------ + +You can also parse a string containing a :symbol:`bson_oid_t`. The input string *MUST* be 24 characters or more in length. + +.. code-block:: c + + bson_oid_t oid; + + bson_oid_init_from_string (&oid, "123456789012345678901234"); + +If you need to parse may :symbol:`bson_oid_t` in a tight loop and can guarantee the data is safe, you might consider using the inline variant. It will be inlined into your code and reduce the need for a foreign function call. + +.. code-block:: c + + bson_oid_t oid; + + bson_oid_init_from_string_unsafe (&oid, "123456789012345678901234"); + +Hashing ObjectIDs +----------------- + +If you need to store items in a hashtable, you may want to use the :symbol:`bson_oid_t` as the key. Libbson provides a hash function for just this purpose. It is based on DJB hash. + +.. code-block:: c + + unsigned hash; + + hash = bson_oid_hash (oid); + +Fetching ObjectID Creation Time +------------------------------- + +You can easily fetch the time that a :symbol:`bson_oid_t` was generated using :symbol:`bson_oid_get_time_t()`. + +.. code-block:: c + + time_t t; + + t = bson_oid_get_time_t (oid); + printf ("The OID was generated at %u\n", (unsigned) t); + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/parsing.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/parsing.rst new file mode 100644 index 0000000..65f5437 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/parsing.rst @@ -0,0 +1,120 @@ +:man_page: bson_parsing + +Parsing and Iterating BSON Documents +==================================== + +Parsing +------- + +BSON documents are lazily parsed as necessary. To begin parsing a BSON document, use one of the provided Libbson functions to create a new :symbol:`bson_t` from existing data such as :symbol:`bson_new_from_data()`. This will make a copy of the data so that additional mutations may occur to the BSON document. + +.. tip:: + + If you only want to parse a BSON document and have no need to mutate it, you may use :symbol:`bson_init_static()` to avoid making a copy of the data. + +.. code-block:: c + + bson_t *b; + + b = bson_new_from_data (my_data, my_data_len); + if (!b) { + fprintf (stderr, "The specified length embedded in did not match " + "\n"); + return; + } + + bson_destroy (b); + +Only two checks are performed when creating a new :symbol:`bson_t` from an existing buffer. First, the document must begin with the buffer length, matching what was expected by the caller. Second, the document must end with the expected trailing ``\0`` byte. + +To parse the document further we use a :symbol:`bson_iter_t` to iterate the elements within the document. Let's print all of the field names in the document. + +.. code-block:: c + + bson_t *b; + bson_iter_t iter; + + if ((b = bson_new_from_data (my_data, my_data_len))) { + if (bson_iter_init (&iter, b)) { + while (bson_iter_next (&iter)) { + printf ("Found element key: \"%s\"\n", bson_iter_key (&iter)); + } + } + bson_destroy (b); + } + +Converting a document to JSON uses a :symbol:`bson_iter_t` and :symbol:`bson_visitor_t` to iterate all fields of a BSON document recursively and generate a UTF-8 encoded JSON string. + +.. code-block:: c + + bson_t *b; + char *json; + + if ((b = bson_new_from_data (my_data, my_data_len))) { + if ((json = bson_as_canonical_extended_json (b, NULL))) { + printf ("%s\n", json); + bson_free (json); + } + bson_destroy (b); + } + +Recursing into Sub-Documents +---------------------------- + +Libbson provides convenient sub-iterators to dive down into a sub-document or sub-array. Below is an example that will dive into a sub-document named "foo" and print it's field names. + +.. code-block:: c + + bson_iter_t iter; + bson_iter_t child; + char *json; + + if (bson_iter_init_find (&iter, doc, "foo") && + BSON_ITER_HOLDS_DOCUMENT (&iter) && bson_iter_recurse (&iter, &child)) { + while (bson_iter_next (&child)) { + printf ("Found sub-key of \"foo\" named \"%s\"\n", + bson_iter_key (&child)); + } + } + +Finding Fields using Dot Notation +--------------------------------- + +Using the :symbol:`bson_iter_recurse()` function exemplified above, :symbol:`bson_iter_find_descendant()` can find a field for you using the MongoDB style path notation such as "foo.bar.0.baz". + +Let's create a document like ``{"foo": {"bar": [{"baz: 1}]}}`` and locate the ``"baz"`` field. + +.. code-block:: c + + bson_t *b; + bson_iter_t iter; + bson_iter_t baz; + + b = + BCON_NEW ("foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}"); + + if (bson_iter_init (&iter, b) && + bson_iter_find_descendant (&iter, "foo.bar.0.baz", &baz) && + BSON_ITER_HOLDS_INT32 (&baz)) { + printf ("baz = %d\n", bson_iter_int32 (&baz)); + } + + bson_destroy (b); + +Validating a BSON Document +-------------------------- + +If all you want to do is validate that a BSON document is valid, you can use :symbol:`bson_validate()`. + +.. code-block:: c + + size_t err_offset; + + if (!bson_validate (doc, BSON_VALIDATE_NONE, &err_offset)) { + fprintf (stderr, + "The document failed to validate at offset: %u\n", + (unsigned) err_offset); + } + +See the :symbol:`bson_validate()` documentation for more information and examples. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/streaming-bson.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/streaming-bson.rst new file mode 100644 index 0000000..862a733 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/streaming-bson.rst @@ -0,0 +1,93 @@ +:man_page: bson_streaming_bson + +Streaming BSON +============== + +:symbol:`bson_reader_t` provides a streaming reader which can be initialized with a filedescriptor or memory region. :symbol:`bson_writer_t` provides a streaming writer which can be initialized with a memory region. (Streaming BSON to a file descriptor is not yet supported.) + +Reading from a BSON Stream +-------------------------- + +:symbol:`bson_reader_t` provides a convenient API to read sequential BSON documents from a file-descriptor or memory buffer. The :symbol:`bson_reader_read()` function will read forward in the underlying stream and return a :symbol:`bson_t` that can be inspected and iterated upon. + +.. code-block:: c + + #include + #include + + int + main (int argc, char *argv[]) + { + bson_reader_t *reader; + const bson_t *doc; + bson_error_t error; + bool eof; + + reader = bson_reader_new_from_file ("mycollection.bson", &error); + + if (!reader) { + fprintf (stderr, "Failed to open file.\n"); + return 1; + } + + while ((doc = bson_reader_read (reader, &eof))) { + char *str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\n", str); + bson_free (str); + } + + if (!eof) { + fprintf (stderr, + "corrupted bson document found at %u\n", + (unsigned) bson_reader_tell (reader)); + } + + bson_reader_destroy (reader); + + return 0; + } + +See :symbol:`bson_reader_new_from_fd()`, :symbol:`bson_reader_new_from_file()`, and :symbol:`bson_reader_new_from_data()` for more information. + +Writing a sequence of BSON Documents +------------------------------------ + +:symbol:`bson_writer_t` provides a convenient API to write a sequence of BSON documents to a memory buffer that can grow with ``realloc()``. The :symbol:`bson_writer_begin()` and :symbol:`bson_writer_end()` functions will manage the underlying buffer while building the sequence of documents. + +This could also be useful if you want to write to a network packet while serializing the documents from a higher level language, (but do so just after the packets header). + +.. code-block:: c + + #include + #include + #include + + int + main (int argc, char *argv[]) + { + bson_writer_t *writer; + bson_t *doc; + uint8_t *buf = NULL; + size_t buflen = 0; + bool r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < 10000; i++) { + r = bson_writer_begin (writer, &doc); + assert (r); + + r = BSON_APPEND_INT32 (doc, "i", i); + assert (r); + + bson_writer_end (writer); + } + + bson_free (buf); + + return 0; + } + +See :symbol:`bson_writer_new()` for more information. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/threading.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/threading.rst new file mode 100644 index 0000000..550ca1c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/threading.rst @@ -0,0 +1,9 @@ +:man_page: bson_threading + +Threading +========= + +Libbson's data structures are *NOT* thread-safe. You are responsible for accessing and mutating these structures from one thread at a time. + +Libbson requires POSIX threads (pthreads) on all UNIX-like platforms. On Windows, the native threading interface is used. Libbson uses your system's threading library to safely generate unique :doc:`ObjectIds `, and to provide a fallback implementation for atomic operations on platforms without built-in atomics. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/tutorial.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/tutorial.rst new file mode 100644 index 0000000..f7e2ff7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/tutorial.rst @@ -0,0 +1,15 @@ +:man_page: bson_tutorial + +Tutorial +======== + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + include-and-link + creating + errors + oid + parsing + utf8 diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/utf8.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/utf8.rst new file mode 100644 index 0000000..140f6e6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/utf8.rst @@ -0,0 +1,33 @@ +:man_page: bson_utf8 + +UTF-8 +===== + +Encoding +-------- + +Libbson expects that you are always working with UTF-8 encoded text. Anything else is **invalid API use**. + +If you should need to walk through UTF-8 sequences, you can use the various UTF-8 helper functions distributed with Libbson. + +Validating a UTF-8 Sequence +--------------------------- + +To validate the string contained in ``my_string``, use the following. You may pass ``-1`` for the string length if you know the string is NULL-terminated. + +.. code-block:: c + + if (!bson_utf8_validate (my_string, -1, false)) { + printf ("Validation failed.\n"); + } + +If ``my_string`` has NULL bytes within the string, you must provide the string length. Use the following format. Notice the ``true`` at the end indicating ``\0`` is allowed. + +.. code-block:: c + + if (!bson_utf8_validate (my_string, my_string_len, true)) { + printf ("Validation failed.\n"); + } + +For more information see the API reference for :symbol:`bson_utf8_validate()`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/valgrind.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/valgrind.rst new file mode 100644 index 0000000..4898e3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/valgrind.rst @@ -0,0 +1,16 @@ +:man_page: bson_valgrind + +Use Valgrind to Check For BSON Data Leaks +========================================= + +A stack-allocated :symbol:`bson_t` contains a small internal buffer; it only heap-allocates additional storage if necessary, depending on its data size. Therefore if you forget to call :symbol:`bson_destroy` on a stack-allocated :symbol:`bson_t`, it might or might not cause a leak that can be detected by valgrind during testing. + +To catch all potential BSON data leaks in your code, configure the BSON_MEMCHECK flag: + +.. code-block:: none + + cmake -DCMAKE_C_FLAGS="-DBSON_MEMCHECK -g" . + +With this flag set, every :symbol:`bson_t` mallocs at least one byte. Run your program's unittests with valgrind to verify all :symbol:`bson_t` structs are destroyed. + +Set the environment variable ``MONGOC_TEST_VALGRIND`` to ``on`` to skip timing-dependent tests known to fail with valgrind. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/version.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/version.rst new file mode 100644 index 0000000..e7c25e7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/version.rst @@ -0,0 +1,54 @@ +:man_page: bson_version + +Libbson Versioning +================== + +Versioning Macros and Functions + +Macros +------ + +The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against. This may be useful if you only want to enable a feature on a certain version of the library. + +Synopsis +-------- + +.. code-block:: c + + #define BSON_CHECK_VERSION(major, minor, micro) + + #define BSON_MAJOR_VERSION (1) + #define BSON_MINOR_VERSION (4) + #define BSON_MICRO_VERSION (1) + #define BSON_VERSION_S "1.4.1" + + #define BSON_VERSION_HEX \ + (BSON_MAJOR_VERSION << 24 | BSON_MINOR_VERSION << 16 | \ + BSON_MICRO_VERSION << 8) + +Only compile a block on Libbson 1.1.0 and newer. + +.. code-block:: c + + #if BSON_CHECK_VERSION(1, 1, 0) + static void + do_something (void) + { + } + #endif + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + bson_check_version + bson_get_major_version + bson_get_micro_version + bson_get_minor_version + bson_get_version + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/CMakeLists.txt new file mode 100644 index 0000000..7a7f85b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/CMakeLists.txt @@ -0,0 +1,10 @@ +file (GLOB_RECURSE src_libbson_examples_DIST_cs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c) +file (GLOB_RECURSE src_libbson_examples_DIST_shs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.sh) + +set_dist_list (src_libbson_examples_DIST + CMakeLists.txt + cmake/find_package/CMakeLists.txt + cmake/find_package_static/CMakeLists.txt + ${src_libbson_examples_DIST_cs} + ${src_libbson_examples_DIST_shs} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-col-view.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-col-view.c new file mode 100644 index 0000000..317b227 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-col-view.c @@ -0,0 +1,96 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#define QUERY(...) ELE_QUERY, __VA_ARGS__, NULL +#define SORT(...) ELE_SORT, __VA_ARGS__, NULL +#define LIMIT(var) ELE_LIMIT, (var) +#define COL_VIEW_CREATE(...) col_view_create ("", __VA_ARGS__, ELE_END) + +typedef enum ele { + ELE_SORT, + ELE_LIMIT, + ELE_QUERY, + ELE_END, +} ele_t; + +bson_t * +col_view_create (const char *stub, ...) +{ + bson_t *bson; + va_list ap; + ele_t type; + int keep_going = 1; + + bcon_append_ctx_t ctx; + bcon_append_ctx_init (&ctx); + + va_start (ap, stub); + + bson = bson_new (); + + while (keep_going) { + type = va_arg (ap, ele_t); + + switch (type) { + case ELE_SORT: + BCON_APPEND_CTX (bson, &ctx, "sort", "{"); + bcon_append_ctx_va (bson, &ctx, &ap); + BCON_APPEND_CTX (bson, &ctx, "}"); + break; + case ELE_LIMIT: { + int i = va_arg (ap, int); + BCON_APPEND_CTX (bson, &ctx, "limit", BCON_INT32 (i)); + break; + } + case ELE_QUERY: + BCON_APPEND_CTX (bson, &ctx, "query", "{"); + bcon_append_ctx_va (bson, &ctx, &ap); + BCON_APPEND_CTX (bson, &ctx, "}"); + break; + case ELE_END: + keep_going = 0; + break; + default: + BSON_ASSERT (0); + break; + } + } + + va_end (ap); + + return bson; +} + +int +main (int argc, char *argv[]) +{ + bson_t *bson; + char *json; + + bson = COL_VIEW_CREATE ( + SORT ("a", BCON_INT32 (1)), QUERY ("hello", "world"), LIMIT (10)); + + json = bson_as_canonical_extended_json (bson, NULL); + printf ("%s\n", json); + bson_free (json); + + bson_destroy (bson); + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-speed.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-speed.c new file mode 100644 index 0000000..01159f0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bcon-speed.c @@ -0,0 +1,93 @@ +/* + * Copyright 2013-2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include + +/* + * This is a test for comparing the performance of BCON to regular + * bson_append*() function calls. + * + * Maybe run the following a few times to get an idea of the performance + * implications of using BCON. Generally, it's fast enough to be very + * useful and result in easier to read BSON code. + * + * time ./bcon-speed 100000 y + * time ./bcon-speed 100000 n + */ + + +int +main (int argc, char *argv[]) +{ + int i; + int n; + int bcon; + bson_t bson, foo, bar, baz; + bson_init (&bson); + + if (argc != 3) { + fprintf (stderr, + "usage: bcon-speed NUM_ITERATIONS [y|n]\n" + "\n" + " y = perform speed tests with bcon\n" + " n = perform speed tests with bson_append\n" + "\n"); + return EXIT_FAILURE; + } + + BSON_ASSERT (argc == 3); + + n = atoi (argv[1]); + bcon = (argv[2][0] == 'y') ? 1 : 0; + + for (i = 0; i < n; i++) { + if (bcon) { + BCON_APPEND (&bson, + "foo", + "{", + "bar", + "{", + "baz", + "[", + BCON_INT32 (1), + BCON_INT32 (2), + BCON_INT32 (3), + "]", + "}", + "}"); + } else { + bson_append_document_begin (&bson, "foo", -1, &foo); + bson_append_document_begin (&foo, "bar", -1, &bar); + bson_append_array_begin (&bar, "baz", -1, &baz); + bson_append_int32 (&baz, "0", -1, 1); + bson_append_int32 (&baz, "1", -1, 2); + bson_append_int32 (&baz, "2", -1, 3); + bson_append_array_end (&bar, &baz); + bson_append_document_end (&foo, &bar); + bson_append_document_end (&bson, &foo); + } + + bson_reinit (&bson); + } + + bson_destroy (&bson); + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-metrics.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-metrics.c new file mode 100644 index 0000000..9eeb941 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-metrics.c @@ -0,0 +1,319 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This program will scan each BSON document contained in the provided files + * and print metrics to STDOUT. + */ + +#include +#include +#include + +#define MAX_RECURSION 100 + +static double +dtimeofday (void) +{ + struct timeval timeval; + bson_gettimeofday (&timeval); + return (timeval.tv_sec + timeval.tv_usec * 0.000001); +} + +typedef struct { + uint64_t count; + char *description; +} bson_type_metrics_t; + +typedef struct { + uint64_t doc_count; + uint64_t element_count; + uint64_t doc_size_max; + uint64_t key_size_tally; + uint64_t utf8_size_tally; + uint32_t depth; + bson_type_metrics_t bson_type_metrics[256]; +} bson_metrics_state_t; + +static bson_metrics_state_t initial_state = { + 0L, + 0L, + 0L, + 0L, + 0L, + 0L, + {{/* BSON_TYPE_EOD = 0x00 */ 0L, "End of document"}, + {/* BSON_TYPE_DOUBLE = 0x01 */ 0L, "Floating point"}, + {/* BSON_TYPE_UTF8 = 0x02 */ 0L, "UTF-8 string"}, + {/* BSON_TYPE_DOCUMENT = 0x03 */ 0L, "Embedded document"}, + {/* BSON_TYPE_ARRAY = 0x04 */ 0L, "Array"}, + {/* BSON_TYPE_BINARY = 0x05 */ 0L, "Binary data"}, + {/* BSON_TYPE_UNDEFINED = 0x06 */ 0L, "Undefined - Deprecated"}, + {/* BSON_TYPE_OID = 0x07 */ 0L, "ObjectId"}, + {/* BSON_TYPE_BOOL = 0x08 */ 0L, "Boolean"}, + {/* BSON_TYPE_DATE_TIME = 0x09 */ 0L, "UTC datetime"}, + {/* BSON_TYPE_NULL = 0x0A */ 0L, "Null value"}, + {/* BSON_TYPE_REGEX = 0x0B */ 0L, "Regular expression"}, + {/* BSON_TYPE_DBPOINTER = 0x0C */ 0L, "DBPointer - Deprecated"}, + {/* BSON_TYPE_CODE = 0x0D */ 0L, "JavaScript code"}, + {/* BSON_TYPE_SYMBOL = 0x0E */ 0L, "Symbol - Deprecated"}, + {/* BSON_TYPE_CODEWSCOPE = 0x0F */ 0L, "JavaScript code w/ scope"}, + {/* BSON_TYPE_INT32 = 0x10 */ 0L, "32-bit Integer"}, + {/* BSON_TYPE_TIMESTAMP = 0x11 */ 0L, "Timestamp"}, + {/* BSON_TYPE_INT64 = 0x12 */ 0L, "64-bit Integer"}, + {0L, NULL}}}; + +static bson_metrics_state_t state; + +static int +compar_bson_type_metrics (const void *a, const void *b) +{ + return (((bson_type_metrics_t *) b)->count - + ((bson_type_metrics_t *) a)->count); +} + +/* + * Forward declarations. + */ +static bool +bson_metrics_visit_array (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); +static bool +bson_metrics_visit_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + +static bool +bson_metrics_visit_utf8 (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data) +{ + bson_metrics_state_t *s = data; + s->utf8_size_tally += v_utf8_len; + + return false; +} + +static bool +bson_metrics_visit_before (const bson_iter_t *iter, const char *key, void *data) +{ + bson_metrics_state_t *s = data; + bson_type_t btype; + ++s->element_count; + s->key_size_tally += strlen (key); /* TODO - filter out array keys(?) */ + btype = bson_iter_type (iter); + ++s->bson_type_metrics[btype].count; + + return false; +} + +static const bson_visitor_t bson_metrics_visitors = { + bson_metrics_visit_before, + NULL, /* visit_after */ + NULL, /* visit_corrupt */ + NULL, /* visit_double */ + bson_metrics_visit_utf8, + bson_metrics_visit_document, + bson_metrics_visit_array, + NULL, /* visit_binary */ + NULL, /* visit_undefined */ + NULL, /* visit_oid */ + NULL, /* visit_bool */ + NULL, /* visit_date_time */ + NULL, /* visit_null */ + NULL, /* visit_regex */ + NULL, /* visit_dbpointer */ + NULL, /* visit_code */ + NULL, /* visit_symbol */ + NULL, /* visit_codewscope */ + NULL, /* visit_int32 */ + NULL, /* visit_timestamp */ + NULL, /* visit_int64 */ + NULL, /* visit_maxkey */ + NULL, /* visit_minkey */ +}; + +static bool +bson_metrics_visit_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data) +{ + bson_metrics_state_t *s = data; + bson_iter_t child; + + if (s->depth >= MAX_RECURSION) { + fprintf (stderr, "Invalid document, max recursion reached.\n"); + return true; + } + + if (bson_iter_init (&child, v_document)) { + s->depth++; + bson_iter_visit_all (&child, &bson_metrics_visitors, data); + s->depth--; + } + + return false; +} + +static bool +bson_metrics_visit_array (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data) +{ + bson_metrics_state_t *s = data; + bson_iter_t child; + + if (s->depth >= MAX_RECURSION) { + fprintf (stderr, "Invalid document, max recursion reached.\n"); + return true; + } + + if (bson_iter_init (&child, v_array)) { + s->depth++; + bson_iter_visit_all (&child, &bson_metrics_visitors, data); + s->depth--; + } + + return false; +} + +static void +bson_metrics (const bson_t *bson, size_t *length, void *data) +{ + bson_iter_t iter; + bson_metrics_state_t *s = data; + ++s->doc_count; + + if (bson_iter_init (&iter, bson)) { + bson_iter_visit_all (&iter, &bson_metrics_visitors, data); + } +} + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + int i, j; + double dtime_before, dtime_after, dtime_delta; + uint64_t aggregate_count; + off_t mark; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + printf ("["); + for (i = 1; i < argc; i++) { + if (i > 1) + printf (","); + filename = argv[i]; + + /* + * Initialize a new reader for this file descriptor. + */ + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + + state = initial_state; + dtime_before = dtimeofday (); + mark = 0; + while ((b = bson_reader_read (reader, NULL))) { + off_t pos = bson_reader_tell (reader); + state.doc_size_max = BSON_MAX (pos - mark, state.doc_size_max); + mark = pos; + bson_metrics (b, NULL, &state); + } + dtime_after = dtimeofday (); + dtime_delta = BSON_MAX (dtime_after - dtime_before, 0.000001); + state.bson_type_metrics[BSON_TYPE_MAXKEY].description = "Max key"; + state.bson_type_metrics[BSON_TYPE_MINKEY].description = "Min key"; + aggregate_count = state.bson_type_metrics[BSON_TYPE_DOCUMENT].count + + state.bson_type_metrics[BSON_TYPE_ARRAY].count; + qsort (state.bson_type_metrics, + 256, + sizeof (bson_type_metrics_t), + compar_bson_type_metrics); + + printf ("\n {\n"); + printf (" \"file\": \"%s\",\n", filename); + printf (" \"secs\": %.2f,\n", dtime_delta); + printf (" \"docs_per_sec\": %" PRIu64 ",\n", + (uint64_t) floor (state.doc_count / dtime_delta)); + printf (" \"docs\": %" PRIu64 ",\n", state.doc_count); + printf (" \"elements\": %" PRIu64 ",\n", state.element_count); + printf (" \"elements_per_doc\": %" PRIu64 ",\n", + (uint64_t) floor ((double) state.element_count / + (double) BSON_MAX (state.doc_count, 1))); + printf (" \"aggregates\": %" PRIu64 ",\n", aggregate_count); + printf (" \"aggregates_per_doc\": %" PRIu64 ",\n", + (uint64_t) floor ((double) aggregate_count / + (double) BSON_MAX (state.doc_count, 1))); + printf (" \"degree\": %" PRIu64 ",\n", + (uint64_t) floor ( + (double) state.element_count / + ((double) BSON_MAX (state.doc_count + aggregate_count, 1)))); + printf (" \"doc_size_max\": %" PRIu64 ",\n", state.doc_size_max); + printf (" \"doc_size_average\": %" PRIu64 ",\n", + (uint64_t) floor ((double) bson_reader_tell (reader) / + (double) BSON_MAX (state.doc_count, 1))); + printf (" \"key_size_average\": %" PRIu64 ",\n", + (uint64_t) floor ((double) state.key_size_tally / + (double) BSON_MAX (state.element_count, 1))); + printf (" \"string_size_average\": %" PRIu64 ",\n", + (uint64_t) floor ( + (double) state.utf8_size_tally / + (double) BSON_MAX ( + state.bson_type_metrics[BSON_TYPE_UTF8].count, 1))); + printf (" \"percent_by_type\": {\n"); + for (j = 0; state.bson_type_metrics[j].count > 0; j++) { + bson_type_metrics_t bson_type_metrics = state.bson_type_metrics[j]; + printf (" \"%s\": %" PRIu64 ",\n", + bson_type_metrics.description, + (uint64_t) floor ((double) bson_type_metrics.count * 100.0 / + (double) BSON_MAX (state.element_count, 1))); + } + printf (" }\n"); + printf (" }"); + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + printf ("\n]\n"); + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-streaming-reader.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-streaming-reader.c new file mode 100644 index 0000000..ff55d82 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-streaming-reader.c @@ -0,0 +1,191 @@ +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#ifdef _WIN32 +#include +#include +#else +#include +#include +#include +#include +#include +#endif + + +#define DEFAULT_PORT "5000" +#define DEFAULT_HOST "localhost" + + +/* + * bson-streaming-remote-open -- + * + * Makes a connection to the specified host and port over TCP. This + * abstracts away most of the socket details required to make a + * connection. + * + * Parameters: + * @hostname: The name of the host to connect to, or NULL. + * @port: The port number of the server on the host, or NULL. + * + * Returns: + * A valid file descriptor ready for reading on success. + * -1 on failure. + */ +int +bson_streaming_remote_open (const char *hostname, const char *port) +{ + int error, sock; + struct addrinfo hints, *ptr, *server_list; + + /* + * Look up the host's address information, hinting that we'd like to use a + * TCP/IP connection. + */ + memset (&hints, 0, sizeof hints); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + error = + getaddrinfo ((!hostname || !strlen (hostname)) ? DEFAULT_HOST : hostname, + (!port || !strlen (port)) ? DEFAULT_PORT : port, + &hints, + &server_list); + + if (error) { + fprintf (stderr, + "bson-streaming-remote-open: Failed to get server info: %s\n", + gai_strerror (error)); + return -1; + } + + /* + * Iterate through the results of getaddrinfo, attempting to connect to the + * first possible result. + */ + for (ptr = server_list; ptr != NULL; ptr = ptr->ai_next) { + sock = socket (ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); + + if (sock < 0) { + perror ("bson-streaming-remote-open: socket creation failed"); + continue; + } + + if (connect (sock, ptr->ai_addr, ptr->ai_addrlen) < 0) { + close (sock); + perror ("bson-streaming-remote-open: connect failure"); + continue; + } + + /* + * Connection success. + */ + break; + } + + freeaddrinfo (server_list); + if (ptr == NULL) { + fprintf (stderr, + "bson-streaming-remote-open: failed to connect to server\n"); + return -1; + } + + return sock; +} + + +/* + * main -- + * + * Connects to a server and reads BSON from it. This program takes the + * following command line options: + * + * -h Print this help and exit. + * -s SERVER_NAME Specify the host name of the server. + * -p PORT_NUM Specify the port number to connect to on the server. + */ +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + char *hostname = NULL; + char *json; + char *port = NULL; + const bson_t *document; + int fd; + int opt; + + opterr = 1; + + /* + * Parse command line arguments. + */ + while ((opt = getopt (argc, argv, "hs:p:")) != -1) { + switch (opt) { + case 'h': + fprintf ( + stdout, "Usage: %s [-s SERVER_NAME] [-p PORT_NUM]\n", argv[0]); + free (hostname); + free (port); + return EXIT_SUCCESS; + case 'p': + free (port); + port = (char *) malloc (strlen (optarg) + 1); + strcpy (port, optarg); + break; + case 's': + free (hostname); + hostname = (char *) malloc (strlen (optarg) + 1); + strcpy (hostname, optarg); + break; + default: + fprintf (stderr, "Unknown option: %s\n", optarg); + } + } + + /* + * Open a file descriptor on the remote and read in BSON documents, one by + * one. As an example of processing, this prints the incoming documents as + * JSON onto STDOUT. + */ + fd = bson_streaming_remote_open (hostname, port); + if (fd == -1) { + free (hostname); + free (port); + return EXIT_FAILURE; + } + + reader = bson_reader_new_from_fd (fd, true); + while ((document = bson_reader_read (reader, NULL))) { + json = bson_as_canonical_extended_json (document, NULL); + fprintf (stdout, "%s\n", json); + bson_free (json); + } + + /* + * Destroy the reader, which performs cleanup. The ``true'' argument passed + * to bson_reader_new_from_fd tells libbson to close the file descriptor on + * destruction. + */ + bson_reader_destroy (reader); + free (hostname); + free (port); + return EXIT_SUCCESS; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-to-json.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-to-json.c new file mode 100644 index 0000000..e4e7139 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-to-json.c @@ -0,0 +1,81 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each BSON document contained in the provided files + * as a JSON string to STDOUT. + */ + + +#include +#include + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + char *str; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s [FILE | -]...\nUse - for STDIN.\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + if (strcmp (filename, "-") == 0) { + reader = bson_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + str = bson_as_canonical_extended_json (b, NULL); + fprintf (stdout, "%s\n", str); + bson_free (str); + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-validate.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-validate.c new file mode 100644 index 0000000..baeb4e7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/bson-validate.c @@ -0,0 +1,97 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will validate each BSON document contained in the files provide + * as arguments to the program. Each document from each file is read in + * sequence until a bad BSON document is found or there are no more documents + * to read. + * + * Try running it with: + * + * ./bson-validate tests/binary/overflow2.bson + * ./bson-validate tests/binary/trailingnull.bson + */ + + +#include +#include +#include + + +int +main (int argc, char *argv[]) +{ + bson_reader_t *reader; + const bson_t *b; + bson_error_t error; + const char *filename; + size_t offset; + int docnum; + int i; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + docnum = 0; + + /* + * Initialize a new reader for this file descriptor. + */ + if (!(reader = bson_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + + /* + * Convert each incoming document to JSON and print to stdout. + */ + while ((b = bson_reader_read (reader, NULL))) { + docnum++; + if (!bson_validate ( + b, + (BSON_VALIDATE_UTF8 | BSON_VALIDATE_UTF8_ALLOW_NULL), + &offset)) { + fprintf (stderr, + "Document %u in \"%s\" is invalid at offset %u.\n", + docnum, + filename, + (int) offset); + bson_reader_destroy (reader); + return 1; + } + } + + /* + * Cleanup after our reader, which closes the file descriptor. + */ + bson_reader_destroy (reader); + } + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package/CMakeLists.txt new file mode 100644 index 0000000..74ee789 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2017 MongoDB Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Demonstrates how to use the CMake 'find_package' mechanism to locate +# and build against libbson. + +cmake_minimum_required (VERSION 2.8) + +if (APPLE) + cmake_policy (SET CMP0042 OLD) +endif () + +project (hello_bson LANGUAGES C) + +# NOTE: For this to work, the CMAKE_PREFIX_PATH variable must be set to point to +# the directory that was used as the argument to CMAKE_INSTALL_PREFIX when +# building libbson. +# -- sphinx-include-start -- +# Specify the minimum version you require. +find_package (libbson-1.0 1.7 REQUIRED) + +message ("-- libbson found version \"${BSON_VERSION}\"") +message ("-- libbson include path \"${BSON_INCLUDE_DIRS}\"") +message ("-- libbson libraries \"${BSON_LIBRARIES}\"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_DEFINITIONS}) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package_static/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package_static/CMakeLists.txt new file mode 100644 index 0000000..47ca754 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/cmake/find_package_static/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2017 MongoDB Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Demonstrates how to use the CMake 'find_package' mechanism to locate +# and build against libbson. + +cmake_minimum_required (VERSION 2.8) + +if (APPLE) + cmake_policy (SET CMP0042 OLD) +endif () + +project (hello_bson LANGUAGES C) + +# NOTE: For this to work, the CMAKE_PREFIX_PATH variable must be set to point to +# the directory that was used as the argument to CMAKE_INSTALL_PREFIX when +# building libbson. +# -- sphinx-include-start -- +# Specify the minimum version you require. +find_package (libbson-static-1.0 1.7 REQUIRED) + +message ("-- libbson-static found version \"${BSON_STATIC_VERSION}\"") +message ("-- libbson-static include path \"${BSON_STATIC_INCLUDE_DIRS}\"") +message ("-- libbson-static libraries \"${BSON_STATIC_LIBRARIES}\"") + +# The "hello_bson.c" sample program is shared among four tests. +add_executable (hello_bson ../../hello_bson.c) +target_include_directories (hello_bson PRIVATE ${BSON_STATIC_INCLUDE_DIRS}) +target_link_libraries (hello_bson PRIVATE ${BSON_STATIC_LIBRARIES}) +target_compile_definitions (hello_bson PRIVATE ${BSON_STATIC_DEFINITIONS}) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config-static.sh b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config-static.sh new file mode 100644 index 0000000..cc7fc51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config-static.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -o xtrace # Write all commands first to stderr +set -o errexit # Exit the script with error if any of the commands fail + +# -- sphinx-include-start -- +gcc -o hello_bson hello_bson.c $(pkg-config --libs --cflags libbson-static-1.0) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config.sh b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config.sh new file mode 100644 index 0000000..acf91f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/compile-with-pkg-config.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -o xtrace # Write all commands first to stderr +set -o errexit # Exit the script with error if any of the commands fail + +# -- sphinx-include-start -- +gcc -o hello_bson hello_bson.c $(pkg-config --libs --cflags libbson-1.0) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/hello_bson.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/hello_bson.c new file mode 100644 index 0000000..5bb1ea5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/hello_bson.c @@ -0,0 +1,34 @@ +/* Copyright 2017 MongoDB Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* -- sphinx-include-start -- */ +#include +#include + +int +main (int argc, const char **argv) +{ + bson_t *b; + char *j; + + b = BCON_NEW ("hello", BCON_UTF8 ("bson!")); + j = bson_as_canonical_extended_json (b, NULL); + printf ("%s\n", j); + + bson_free (j); + bson_destroy (b); + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/json-to-bson.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/json-to-bson.c new file mode 100644 index 0000000..7339d2d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/examples/json-to-bson.c @@ -0,0 +1,91 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This program will print each JSON document contained in the provided files + * as a BSON string to STDOUT. + */ + + +#include +#include +#include + + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +int +main (int argc, char *argv[]) +{ + bson_json_reader_t *reader; + bson_error_t error; + const char *filename; + bson_t doc = BSON_INITIALIZER; + int i; + int b; + + /* + * Print program usage if no arguments are provided. + */ + if (argc == 1) { + fprintf (stderr, "usage: %s FILE...\n", argv[0]); + return 1; + } + + /* + * Process command line arguments expecting each to be a filename. + */ + for (i = 1; i < argc; i++) { + filename = argv[i]; + + /* + * Open the filename provided in command line arguments. + */ + if (0 == strcmp (filename, "-")) { + reader = bson_json_reader_new_from_fd (STDIN_FILENO, false); + } else { + if (!(reader = bson_json_reader_new_from_file (filename, &error))) { + fprintf ( + stderr, "Failed to open \"%s\": %s\n", filename, error.message); + continue; + } + } + + /* + * Convert each incoming document to BSON and print to stdout. + */ + while ((b = bson_json_reader_read (reader, &doc, &error))) { + if (b < 0) { + fprintf (stderr, "Error in json parsing:\n%s\n", error.message); + abort (); + } + + if (fwrite (bson_get_data (&doc), 1, doc.len, stdout) != doc.len) { + fprintf (stderr, "Failed to write to stdout, exiting.\n"); + exit (1); + } + bson_reinit (&doc); + } + + bson_json_reader_destroy (reader); + bson_destroy (&doc); + } + + return 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/CMakeLists.txt new file mode 100644 index 0000000..6a8befb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/CMakeLists.txt @@ -0,0 +1,15 @@ +add_subdirectory (bson) +add_subdirectory (jsonsl) + +set_local_dist (src_libbson_src_DIST_local + CMakeLists.txt + libbson-1.0.pc.in + libbson-static-1.0.pc.in +) + +set (src_libbson_src_DIST + ${src_libbson_src_DIST_local} + ${src_libbson_src_bson_DIST} + ${src_libbson_src_jsonsl_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/CMakeLists.txt new file mode 100644 index 0000000..29a5ec7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/CMakeLists.txt @@ -0,0 +1,68 @@ +set (src_libbson_src_bson_DIST_hs + bcon.h + bson.h + bson-atomic.h + bson-clock.h + bson-compat.h + bson-context.h + bson-decimal128.h + bson-endian.h + bson-error.h + bson-iter.h + bson-json.h + bson-keys.h + bson-macros.h + bson-md5.h + bson-memory.h + bson-oid.h + bson-reader.h + bson-string.h + bson-types.h + bson-utf8.h + bson-value.h + bson-version-functions.h + bson-writer.h + bson-private.h + bson-iso8601-private.h + bson-context-private.h + bson-fnv-private.h + bson-timegm-private.h + forwarding/bson.h +) +extra_dist_generated ( + bson-version.h +) + +set (src_libbson_src_bson_DIST_cs + bcon.c + bson.c + bson-atomic.c + bson-clock.c + bson-context.c + bson-decimal128.c + bson-error.c + bson-fnv.c + bson-iter.c + bson-iso8601.c + bson-json.c + bson-keys.c + bson-md5.c + bson-memory.c + bson-oid.c + bson-reader.c + bson-string.c + bson-timegm.c + bson-utf8.c + bson-value.c + bson-version-functions.c + bson-writer.c +) + +set_dist_list (src_libbson_src_bson_DIST + CMakeLists.txt + bson-config.h.in + bson-version.h.in + modules/module.modulemap.in + ${src_libbson_src_bson_DIST_hs} + ${src_libbson_src_bson_DIST_cs} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.c new file mode 100644 index 0000000..e3c81fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.c @@ -0,0 +1,1017 @@ +/* + * @file bcon.c + * @brief BCON (BSON C Object Notation) Implementation + */ + +/* Copyright 2009-2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "bson/bcon.h" +#include "bson/bson-config.h" + +/* These stack manipulation macros are used to manage append recursion in + * bcon_append_ctx_va(). They take care of some awkward dereference rules (the + * real bson object isn't in the stack, but accessed by pointer) and add in run + * time asserts to make sure we don't blow the stack in either direction */ + +#define STACK_ELE(_delta, _name) (ctx->stack[(_delta) + ctx->n]._name) + +#define STACK_BSON(_delta) \ + (((_delta) + ctx->n) == 0 ? bson : &STACK_ELE (_delta, bson)) + +#define STACK_ITER(_delta) \ + (((_delta) + ctx->n) == 0 ? &root_iter : &STACK_ELE (_delta, iter)) + +#define STACK_BSON_PARENT STACK_BSON (-1) +#define STACK_BSON_CHILD STACK_BSON (0) + +#define STACK_ITER_PARENT STACK_ITER (-1) +#define STACK_ITER_CHILD STACK_ITER (0) + +#define STACK_I STACK_ELE (0, i) +#define STACK_IS_ARRAY STACK_ELE (0, is_array) + +#define STACK_PUSH_ARRAY(statement) \ + do { \ + BSON_ASSERT (ctx->n < (BCON_STACK_MAX - 1)); \ + ctx->n++; \ + STACK_I = 0; \ + STACK_IS_ARRAY = 1; \ + statement; \ + } while (0) + +#define STACK_PUSH_DOC(statement) \ + do { \ + BSON_ASSERT (ctx->n < (BCON_STACK_MAX - 1)); \ + ctx->n++; \ + STACK_IS_ARRAY = 0; \ + statement; \ + } while (0) + +#define STACK_POP_ARRAY(statement) \ + do { \ + BSON_ASSERT (STACK_IS_ARRAY); \ + BSON_ASSERT (ctx->n != 0); \ + statement; \ + ctx->n--; \ + } while (0) + +#define STACK_POP_DOC(statement) \ + do { \ + BSON_ASSERT (!STACK_IS_ARRAY); \ + BSON_ASSERT (ctx->n != 0); \ + statement; \ + ctx->n--; \ + } while (0) + +/* This is a landing pad union for all of the types we can process with bcon. + * We need actual storage for this to capture the return value of va_arg, which + * takes multiple calls to get everything we need for some complex types */ +typedef union bcon_append { + char *UTF8; + double DOUBLE; + bson_t *DOCUMENT; + bson_t *ARRAY; + bson_t *BCON; + + struct { + bson_subtype_t subtype; + uint8_t *binary; + uint32_t length; + } BIN; + + bson_oid_t *OID; + bool BOOL; + int64_t DATE_TIME; + + struct { + char *regex; + char *flags; + } REGEX; + + struct { + char *collection; + bson_oid_t *oid; + } DBPOINTER; + + const char *CODE; + + char *SYMBOL; + + struct { + const char *js; + bson_t *scope; + } CODEWSCOPE; + + int32_t INT32; + + struct { + uint32_t timestamp; + uint32_t increment; + } TIMESTAMP; + + int64_t INT64; + bson_decimal128_t *DECIMAL128; + const bson_iter_t *ITER; +} bcon_append_t; + +/* same as bcon_append_t. Some extra symbols and varying types that handle the + * differences between bson_append and bson_iter */ +typedef union bcon_extract { + bson_type_t TYPE; + bson_iter_t *ITER; + const char *key; + const char **UTF8; + double *DOUBLE; + bson_t *DOCUMENT; + bson_t *ARRAY; + + struct { + bson_subtype_t *subtype; + const uint8_t **binary; + uint32_t *length; + } BIN; + + const bson_oid_t **OID; + bool *BOOL; + int64_t *DATE_TIME; + + struct { + const char **regex; + const char **flags; + } REGEX; + + struct { + const char **collection; + const bson_oid_t **oid; + } DBPOINTER; + + const char **CODE; + + const char **SYMBOL; + + struct { + const char **js; + bson_t *scope; + } CODEWSCOPE; + + int32_t *INT32; + + struct { + uint32_t *timestamp; + uint32_t *increment; + } TIMESTAMP; + + int64_t *INT64; + bson_decimal128_t *DECIMAL128; +} bcon_extract_t; + +static const char *gBconMagic = "BCON_MAGIC"; +static const char *gBconeMagic = "BCONE_MAGIC"; + +const char * +bson_bcon_magic (void) +{ + return gBconMagic; +} + + +const char * +bson_bcone_magic (void) +{ + return gBconeMagic; +} + +static void +_noop (void) +{ +} + +/* appends val to the passed bson object. Meant to be a super simple dispatch + * table */ +static void +_bcon_append_single (bson_t *bson, + bcon_type_t type, + const char *key, + bcon_append_t *val) +{ + switch ((int) type) { + case BCON_TYPE_UTF8: + BSON_ASSERT (bson_append_utf8 (bson, key, -1, val->UTF8, -1)); + break; + case BCON_TYPE_DOUBLE: + BSON_ASSERT (bson_append_double (bson, key, -1, val->DOUBLE)); + break; + case BCON_TYPE_BIN: { + BSON_ASSERT (bson_append_binary ( + bson, key, -1, val->BIN.subtype, val->BIN.binary, val->BIN.length)); + break; + } + case BCON_TYPE_UNDEFINED: + BSON_ASSERT (bson_append_undefined (bson, key, -1)); + break; + case BCON_TYPE_OID: + BSON_ASSERT (bson_append_oid (bson, key, -1, val->OID)); + break; + case BCON_TYPE_BOOL: + BSON_ASSERT (bson_append_bool (bson, key, -1, (bool) val->BOOL)); + break; + case BCON_TYPE_DATE_TIME: + BSON_ASSERT (bson_append_date_time (bson, key, -1, val->DATE_TIME)); + break; + case BCON_TYPE_NULL: + BSON_ASSERT (bson_append_null (bson, key, -1)); + break; + case BCON_TYPE_REGEX: { + BSON_ASSERT ( + bson_append_regex (bson, key, -1, val->REGEX.regex, val->REGEX.flags)); + break; + } + case BCON_TYPE_DBPOINTER: { + BSON_ASSERT (bson_append_dbpointer ( + bson, key, -1, val->DBPOINTER.collection, val->DBPOINTER.oid)); + break; + } + case BCON_TYPE_CODE: + BSON_ASSERT (bson_append_code (bson, key, -1, val->CODE)); + break; + case BCON_TYPE_SYMBOL: + BSON_ASSERT (bson_append_symbol (bson, key, -1, val->SYMBOL, -1)); + break; + case BCON_TYPE_CODEWSCOPE: + BSON_ASSERT (bson_append_code_with_scope ( + bson, key, -1, val->CODEWSCOPE.js, val->CODEWSCOPE.scope)); + break; + case BCON_TYPE_INT32: + BSON_ASSERT (bson_append_int32 (bson, key, -1, val->INT32)); + break; + case BCON_TYPE_TIMESTAMP: { + BSON_ASSERT (bson_append_timestamp ( + bson, key, -1, val->TIMESTAMP.timestamp, val->TIMESTAMP.increment)); + break; + } + case BCON_TYPE_INT64: + BSON_ASSERT (bson_append_int64 (bson, key, -1, val->INT64)); + break; + case BCON_TYPE_DECIMAL128: + BSON_ASSERT (bson_append_decimal128 (bson, key, -1, val->DECIMAL128)); + break; + case BCON_TYPE_MAXKEY: + BSON_ASSERT (bson_append_maxkey (bson, key, -1)); + break; + case BCON_TYPE_MINKEY: + BSON_ASSERT (bson_append_minkey (bson, key, -1)); + break; + case BCON_TYPE_ARRAY: { + BSON_ASSERT (bson_append_array (bson, key, -1, val->ARRAY)); + break; + } + case BCON_TYPE_DOCUMENT: { + BSON_ASSERT (bson_append_document (bson, key, -1, val->DOCUMENT)); + break; + } + case BCON_TYPE_ITER: + BSON_ASSERT (bson_append_iter (bson, key, -1, val->ITER)); + break; + default: + BSON_ASSERT (0); + break; + } +} + +#define CHECK_TYPE(_type) \ + do { \ + if (bson_iter_type (iter) != (_type)) { \ + return false; \ + } \ + } while (0) + +/* extracts the value under the iterator and writes it to val. returns false + * if the iterator type doesn't match the token type. + * + * There are two magic tokens: + * + * BCONE_SKIP - + * Let's us verify that a key has a type, without caring about its value. + * This allows for wider declarative BSON verification + * + * BCONE_ITER - + * Returns the underlying iterator. This could allow for more complicated, + * procedural verification (if a parameter could have multiple types). + * */ +static bool +_bcon_extract_single (const bson_iter_t *iter, + bcon_type_t type, + bcon_extract_t *val) +{ + switch ((int) type) { + case BCON_TYPE_UTF8: + CHECK_TYPE (BSON_TYPE_UTF8); + *val->UTF8 = bson_iter_utf8 (iter, NULL); + break; + case BCON_TYPE_DOUBLE: + CHECK_TYPE (BSON_TYPE_DOUBLE); + *val->DOUBLE = bson_iter_double (iter); + break; + case BCON_TYPE_BIN: + CHECK_TYPE (BSON_TYPE_BINARY); + bson_iter_binary ( + iter, val->BIN.subtype, val->BIN.length, val->BIN.binary); + break; + case BCON_TYPE_UNDEFINED: + CHECK_TYPE (BSON_TYPE_UNDEFINED); + break; + case BCON_TYPE_OID: + CHECK_TYPE (BSON_TYPE_OID); + *val->OID = bson_iter_oid (iter); + break; + case BCON_TYPE_BOOL: + CHECK_TYPE (BSON_TYPE_BOOL); + *val->BOOL = bson_iter_bool (iter); + break; + case BCON_TYPE_DATE_TIME: + CHECK_TYPE (BSON_TYPE_DATE_TIME); + *val->DATE_TIME = bson_iter_date_time (iter); + break; + case BCON_TYPE_NULL: + CHECK_TYPE (BSON_TYPE_NULL); + break; + case BCON_TYPE_REGEX: + CHECK_TYPE (BSON_TYPE_REGEX); + *val->REGEX.regex = bson_iter_regex (iter, val->REGEX.flags); + + break; + case BCON_TYPE_DBPOINTER: + CHECK_TYPE (BSON_TYPE_DBPOINTER); + bson_iter_dbpointer ( + iter, NULL, val->DBPOINTER.collection, val->DBPOINTER.oid); + break; + case BCON_TYPE_CODE: + CHECK_TYPE (BSON_TYPE_CODE); + *val->CODE = bson_iter_code (iter, NULL); + break; + case BCON_TYPE_SYMBOL: + CHECK_TYPE (BSON_TYPE_SYMBOL); + *val->SYMBOL = bson_iter_symbol (iter, NULL); + break; + case BCON_TYPE_CODEWSCOPE: { + const uint8_t *buf; + uint32_t len; + + CHECK_TYPE (BSON_TYPE_CODEWSCOPE); + + *val->CODEWSCOPE.js = bson_iter_codewscope (iter, NULL, &len, &buf); + + BSON_ASSERT (bson_init_static (val->CODEWSCOPE.scope, buf, len)); + break; + } + case BCON_TYPE_INT32: + CHECK_TYPE (BSON_TYPE_INT32); + *val->INT32 = bson_iter_int32 (iter); + break; + case BCON_TYPE_TIMESTAMP: + CHECK_TYPE (BSON_TYPE_TIMESTAMP); + bson_iter_timestamp ( + iter, val->TIMESTAMP.timestamp, val->TIMESTAMP.increment); + break; + case BCON_TYPE_INT64: + CHECK_TYPE (BSON_TYPE_INT64); + *val->INT64 = bson_iter_int64 (iter); + break; + case BCON_TYPE_DECIMAL128: + CHECK_TYPE (BSON_TYPE_DECIMAL128); + BSON_ASSERT (bson_iter_decimal128 (iter, val->DECIMAL128)); + break; + case BCON_TYPE_MAXKEY: + CHECK_TYPE (BSON_TYPE_MAXKEY); + break; + case BCON_TYPE_MINKEY: + CHECK_TYPE (BSON_TYPE_MINKEY); + break; + case BCON_TYPE_ARRAY: { + const uint8_t *buf; + uint32_t len; + + CHECK_TYPE (BSON_TYPE_ARRAY); + + bson_iter_array (iter, &len, &buf); + + BSON_ASSERT (bson_init_static (val->ARRAY, buf, len)); + break; + } + case BCON_TYPE_DOCUMENT: { + const uint8_t *buf; + uint32_t len; + + CHECK_TYPE (BSON_TYPE_DOCUMENT); + + bson_iter_document (iter, &len, &buf); + + BSON_ASSERT (bson_init_static (val->DOCUMENT, buf, len)); + break; + } + case BCON_TYPE_SKIP: + CHECK_TYPE (val->TYPE); + break; + case BCON_TYPE_ITER: + memcpy (val->ITER, iter, sizeof *iter); + break; + default: + BSON_ASSERT (0); + break; + } + + return true; +} + +/* Consumes ap, storing output values into u and returning the type of the + * captured token. + * + * The basic workflow goes like this: + * + * 1. Look at the current arg. It will be a char * + * a. If it's a NULL, we're done processing. + * b. If it's BCON_MAGIC (a symbol with storage in this module) + * I. The next token is the type + * II. The type specifies how many args to eat and their types + * c. Otherwise it's either recursion related or a raw string + * I. If the first byte is '{', '}', '[', or ']' pass back an + * appropriate recursion token + * II. If not, just call it a UTF8 token and pass that back + */ +static bcon_type_t +_bcon_append_tokenize (va_list *ap, bcon_append_t *u) +{ + char *mark; + bcon_type_t type; + + mark = va_arg (*ap, char *); + + BSON_ASSERT (mark != BCONE_MAGIC); + + if (mark == NULL) { + type = BCON_TYPE_END; + } else if (mark == BCON_MAGIC) { + type = va_arg (*ap, bcon_type_t); + + switch ((int) type) { + case BCON_TYPE_UTF8: + u->UTF8 = va_arg (*ap, char *); + break; + case BCON_TYPE_DOUBLE: + u->DOUBLE = va_arg (*ap, double); + break; + case BCON_TYPE_DOCUMENT: + u->DOCUMENT = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_ARRAY: + u->ARRAY = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_BIN: + u->BIN.subtype = va_arg (*ap, bson_subtype_t); + u->BIN.binary = va_arg (*ap, uint8_t *); + u->BIN.length = va_arg (*ap, uint32_t); + break; + case BCON_TYPE_UNDEFINED: + break; + case BCON_TYPE_OID: + u->OID = va_arg (*ap, bson_oid_t *); + break; + case BCON_TYPE_BOOL: + u->BOOL = va_arg (*ap, int); + break; + case BCON_TYPE_DATE_TIME: + u->DATE_TIME = va_arg (*ap, int64_t); + break; + case BCON_TYPE_NULL: + break; + case BCON_TYPE_REGEX: + u->REGEX.regex = va_arg (*ap, char *); + u->REGEX.flags = va_arg (*ap, char *); + break; + case BCON_TYPE_DBPOINTER: + u->DBPOINTER.collection = va_arg (*ap, char *); + u->DBPOINTER.oid = va_arg (*ap, bson_oid_t *); + break; + case BCON_TYPE_CODE: + u->CODE = va_arg (*ap, char *); + break; + case BCON_TYPE_SYMBOL: + u->SYMBOL = va_arg (*ap, char *); + break; + case BCON_TYPE_CODEWSCOPE: + u->CODEWSCOPE.js = va_arg (*ap, char *); + u->CODEWSCOPE.scope = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_INT32: + u->INT32 = va_arg (*ap, int32_t); + break; + case BCON_TYPE_TIMESTAMP: + u->TIMESTAMP.timestamp = va_arg (*ap, uint32_t); + u->TIMESTAMP.increment = va_arg (*ap, uint32_t); + break; + case BCON_TYPE_INT64: + u->INT64 = va_arg (*ap, int64_t); + break; + case BCON_TYPE_DECIMAL128: + u->DECIMAL128 = va_arg (*ap, bson_decimal128_t *); + break; + case BCON_TYPE_MAXKEY: + break; + case BCON_TYPE_MINKEY: + break; + case BCON_TYPE_BCON: + u->BCON = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_ITER: + u->ITER = va_arg (*ap, const bson_iter_t *); + break; + default: + BSON_ASSERT (0); + break; + } + } else { + switch (mark[0]) { + case '{': + type = BCON_TYPE_DOC_START; + break; + case '}': + type = BCON_TYPE_DOC_END; + break; + case '[': + type = BCON_TYPE_ARRAY_START; + break; + case ']': + type = BCON_TYPE_ARRAY_END; + break; + + default: + type = BCON_TYPE_UTF8; + u->UTF8 = mark; + break; + } + } + + return type; +} + + +/* Consumes ap, storing output values into u and returning the type of the + * captured token. + * + * The basic workflow goes like this: + * + * 1. Look at the current arg. It will be a char * + * a. If it's a NULL, we're done processing. + * b. If it's BCONE_MAGIC (a symbol with storage in this module) + * I. The next token is the type + * II. The type specifies how many args to eat and their types + * c. Otherwise it's either recursion related or a raw string + * I. If the first byte is '{', '}', '[', or ']' pass back an + * appropriate recursion token + * II. If not, just call it a UTF8 token and pass that back + */ +static bcon_type_t +_bcon_extract_tokenize (va_list *ap, bcon_extract_t *u) +{ + char *mark; + bcon_type_t type; + + mark = va_arg (*ap, char *); + + BSON_ASSERT (mark != BCON_MAGIC); + + if (mark == NULL) { + type = BCON_TYPE_END; + } else if (mark == BCONE_MAGIC) { + type = va_arg (*ap, bcon_type_t); + + switch ((int) type) { + case BCON_TYPE_UTF8: + u->UTF8 = va_arg (*ap, const char **); + break; + case BCON_TYPE_DOUBLE: + u->DOUBLE = va_arg (*ap, double *); + break; + case BCON_TYPE_DOCUMENT: + u->DOCUMENT = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_ARRAY: + u->ARRAY = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_BIN: + u->BIN.subtype = va_arg (*ap, bson_subtype_t *); + u->BIN.binary = va_arg (*ap, const uint8_t **); + u->BIN.length = va_arg (*ap, uint32_t *); + break; + case BCON_TYPE_UNDEFINED: + break; + case BCON_TYPE_OID: + u->OID = va_arg (*ap, const bson_oid_t **); + break; + case BCON_TYPE_BOOL: + u->BOOL = va_arg (*ap, bool *); + break; + case BCON_TYPE_DATE_TIME: + u->DATE_TIME = va_arg (*ap, int64_t *); + break; + case BCON_TYPE_NULL: + break; + case BCON_TYPE_REGEX: + u->REGEX.regex = va_arg (*ap, const char **); + u->REGEX.flags = va_arg (*ap, const char **); + break; + case BCON_TYPE_DBPOINTER: + u->DBPOINTER.collection = va_arg (*ap, const char **); + u->DBPOINTER.oid = va_arg (*ap, const bson_oid_t **); + break; + case BCON_TYPE_CODE: + u->CODE = va_arg (*ap, const char **); + break; + case BCON_TYPE_SYMBOL: + u->SYMBOL = va_arg (*ap, const char **); + break; + case BCON_TYPE_CODEWSCOPE: + u->CODEWSCOPE.js = va_arg (*ap, const char **); + u->CODEWSCOPE.scope = va_arg (*ap, bson_t *); + break; + case BCON_TYPE_INT32: + u->INT32 = va_arg (*ap, int32_t *); + break; + case BCON_TYPE_TIMESTAMP: + u->TIMESTAMP.timestamp = va_arg (*ap, uint32_t *); + u->TIMESTAMP.increment = va_arg (*ap, uint32_t *); + break; + case BCON_TYPE_INT64: + u->INT64 = va_arg (*ap, int64_t *); + break; + case BCON_TYPE_DECIMAL128: + u->DECIMAL128 = va_arg (*ap, bson_decimal128_t *); + break; + case BCON_TYPE_MAXKEY: + break; + case BCON_TYPE_MINKEY: + break; + case BCON_TYPE_SKIP: + u->TYPE = va_arg (*ap, bson_type_t); + break; + case BCON_TYPE_ITER: + u->ITER = va_arg (*ap, bson_iter_t *); + break; + default: + BSON_ASSERT (0); + break; + } + } else { + switch (mark[0]) { + case '{': + type = BCON_TYPE_DOC_START; + break; + case '}': + type = BCON_TYPE_DOC_END; + break; + case '[': + type = BCON_TYPE_ARRAY_START; + break; + case ']': + type = BCON_TYPE_ARRAY_END; + break; + + default: + type = BCON_TYPE_RAW; + u->key = mark; + break; + } + } + + return type; +} + + +/* This trivial utility function is useful for concatenating a bson object onto + * the end of another, ignoring the keys from the source bson object and + * continuing to use and increment the keys from the source. It's only useful + * when called from bcon_append_ctx_va */ +static void +_bson_concat_array (bson_t *dest, const bson_t *src, bcon_append_ctx_t *ctx) +{ + bson_iter_t iter; + const char *key; + char i_str[16]; + bool r; + + r = bson_iter_init (&iter, src); + + if (!r) { + fprintf (stderr, "Invalid BSON document, possible memory coruption.\n"); + return; + } + + STACK_I--; + + while (bson_iter_next (&iter)) { + bson_uint32_to_string (STACK_I, &key, i_str, sizeof i_str); + STACK_I++; + + BSON_ASSERT (bson_append_iter (dest, key, -1, &iter)); + } +} + + +/* Append_ctx_va consumes the va_list until NULL is found, appending into bson + * as tokens are found. It can receive or return an in-progress bson object + * via the ctx param. It can also operate on the middle of a va_list, and so + * can be wrapped inside of another varargs function. + * + * Note that passing in a va_list that isn't perferectly formatted for BCON + * ingestion will almost certainly result in undefined behavior + * + * The workflow relies on the passed ctx object, which holds a stack of bson + * objects, along with metadata (if the emedded layer is an array, and which + * element it is on if so). We iterate, generating tokens from the va_list, + * until we reach an END token. If any errors occur, we just blow up (the + * var_args stuff is already incredibly fragile to mistakes, and we have no way + * of introspecting, so just don't screw it up). + * + * There are also a few STACK_* macros in here which manimpulate ctx that are + * defined up top. + * */ +void +bcon_append_ctx_va (bson_t *bson, bcon_append_ctx_t *ctx, va_list *ap) +{ + bcon_type_t type; + const char *key; + char i_str[16]; + + bcon_append_t u = {0}; + + while (1) { + if (STACK_IS_ARRAY) { + bson_uint32_to_string (STACK_I, &key, i_str, sizeof i_str); + STACK_I++; + } else { + type = _bcon_append_tokenize (ap, &u); + + if (type == BCON_TYPE_END) { + return; + } + + if (type == BCON_TYPE_DOC_END) { + STACK_POP_DOC ( + bson_append_document_end (STACK_BSON_PARENT, STACK_BSON_CHILD)); + continue; + } + + if (type == BCON_TYPE_BCON) { + bson_concat (STACK_BSON_CHILD, u.BCON); + continue; + } + + BSON_ASSERT (type == BCON_TYPE_UTF8); + + key = u.UTF8; + } + + type = _bcon_append_tokenize (ap, &u); + BSON_ASSERT (type != BCON_TYPE_END); + + switch ((int) type) { + case BCON_TYPE_BCON: + BSON_ASSERT (STACK_IS_ARRAY); + _bson_concat_array (STACK_BSON_CHILD, u.BCON, ctx); + + break; + case BCON_TYPE_DOC_START: + STACK_PUSH_DOC (bson_append_document_begin ( + STACK_BSON_PARENT, key, -1, STACK_BSON_CHILD)); + break; + case BCON_TYPE_DOC_END: + STACK_POP_DOC ( + bson_append_document_end (STACK_BSON_PARENT, STACK_BSON_CHILD)); + break; + case BCON_TYPE_ARRAY_START: + STACK_PUSH_ARRAY (bson_append_array_begin ( + STACK_BSON_PARENT, key, -1, STACK_BSON_CHILD)); + break; + case BCON_TYPE_ARRAY_END: + STACK_POP_ARRAY ( + bson_append_array_end (STACK_BSON_PARENT, STACK_BSON_CHILD)); + break; + default: + _bcon_append_single (STACK_BSON_CHILD, type, key, &u); + + break; + } + } +} + + +/* extract_ctx_va consumes the va_list until NULL is found, extracting values + * as tokens are found. It can receive or return an in-progress bson object + * via the ctx param. It can also operate on the middle of a va_list, and so + * can be wrapped inside of another varargs function. + * + * Note that passing in a va_list that isn't perferectly formatted for BCON + * ingestion will almost certainly result in undefined behavior + * + * The workflow relies on the passed ctx object, which holds a stack of iterator + * objects, along with metadata (if the emedded layer is an array, and which + * element it is on if so). We iterate, generating tokens from the va_list, + * until we reach an END token. If any errors occur, we just blow up (the + * var_args stuff is already incredibly fragile to mistakes, and we have no way + * of introspecting, so just don't screw it up). + * + * There are also a few STACK_* macros in here which manimpulate ctx that are + * defined up top. + * + * The function returns true if all tokens could be successfully matched, false + * otherwise. + * */ +bool +bcon_extract_ctx_va (bson_t *bson, bcon_extract_ctx_t *ctx, va_list *ap) +{ + bcon_type_t type; + const char *key; + bson_iter_t root_iter; + bson_iter_t current_iter; + char i_str[16]; + + bcon_extract_t u = {0}; + + BSON_ASSERT (bson_iter_init (&root_iter, bson)); + + while (1) { + if (STACK_IS_ARRAY) { + bson_uint32_to_string (STACK_I, &key, i_str, sizeof i_str); + STACK_I++; + } else { + type = _bcon_extract_tokenize (ap, &u); + + if (type == BCON_TYPE_END) { + return true; + } + + if (type == BCON_TYPE_DOC_END) { + STACK_POP_DOC (_noop ()); + continue; + } + + BSON_ASSERT (type == BCON_TYPE_RAW); + + key = u.key; + } + + type = _bcon_extract_tokenize (ap, &u); + BSON_ASSERT (type != BCON_TYPE_END); + + if (type == BCON_TYPE_DOC_END) { + STACK_POP_DOC (_noop ()); + } else if (type == BCON_TYPE_ARRAY_END) { + STACK_POP_ARRAY (_noop ()); + } else { + memcpy (¤t_iter, STACK_ITER_CHILD, sizeof current_iter); + + if (!bson_iter_find (¤t_iter, key)) { + return false; + } + + switch ((int) type) { + case BCON_TYPE_DOC_START: + + if (bson_iter_type (¤t_iter) != BSON_TYPE_DOCUMENT) { + return false; + } + + STACK_PUSH_DOC ( + bson_iter_recurse (¤t_iter, STACK_ITER_CHILD)); + break; + case BCON_TYPE_ARRAY_START: + + if (bson_iter_type (¤t_iter) != BSON_TYPE_ARRAY) { + return false; + } + + STACK_PUSH_ARRAY ( + bson_iter_recurse (¤t_iter, STACK_ITER_CHILD)); + break; + default: + + if (!_bcon_extract_single (¤t_iter, type, &u)) { + return false; + } + + break; + } + } + } +} + +void +bcon_extract_ctx_init (bcon_extract_ctx_t *ctx) +{ + ctx->n = 0; + ctx->stack[0].is_array = false; +} + +bool +bcon_extract (bson_t *bson, ...) +{ + va_list ap; + bcon_extract_ctx_t ctx; + bool r; + + bcon_extract_ctx_init (&ctx); + + va_start (ap, bson); + + r = bcon_extract_ctx_va (bson, &ctx, &ap); + + va_end (ap); + + return r; +} + + +void +bcon_append (bson_t *bson, ...) +{ + va_list ap; + bcon_append_ctx_t ctx; + + bcon_append_ctx_init (&ctx); + + va_start (ap, bson); + + bcon_append_ctx_va (bson, &ctx, &ap); + + va_end (ap); +} + + +void +bcon_append_ctx (bson_t *bson, bcon_append_ctx_t *ctx, ...) +{ + va_list ap; + + va_start (ap, ctx); + + bcon_append_ctx_va (bson, ctx, &ap); + + va_end (ap); +} + + +void +bcon_extract_ctx (bson_t *bson, bcon_extract_ctx_t *ctx, ...) +{ + va_list ap; + + va_start (ap, ctx); + + bcon_extract_ctx_va (bson, ctx, &ap); + + va_end (ap); +} + +void +bcon_append_ctx_init (bcon_append_ctx_t *ctx) +{ + ctx->n = 0; + ctx->stack[0].is_array = 0; +} + + +bson_t * +bcon_new (void *unused, ...) +{ + va_list ap; + bcon_append_ctx_t ctx; + bson_t *bson; + + bcon_append_ctx_init (&ctx); + + bson = bson_new (); + + va_start (ap, unused); + + bcon_append_ctx_va (bson, &ctx, &ap); + + va_end (ap); + + return bson; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.h new file mode 100644 index 0000000..29251b0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bcon.h @@ -0,0 +1,293 @@ +/* + * @file bcon.h + * @brief BCON (BSON C Object Notation) Declarations + */ + +/* Copyright 2009-2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef BCON_H_ +#define BCON_H_ + +#include "bson/bson.h" + + +BSON_BEGIN_DECLS + + +#define BCON_STACK_MAX 100 + +#define BCON_ENSURE_DECLARE(fun, type) \ + static BSON_INLINE type bcon_ensure_##fun (type _t) \ + { \ + return _t; \ + } + +#define BCON_ENSURE(fun, val) bcon_ensure_##fun (val) + +#define BCON_ENSURE_STORAGE(fun, val) bcon_ensure_##fun (&(val)) + +BCON_ENSURE_DECLARE (const_char_ptr, const char *) +BCON_ENSURE_DECLARE (const_char_ptr_ptr, const char **) +BCON_ENSURE_DECLARE (double, double) +BCON_ENSURE_DECLARE (double_ptr, double *) +BCON_ENSURE_DECLARE (const_bson_ptr, const bson_t *) +BCON_ENSURE_DECLARE (bson_ptr, bson_t *) +BCON_ENSURE_DECLARE (subtype, bson_subtype_t) +BCON_ENSURE_DECLARE (subtype_ptr, bson_subtype_t *) +BCON_ENSURE_DECLARE (const_uint8_ptr, const uint8_t *) +BCON_ENSURE_DECLARE (const_uint8_ptr_ptr, const uint8_t **) +BCON_ENSURE_DECLARE (uint32, uint32_t) +BCON_ENSURE_DECLARE (uint32_ptr, uint32_t *) +BCON_ENSURE_DECLARE (const_oid_ptr, const bson_oid_t *) +BCON_ENSURE_DECLARE (const_oid_ptr_ptr, const bson_oid_t **) +BCON_ENSURE_DECLARE (int32, int32_t) +BCON_ENSURE_DECLARE (int32_ptr, int32_t *) +BCON_ENSURE_DECLARE (int64, int64_t) +BCON_ENSURE_DECLARE (int64_ptr, int64_t *) +BCON_ENSURE_DECLARE (const_decimal128_ptr, const bson_decimal128_t *) +BCON_ENSURE_DECLARE (bool, bool) +BCON_ENSURE_DECLARE (bool_ptr, bool *) +BCON_ENSURE_DECLARE (bson_type, bson_type_t) +BCON_ENSURE_DECLARE (bson_iter_ptr, bson_iter_t *) +BCON_ENSURE_DECLARE (const_bson_iter_ptr, const bson_iter_t *) + +#define BCON_UTF8(_val) \ + BCON_MAGIC, BCON_TYPE_UTF8, BCON_ENSURE (const_char_ptr, (_val)) +#define BCON_DOUBLE(_val) \ + BCON_MAGIC, BCON_TYPE_DOUBLE, BCON_ENSURE (double, (_val)) +#define BCON_DOCUMENT(_val) \ + BCON_MAGIC, BCON_TYPE_DOCUMENT, BCON_ENSURE (const_bson_ptr, (_val)) +#define BCON_ARRAY(_val) \ + BCON_MAGIC, BCON_TYPE_ARRAY, BCON_ENSURE (const_bson_ptr, (_val)) +#define BCON_BIN(_subtype, _binary, _length) \ + BCON_MAGIC, BCON_TYPE_BIN, BCON_ENSURE (subtype, (_subtype)), \ + BCON_ENSURE (const_uint8_ptr, (_binary)), \ + BCON_ENSURE (uint32, (_length)) +#define BCON_UNDEFINED BCON_MAGIC, BCON_TYPE_UNDEFINED +#define BCON_OID(_val) \ + BCON_MAGIC, BCON_TYPE_OID, BCON_ENSURE (const_oid_ptr, (_val)) +#define BCON_BOOL(_val) BCON_MAGIC, BCON_TYPE_BOOL, BCON_ENSURE (bool, (_val)) +#define BCON_DATE_TIME(_val) \ + BCON_MAGIC, BCON_TYPE_DATE_TIME, BCON_ENSURE (int64, (_val)) +#define BCON_NULL BCON_MAGIC, BCON_TYPE_NULL +#define BCON_REGEX(_regex, _flags) \ + BCON_MAGIC, BCON_TYPE_REGEX, BCON_ENSURE (const_char_ptr, (_regex)), \ + BCON_ENSURE (const_char_ptr, (_flags)) +#define BCON_DBPOINTER(_collection, _oid) \ + BCON_MAGIC, BCON_TYPE_DBPOINTER, \ + BCON_ENSURE (const_char_ptr, (_collection)), \ + BCON_ENSURE (const_oid_ptr, (_oid)) +#define BCON_CODE(_val) \ + BCON_MAGIC, BCON_TYPE_CODE, BCON_ENSURE (const_char_ptr, (_val)) +#define BCON_SYMBOL(_val) \ + BCON_MAGIC, BCON_TYPE_SYMBOL, BCON_ENSURE (const_char_ptr, (_val)) +#define BCON_CODEWSCOPE(_js, _scope) \ + BCON_MAGIC, BCON_TYPE_CODEWSCOPE, BCON_ENSURE (const_char_ptr, (_js)), \ + BCON_ENSURE (const_bson_ptr, (_scope)) +#define BCON_INT32(_val) \ + BCON_MAGIC, BCON_TYPE_INT32, BCON_ENSURE (int32, (_val)) +#define BCON_TIMESTAMP(_timestamp, _increment) \ + BCON_MAGIC, BCON_TYPE_TIMESTAMP, BCON_ENSURE (int32, (_timestamp)), \ + BCON_ENSURE (int32, (_increment)) +#define BCON_INT64(_val) \ + BCON_MAGIC, BCON_TYPE_INT64, BCON_ENSURE (int64, (_val)) +#define BCON_DECIMAL128(_val) \ + BCON_MAGIC, BCON_TYPE_DECIMAL128, BCON_ENSURE (const_decimal128_ptr, (_val)) +#define BCON_MAXKEY BCON_MAGIC, BCON_TYPE_MAXKEY +#define BCON_MINKEY BCON_MAGIC, BCON_TYPE_MINKEY +#define BCON(_val) \ + BCON_MAGIC, BCON_TYPE_BCON, BCON_ENSURE (const_bson_ptr, (_val)) +#define BCON_ITER(_val) \ + BCON_MAGIC, BCON_TYPE_ITER, BCON_ENSURE (const_bson_iter_ptr, (_val)) + +#define BCONE_UTF8(_val) \ + BCONE_MAGIC, BCON_TYPE_UTF8, BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_val)) +#define BCONE_DOUBLE(_val) \ + BCONE_MAGIC, BCON_TYPE_DOUBLE, BCON_ENSURE_STORAGE (double_ptr, (_val)) +#define BCONE_DOCUMENT(_val) \ + BCONE_MAGIC, BCON_TYPE_DOCUMENT, BCON_ENSURE_STORAGE (bson_ptr, (_val)) +#define BCONE_ARRAY(_val) \ + BCONE_MAGIC, BCON_TYPE_ARRAY, BCON_ENSURE_STORAGE (bson_ptr, (_val)) +#define BCONE_BIN(subtype, binary, length) \ + BCONE_MAGIC, BCON_TYPE_BIN, BCON_ENSURE_STORAGE (subtype_ptr, (subtype)), \ + BCON_ENSURE_STORAGE (const_uint8_ptr_ptr, (binary)), \ + BCON_ENSURE_STORAGE (uint32_ptr, (length)) +#define BCONE_UNDEFINED BCONE_MAGIC, BCON_TYPE_UNDEFINED +#define BCONE_OID(_val) \ + BCONE_MAGIC, BCON_TYPE_OID, BCON_ENSURE_STORAGE (const_oid_ptr_ptr, (_val)) +#define BCONE_BOOL(_val) \ + BCONE_MAGIC, BCON_TYPE_BOOL, BCON_ENSURE_STORAGE (bool_ptr, (_val)) +#define BCONE_DATE_TIME(_val) \ + BCONE_MAGIC, BCON_TYPE_DATE_TIME, BCON_ENSURE_STORAGE (int64_ptr, (_val)) +#define BCONE_NULL BCONE_MAGIC, BCON_TYPE_NULL +#define BCONE_REGEX(_regex, _flags) \ + BCONE_MAGIC, BCON_TYPE_REGEX, \ + BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_regex)), \ + BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_flags)) +#define BCONE_DBPOINTER(_collection, _oid) \ + BCONE_MAGIC, BCON_TYPE_DBPOINTER, \ + BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_collection)), \ + BCON_ENSURE_STORAGE (const_oid_ptr_ptr, (_oid)) +#define BCONE_CODE(_val) \ + BCONE_MAGIC, BCON_TYPE_CODE, BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_val)) +#define BCONE_SYMBOL(_val) \ + BCONE_MAGIC, BCON_TYPE_SYMBOL, \ + BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_val)) +#define BCONE_CODEWSCOPE(_js, _scope) \ + BCONE_MAGIC, BCON_TYPE_CODEWSCOPE, \ + BCON_ENSURE_STORAGE (const_char_ptr_ptr, (_js)), \ + BCON_ENSURE_STORAGE (bson_ptr, (_scope)) +#define BCONE_INT32(_val) \ + BCONE_MAGIC, BCON_TYPE_INT32, BCON_ENSURE_STORAGE (int32_ptr, (_val)) +#define BCONE_TIMESTAMP(_timestamp, _increment) \ + BCONE_MAGIC, BCON_TYPE_TIMESTAMP, \ + BCON_ENSURE_STORAGE (int32_ptr, (_timestamp)), \ + BCON_ENSURE_STORAGE (int32_ptr, (_increment)) +#define BCONE_INT64(_val) \ + BCONE_MAGIC, BCON_TYPE_INT64, BCON_ENSURE_STORAGE (int64_ptr, (_val)) +#define BCONE_DECIMAL128(_val) \ + BCONE_MAGIC, BCON_TYPE_DECIMAL128, \ + BCON_ENSURE_STORAGE (const_decimal128_ptr, (_val)) +#define BCONE_MAXKEY BCONE_MAGIC, BCON_TYPE_MAXKEY +#define BCONE_MINKEY BCONE_MAGIC, BCON_TYPE_MINKEY +#define BCONE_SKIP(_val) \ + BCONE_MAGIC, BCON_TYPE_SKIP, BCON_ENSURE (bson_type, (_val)) +#define BCONE_ITER(_val) \ + BCONE_MAGIC, BCON_TYPE_ITER, BCON_ENSURE_STORAGE (bson_iter_ptr, (_val)) + +#define BCON_MAGIC bson_bcon_magic () +#define BCONE_MAGIC bson_bcone_magic () + +typedef enum { + BCON_TYPE_UTF8, + BCON_TYPE_DOUBLE, + BCON_TYPE_DOCUMENT, + BCON_TYPE_ARRAY, + BCON_TYPE_BIN, + BCON_TYPE_UNDEFINED, + BCON_TYPE_OID, + BCON_TYPE_BOOL, + BCON_TYPE_DATE_TIME, + BCON_TYPE_NULL, + BCON_TYPE_REGEX, + BCON_TYPE_DBPOINTER, + BCON_TYPE_CODE, + BCON_TYPE_SYMBOL, + BCON_TYPE_CODEWSCOPE, + BCON_TYPE_INT32, + BCON_TYPE_TIMESTAMP, + BCON_TYPE_INT64, + BCON_TYPE_DECIMAL128, + BCON_TYPE_MAXKEY, + BCON_TYPE_MINKEY, + BCON_TYPE_BCON, + BCON_TYPE_ARRAY_START, + BCON_TYPE_ARRAY_END, + BCON_TYPE_DOC_START, + BCON_TYPE_DOC_END, + BCON_TYPE_END, + BCON_TYPE_RAW, + BCON_TYPE_SKIP, + BCON_TYPE_ITER, + BCON_TYPE_ERROR, +} bcon_type_t; + +typedef struct bcon_append_ctx_frame { + int i; + bool is_array; + bson_t bson; +} bcon_append_ctx_frame_t; + +typedef struct bcon_extract_ctx_frame { + int i; + bool is_array; + bson_iter_t iter; +} bcon_extract_ctx_frame_t; + +typedef struct _bcon_append_ctx_t { + bcon_append_ctx_frame_t stack[BCON_STACK_MAX]; + int n; +} bcon_append_ctx_t; + +typedef struct _bcon_extract_ctx_t { + bcon_extract_ctx_frame_t stack[BCON_STACK_MAX]; + int n; +} bcon_extract_ctx_t; + +BSON_EXPORT (void) +bcon_append (bson_t *bson, ...) BSON_GNUC_NULL_TERMINATED; +BSON_EXPORT (void) +bcon_append_ctx (bson_t *bson, + bcon_append_ctx_t *ctx, + ...) BSON_GNUC_NULL_TERMINATED; +BSON_EXPORT (void) +bcon_append_ctx_va (bson_t *bson, bcon_append_ctx_t *ctx, va_list *va); +BSON_EXPORT (void) +bcon_append_ctx_init (bcon_append_ctx_t *ctx); + +BSON_EXPORT (void) +bcon_extract_ctx_init (bcon_extract_ctx_t *ctx); + +BSON_EXPORT (void) +bcon_extract_ctx (bson_t *bson, + bcon_extract_ctx_t *ctx, + ...) BSON_GNUC_NULL_TERMINATED; + +BSON_EXPORT (bool) +bcon_extract_ctx_va (bson_t *bson, bcon_extract_ctx_t *ctx, va_list *ap); + +BSON_EXPORT (bool) +bcon_extract (bson_t *bson, ...) BSON_GNUC_NULL_TERMINATED; + +BSON_EXPORT (bool) +bcon_extract_va (bson_t *bson, + bcon_extract_ctx_t *ctx, + ...) BSON_GNUC_NULL_TERMINATED; + +BSON_EXPORT (bson_t *) +bcon_new (void *unused, ...) BSON_GNUC_NULL_TERMINATED; + +/** + * The bcon_..() functions are all declared with __attribute__((sentinel)). + * + * From GCC manual for "sentinel": "A valid NULL in this context is defined as + * zero with any pointer type. If your system defines the NULL macro with an + * integer type then you need to add an explicit cast." + * Case in point: GCC on Solaris (at least) + */ +#define BCON_APPEND(_bson, ...) \ + bcon_append ((_bson), __VA_ARGS__, (void *) NULL) +#define BCON_APPEND_CTX(_bson, _ctx, ...) \ + bcon_append_ctx ((_bson), (_ctx), __VA_ARGS__, (void *) NULL) + +#define BCON_EXTRACT(_bson, ...) \ + bcon_extract ((_bson), __VA_ARGS__, (void *) NULL) + +#define BCON_EXTRACT_CTX(_bson, _ctx, ...) \ + bcon_extract ((_bson), (_ctx), __VA_ARGS__, (void *) NULL) + +#define BCON_NEW(...) bcon_new (NULL, __VA_ARGS__, (void *) NULL) + +BSON_EXPORT (const char *) +bson_bcon_magic (void) BSON_GNUC_PURE; +BSON_EXPORT (const char *) +bson_bcone_magic (void) BSON_GNUC_PURE; + + +BSON_END_DECLS + + +#endif diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.c new file mode 100644 index 0000000..3faf896 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.c @@ -0,0 +1,73 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-atomic.h" + + +/* + * We should only ever hit these on non-Windows systems, for which we require + * pthread support. Therefore, we will avoid making a threading portability + * for threads here and just use pthreads directly. + */ + + +#ifdef __BSON_NEED_BARRIER +#include +static pthread_mutex_t gBarrier = PTHREAD_MUTEX_INITIALIZER; +void +bson_memory_barrier (void) +{ + pthread_mutex_lock (&gBarrier); + pthread_mutex_unlock (&gBarrier); +} +#endif + + +#ifdef __BSON_NEED_ATOMIC_32 +#include +static pthread_mutex_t gSync32 = PTHREAD_MUTEX_INITIALIZER; +int32_t +bson_atomic_int_add (volatile int32_t *p, int32_t n) +{ + int ret; + + pthread_mutex_lock (&gSync32); + *p += n; + ret = *p; + pthread_mutex_unlock (&gSync32); + + return ret; +} +#endif + + +#ifdef __BSON_NEED_ATOMIC_64 +#include +static pthread_mutex_t gSync64 = PTHREAD_MUTEX_INITIALIZER; +int64_t +bson_atomic_int64_add (volatile int64_t *p, int64_t n) +{ + int64_t ret; + + pthread_mutex_lock (&gSync64); + *p += n; + ret = *p; + pthread_mutex_unlock (&gSync64); + + return ret; +} +#endif diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.h new file mode 100644 index 0000000..18e29c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-atomic.h @@ -0,0 +1,103 @@ +/* + * Copyright 2013-2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_ATOMIC_H +#define BSON_ATOMIC_H + + +#include "bson/bson-config.h" +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" + + +BSON_BEGIN_DECLS + + +#if defined(__sun) && defined(__SVR4) +/* Solaris */ +#include +#define bson_atomic_int_add(p, v) \ + atomic_add_32_nv ((volatile uint32_t *) p, (v)) +#define bson_atomic_int64_add(p, v) \ + atomic_add_64_nv ((volatile uint64_t *) p, (v)) +#elif defined(_WIN32) +/* MSVC/MinGW */ +#define bson_atomic_int_add(p, v) \ + (InterlockedExchangeAdd ((volatile LONG *) (p), (LONG) (v)) + (LONG) (v)) +#define bson_atomic_int64_add(p, v) \ + (InterlockedExchangeAdd64 ((volatile LONGLONG *) (p), (LONGLONG) (v)) + \ + (LONGLONG) (v)) +#else +#ifdef BSON_HAVE_ATOMIC_32_ADD_AND_FETCH +#define bson_atomic_int_add(p, v) __sync_add_and_fetch ((p), (v)) +#else +#define __BSON_NEED_ATOMIC_32 +#endif +#ifdef BSON_HAVE_ATOMIC_64_ADD_AND_FETCH +#if BSON_GNUC_IS_VERSION(4, 1) +/* + * GCC 4.1 on i386 can generate buggy 64-bit atomic increment. + * So we will work around with a fallback. + * + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40693 + */ +#define __BSON_NEED_ATOMIC_64 +#else +#define bson_atomic_int64_add(p, v) \ + __sync_add_and_fetch ((volatile int64_t *) (p), (int64_t) (v)) +#endif +#else +#define __BSON_NEED_ATOMIC_64 +#endif +#endif + +#ifdef __BSON_NEED_ATOMIC_32 +BSON_EXPORT (int32_t) +bson_atomic_int_add (volatile int32_t *p, int32_t n); +#endif +#ifdef __BSON_NEED_ATOMIC_64 +BSON_EXPORT (int64_t) +bson_atomic_int64_add (volatile int64_t *p, int64_t n); +#endif + + +#if defined(_WIN32) +#define bson_memory_barrier() MemoryBarrier () +#elif defined(__GNUC__) +#if BSON_GNUC_CHECK_VERSION(4, 1) +#define bson_memory_barrier() __sync_synchronize () +#else +#warning "GCC Pre-4.1 discovered, using inline assembly for memory barrier." +#define bson_memory_barrier() __asm__ volatile("" ::: "memory") +#endif +#elif defined(__SUNPRO_C) +#include +#define bson_memory_barrier() __machine_rw_barrier () +#elif defined(__xlC__) +#define bson_memory_barrier() __sync () +#else +#define __BSON_NEED_BARRIER 1 +#warning "Unknown compiler, using lock for compiler barrier." +BSON_EXPORT (void) +bson_memory_barrier (void); +#endif + + +BSON_END_DECLS + + +#endif /* BSON_ATOMIC_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.c new file mode 100644 index 0000000..b3819d4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.c @@ -0,0 +1,155 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifdef __APPLE__ +#include +#include +#include +#include +#endif + + +#include "bson/bson-config.h" +#include "bson/bson-compat.h" + + +#if defined(BSON_HAVE_CLOCK_GETTIME) +#include +#include +#endif + +#include "bson/bson-clock.h" + + +/* + *-------------------------------------------------------------------------- + * + * bson_gettimeofday -- + * + * A wrapper around gettimeofday() with fallback support for Windows. + * + * Returns: + * 0 if successful. + * + * Side effects: + * @tv is set. + * + *-------------------------------------------------------------------------- + */ + +int +bson_gettimeofday (struct timeval *tv) /* OUT */ +{ +#if defined(_WIN32) +#if defined(_MSC_VER) +#define DELTA_EPOCH_IN_MICROSEC 11644473600000000Ui64 +#else +#define DELTA_EPOCH_IN_MICROSEC 11644473600000000ULL +#endif + FILETIME ft; + uint64_t tmp = 0; + + /* + * The const value is shamelessly stolen from + * http://www.boost.org/doc/libs/1_55_0/boost/chrono/detail/inlined/win/chrono.hpp + * + * File times are the number of 100 nanosecond intervals elapsed since + * 12:00 am Jan 1, 1601 UTC. I haven't check the math particularly hard + * + * ... good luck + */ + + if (tv) { + GetSystemTimeAsFileTime (&ft); + + /* pull out of the filetime into a 64 bit uint */ + tmp |= ft.dwHighDateTime; + tmp <<= 32; + tmp |= ft.dwLowDateTime; + + /* convert from 100's of nanosecs to microsecs */ + tmp /= 10; + + /* adjust to unix epoch */ + tmp -= DELTA_EPOCH_IN_MICROSEC; + + tv->tv_sec = (long) (tmp / 1000000UL); + tv->tv_usec = (long) (tmp % 1000000UL); + } + + return 0; +#else + return gettimeofday (tv, NULL); +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_get_monotonic_time -- + * + * Returns the monotonic system time, if available. A best effort is + * made to use the monotonic clock. However, some systems may not + * support such a feature. + * + * Returns: + * The monotonic clock in microseconds. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int64_t +bson_get_monotonic_time (void) +{ +#if defined(BSON_HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) + struct timespec ts; + /* ts.tv_sec may be a four-byte integer on 32 bit machines, so cast to + * int64_t to avoid truncation. */ + clock_gettime (CLOCK_MONOTONIC, &ts); + return (((int64_t) ts.tv_sec * 1000000) + (ts.tv_nsec / 1000)); +#elif defined(__APPLE__) + static mach_timebase_info_data_t info = {0}; + static double ratio = 0.0; + + if (!info.denom) { + /* the value from mach_absolute_time () * info.numer / info.denom + * is in nano seconds. So we have to divid by 1000.0 to get micro + * seconds*/ + mach_timebase_info (&info); + ratio = (double) info.numer / (double) info.denom / 1000.0; + } + + return mach_absolute_time () * ratio; +#elif defined(_WIN32) + /* Despite it's name, this is in milliseconds! */ + int64_t ticks = GetTickCount64 (); + return (ticks * 1000); +#elif defined(__hpux__) + int64_t nanosec = gethrtime (); + return (nanosec / 1000UL); +#else +#warning "Monotonic clock is not yet supported on your platform." + struct timeval tv; + + bson_gettimeofday (&tv); + return ((int64_t) tv.tv_sec * 1000000) + tv.tv_usec; +#endif +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.h new file mode 100644 index 0000000..195668d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-clock.h @@ -0,0 +1,44 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_CLOCK_H +#define BSON_CLOCK_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (int64_t) +bson_get_monotonic_time (void); +BSON_EXPORT (int) +bson_gettimeofday (struct timeval *tv); + + +BSON_END_DECLS + + +#endif /* BSON_CLOCK_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-compat.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-compat.h new file mode 100644 index 0000000..68f384d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-compat.h @@ -0,0 +1,180 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_COMPAT_H +#define BSON_COMPAT_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#if defined(__MINGW32__) +#if defined(__USE_MINGW_ANSI_STDIO) +#if __USE_MINGW_ANSI_STDIO < 1 +#error "__USE_MINGW_ANSI_STDIO > 0 is required for correct PRI* macros" +#endif +#else +#define __USE_MINGW_ANSI_STDIO 1 +#endif +#endif + +#include "bson/bson-config.h" +#include "bson/bson-macros.h" + + +#ifdef BSON_OS_WIN32 +#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600) +#undef _WIN32_WINNT +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#else +#include +#endif +#include +#include +#endif + + +#ifdef BSON_OS_UNIX +#include +#include +#endif + + +#include "bson/bson-macros.h" + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +BSON_BEGIN_DECLS + +#if !defined(_MSC_VER) || (_MSC_VER >= 1800) +#include +#endif +#ifdef _MSC_VER +#ifndef __cplusplus +/* benign redefinition of type */ +#pragma warning(disable : 4142) +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +typedef SSIZE_T ssize_t; +#endif +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +typedef SIZE_T size_t; +#endif +#pragma warning(default : 4142) +#else +/* + * MSVC++ does not include ssize_t, just size_t. + * So we need to synthesize that as well. + */ +#pragma warning(disable : 4142) +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +typedef SSIZE_T ssize_t; +#endif +#pragma warning(default : 4142) +#endif +#ifndef PRIi32 +#define PRIi32 "d" +#endif +#ifndef PRId32 +#define PRId32 "d" +#endif +#ifndef PRIu32 +#define PRIu32 "u" +#endif +#ifndef PRIi64 +#define PRIi64 "I64i" +#endif +#ifndef PRId64 +#define PRId64 "I64i" +#endif +#ifndef PRIu64 +#define PRIu64 "I64u" +#endif +#endif + +#if defined(__MINGW32__) && !defined(INIT_ONCE_STATIC_INIT) +#define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT +typedef RTL_RUN_ONCE INIT_ONCE; +#endif + +#ifdef BSON_HAVE_STDBOOL_H +#include +#elif !defined(__bool_true_false_are_defined) +#ifndef __cplusplus +typedef signed char bool; +#define false 0 +#define true 1 +#endif +#define __bool_true_false_are_defined 1 +#endif + + +#if defined(__GNUC__) +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) +#define bson_sync_synchronize() __sync_synchronize () +#elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \ + defined(__i686__) || defined(__x86_64__) +#define bson_sync_synchronize() asm volatile("mfence" ::: "memory") +#else +#define bson_sync_synchronize() asm volatile("sync" ::: "memory") +#endif +#elif defined(_MSC_VER) +#define bson_sync_synchronize() MemoryBarrier () +#endif + + +#if !defined(va_copy) && defined(__va_copy) +#define va_copy(dst, src) __va_copy (dst, src) +#endif + + +#if !defined(va_copy) +#define va_copy(dst, src) ((dst) = (src)) +#endif + + +BSON_END_DECLS + + +#endif /* BSON_COMPAT_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-config.h.in b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-config.h.in new file mode 100644 index 0000000..f09c32b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-config.h.in @@ -0,0 +1,131 @@ +#ifndef BSON_CONFIG_H +#define BSON_CONFIG_H + +/* + * Define to 1234 for Little Endian, 4321 for Big Endian. + */ +#define BSON_BYTE_ORDER @BSON_BYTE_ORDER@ + + +/* + * Define to 1 if you have stdbool.h + */ +#define BSON_HAVE_STDBOOL_H @BSON_HAVE_STDBOOL_H@ +#if BSON_HAVE_STDBOOL_H != 1 +# undef BSON_HAVE_STDBOOL_H +#endif + + +/* + * Define to 1 for POSIX-like systems, 2 for Windows. + */ +#define BSON_OS @BSON_OS@ + + +/* + * Define to 1 if we have access to GCC 32-bit atomic builtins. + * While this requires GCC 4.1+ in most cases, it is also architecture + * dependent. For example, some PPC or ARM systems may not have it even + * if it is a recent GCC version. + */ +#define BSON_HAVE_ATOMIC_32_ADD_AND_FETCH @BSON_HAVE_ATOMIC_32_ADD_AND_FETCH@ +#if BSON_HAVE_ATOMIC_32_ADD_AND_FETCH != 1 +# undef BSON_HAVE_ATOMIC_32_ADD_AND_FETCH +#endif + +/* + * Similarly, define to 1 if we have access to GCC 64-bit atomic builtins. + */ +#define BSON_HAVE_ATOMIC_64_ADD_AND_FETCH @BSON_HAVE_ATOMIC_64_ADD_AND_FETCH@ +#if BSON_HAVE_ATOMIC_64_ADD_AND_FETCH != 1 +# undef BSON_HAVE_ATOMIC_64_ADD_AND_FETCH +#endif + + +/* + * Define to 1 if you have clock_gettime() available. + */ +#define BSON_HAVE_CLOCK_GETTIME @BSON_HAVE_CLOCK_GETTIME@ +#if BSON_HAVE_CLOCK_GETTIME != 1 +# undef BSON_HAVE_CLOCK_GETTIME +#endif + + +/* + * Define to 1 if you have strings.h available on your platform. + */ +#define BSON_HAVE_STRINGS_H @BSON_HAVE_STRINGS_H@ +#if BSON_HAVE_STRINGS_H != 1 +# undef BSON_HAVE_STRINGS_H +#endif + + +/* + * Define to 1 if you have strnlen available on your platform. + */ +#define BSON_HAVE_STRNLEN @BSON_HAVE_STRNLEN@ +#if BSON_HAVE_STRNLEN != 1 +# undef BSON_HAVE_STRNLEN +#endif + + +/* + * Define to 1 if you have snprintf available on your platform. + */ +#define BSON_HAVE_SNPRINTF @BSON_HAVE_SNPRINTF@ +#if BSON_HAVE_SNPRINTF != 1 +# undef BSON_HAVE_SNPRINTF +#endif + + +/* + * Define to 1 if you have gmtime_r available on your platform. + */ +#define BSON_HAVE_GMTIME_R @BSON_HAVE_GMTIME_R@ +#if BSON_HAVE_GMTIME_R != 1 +# undef BSON_HAVE_GMTIME_R +#endif + + +/* + * Define to 1 if you have reallocf available on your platform. + */ +#define BSON_HAVE_REALLOCF @BSON_HAVE_REALLOCF@ +#if BSON_HAVE_REALLOCF != 1 +# undef BSON_HAVE_REALLOCF +#endif + + +/* + * Define to 1 if you have struct timespec available on your platform. + */ +#define BSON_HAVE_TIMESPEC @BSON_HAVE_TIMESPEC@ +#if BSON_HAVE_TIMESPEC != 1 +# undef BSON_HAVE_TIMESPEC +#endif + + +/* + * Define to 1 if you want extra aligned types in libbson + */ +#define BSON_EXTRA_ALIGN @BSON_EXTRA_ALIGN@ +#if BSON_EXTRA_ALIGN != 1 +# undef BSON_EXTRA_ALIGN +#endif + + +/* + * Define to 1 if you have SYS_gettid syscall + */ +#define BSON_HAVE_SYSCALL_TID @BSON_HAVE_SYSCALL_TID@ +#if BSON_HAVE_SYSCALL_TID != 1 +# undef BSON_HAVE_SYSCALL_TID +#endif + +#define BSON_HAVE_RAND_R @BSON_HAVE_RAND_R@ +#if BSON_HAVE_RAND_R != 1 +# undef BSON_HAVE_RAND_R +#endif + + +#endif /* BSON_CONFIG_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context-private.h new file mode 100644 index 0000000..0edce82 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context-private.h @@ -0,0 +1,48 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_CONTEXT_PRIVATE_H +#define BSON_CONTEXT_PRIVATE_H + + +#include "bson/bson-context.h" +#include "common-thread-private.h" + + +BSON_BEGIN_DECLS + + +struct _bson_context_t { + /* flags are defined in bson_context_flags_t */ + int flags : 7; + bool pidbe_once : 1; + uint8_t pidbe[2]; + uint8_t fnv[3]; + int32_t seq32; + int64_t seq64; + + void (*oid_get_host) (bson_context_t *context, bson_oid_t *oid); + void (*oid_get_pid) (bson_context_t *context, bson_oid_t *oid); + void (*oid_get_seq32) (bson_context_t *context, bson_oid_t *oid); + void (*oid_get_seq64) (bson_context_t *context, bson_oid_t *oid); +}; + + +BSON_END_DECLS + + +#endif /* BSON_CONTEXT_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.c new file mode 100644 index 0000000..faae662 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.c @@ -0,0 +1,502 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "bson/bson-compat.h" + +#include +#include +#include +#include +#include + +#include "bson/bson-atomic.h" +#include "bson/bson-clock.h" +#include "bson/bson-context.h" +#include "bson/bson-context-private.h" +#include "bson/bson-fnv-private.h" +#include "bson/bson-memory.h" +#include "common-thread-private.h" + +#ifdef BSON_HAVE_SYSCALL_TID +#include +#endif + + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 256 +#endif + + +/* + * Globals. + */ +static bson_context_t gContextDefault; + + +#ifdef BSON_HAVE_SYSCALL_TID +static long +bson_gettid (void) +{ + return syscall (SYS_gettid); +} +#endif + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_host -- + * + * Retrieves a 3 byte hash of the hostname and assigns those bytes + * to the host portion of oid. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_host (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + uint8_t *bytes = (uint8_t *) oid; + uint32_t fnv1a_hash; + char hostname[HOST_NAME_MAX]; + + BSON_ASSERT (context); + BSON_ASSERT (oid); + + gethostname (hostname, sizeof hostname); + hostname[HOST_NAME_MAX - 1] = '\0'; + + fnv1a_hash = _mongoc_fnv_24a_str (hostname); + + bytes[4] = (uint8_t) ((fnv1a_hash >> (0 * 8)) & 0xff); + bytes[5] = (uint8_t) ((fnv1a_hash >> (1 * 8)) & 0xff); + bytes[6] = (uint8_t) ((fnv1a_hash >> (2 * 8)) & 0xff); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_host_cached -- + * + * Fetch the cached copy of the 3 byte hash of the hostname + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_host_cached (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + BSON_ASSERT (context); + BSON_ASSERT (oid); + + oid->bytes[4] = context->fnv[0]; + oid->bytes[5] = context->fnv[1]; + oid->bytes[6] = context->fnv[2]; +} + + +static BSON_INLINE uint16_t +_bson_getpid (void) +{ + uint16_t pid; +#ifdef BSON_OS_WIN32 + DWORD real_pid; + + real_pid = GetCurrentProcessId (); + pid = (real_pid & 0xFFFF) ^ ((real_pid >> 16) & 0xFFFF); +#else + pid = getpid (); +#endif + + return pid; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_pid -- + * + * Initialize the pid field of @oid. + * + * The pid field is 2 bytes, big-endian for memcmp(). + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_pid (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + uint16_t pid = _bson_getpid (); + uint8_t *bytes = (uint8_t *) &pid; + + BSON_ASSERT (context); + BSON_ASSERT (oid); + + pid = BSON_UINT16_TO_BE (pid); + + oid->bytes[7] = bytes[0]; + oid->bytes[8] = bytes[1]; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_pid_cached -- + * + * Fetch the cached copy of the current pid. + * This helps avoid multiple calls to getpid() which is slower + * on some systems. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_pid_cached (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + oid->bytes[7] = context->pidbe[0]; + oid->bytes[8] = context->pidbe[1]; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_seq32 -- + * + * 32-bit sequence generator, non-thread-safe version. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_seq32 (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + uint32_t seq = context->seq32++; + + seq = BSON_UINT32_TO_BE (seq); + memcpy (&oid->bytes[9], ((uint8_t *) &seq) + 1, 3); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_seq32_threadsafe -- + * + * Thread-safe version of 32-bit sequence generator. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_seq32_threadsafe (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + int32_t seq = bson_atomic_int_add (&context->seq32, 1); + + seq = BSON_UINT32_TO_BE (seq); + memcpy (&oid->bytes[9], ((uint8_t *) &seq) + 1, 3); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_seq64 -- + * + * 64-bit oid sequence generator, non-thread-safe version. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_seq64 (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + uint64_t seq; + + BSON_ASSERT (context); + BSON_ASSERT (oid); + + seq = BSON_UINT64_TO_BE (context->seq64++); + memcpy (&oid->bytes[4], &seq, sizeof (seq)); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_context_get_oid_seq64_threadsafe -- + * + * Thread-safe 64-bit sequence generator. + * + * Returns: + * None. + * + * Side effects: + * @oid is modified. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_context_get_oid_seq64_threadsafe (bson_context_t *context, /* IN */ + bson_oid_t *oid) /* OUT */ +{ + int64_t seq = bson_atomic_int64_add (&context->seq64, 1); + + seq = BSON_UINT64_TO_BE (seq); + memcpy (&oid->bytes[4], &seq, sizeof (seq)); +} + + +static void +_bson_context_init (bson_context_t *context, /* IN */ + bson_context_flags_t flags) /* IN */ +{ + struct timeval tv; + uint16_t pid; + unsigned int seed[3]; + unsigned int real_seed; + bson_oid_t oid; + + context->flags = (int) flags; + context->oid_get_host = _bson_context_get_oid_host_cached; + context->oid_get_pid = _bson_context_get_oid_pid_cached; + context->oid_get_seq32 = _bson_context_get_oid_seq32; + context->oid_get_seq64 = _bson_context_get_oid_seq64; + + /* + * Generate a seed for our the random starting position of our increment + * bytes. We mask off the last nibble so that the last digit of the OID will + * start at zero. Just to be nice. + * + * The seed itself is made up of the current time in seconds, milliseconds, + * and pid xored together. I welcome better solutions if at all necessary. + */ + bson_gettimeofday (&tv); + seed[0] = (unsigned int) tv.tv_sec; + seed[1] = (unsigned int) tv.tv_usec; + seed[2] = _bson_getpid (); + real_seed = seed[0] ^ seed[1] ^ seed[2]; + +#ifndef BSON_HAVE_RAND_R + /* ms's runtime is multithreaded by default, so no rand_r */ + /* no rand_r on android either */ + srand (real_seed); + context->seq32 = rand () & 0x007FFFF0; +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ + defined(__OpenBSD__) + arc4random_buf (&context->seq32, sizeof (context->seq32)); + context->seq32 &= 0x007FFFF0; +#else + context->seq32 = rand_r (&real_seed) & 0x007FFFF0; +#endif + + if ((flags & BSON_CONTEXT_DISABLE_HOST_CACHE)) { + context->oid_get_host = _bson_context_get_oid_host; + } else { + _bson_context_get_oid_host (context, &oid); + context->fnv[0] = oid.bytes[4]; + context->fnv[1] = oid.bytes[5]; + context->fnv[2] = oid.bytes[6]; + } + + if ((flags & BSON_CONTEXT_THREAD_SAFE)) { + context->oid_get_seq32 = _bson_context_get_oid_seq32_threadsafe; + context->oid_get_seq64 = _bson_context_get_oid_seq64_threadsafe; + } + + if ((flags & BSON_CONTEXT_DISABLE_PID_CACHE)) { + context->oid_get_pid = _bson_context_get_oid_pid; + } else { +#ifdef BSON_HAVE_SYSCALL_TID + if ((flags & BSON_CONTEXT_USE_TASK_ID)) { + uint16_t tid; + + /* This call is always successful */ + tid = (uint16_t) bson_gettid (); + pid = BSON_UINT16_TO_BE (tid); + } else +#endif + { + pid = BSON_UINT16_TO_BE (_bson_getpid ()); + } + + memcpy (&context->pidbe[0], &pid, 2); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_context_new -- + * + * Initializes a new context with the flags specified. + * + * In most cases, you want to call this with @flags set to + * BSON_CONTEXT_NONE. + * + * If you are running on Linux, %BSON_CONTEXT_USE_TASK_ID can result + * in a healthy speedup for multi-threaded scenarios. + * + * If you absolutely must have a single context for your application + * and use more than one thread, then %BSON_CONTEXT_THREAD_SAFE should + * be bitwise-or'd with your flags. This requires synchronization + * between threads. + * + * If you expect your hostname to change often, you may consider + * specifying %BSON_CONTEXT_DISABLE_HOST_CACHE so that gethostname() + * is called for every OID generated. This is much slower. + * + * If you expect your pid to change without notice, such as from an + * unexpected call to fork(), then specify + * %BSON_CONTEXT_DISABLE_PID_CACHE. + * + * Returns: + * A newly allocated bson_context_t that should be freed with + * bson_context_destroy(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_context_t * +bson_context_new (bson_context_flags_t flags) +{ + bson_context_t *context; + + context = bson_malloc0 (sizeof *context); + _bson_context_init (context, flags); + + return context; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_context_destroy -- + * + * Cleans up a bson_context_t and releases any associated resources. + * This should be called when you are done using @context. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_context_destroy (bson_context_t *context) /* IN */ +{ + bson_free (context); +} + + +static BSON_ONCE_FUN (_bson_context_init_default) +{ + _bson_context_init ( + &gContextDefault, + (BSON_CONTEXT_THREAD_SAFE | BSON_CONTEXT_DISABLE_PID_CACHE)); + BSON_ONCE_RETURN; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_context_get_default -- + * + * Fetches the default, thread-safe implementation of #bson_context_t. + * If you need faster generation, it is recommended you create your + * own #bson_context_t with bson_context_new(). + * + * Returns: + * A shared instance to the default #bson_context_t. This should not + * be modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_context_t * +bson_context_get_default (void) +{ + static bson_once_t once = BSON_ONCE_INIT; + + bson_once (&once, _bson_context_init_default); + + return &gContextDefault; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.h new file mode 100644 index 0000000..0520d2d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-context.h @@ -0,0 +1,45 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_CONTEXT_H +#define BSON_CONTEXT_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (bson_context_t *) +bson_context_new (bson_context_flags_t flags); +BSON_EXPORT (void) +bson_context_destroy (bson_context_t *context); +BSON_EXPORT (bson_context_t *) +bson_context_get_default (void); + + +BSON_END_DECLS + + +#endif /* BSON_CONTEXT_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.c new file mode 100644 index 0000000..27829a5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.c @@ -0,0 +1,773 @@ + +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "bson/bson-decimal128.h" +#include "bson/bson-types.h" +#include "bson/bson-macros.h" +#include "bson/bson-string.h" + + +#define BSON_DECIMAL128_EXPONENT_MAX 6111 +#define BSON_DECIMAL128_EXPONENT_MIN -6176 +#define BSON_DECIMAL128_EXPONENT_BIAS 6176 +#define BSON_DECIMAL128_MAX_DIGITS 34 + +#define BSON_DECIMAL128_SET_NAN(dec) \ + do { \ + (dec).high = 0x7c00000000000000ull; \ + (dec).low = 0; \ + } while (0); +#define BSON_DECIMAL128_SET_INF(dec, isneg) \ + do { \ + (dec).high = 0x7800000000000000ull + 0x8000000000000000ull * (isneg); \ + (dec).low = 0; \ + } while (0); + +/** + * _bson_uint128_t: + * + * This struct represents a 128 bit integer. + */ +typedef struct { + uint32_t parts[4]; /* 32-bit words stored high to low. */ +} _bson_uint128_t; + + +/** + *------------------------------------------------------------------------------ + * + * _bson_uint128_divide1B -- + * + * This function divides a #_bson_uint128_t by 1000000000 (1 billion) and + * computes the quotient and remainder. + * + * The remainder will contain 9 decimal digits for conversion to string. + * + * @value The #_bson_uint128_t operand. + * @quotient A pointer to store the #_bson_uint128_t quotient. + * @rem A pointer to store the #uint64_t remainder. + * + * Returns: + * The quotient at @quotient and the remainder at @rem. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------------ + */ +static void +_bson_uint128_divide1B (_bson_uint128_t value, /* IN */ + _bson_uint128_t *quotient, /* OUT */ + uint32_t *rem) /* OUT */ +{ + const uint32_t DIVISOR = 1000 * 1000 * 1000; + uint64_t _rem = 0; + int i = 0; + + if (!value.parts[0] && !value.parts[1] && !value.parts[2] && + !value.parts[3]) { + *quotient = value; + *rem = 0; + return; + } + + + for (i = 0; i <= 3; i++) { + _rem <<= 32; /* Adjust remainder to match value of next dividend */ + _rem += value.parts[i]; /* Add the divided to _rem */ + value.parts[i] = (uint32_t) (_rem / DIVISOR); + _rem %= DIVISOR; /* Store the remainder */ + } + + *quotient = value; + *rem = (uint32_t) _rem; +} + + +/** + *------------------------------------------------------------------------------ + * + * bson_decimal128_to_string -- + * + * This function converts a BID formatted decimal128 value to string, + * accepting a &bson_decimal128_t as @dec. The string is stored at @str. + * + * @dec : The BID formatted decimal to convert. + * @str : The output decimal128 string. At least %BSON_DECIMAL128_STRING + *characters. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------------ + */ +void +bson_decimal128_to_string (const bson_decimal128_t *dec, /* IN */ + char *str) /* OUT */ +{ + uint32_t COMBINATION_MASK = 0x1f; /* Extract least significant 5 bits */ + uint32_t EXPONENT_MASK = 0x3fff; /* Extract least significant 14 bits */ + uint32_t COMBINATION_INFINITY = 30; /* Value of combination field for Inf */ + uint32_t COMBINATION_NAN = 31; /* Value of combination field for NaN */ + uint32_t EXPONENT_BIAS = 6176; /* decimal128 exponent bias */ + + char *str_out = str; /* output pointer in string */ + char significand_str[35]; /* decoded significand digits */ + + + /* Note: bits in this routine are referred to starting at 0, */ + /* from the sign bit, towards the coefficient. */ + uint32_t high; /* bits 0 - 31 */ + uint32_t midh; /* bits 32 - 63 */ + uint32_t midl; /* bits 64 - 95 */ + uint32_t low; /* bits 96 - 127 */ + uint32_t combination; /* bits 1 - 5 */ + uint32_t biased_exponent; /* decoded biased exponent (14 bits) */ + uint32_t significand_digits = 0; /* the number of significand digits */ + uint32_t significand[36] = {0}; /* the base-10 digits in the significand */ + uint32_t *significand_read = significand; /* read pointer into significand */ + int32_t exponent; /* unbiased exponent */ + int32_t scientific_exponent; /* the exponent if scientific notation is + * used */ + bool is_zero = false; /* true if the number is zero */ + + uint8_t significand_msb; /* the most signifcant significand bits (50-46) */ + _bson_uint128_t + significand128; /* temporary storage for significand decoding */ + size_t i; /* indexing variables */ + int j, k; + + memset (significand_str, 0, sizeof (significand_str)); + + if ((int64_t) dec->high < 0) { /* negative */ + *(str_out++) = '-'; + } + + low = (uint32_t) dec->low, midl = (uint32_t) (dec->low >> 32), + midh = (uint32_t) dec->high, high = (uint32_t) (dec->high >> 32); + + /* Decode combination field and exponent */ + combination = (high >> 26) & COMBINATION_MASK; + + if (BSON_UNLIKELY ((combination >> 3) == 3)) { + /* Check for 'special' values */ + if (combination == COMBINATION_INFINITY) { /* Infinity */ + strcpy (str_out, BSON_DECIMAL128_INF); + return; + } else if (combination == COMBINATION_NAN) { /* NaN */ + /* str, not str_out, to erase the sign */ + strcpy (str, BSON_DECIMAL128_NAN); + /* we don't care about the NaN payload. */ + return; + } else { + biased_exponent = (high >> 15) & EXPONENT_MASK; + significand_msb = 0x8 + ((high >> 14) & 0x1); + } + } else { + significand_msb = (high >> 14) & 0x7; + biased_exponent = (high >> 17) & EXPONENT_MASK; + } + + exponent = biased_exponent - EXPONENT_BIAS; + /* Create string of significand digits */ + + /* Convert the 114-bit binary number represented by */ + /* (high, midh, midl, low) to at most 34 decimal */ + /* digits through modulo and division. */ + significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); + significand128.parts[1] = midh; + significand128.parts[2] = midl; + significand128.parts[3] = low; + + if (significand128.parts[0] == 0 && significand128.parts[1] == 0 && + significand128.parts[2] == 0 && significand128.parts[3] == 0) { + is_zero = true; + } else if (significand128.parts[0] >= (1 << 17)) { + /* The significand is non-canonical or zero. + * In order to preserve compatibility with the densely packed decimal + * format, the maximum value for the significand of decimal128 is + * 1e34 - 1. If the value is greater than 1e34 - 1, the IEEE 754 + * standard dictates that the significand is interpreted as zero. + */ + is_zero = true; + } else { + for (k = 3; k >= 0; k--) { + uint32_t least_digits = 0; + _bson_uint128_divide1B ( + significand128, &significand128, &least_digits); + + /* We now have the 9 least significant digits (in base 2). */ + /* Convert and output to string. */ + if (!least_digits) { + continue; + } + + for (j = 8; j >= 0; j--) { + significand[k * 9 + j] = least_digits % 10; + least_digits /= 10; + } + } + } + + /* Output format options: */ + /* Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd */ + /* Regular - ddd.ddd */ + + if (is_zero) { + significand_digits = 1; + *significand_read = 0; + } else { + significand_digits = 36; + while (!(*significand_read)) { + significand_digits--; + significand_read++; + } + } + + scientific_exponent = significand_digits - 1 + exponent; + + /* The scientific exponent checks are dictated by the string conversion + * specification and are somewhat arbitrary cutoffs. + * + * We must check exponent > 0, because if this is the case, the number + * has trailing zeros. However, we *cannot* output these trailing zeros, + * because doing so would change the precision of the value, and would + * change stored data if the string converted number is round tripped. + */ + if (scientific_exponent < -6 || exponent > 0) { + /* Scientific format */ + *(str_out++) = *(significand_read++) + '0'; + significand_digits--; + + if (significand_digits) { + *(str_out++) = '.'; + } + + for (i = 0; i < significand_digits && (str_out - str) < 36; i++) { + *(str_out++) = *(significand_read++) + '0'; + } + /* Exponent */ + *(str_out++) = 'E'; + bson_snprintf (str_out, 6, "%+d", scientific_exponent); + } else { + /* Regular format with no decimal place */ + if (exponent >= 0) { + for (i = 0; i < significand_digits && (str_out - str) < 36; i++) { + *(str_out++) = *(significand_read++) + '0'; + } + *str_out = '\0'; + } else { + int32_t radix_position = significand_digits + exponent; + + if (radix_position > 0) { /* non-zero digits before radix */ + for (i = 0; + i < radix_position && (str_out - str) < BSON_DECIMAL128_STRING; + i++) { + *(str_out++) = *(significand_read++) + '0'; + } + } else { /* leading zero before radix point */ + *(str_out++) = '0'; + } + + *(str_out++) = '.'; + while (radix_position++ < 0) { /* add leading zeros after radix */ + *(str_out++) = '0'; + } + + for (i = 0; + (i < significand_digits - BSON_MAX (radix_position - 1, 0)) && + (str_out - str) < BSON_DECIMAL128_STRING; + i++) { + *(str_out++) = *(significand_read++) + '0'; + } + *str_out = '\0'; + } + } +} + +typedef struct { + uint64_t high, low; +} _bson_uint128_6464_t; + + +/** + *------------------------------------------------------------------------- + * + * mul64x64 -- + * + * This function multiplies two &uint64_t into a &_bson_uint128_6464_t. + * + * Returns: + * The product of @left and @right. + * + * Side Effects: + * None. + * + *------------------------------------------------------------------------- + */ +static void +_mul_64x64 (uint64_t left, /* IN */ + uint64_t right, /* IN */ + _bson_uint128_6464_t *product) /* OUT */ +{ + uint64_t left_high, left_low, right_high, right_low, product_high, + product_mid, product_mid2, product_low; + _bson_uint128_6464_t rt = {0}; + + if (!left && !right) { + *product = rt; + return; + } + + left_high = left >> 32; + left_low = (uint32_t) left; + right_high = right >> 32; + right_low = (uint32_t) right; + + product_high = left_high * right_high; + product_mid = left_high * right_low; + product_mid2 = left_low * right_high; + product_low = left_low * right_low; + + product_high += product_mid >> 32; + product_mid = (uint32_t) product_mid + product_mid2 + (product_low >> 32); + + product_high = product_high + (product_mid >> 32); + product_low = (product_mid << 32) + (uint32_t) product_low; + + rt.high = product_high; + rt.low = product_low; + *product = rt; +} + +/** + *------------------------------------------------------------------------------ + * + * _dec128_tolower -- + * + * This function converts the ASCII character @c to lowercase. It is locale + * insensitive (unlike the stdlib tolower). + * + * Returns: + * The lowercased character. + */ +char +_dec128_tolower (char c) +{ + if (isupper (c)) { + c += 32; + } + + return c; +} + +/** + *------------------------------------------------------------------------------ + * + * _dec128_istreq -- + * + * This function compares the null-terminated *ASCII* strings @a and @b + * for case-insensitive equality. + * + * Returns: + * true if the strings are equal, false otherwise. + */ +bool +_dec128_istreq (const char *a, /* IN */ + const char *b /* IN */) +{ + while (*a != '\0' || *b != '\0') { + /* strings are different lengths. */ + if (*a == '\0' || *b == '\0') { + return false; + } + + if (_dec128_tolower (*a) != _dec128_tolower (*b)) { + return false; + } + + a++; + b++; + } + + return true; +} + +/** + *------------------------------------------------------------------------------ + * + * bson_decimal128_from_string -- + * + * This function converts @string in the format [+-]ddd[.]ddd[E][+-]dddd to + * decimal128. Out of range values are converted to +/-Infinity. Invalid + * strings are converted to NaN. + * + * If more digits are provided than the available precision allows, + * round to the nearest expressable decimal128 with ties going to even will + * occur. + * + * Note: @string must be ASCII only! + * + * Returns: + * true on success, or false on failure. @dec will be NaN if @str was invalid + * The &bson_decimal128_t converted from @string at @dec. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------------ + */ +bool +bson_decimal128_from_string (const char *string, /* IN */ + bson_decimal128_t *dec) /* OUT */ +{ + return bson_decimal128_from_string_w_len (string, -1, dec); +} + + +/** + *------------------------------------------------------------------------------ + * + * bson_decimal128_from_string_w_len -- + * + * This function converts @string in the format [+-]ddd[.]ddd[E][+-]dddd to + * decimal128. Out of range values are converted to +/-Infinity. Invalid + * strings are converted to NaN. @len is the length of the string, or -1 + * meaning the string is null-terminated. + * + * If more digits are provided than the available precision allows, + * round to the nearest expressable decimal128 with ties going to even will + * occur. + * + * Note: @string must be ASCII only! + * + * Returns: + * true on success, or false on failure. @dec will be NaN if @str was invalid + * The &bson_decimal128_t converted from @string at @dec. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------------ + */ +bool +bson_decimal128_from_string_w_len (const char *string, /* IN */ + int len, /* IN */ + bson_decimal128_t *dec) /* OUT */ +{ + _bson_uint128_6464_t significand = {0}; + + const char *str_read = string; /* Read pointer for consuming str. */ + + /* Parsing state tracking */ + bool is_negative = false; + bool saw_radix = false; + bool includes_sign = false; /* True if the input string contains a sign. */ + bool found_nonzero = false; + + size_t significant_digits = 0; /* Total number of significant digits + * (no leading or trailing zero) */ + size_t ndigits_read = 0; /* Total number of significand digits read */ + size_t ndigits = 0; /* Total number of digits (no leading zeros) */ + size_t radix_position = 0; /* The number of the digits after radix */ + size_t first_nonzero = 0; /* The index of the first non-zero in *str* */ + + uint16_t digits[BSON_DECIMAL128_MAX_DIGITS] = {0}; + uint16_t ndigits_stored = 0; /* The number of digits in digits */ + uint16_t *digits_insert = digits; /* Insertion pointer for digits */ + size_t first_digit = 0; /* The index of the first non-zero digit */ + size_t last_digit = 0; /* The index of the last digit */ + + int32_t exponent = 0; + uint64_t significand_high = 0; /* The high 17 digits of the significand */ + uint64_t significand_low = 0; /* The low 17 digits of the significand */ + uint16_t biased_exponent = 0; /* The biased exponent */ + + BSON_ASSERT (dec); + dec->high = 0; + dec->low = 0; + + if (*str_read == '+' || *str_read == '-') { + is_negative = *(str_read++) == '-'; + includes_sign = true; + } + + /* Check for Infinity or NaN */ + if (!isdigit (*str_read) && *str_read != '.') { + if (_dec128_istreq (str_read, "inf") || + _dec128_istreq (str_read, "infinity")) { + BSON_DECIMAL128_SET_INF (*dec, is_negative); + return true; + } else if (_dec128_istreq (str_read, "nan")) { + BSON_DECIMAL128_SET_NAN (*dec); + return true; + } + + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + /* Read digits */ + while (((isdigit (*str_read) || *str_read == '.')) && + (len == -1 || str_read < string + len)) { + if (*str_read == '.') { + if (saw_radix) { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + saw_radix = true; + str_read++; + continue; + } + + if (ndigits_stored < 34) { + if (*str_read != '0' || found_nonzero) { + if (!found_nonzero) { + first_nonzero = ndigits_read; + } + + found_nonzero = true; + *(digits_insert++) = *(str_read) - '0'; /* Only store 34 digits */ + ndigits_stored++; + } + } + + if (found_nonzero) { + ndigits++; + } + + if (saw_radix) { + radix_position++; + } + + ndigits_read++; + str_read++; + } + + if (saw_radix && !ndigits_read) { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + /* Read exponent if exists */ + if (*str_read == 'e' || *str_read == 'E') { + int nread = 0; +#ifdef _MSC_VER +#define SSCANF sscanf_s +#else +#define SSCANF sscanf +#endif + int read_exponent = SSCANF (++str_read, "%d%n", &exponent, &nread); + str_read += nread; + + if (!read_exponent || nread == 0) { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + +#undef SSCANF + } + + if ((len == -1 || str_read < string + len) && *str_read) { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + /* Done reading input. */ + /* Find first non-zero digit in digits */ + first_digit = 0; + + if (!ndigits_stored) { /* value is zero */ + first_digit = 0; + last_digit = 0; + digits[0] = 0; + ndigits = 1; + ndigits_stored = 1; + significant_digits = 0; + } else { + last_digit = ndigits_stored - 1; + significant_digits = ndigits; + /* Mark trailing zeros as non-significant */ + while (string[first_nonzero + significant_digits - 1 + includes_sign + + saw_radix] == '0') { + significant_digits--; + } + } + + + /* Normalization of exponent */ + /* Correct exponent based on radix position, and shift significand as needed + */ + /* to represent user input */ + + /* Overflow prevention */ + if (exponent <= radix_position && radix_position - exponent > (1 << 14)) { + exponent = BSON_DECIMAL128_EXPONENT_MIN; + } else { + exponent -= radix_position; + } + + /* Attempt to normalize the exponent */ + while (exponent > BSON_DECIMAL128_EXPONENT_MAX) { + /* Shift exponent to significand and decrease */ + last_digit++; + + if (last_digit - first_digit > BSON_DECIMAL128_MAX_DIGITS) { + /* The exponent is too great to shift into the significand. */ + if (significant_digits == 0) { + /* Value is zero, we are allowed to clamp the exponent. */ + exponent = BSON_DECIMAL128_EXPONENT_MAX; + break; + } + + /* Overflow is not permitted, error. */ + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + exponent--; + } + + while (exponent < BSON_DECIMAL128_EXPONENT_MIN || ndigits_stored < ndigits) { + /* Shift last digit */ + if (last_digit == 0) { + /* underflow is not allowed, but zero clamping is */ + if (significant_digits == 0) { + exponent = BSON_DECIMAL128_EXPONENT_MIN; + break; + } + + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + if (ndigits_stored < ndigits) { + if (string[ndigits - 1 + includes_sign + saw_radix] - '0' != 0 && + significant_digits != 0) { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + ndigits--; /* adjust to match digits not stored */ + } else { + if (digits[last_digit] != 0) { + /* Inexact rounding is not allowed. */ + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + + + last_digit--; /* adjust to round */ + } + + if (exponent < BSON_DECIMAL128_EXPONENT_MAX) { + exponent++; + } else { + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + } + + /* Round */ + /* We've normalized the exponent, but might still need to round. */ + if (last_digit - first_digit + 1 < significant_digits) { + uint8_t round_digit; + + /* There are non-zero digits after last_digit that need rounding. */ + /* We round to nearest, ties to even */ + round_digit = + string[first_nonzero + last_digit + includes_sign + saw_radix + 1] - + '0'; + + if (round_digit != 0) { + /* Inexact (non-zero) rounding is not allowed */ + BSON_DECIMAL128_SET_NAN (*dec); + return false; + } + } + + /* Encode significand */ + significand_high = 0, /* The high 17 digits of the significand */ + significand_low = 0; /* The low 17 digits of the significand */ + + if (significant_digits == 0) { /* read a zero */ + significand_high = 0; + significand_low = 0; + } else if (last_digit - first_digit < 17) { + size_t d_idx = first_digit; + significand_low = digits[d_idx++]; + + for (; d_idx <= last_digit; d_idx++) { + significand_low *= 10; + significand_low += digits[d_idx]; + significand_high = 0; + } + } else { + size_t d_idx = first_digit; + significand_high = digits[d_idx++]; + + for (; d_idx <= last_digit - 17; d_idx++) { + significand_high *= 10; + significand_high += digits[d_idx]; + } + + significand_low = digits[d_idx++]; + + for (; d_idx <= last_digit; d_idx++) { + significand_low *= 10; + significand_low += digits[d_idx]; + } + } + + _mul_64x64 (significand_high, 100000000000000000ull, &significand); + significand.low += significand_low; + + if (significand.low < significand_low) { + significand.high += 1; + } + + + biased_exponent = (exponent + (int16_t) BSON_DECIMAL128_EXPONENT_BIAS); + + /* Encode combination, exponent, and significand. */ + if ((significand.high >> 49) & 1) { + /* Encode '11' into bits 1 to 3 */ + dec->high |= (0x3ull << 61); + dec->high |= (biased_exponent & 0x3fffull) << 47; + dec->high |= significand.high & 0x7fffffffffffull; + } else { + dec->high |= (biased_exponent & 0x3fffull) << 49; + dec->high |= significand.high & 0x1ffffffffffffull; + } + + dec->low = significand.low; + + /* Encode sign */ + if (is_negative) { + dec->high |= 0x8000000000000000ull; + } + + return true; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.h new file mode 100644 index 0000000..e7fe7de --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-decimal128.h @@ -0,0 +1,66 @@ +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_DECIMAL128_H +#define BSON_DECIMAL128_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "bson/bson-macros.h" +#include "bson/bson-config.h" +#include "bson/bson-types.h" + + +/** + * BSON_DECIMAL128_STRING: + * + * The length of a decimal128 string (with null terminator). + * + * 1 for the sign + * 35 for digits and radix + * 2 for exponent indicator and sign + * 4 for exponent digits + */ +#define BSON_DECIMAL128_STRING 43 +#define BSON_DECIMAL128_INF "Infinity" +#define BSON_DECIMAL128_NAN "NaN" + + +BSON_BEGIN_DECLS + +BSON_EXPORT (void) +bson_decimal128_to_string (const bson_decimal128_t *dec, char *str); + + +/* Note: @string must be ASCII characters only! */ +BSON_EXPORT (bool) +bson_decimal128_from_string (const char *string, bson_decimal128_t *dec); + +BSON_EXPORT (bool) +bson_decimal128_from_string_w_len (const char *string, + int len, + bson_decimal128_t *dec); + +BSON_END_DECLS + + +#endif /* BSON_DECIMAL128_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-endian.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-endian.h new file mode 100644 index 0000000..4fc2dfd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-endian.h @@ -0,0 +1,230 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_ENDIAN_H +#define BSON_ENDIAN_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#if defined(__sun) +#include +#endif + +#include "bson/bson-config.h" +#include "bson/bson-macros.h" +#include "bson/bson-compat.h" + + +BSON_BEGIN_DECLS + + +#define BSON_BIG_ENDIAN 4321 +#define BSON_LITTLE_ENDIAN 1234 + + +#if defined(__sun) +#define BSON_UINT16_SWAP_LE_BE(v) BSWAP_16 ((uint16_t) v) +#define BSON_UINT32_SWAP_LE_BE(v) BSWAP_32 ((uint32_t) v) +#define BSON_UINT64_SWAP_LE_BE(v) BSWAP_64 ((uint64_t) v) +#elif defined(__clang__) && defined(__clang_major__) && \ + defined(__clang_minor__) && (__clang_major__ >= 3) && \ + (__clang_minor__ >= 1) +#if __has_builtin(__builtin_bswap16) +#define BSON_UINT16_SWAP_LE_BE(v) __builtin_bswap16 (v) +#endif +#if __has_builtin(__builtin_bswap32) +#define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 (v) +#endif +#if __has_builtin(__builtin_bswap64) +#define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 (v) +#endif +#elif defined(__GNUC__) && (__GNUC__ >= 4) +#if __GNUC__ > 4 || (defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 3) +#define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t) v) +#define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t) v) +#endif +#if __GNUC__ > 4 || (defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 8) +#define BSON_UINT16_SWAP_LE_BE(v) __builtin_bswap16 ((uint32_t) v) +#endif +#endif + + +#ifndef BSON_UINT16_SWAP_LE_BE +#define BSON_UINT16_SWAP_LE_BE(v) __bson_uint16_swap_slow ((uint16_t) v) +#endif + + +#ifndef BSON_UINT32_SWAP_LE_BE +#define BSON_UINT32_SWAP_LE_BE(v) __bson_uint32_swap_slow ((uint32_t) v) +#endif + + +#ifndef BSON_UINT64_SWAP_LE_BE +#define BSON_UINT64_SWAP_LE_BE(v) __bson_uint64_swap_slow ((uint64_t) v) +#endif + + +#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN +#define BSON_UINT16_FROM_LE(v) ((uint16_t) v) +#define BSON_UINT16_TO_LE(v) ((uint16_t) v) +#define BSON_UINT16_FROM_BE(v) BSON_UINT16_SWAP_LE_BE (v) +#define BSON_UINT16_TO_BE(v) BSON_UINT16_SWAP_LE_BE (v) +#define BSON_UINT32_FROM_LE(v) ((uint32_t) v) +#define BSON_UINT32_TO_LE(v) ((uint32_t) v) +#define BSON_UINT32_FROM_BE(v) BSON_UINT32_SWAP_LE_BE (v) +#define BSON_UINT32_TO_BE(v) BSON_UINT32_SWAP_LE_BE (v) +#define BSON_UINT64_FROM_LE(v) ((uint64_t) v) +#define BSON_UINT64_TO_LE(v) ((uint64_t) v) +#define BSON_UINT64_FROM_BE(v) BSON_UINT64_SWAP_LE_BE (v) +#define BSON_UINT64_TO_BE(v) BSON_UINT64_SWAP_LE_BE (v) +#define BSON_DOUBLE_FROM_LE(v) ((double) v) +#define BSON_DOUBLE_TO_LE(v) ((double) v) +#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN +#define BSON_UINT16_FROM_LE(v) BSON_UINT16_SWAP_LE_BE (v) +#define BSON_UINT16_TO_LE(v) BSON_UINT16_SWAP_LE_BE (v) +#define BSON_UINT16_FROM_BE(v) ((uint16_t) v) +#define BSON_UINT16_TO_BE(v) ((uint16_t) v) +#define BSON_UINT32_FROM_LE(v) BSON_UINT32_SWAP_LE_BE (v) +#define BSON_UINT32_TO_LE(v) BSON_UINT32_SWAP_LE_BE (v) +#define BSON_UINT32_FROM_BE(v) ((uint32_t) v) +#define BSON_UINT32_TO_BE(v) ((uint32_t) v) +#define BSON_UINT64_FROM_LE(v) BSON_UINT64_SWAP_LE_BE (v) +#define BSON_UINT64_TO_LE(v) BSON_UINT64_SWAP_LE_BE (v) +#define BSON_UINT64_FROM_BE(v) ((uint64_t) v) +#define BSON_UINT64_TO_BE(v) ((uint64_t) v) +#define BSON_DOUBLE_FROM_LE(v) (__bson_double_swap_slow (v)) +#define BSON_DOUBLE_TO_LE(v) (__bson_double_swap_slow (v)) +#else +#error "The endianness of target architecture is unknown." +#endif + + +/* + *-------------------------------------------------------------------------- + * + * __bson_uint16_swap_slow -- + * + * Fallback endianness conversion for 16-bit integers. + * + * Returns: + * The endian swapped version. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE uint16_t +__bson_uint16_swap_slow (uint16_t v) /* IN */ +{ + return ((v & 0x00FF) << 8) | ((v & 0xFF00) >> 8); +} + + +/* + *-------------------------------------------------------------------------- + * + * __bson_uint32_swap_slow -- + * + * Fallback endianness conversion for 32-bit integers. + * + * Returns: + * The endian swapped version. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE uint32_t +__bson_uint32_swap_slow (uint32_t v) /* IN */ +{ + return ((v & 0x000000FFU) << 24) | ((v & 0x0000FF00U) << 8) | + ((v & 0x00FF0000U) >> 8) | ((v & 0xFF000000U) >> 24); +} + + +/* + *-------------------------------------------------------------------------- + * + * __bson_uint64_swap_slow -- + * + * Fallback endianness conversion for 64-bit integers. + * + * Returns: + * The endian swapped version. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE uint64_t +__bson_uint64_swap_slow (uint64_t v) /* IN */ +{ + return ((v & 0x00000000000000FFULL) << 56) | + ((v & 0x000000000000FF00ULL) << 40) | + ((v & 0x0000000000FF0000ULL) << 24) | + ((v & 0x00000000FF000000ULL) << 8) | + ((v & 0x000000FF00000000ULL) >> 8) | + ((v & 0x0000FF0000000000ULL) >> 24) | + ((v & 0x00FF000000000000ULL) >> 40) | + ((v & 0xFF00000000000000ULL) >> 56); +} + + +/* + *-------------------------------------------------------------------------- + * + * __bson_double_swap_slow -- + * + * Fallback endianness conversion for double floating point. + * + * Returns: + * The endian swapped version. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +BSON_STATIC_ASSERT2 (sizeof_uint64_t, sizeof (double) == sizeof (uint64_t)); + +static BSON_INLINE double +__bson_double_swap_slow (double v) /* IN */ +{ + uint64_t uv; + + memcpy (&uv, &v, sizeof (v)); + uv = BSON_UINT64_SWAP_LE_BE (uv); + memcpy (&v, &uv, sizeof (v)); + + return v; +} + +BSON_END_DECLS + + +#endif /* BSON_ENDIAN_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.c new file mode 100644 index 0000000..6806377 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.c @@ -0,0 +1,126 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "bson/bson-compat.h" +#include "bson/bson-config.h" +#include "bson/bson-error.h" +#include "bson/bson-memory.h" +#include "bson/bson-string.h" +#include "bson/bson-types.h" + + +/* + *-------------------------------------------------------------------------- + * + * bson_set_error -- + * + * Initializes @error using the parameters specified. + * + * @domain is an application specific error domain which should + * describe which module initiated the error. Think of this as the + * exception type. + * + * @code is the @domain specific error code. + * + * @format is used to generate the format string. It uses vsnprintf() + * internally so the format should match what you would use there. + * + * Parameters: + * @error: A #bson_error_t. + * @domain: The error domain. + * @code: The error code. + * @format: A printf style format string. + * + * Returns: + * None. + * + * Side effects: + * @error is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_set_error (bson_error_t *error, /* OUT */ + uint32_t domain, /* IN */ + uint32_t code, /* IN */ + const char *format, /* IN */ + ...) /* IN */ +{ + va_list args; + + if (error) { + error->domain = domain; + error->code = code; + + va_start (args, format); + bson_vsnprintf (error->message, sizeof error->message, format, args); + va_end (args); + + error->message[sizeof error->message - 1] = '\0'; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strerror_r -- + * + * This is a reentrant safe macro for strerror. + * + * The resulting string may be stored in @buf. + * + * Returns: + * A pointer to a static string or @buf. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_strerror_r (int err_code, /* IN */ + char *buf, /* IN */ + size_t buflen) /* IN */ +{ + static const char *unknown_msg = "Unknown error"; + char *ret = NULL; + +#if defined(_WIN32) + if (strerror_s (buf, buflen, err_code) != 0) { + ret = buf; + } +#elif defined(__GNUC__) && defined(_GNU_SOURCE) + ret = strerror_r (err_code, buf, buflen); +#else /* XSI strerror_r */ + if (strerror_r (err_code, buf, buflen) == 0) { + ret = buf; + } +#endif + + if (!ret) { + bson_strncpy (buf, unknown_msg, buflen); + ret = buf; + } + + return ret; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.h new file mode 100644 index 0000000..af727c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-error.h @@ -0,0 +1,48 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_ERROR_H +#define BSON_ERROR_H + + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +#define BSON_ERROR_JSON 1 +#define BSON_ERROR_READER 2 +#define BSON_ERROR_INVALID 3 + + +BSON_EXPORT (void) +bson_set_error (bson_error_t *error, + uint32_t domain, + uint32_t code, + const char *format, + ...) BSON_GNUC_PRINTF (4, 5); +BSON_EXPORT (char *) +bson_strerror_r (int err_code, char *buf, size_t buflen); + + +BSON_END_DECLS + + +#endif /* BSON_ERROR_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv-private.h new file mode 100644 index 0000000..9781366 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv-private.h @@ -0,0 +1,25 @@ +/* + * Please do not copyright this code. This code is in the public domain. + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * By: + * chongo /\oo/\ + * http://www.isthe.com/chongo/ + */ + +#ifndef MONGO_C_DRIVER_BSON_FNV_PRIVATE_H +#define MONGO_C_DRIVER_BSON_FNV_PRIVATE_H + +#include "bson/bson.h" + +uint32_t +_mongoc_fnv_24a_str (char *str); + +#endif /* MONGO_C_DRIVER_BSON_FNV_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv.c new file mode 100644 index 0000000..d7ddf9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-fnv.c @@ -0,0 +1,90 @@ +/* + * Please do not copyright this code. This code is in the public domain. + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * By: + * chongo /\oo/\ + * http://www.isthe.com/chongo/ + */ + +/* + * Sources: http://www.isthe.com/chongo/src/fnv/hash_32a.c + * http://www.isthe.com/chongo/tech/comp/fnv/index.html#xor-fold + */ + +#include "bson/bson-fnv-private.h" + +/* + * 32 bit FNV-1a non-zero initial basis + * + * The FNV-1 initial basis is the FNV-0 hash of the following 32 octets: + * + * chongo /\../\ + * + * NOTE: The \'s above are not back-slashing escape characters. + * They are literal ASCII backslash 0x5c characters. + * + * NOTE: The FNV-1a initial basis is the same value as FNV-1 by definition. + */ +#define FNV1_32A_INIT ((uint32_t) 0x811c9dc5) + +/* + * 32 bit magic FNV-1a prime + * NOTE: define NO_FNV_GCC_OPTIMIZATION to use this prime + */ +#define FNV_32_PRIME ((Fnv32_t) 0x01000193) + +/* + * For producing 24 bit FNV-1a hash using xor-fold on a 32 bit FNV-1a hash + */ +#define MASK_24 (((uint32_t) 1 << 24) - 1) /* i.e., (uint32_t) 0xffffff */ + +/*--------------------------------------------------------------------------- + * + * _mongoc_fnv_24a_str -- + * + * perform a 32 bit Fowler/Noll/Vo FNV-1a hash on a string and + * xor-fold it into a 24 bit hash + * + * Return: + * 24 bit hash as a static hash type + * + * Note: + * input strings with multiple null characters will stop being + * processed at the first null + * + *-------------------------------------------------------------------------- + */ +uint32_t +_mongoc_fnv_24a_str (char *str) +{ + uint32_t hval = FNV1_32A_INIT; /* initial 32 bit hash basis */ + unsigned char *s = (unsigned char *) str; /* unsigned string */ + + /* FNV-1a hash each octet in the buffer */ + while (*s) { + /* xor the bottom with the current octet */ + hval ^= (uint32_t) *s++; + +/* multiply by the 32 bit FNV magic prime mod 2^32 */ +#if defined(NO_FNV_GCC_OPTIMIZATION) + hval *= FNV_32_PRIME; +#else + hval += + (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); +#endif + } + + /* xor-fold the result to a 24 bit value */ + hval = (hval >> 24) ^ (hval & MASK_24); + + /* return our new 24 bit hash value */ + return hval; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601-private.h new file mode 100644 index 0000000..44471f2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601-private.h @@ -0,0 +1,48 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_ISO8601_PRIVATE_H +#define BSON_ISO8601_PRIVATE_H + + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" +#include "bson/bson-string.h" + + +BSON_BEGIN_DECLS + +bool +_bson_iso8601_date_parse (const char *str, + int32_t len, + int64_t *out, + bson_error_t *error); + +/** + * _bson_iso8601_date_format: + * @msecs_since_epoch: A positive number of milliseconds since Jan 1, 1970. + * @str: The string to append the ISO8601-formatted to. + * + * Appends a date formatted like "2012-12-24T12:15:30.500Z" to @str. + */ +void +_bson_iso8601_date_format (int64_t msecs_since_epoch, bson_string_t *str); + +BSON_END_DECLS + + +#endif /* BSON_ISO8601_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601.c new file mode 100644 index 0000000..bd44ff5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iso8601.c @@ -0,0 +1,333 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" +#include "bson/bson-error.h" +#include "bson/bson-iso8601-private.h" +#include "bson/bson-json.h" +#include "bson/bson-timegm-private.h" + + +static bool +get_tok (const char *terminals, + const char **ptr, + int32_t *remaining, + const char **out, + int32_t *out_len) +{ + const char *terminal; + bool found_terminal = false; + + if (!*remaining) { + *out = ""; + *out_len = 0; + } + + *out = *ptr; + *out_len = -1; + + for (; *remaining && !found_terminal; + (*ptr)++, (*remaining)--, (*out_len)++) { + for (terminal = terminals; *terminal; terminal++) { + if (**ptr == *terminal) { + found_terminal = true; + break; + } + } + } + + if (!found_terminal) { + (*out_len)++; + } + + return found_terminal; +} + +static bool +digits_only (const char *str, int32_t len) +{ + int i; + + for (i = 0; i < len; i++) { + if (!isdigit (str[i])) { + return false; + } + } + + return true; +} + +static bool +parse_num (const char *str, + int32_t len, + int32_t digits, + int32_t min, + int32_t max, + int32_t *out) +{ + int i; + int magnitude = 1; + int32_t value = 0; + + if ((digits >= 0 && len != digits) || !digits_only (str, len)) { + return false; + } + + for (i = 1; i <= len; i++, magnitude *= 10) { + value += (str[len - i] - '0') * magnitude; + } + + if (value < min || value > max) { + return false; + } + + *out = value; + + return true; +} + +bool +_bson_iso8601_date_parse (const char *str, + int32_t len, + int64_t *out, + bson_error_t *error) +{ + const char *ptr; + int32_t remaining = len; + + const char *year_ptr = NULL; + const char *month_ptr = NULL; + const char *day_ptr = NULL; + const char *hour_ptr = NULL; + const char *min_ptr = NULL; + const char *sec_ptr = NULL; + const char *millis_ptr = NULL; + const char *tz_ptr = NULL; + + int32_t year_len = 0; + int32_t month_len = 0; + int32_t day_len = 0; + int32_t hour_len = 0; + int32_t min_len = 0; + int32_t sec_len = 0; + int32_t millis_len = 0; + int32_t tz_len = 0; + + int32_t year; + int32_t month; + int32_t day; + int32_t hour; + int32_t min; + int32_t sec = 0; + int64_t millis = 0; + int32_t tz_adjustment = 0; + + struct bson_tm posix_date = {0}; + +#define DATE_PARSE_ERR(msg) \ + bson_set_error (error, \ + BSON_ERROR_JSON, \ + BSON_JSON_ERROR_READ_INVALID_PARAM, \ + "Could not parse \"%s\" as date: " msg, \ + str); \ + return false + +#define DEFAULT_DATE_PARSE_ERR \ + DATE_PARSE_ERR ("use ISO8601 format yyyy-mm-ddThh:mm plus timezone, either" \ + " \"Z\" or like \"+0500\"") + + ptr = str; + + /* we have to match at least yyyy-mm-ddThh:mm */ + if (!(get_tok ("-", &ptr, &remaining, &year_ptr, &year_len) && + get_tok ("-", &ptr, &remaining, &month_ptr, &month_len) && + get_tok ("T", &ptr, &remaining, &day_ptr, &day_len) && + get_tok (":", &ptr, &remaining, &hour_ptr, &hour_len) && + get_tok (":+-Z", &ptr, &remaining, &min_ptr, &min_len))) { + DEFAULT_DATE_PARSE_ERR; + } + + /* if the minute has a ':' at the end look for seconds */ + if (min_ptr[min_len] == ':') { + if (remaining < 2) { + DATE_PARSE_ERR ("reached end of date while looking for seconds"); + } + + get_tok (".+-Z", &ptr, &remaining, &sec_ptr, &sec_len); + + if (!sec_len) { + DATE_PARSE_ERR ("minute ends in \":\" seconds is required"); + } + } + + /* if we had a second and it is followed by a '.' look for milliseconds */ + if (sec_len && sec_ptr[sec_len] == '.') { + if (remaining < 2) { + DATE_PARSE_ERR ("reached end of date while looking for milliseconds"); + } + + get_tok ("+-Z", &ptr, &remaining, &millis_ptr, &millis_len); + + if (!millis_len) { + DATE_PARSE_ERR ("seconds ends in \".\", milliseconds is required"); + } + } + + /* backtrack by 1 to put ptr on the timezone */ + ptr--; + remaining++; + + get_tok ("", &ptr, &remaining, &tz_ptr, &tz_len); + + if (!parse_num (year_ptr, year_len, 4, -9999, 9999, &year)) { + DATE_PARSE_ERR ("year must be an integer"); + } + + /* values are as in struct tm */ + year -= 1900; + + if (!parse_num (month_ptr, month_len, 2, 1, 12, &month)) { + DATE_PARSE_ERR ("month must be an integer"); + } + + /* values are as in struct tm */ + month -= 1; + + if (!parse_num (day_ptr, day_len, 2, 1, 31, &day)) { + DATE_PARSE_ERR ("day must be an integer"); + } + + if (!parse_num (hour_ptr, hour_len, 2, 0, 23, &hour)) { + DATE_PARSE_ERR ("hour must be an integer"); + } + + if (!parse_num (min_ptr, min_len, 2, 0, 59, &min)) { + DATE_PARSE_ERR ("minute must be an integer"); + } + + if (sec_len && !parse_num (sec_ptr, sec_len, 2, 0, 60, &sec)) { + DATE_PARSE_ERR ("seconds must be an integer"); + } + + if (tz_len > 0) { + if (tz_ptr[0] == 'Z' && tz_len == 1) { + /* valid */ + } else if (tz_ptr[0] == '+' || tz_ptr[0] == '-') { + int32_t tz_hour; + int32_t tz_min; + + if (tz_len != 5 || !digits_only (tz_ptr + 1, 4)) { + DATE_PARSE_ERR ("could not parse timezone"); + } + + if (!parse_num (tz_ptr + 1, 2, -1, -23, 23, &tz_hour)) { + DATE_PARSE_ERR ("timezone hour must be at most 23"); + } + + if (!parse_num (tz_ptr + 3, 2, -1, 0, 59, &tz_min)) { + DATE_PARSE_ERR ("timezone minute must be at most 59"); + } + + /* we inflect the meaning of a 'positive' timezone. Those are hours + * we have to subtract, and vice versa */ + tz_adjustment = + (tz_ptr[0] == '-' ? 1 : -1) * ((tz_min * 60) + (tz_hour * 60 * 60)); + + if (!(tz_adjustment > -86400 && tz_adjustment < 86400)) { + DATE_PARSE_ERR ("timezone offset must be less than 24 hours"); + } + } else { + DATE_PARSE_ERR ("timezone is required"); + } + } + + if (millis_len > 0) { + int i; + int magnitude; + millis = 0; + + if (millis_len > 3 || !digits_only (millis_ptr, millis_len)) { + DATE_PARSE_ERR ("milliseconds must be an integer"); + } + + for (i = 1, magnitude = 1; i <= millis_len; i++, magnitude *= 10) { + millis += (millis_ptr[millis_len - i] - '0') * magnitude; + } + + if (millis_len == 1) { + millis *= 100; + } else if (millis_len == 2) { + millis *= 10; + } + + if (millis < 0 || millis > 1000) { + DATE_PARSE_ERR ("milliseconds must be at least 0 and less than 1000"); + } + } + + posix_date.tm_sec = sec; + posix_date.tm_min = min; + posix_date.tm_hour = hour; + posix_date.tm_mday = day; + posix_date.tm_mon = month; + posix_date.tm_year = year; + posix_date.tm_wday = 0; + posix_date.tm_yday = 0; + + millis = 1000 * _bson_timegm (&posix_date) + millis; + millis += tz_adjustment * 1000; + *out = millis; + + return true; +} + + +void +_bson_iso8601_date_format (int64_t msec_since_epoch, bson_string_t *str) +{ + time_t t; + int64_t msecs_part; + char buf[64]; + + msecs_part = msec_since_epoch % 1000; + t = (time_t) (msec_since_epoch / 1000); + +#ifdef BSON_HAVE_GMTIME_R + { + struct tm posix_date; + gmtime_r (&t, &posix_date); + strftime (buf, sizeof buf, "%Y-%m-%dT%H:%M:%S", &posix_date); + } +#elif defined(_MSC_VER) + { + /* Windows gmtime_s is thread-safe */ + struct tm time_buf; + gmtime_s (&time_buf, &t); + strftime (buf, sizeof buf, "%Y-%m-%dT%H:%M:%S", &time_buf); + } +#else + strftime (buf, sizeof buf, "%Y-%m-%dT%H:%M:%S", gmtime (&t)); +#endif + + if (msecs_part) { + bson_string_append_printf (str, "%s.%3" PRId64 "Z", buf, msecs_part); + } else { + bson_string_append (str, buf); + bson_string_append_c (str, 'Z'); + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.c new file mode 100644 index 0000000..820134e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.c @@ -0,0 +1,2528 @@ +/* + * Copyright 2013-2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-iter.h" +#include "bson/bson-config.h" +#include "bson/bson-decimal128.h" +#include "bson-types.h" + +#define ITER_TYPE(i) ((bson_type_t) * ((i)->raw + (i)->type)) + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_init -- + * + * Initializes @iter to be used to iterate @bson. + * + * Returns: + * true if bson_iter_t was initialized. otherwise false. + * + * Side effects: + * @iter is initialized. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_init (bson_iter_t *iter, /* OUT */ + const bson_t *bson) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (bson); + + if (BSON_UNLIKELY (bson->len < 5)) { + memset (iter, 0, sizeof *iter); + return false; + } + + iter->raw = bson_get_data (bson); + iter->len = bson->len; + iter->off = 0; + iter->type = 0; + iter->key = 0; + iter->d1 = 0; + iter->d2 = 0; + iter->d3 = 0; + iter->d4 = 0; + iter->next_off = 4; + iter->err_off = 0; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_init_from_data -- + * + * Initializes @iter to be used to iterate @data of length @length + * + * Returns: + * true if bson_iter_t was initialized. otherwise false. + * + * Side effects: + * @iter is initialized. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_init_from_data (bson_iter_t *iter, /* OUT */ + const uint8_t *data, /* IN */ + size_t length) /* IN */ +{ + uint32_t len_le; + + BSON_ASSERT (iter); + BSON_ASSERT (data); + + if (BSON_UNLIKELY ((length < 5) || (length > INT_MAX))) { + memset (iter, 0, sizeof *iter); + return false; + } + + memcpy (&len_le, data, sizeof (len_le)); + + if (BSON_UNLIKELY ((size_t) BSON_UINT32_FROM_LE (len_le) != length)) { + memset (iter, 0, sizeof *iter); + return false; + } + + if (BSON_UNLIKELY (data[length - 1])) { + memset (iter, 0, sizeof *iter); + return false; + } + + iter->raw = (uint8_t *) data; + iter->len = length; + iter->off = 0; + iter->type = 0; + iter->key = 0; + iter->d1 = 0; + iter->d2 = 0; + iter->d3 = 0; + iter->d4 = 0; + iter->next_off = 4; + iter->err_off = 0; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_recurse -- + * + * Creates a new sub-iter looking at the document or array that @iter + * is currently pointing at. + * + * Returns: + * true if successful and @child was initialized. + * + * Side effects: + * @child is initialized. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_recurse (const bson_iter_t *iter, /* IN */ + bson_iter_t *child) /* OUT */ +{ + const uint8_t *data = NULL; + uint32_t len = 0; + + BSON_ASSERT (iter); + BSON_ASSERT (child); + + if (ITER_TYPE (iter) == BSON_TYPE_DOCUMENT) { + bson_iter_document (iter, &len, &data); + } else if (ITER_TYPE (iter) == BSON_TYPE_ARRAY) { + bson_iter_array (iter, &len, &data); + } else { + return false; + } + + child->raw = data; + child->len = len; + child->off = 0; + child->type = 0; + child->key = 0; + child->d1 = 0; + child->d2 = 0; + child->d3 = 0; + child->d4 = 0; + child->next_off = 4; + child->err_off = 0; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_init_find -- + * + * Initializes a #bson_iter_t and moves the iter to the first field + * matching @key. + * + * Returns: + * true if the field named @key was found; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_init_find (bson_iter_t *iter, /* INOUT */ + const bson_t *bson, /* IN */ + const char *key) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (bson); + BSON_ASSERT (key); + + return bson_iter_init (iter, bson) && bson_iter_find (iter, key); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_init_find_w_len -- + * + * Initializes a #bson_iter_t and moves the iter to the first field + * matching @key. + * + * Returns: + * true if the field named @key was found; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_init_find_w_len (bson_iter_t *iter, /* INOUT */ + const bson_t *bson, /* IN */ + const char *key, /* IN */ + int keylen) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (bson); + BSON_ASSERT (key); + + return bson_iter_init (iter, bson) && + bson_iter_find_w_len (iter, key, keylen); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_init_find_case -- + * + * A case-insensitive version of bson_iter_init_find(). + * + * Returns: + * true if the field was found and @iter is observing that field. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_init_find_case (bson_iter_t *iter, /* INOUT */ + const bson_t *bson, /* IN */ + const char *key) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (bson); + BSON_ASSERT (key); + + return bson_iter_init (iter, bson) && bson_iter_find_case (iter, key); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_find_w_len -- + * + * Searches through @iter starting from the current position for a key + * matching @key. @keylen indicates the length of @key, or -1 to + * determine the length with strlen(). + * + * Returns: + * true if the field @key was found. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_find_w_len (bson_iter_t *iter, /* INOUT */ + const char *key, /* IN */ + int keylen) /* IN */ +{ + const char *ikey; + + if (keylen < 0) { + keylen = (int) strlen (key); + } + + while (bson_iter_next (iter)) { + ikey = bson_iter_key (iter); + + if ((0 == strncmp (key, ikey, keylen)) && (ikey[keylen] == '\0')) { + return true; + } + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_find -- + * + * Searches through @iter starting from the current position for a key + * matching @key. This is a case-sensitive search meaning "KEY" and + * "key" would NOT match. + * + * Returns: + * true if @key is found. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_find (bson_iter_t *iter, /* INOUT */ + const char *key) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (key); + + return bson_iter_find_w_len (iter, key, -1); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_find_case -- + * + * Searches through @iter starting from the current position for a key + * matching @key. This is a case-insensitive search meaning "KEY" and + * "key" would match. + * + * Returns: + * true if @key is found. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_find_case (bson_iter_t *iter, /* INOUT */ + const char *key) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (key); + + while (bson_iter_next (iter)) { + if (!bson_strcasecmp (key, bson_iter_key (iter))) { + return true; + } + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_find_descendant -- + * + * Locates a descendant using the "parent.child.key" notation. This + * operates similar to bson_iter_find() except that it can recurse + * into children documents using the dot notation. + * + * Returns: + * true if the descendant was found and @descendant was initialized. + * + * Side effects: + * @descendant may be initialized. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_find_descendant (bson_iter_t *iter, /* INOUT */ + const char *dotkey, /* IN */ + bson_iter_t *descendant) /* OUT */ +{ + bson_iter_t tmp; + const char *dot; + size_t sublen; + + BSON_ASSERT (iter); + BSON_ASSERT (dotkey); + BSON_ASSERT (descendant); + + if ((dot = strchr (dotkey, '.'))) { + sublen = dot - dotkey; + } else { + sublen = strlen (dotkey); + } + + if (bson_iter_find_w_len (iter, dotkey, (int) sublen)) { + if (!dot) { + *descendant = *iter; + return true; + } + + if (BSON_ITER_HOLDS_DOCUMENT (iter) || BSON_ITER_HOLDS_ARRAY (iter)) { + if (bson_iter_recurse (iter, &tmp)) { + return bson_iter_find_descendant (&tmp, dot + 1, descendant); + } + } + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_key -- + * + * Retrieves the key of the current field. The resulting key is valid + * while @iter is valid. + * + * Returns: + * A string that should not be modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_key (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + return bson_iter_key_unsafe (iter); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_type -- + * + * Retrieves the type of the current field. It may be useful to check + * the type using the BSON_ITER_HOLDS_*() macros. + * + * Returns: + * A bson_type_t. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_type_t +bson_iter_type (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (iter->raw); + BSON_ASSERT (iter->len); + + return bson_iter_type_unsafe (iter); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_iter_next_internal -- + * + * Internal function to advance @iter to the next field and retrieve + * the key and BSON type before error-checking. @next_keylen is + * the key length of the next field being iterated or 0 if this is + * not known. + * + * Return: + * true if an element was decoded, else false. + * + * Side effects: + * @key and @bson_type are set. + * + * If the return value is false: + * - @iter is invalidated: @iter->raw is NULLed + * - @unsupported is set to true if the bson type is unsupported + * - otherwise if the BSON is corrupt, @iter->err_off is nonzero + * - otherwise @bson_type is set to BSON_TYPE_EOD + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_iter_next_internal (bson_iter_t *iter, /* INOUT */ + uint32_t next_keylen, /* IN */ + const char **key, /* OUT */ + uint32_t *bson_type, /* OUT */ + bool *unsupported) /* OUT */ +{ + const uint8_t *data; + uint32_t o; + unsigned int len; + + BSON_ASSERT (iter); + + *unsupported = false; + + if (!iter->raw) { + *key = NULL; + *bson_type = BSON_TYPE_EOD; + return false; + } + + data = iter->raw; + len = iter->len; + + iter->off = iter->next_off; + iter->type = iter->off; + iter->key = iter->off + 1; + iter->d1 = 0; + iter->d2 = 0; + iter->d3 = 0; + iter->d4 = 0; + + if (next_keylen == 0) { + /* iterate from start to end of NULL-terminated key string */ + for (o = iter->key; o < len; o++) { + if (!data[o]) { + iter->d1 = ++o; + goto fill_data_fields; + } + } + } else { + o = iter->key + next_keylen + 1; + iter->d1 = o; + goto fill_data_fields; + } + + goto mark_invalid; + +fill_data_fields: + + *key = bson_iter_key_unsafe (iter); + *bson_type = ITER_TYPE (iter); + + switch (*bson_type) { + case BSON_TYPE_DATE_TIME: + case BSON_TYPE_DOUBLE: + case BSON_TYPE_INT64: + case BSON_TYPE_TIMESTAMP: + iter->next_off = o + 8; + break; + case BSON_TYPE_CODE: + case BSON_TYPE_SYMBOL: + case BSON_TYPE_UTF8: { + uint32_t l; + + if ((o + 4) >= len) { + iter->err_off = o; + goto mark_invalid; + } + + iter->d2 = o + 4; + memcpy (&l, iter->raw + iter->d1, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + if (l > (len - (o + 4))) { + iter->err_off = o; + goto mark_invalid; + } + + iter->next_off = o + 4 + l; + + /* + * Make sure the string length includes the NUL byte. + */ + if (BSON_UNLIKELY ((l == 0) || (iter->next_off >= len))) { + iter->err_off = o; + goto mark_invalid; + } + + /* + * Make sure the last byte is a NUL byte. + */ + if (BSON_UNLIKELY ((iter->raw + iter->d2)[l - 1] != '\0')) { + iter->err_off = o + 4 + l - 1; + goto mark_invalid; + } + } break; + case BSON_TYPE_BINARY: { + bson_subtype_t subtype; + uint32_t l; + + if (o >= (len - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + iter->d2 = o + 4; + iter->d3 = o + 5; + + memcpy (&l, iter->raw + iter->d1, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + if (l >= (len - o - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + subtype = *(iter->raw + iter->d2); + + if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) { + int32_t binary_len; + + if (l < 4) { + iter->err_off = o; + goto mark_invalid; + } + + /* subtype 2 has a redundant length header in the data */ + memcpy (&binary_len, (iter->raw + iter->d3), sizeof (binary_len)); + binary_len = BSON_UINT32_FROM_LE (binary_len); + if (binary_len + 4 != l) { + iter->err_off = iter->d3; + goto mark_invalid; + } + } + + iter->next_off = o + 5 + l; + } break; + case BSON_TYPE_ARRAY: + case BSON_TYPE_DOCUMENT: { + uint32_t l; + + if (o >= (len - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + memcpy (&l, iter->raw + iter->d1, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + if ((l > len) || (l > (len - o))) { + iter->err_off = o; + goto mark_invalid; + } + + iter->next_off = o + l; + } break; + case BSON_TYPE_OID: + iter->next_off = o + 12; + break; + case BSON_TYPE_BOOL: { + char val; + + if (iter->d1 >= len) { + iter->err_off = o; + goto mark_invalid; + } + + memcpy (&val, iter->raw + iter->d1, 1); + if (val != 0x00 && val != 0x01) { + iter->err_off = o; + goto mark_invalid; + } + + iter->next_off = o + 1; + } break; + case BSON_TYPE_REGEX: { + bool eor = false; + bool eoo = false; + + for (; o < len; o++) { + if (!data[o]) { + iter->d2 = ++o; + eor = true; + break; + } + } + + if (!eor) { + iter->err_off = iter->next_off; + goto mark_invalid; + } + + for (; o < len; o++) { + if (!data[o]) { + eoo = true; + break; + } + } + + if (!eoo) { + iter->err_off = iter->next_off; + goto mark_invalid; + } + + iter->next_off = o + 1; + } break; + case BSON_TYPE_DBPOINTER: { + uint32_t l; + + if (o >= (len - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + iter->d2 = o + 4; + memcpy (&l, iter->raw + iter->d1, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + /* Check valid string length. l counts '\0' but not 4 bytes for itself. */ + if (l == 0 || l > (len - o - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + if (*(iter->raw + o + l + 3)) { + /* not null terminated */ + iter->err_off = o + l + 3; + goto mark_invalid; + } + + iter->d3 = o + 4 + l; + iter->next_off = o + 4 + l + 12; + } break; + case BSON_TYPE_CODEWSCOPE: { + uint32_t l; + uint32_t doclen; + + if ((len < 19) || (o >= (len - 14))) { + iter->err_off = o; + goto mark_invalid; + } + + iter->d2 = o + 4; + iter->d3 = o + 8; + + memcpy (&l, iter->raw + iter->d1, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + if ((l < 14) || (l >= (len - o))) { + iter->err_off = o; + goto mark_invalid; + } + + iter->next_off = o + l; + + if (iter->next_off >= len) { + iter->err_off = o; + goto mark_invalid; + } + + memcpy (&l, iter->raw + iter->d2, sizeof (l)); + l = BSON_UINT32_FROM_LE (l); + + if (l == 0 || l >= (len - o - 4 - 4)) { + iter->err_off = o; + goto mark_invalid; + } + + if ((o + 4 + 4 + l + 4) >= iter->next_off) { + iter->err_off = o + 4; + goto mark_invalid; + } + + iter->d4 = o + 4 + 4 + l; + memcpy (&doclen, iter->raw + iter->d4, sizeof (doclen)); + doclen = BSON_UINT32_FROM_LE (doclen); + + if ((o + 4 + 4 + l + doclen) != iter->next_off) { + iter->err_off = o + 4 + 4 + l; + goto mark_invalid; + } + } break; + case BSON_TYPE_INT32: + iter->next_off = o + 4; + break; + case BSON_TYPE_DECIMAL128: + iter->next_off = o + 16; + break; + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + case BSON_TYPE_NULL: + case BSON_TYPE_UNDEFINED: + iter->next_off = o; + break; + default: + *unsupported = true; + /* FALL THROUGH */ + case BSON_TYPE_EOD: + iter->err_off = o; + goto mark_invalid; + } + + /* + * Check to see if any of the field locations would overflow the + * current BSON buffer. If so, set the error location to the offset + * of where the field starts. + */ + if (iter->next_off >= len) { + iter->err_off = o; + goto mark_invalid; + } + + iter->err_off = 0; + + return true; + +mark_invalid: + iter->raw = NULL; + iter->len = 0; + iter->next_off = 0; + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_next -- + * + * Advances @iter to the next field of the underlying BSON document. + * If all fields have been exhausted, then %false is returned. + * + * It is a programming error to use @iter after this function has + * returned false. + * + * Returns: + * true if the iter was advanced to the next record. + * otherwise false and @iter should be considered invalid. + * + * Side effects: + * @iter may be invalidated. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_next (bson_iter_t *iter) /* INOUT */ +{ + uint32_t bson_type; + const char *key; + bool unsupported; + + return _bson_iter_next_internal (iter, 0, &key, &bson_type, &unsupported); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_binary -- + * + * Retrieves the BSON_TYPE_BINARY field. The subtype is stored in + * @subtype. The length of @binary in bytes is stored in @binary_len. + * + * @binary should not be modified or freed and is only valid while + * @iter's bson_t is valid and unmodified. + * + * Parameters: + * @iter: A bson_iter_t + * @subtype: A location for the binary subtype. + * @binary_len: A location for the length of @binary. + * @binary: A location for a pointer to the binary data. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_binary (const bson_iter_t *iter, /* IN */ + bson_subtype_t *subtype, /* OUT */ + uint32_t *binary_len, /* OUT */ + const uint8_t **binary) /* OUT */ +{ + bson_subtype_t backup; + + BSON_ASSERT (iter); + BSON_ASSERT (!binary || binary_len); + + if (ITER_TYPE (iter) == BSON_TYPE_BINARY) { + if (!subtype) { + subtype = &backup; + } + + *subtype = (bson_subtype_t) * (iter->raw + iter->d2); + + if (binary) { + memcpy (binary_len, (iter->raw + iter->d1), sizeof (*binary_len)); + *binary_len = BSON_UINT32_FROM_LE (*binary_len); + *binary = iter->raw + iter->d3; + + if (*subtype == BSON_SUBTYPE_BINARY_DEPRECATED) { + *binary_len -= sizeof (int32_t); + *binary += sizeof (int32_t); + } + } + + return; + } + + if (binary) { + *binary = NULL; + } + + if (binary_len) { + *binary_len = 0; + } + + if (subtype) { + *subtype = BSON_SUBTYPE_BINARY; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_bool -- + * + * Retrieves the current field of type BSON_TYPE_BOOL. + * + * Returns: + * true or false, dependent on bson document. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_bool (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_BOOL) { + return bson_iter_bool_unsafe (iter); + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_as_bool -- + * + * If @iter is on a boolean field, returns the boolean. If it is on a + * non-boolean field such as int32, int64, or double, it will convert + * the value to a boolean. + * + * Zero is false, and non-zero is true. + * + * Returns: + * true or false, dependent on field type. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_iter_as_bool (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + switch ((int) ITER_TYPE (iter)) { + case BSON_TYPE_BOOL: + return bson_iter_bool (iter); + case BSON_TYPE_DOUBLE: + return !(bson_iter_double (iter) == 0.0); + case BSON_TYPE_INT64: + return !(bson_iter_int64 (iter) == 0); + case BSON_TYPE_INT32: + return !(bson_iter_int32 (iter) == 0); + case BSON_TYPE_UTF8: + return true; + case BSON_TYPE_NULL: + case BSON_TYPE_UNDEFINED: + return false; + default: + return true; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_double -- + * + * Retrieves the current field of type BSON_TYPE_DOUBLE. + * + * Returns: + * A double. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +double +bson_iter_double (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DOUBLE) { + return bson_iter_double_unsafe (iter); + } + + return 0; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_as_double -- + * + * If @iter is on a field of type BSON_TYPE_DOUBLE, + * returns the double. If it is on an integer field + * such as int32, int64, or bool, it will convert + * the value to a double. + * + * + * Returns: + * A double. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +double +bson_iter_as_double (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + switch ((int) ITER_TYPE (iter)) { + case BSON_TYPE_BOOL: + return (double) bson_iter_bool (iter); + case BSON_TYPE_DOUBLE: + return bson_iter_double (iter); + case BSON_TYPE_INT32: + return (double) bson_iter_int32 (iter); + case BSON_TYPE_INT64: + return (double) bson_iter_int64 (iter); + default: + return 0; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_int32 -- + * + * Retrieves the value of the field of type BSON_TYPE_INT32. + * + * Returns: + * A 32-bit signed integer. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int32_t +bson_iter_int32 (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_INT32) { + return bson_iter_int32_unsafe (iter); + } + + return 0; +} + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_int64 -- + * + * Retrieves a 64-bit signed integer for the current BSON_TYPE_INT64 + * field. + * + * Returns: + * A 64-bit signed integer. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int64_t +bson_iter_int64 (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_INT64) { + return bson_iter_int64_unsafe (iter); + } + + return 0; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_as_int64 -- + * + * If @iter is not an int64 field, it will try to convert the value to + * an int64. Such field types include: + * + * - bool + * - double + * - int32 + * + * Returns: + * An int64_t. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int64_t +bson_iter_as_int64 (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + switch ((int) ITER_TYPE (iter)) { + case BSON_TYPE_BOOL: + return (int64_t) bson_iter_bool (iter); + case BSON_TYPE_DOUBLE: + return (int64_t) bson_iter_double (iter); + case BSON_TYPE_INT64: + return bson_iter_int64 (iter); + case BSON_TYPE_INT32: + return (int64_t) bson_iter_int32 (iter); + default: + return 0; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_decimal128 -- + * + * This function retrieves the current field of type + *%BSON_TYPE_DECIMAL128. + * The result is valid while @iter is valid, and is stored in @dec. + * + * Returns: + * + * True on success, false on failure. + * + * Side Effects: + * None. + * + *-------------------------------------------------------------------------- + */ +bool +bson_iter_decimal128 (const bson_iter_t *iter, /* IN */ + bson_decimal128_t *dec) /* OUT */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DECIMAL128) { + bson_iter_decimal128_unsafe (iter, dec); + return true; + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_oid -- + * + * Retrieves the current field of type %BSON_TYPE_OID. The result is + * valid while @iter is valid. + * + * Returns: + * A bson_oid_t that should not be modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const bson_oid_t * +bson_iter_oid (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_OID) { + return bson_iter_oid_unsafe (iter); + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_regex -- + * + * Fetches the current field from the iter which should be of type + * BSON_TYPE_REGEX. + * + * Returns: + * Regex from @iter. This should not be modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_regex (const bson_iter_t *iter, /* IN */ + const char **options) /* IN */ +{ + const char *ret = NULL; + const char *ret_options = NULL; + + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_REGEX) { + ret = (const char *) (iter->raw + iter->d1); + ret_options = (const char *) (iter->raw + iter->d2); + } + + if (options) { + *options = ret_options; + } + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_utf8 -- + * + * Retrieves the current field of type %BSON_TYPE_UTF8 as a UTF-8 + * encoded string. + * + * Parameters: + * @iter: A bson_iter_t. + * @length: A location for the length of the string. + * + * Returns: + * A string that should not be modified or freed. + * + * Side effects: + * @length will be set to the result strings length if non-NULL. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_utf8 (const bson_iter_t *iter, /* IN */ + uint32_t *length) /* OUT */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_UTF8) { + if (length) { + *length = bson_iter_utf8_len_unsafe (iter); + } + + return (const char *) (iter->raw + iter->d2); + } + + if (length) { + *length = 0; + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_dup_utf8 -- + * + * Copies the current UTF-8 element into a newly allocated string. The + * string should be freed using bson_free() when the caller is + * finished with it. + * + * Returns: + * A newly allocated char* that should be freed with bson_free(). + * + * Side effects: + * @length will be set to the result strings length if non-NULL. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_iter_dup_utf8 (const bson_iter_t *iter, /* IN */ + uint32_t *length) /* OUT */ +{ + uint32_t local_length = 0; + const char *str; + char *ret = NULL; + + BSON_ASSERT (iter); + + if ((str = bson_iter_utf8 (iter, &local_length))) { + ret = bson_malloc0 (local_length + 1); + memcpy (ret, str, local_length); + ret[local_length] = '\0'; + } + + if (length) { + *length = local_length; + } + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_code -- + * + * Retrieves the current field of type %BSON_TYPE_CODE. The length of + * the resulting string is stored in @length. + * + * Parameters: + * @iter: A bson_iter_t. + * @length: A location for the code length. + * + * Returns: + * A NUL-terminated string containing the code which should not be + * modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_code (const bson_iter_t *iter, /* IN */ + uint32_t *length) /* OUT */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_CODE) { + if (length) { + *length = bson_iter_utf8_len_unsafe (iter); + } + + return (const char *) (iter->raw + iter->d2); + } + + if (length) { + *length = 0; + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_codewscope -- + * + * Similar to bson_iter_code() but with a scope associated encoded as + * a BSON document. @scope should not be modified or freed. It is + * valid while @iter is valid. + * + * Parameters: + * @iter: A #bson_iter_t. + * @length: A location for the length of resulting string. + * @scope_len: A location for the length of @scope. + * @scope: A location for the scope encoded as BSON. + * + * Returns: + * A NUL-terminated string that should not be modified or freed. + * + * Side effects: + * @length is set to the resulting string length in bytes. + * @scope_len is set to the length of @scope in bytes. + * @scope is set to the scope documents buffer which can be + * turned into a bson document with bson_init_static(). + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_codewscope (const bson_iter_t *iter, /* IN */ + uint32_t *length, /* OUT */ + uint32_t *scope_len, /* OUT */ + const uint8_t **scope) /* OUT */ +{ + uint32_t len; + + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_CODEWSCOPE) { + if (length) { + memcpy (&len, iter->raw + iter->d2, sizeof (len)); + /* The string length was checked > 0 in _bson_iter_next_internal. */ + len = BSON_UINT32_FROM_LE (len); + BSON_ASSERT (len > 0); + *length = len - 1; + } + + memcpy (&len, iter->raw + iter->d4, sizeof (len)); + *scope_len = BSON_UINT32_FROM_LE (len); + *scope = iter->raw + iter->d4; + return (const char *) (iter->raw + iter->d3); + } + + if (length) { + *length = 0; + } + + if (scope_len) { + *scope_len = 0; + } + + if (scope) { + *scope = NULL; + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_dbpointer -- + * + * Retrieves a BSON_TYPE_DBPOINTER field. @collection_len will be set + * to the length of the collection name. The collection name will be + * placed into @collection. The oid will be placed into @oid. + * + * @collection and @oid should not be modified. + * + * Parameters: + * @iter: A #bson_iter_t. + * @collection_len: A location for the length of @collection. + * @collection: A location for the collection name. + * @oid: A location for the oid. + * + * Returns: + * None. + * + * Side effects: + * @collection_len is set to the length of @collection in bytes + * excluding the null byte. + * @collection is set to the collection name, including a terminating + * null byte. + * @oid is initialized with the oid. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_dbpointer (const bson_iter_t *iter, /* IN */ + uint32_t *collection_len, /* OUT */ + const char **collection, /* OUT */ + const bson_oid_t **oid) /* OUT */ +{ + BSON_ASSERT (iter); + + if (collection) { + *collection = NULL; + } + + if (oid) { + *oid = NULL; + } + + if (ITER_TYPE (iter) == BSON_TYPE_DBPOINTER) { + if (collection_len) { + memcpy ( + collection_len, (iter->raw + iter->d1), sizeof (*collection_len)); + *collection_len = BSON_UINT32_FROM_LE (*collection_len); + + if ((*collection_len) > 0) { + (*collection_len)--; + } + } + + if (collection) { + *collection = (const char *) (iter->raw + iter->d2); + } + + if (oid) { + *oid = (const bson_oid_t *) (iter->raw + iter->d3); + } + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_symbol -- + * + * Retrieves the symbol of the current field of type BSON_TYPE_SYMBOL. + * + * Parameters: + * @iter: A bson_iter_t. + * @length: A location for the length of the symbol. + * + * Returns: + * A string containing the symbol as UTF-8. The value should not be + * modified or freed. + * + * Side effects: + * @length is set to the resulting strings length in bytes, + * excluding the null byte. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_iter_symbol (const bson_iter_t *iter, /* IN */ + uint32_t *length) /* OUT */ +{ + const char *ret = NULL; + uint32_t ret_length = 0; + + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_SYMBOL) { + ret = (const char *) (iter->raw + iter->d2); + ret_length = bson_iter_utf8_len_unsafe (iter); + } + + if (length) { + *length = ret_length; + } + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_date_time -- + * + * Fetches the number of milliseconds elapsed since the UNIX epoch. + * This value can be negative as times before 1970 are valid. + * + * Returns: + * A signed 64-bit integer containing the number of milliseconds. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int64_t +bson_iter_date_time (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DATE_TIME) { + return bson_iter_int64_unsafe (iter); + } + + return 0; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_time_t -- + * + * Retrieves the current field of type BSON_TYPE_DATE_TIME as a + * time_t. + * + * Returns: + * A #time_t of the number of seconds since UNIX epoch in UTC. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +time_t +bson_iter_time_t (const bson_iter_t *iter) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DATE_TIME) { + return bson_iter_time_t_unsafe (iter); + } + + return 0; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_timestamp -- + * + * Fetches the current field if it is a BSON_TYPE_TIMESTAMP. + * + * Parameters: + * @iter: A #bson_iter_t. + * @timestamp: a location for the timestamp. + * @increment: A location for the increment. + * + * Returns: + * None. + * + * Side effects: + * @timestamp is initialized. + * @increment is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_timestamp (const bson_iter_t *iter, /* IN */ + uint32_t *timestamp, /* OUT */ + uint32_t *increment) /* OUT */ +{ + uint64_t encoded; + uint32_t ret_timestamp = 0; + uint32_t ret_increment = 0; + + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_TIMESTAMP) { + memcpy (&encoded, iter->raw + iter->d1, sizeof (encoded)); + encoded = BSON_UINT64_FROM_LE (encoded); + ret_timestamp = (encoded >> 32) & 0xFFFFFFFF; + ret_increment = encoded & 0xFFFFFFFF; + } + + if (timestamp) { + *timestamp = ret_timestamp; + } + + if (increment) { + *increment = ret_increment; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_timeval -- + * + * Retrieves the current field of type BSON_TYPE_DATE_TIME and stores + * it into the struct timeval provided. tv->tv_sec is set to the + * number of seconds since the UNIX epoch in UTC. + * + * Since BSON_TYPE_DATE_TIME does not support fractions of a second, + * tv->tv_usec will always be set to zero. + * + * Returns: + * None. + * + * Side effects: + * @tv is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_timeval (const bson_iter_t *iter, /* IN */ + struct timeval *tv) /* OUT */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DATE_TIME) { + bson_iter_timeval_unsafe (iter, tv); + return; + } + + memset (tv, 0, sizeof *tv); +} + + +/** + * bson_iter_document: + * @iter: a bson_iter_t. + * @document_len: A location for the document length. + * @document: A location for a pointer to the document buffer. + * + */ +/* + *-------------------------------------------------------------------------- + * + * bson_iter_document -- + * + * Retrieves the data to the document BSON structure and stores the + * length of the document buffer in @document_len and the document + * buffer in @document. + * + * If you would like to iterate over the child contents, you might + * consider creating a bson_t on the stack such as the following. It + * allows you to call functions taking a const bson_t* only. + * + * bson_t b; + * uint32_t len; + * const uint8_t *data; + * + * bson_iter_document(iter, &len, &data); + * + * if (bson_init_static (&b, data, len)) { + * ... + * } + * + * There is no need to cleanup the bson_t structure as no data can be + * modified in the process of its use (as it is static/const). + * + * Returns: + * None. + * + * Side effects: + * @document_len is initialized. + * @document is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_document (const bson_iter_t *iter, /* IN */ + uint32_t *document_len, /* OUT */ + const uint8_t **document) /* OUT */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (document_len); + BSON_ASSERT (document); + + *document = NULL; + *document_len = 0; + + if (ITER_TYPE (iter) == BSON_TYPE_DOCUMENT) { + memcpy (document_len, (iter->raw + iter->d1), sizeof (*document_len)); + *document_len = BSON_UINT32_FROM_LE (*document_len); + *document = (iter->raw + iter->d1); + } +} + + +/** + * bson_iter_array: + * @iter: a #bson_iter_t. + * @array_len: A location for the array length. + * @array: A location for a pointer to the array buffer. + */ +/* + *-------------------------------------------------------------------------- + * + * bson_iter_array -- + * + * Retrieves the data to the array BSON structure and stores the + * length of the array buffer in @array_len and the array buffer in + * @array. + * + * If you would like to iterate over the child contents, you might + * consider creating a bson_t on the stack such as the following. It + * allows you to call functions taking a const bson_t* only. + * + * bson_t b; + * uint32_t len; + * const uint8_t *data; + * + * bson_iter_array (iter, &len, &data); + * + * if (bson_init_static (&b, data, len)) { + * ... + * } + * + * There is no need to cleanup the #bson_t structure as no data can be + * modified in the process of its use. + * + * Returns: + * None. + * + * Side effects: + * @array_len is initialized. + * @array is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_array (const bson_iter_t *iter, /* IN */ + uint32_t *array_len, /* OUT */ + const uint8_t **array) /* OUT */ +{ + BSON_ASSERT (iter); + BSON_ASSERT (array_len); + BSON_ASSERT (array); + + *array = NULL; + *array_len = 0; + + if (ITER_TYPE (iter) == BSON_TYPE_ARRAY) { + memcpy (array_len, (iter->raw + iter->d1), sizeof (*array_len)); + *array_len = BSON_UINT32_FROM_LE (*array_len); + *array = (iter->raw + iter->d1); + } +} + + +#define VISIT_FIELD(name) visitor->visit_##name && visitor->visit_##name +#define VISIT_AFTER VISIT_FIELD (after) +#define VISIT_BEFORE VISIT_FIELD (before) +#define VISIT_CORRUPT \ + if (visitor->visit_corrupt) \ + visitor->visit_corrupt +#define VISIT_DOUBLE VISIT_FIELD (double) +#define VISIT_UTF8 VISIT_FIELD (utf8) +#define VISIT_DOCUMENT VISIT_FIELD (document) +#define VISIT_ARRAY VISIT_FIELD (array) +#define VISIT_BINARY VISIT_FIELD (binary) +#define VISIT_UNDEFINED VISIT_FIELD (undefined) +#define VISIT_OID VISIT_FIELD (oid) +#define VISIT_BOOL VISIT_FIELD (bool) +#define VISIT_DATE_TIME VISIT_FIELD (date_time) +#define VISIT_NULL VISIT_FIELD (null) +#define VISIT_REGEX VISIT_FIELD (regex) +#define VISIT_DBPOINTER VISIT_FIELD (dbpointer) +#define VISIT_CODE VISIT_FIELD (code) +#define VISIT_SYMBOL VISIT_FIELD (symbol) +#define VISIT_CODEWSCOPE VISIT_FIELD (codewscope) +#define VISIT_INT32 VISIT_FIELD (int32) +#define VISIT_TIMESTAMP VISIT_FIELD (timestamp) +#define VISIT_INT64 VISIT_FIELD (int64) +#define VISIT_DECIMAL128 VISIT_FIELD (decimal128) +#define VISIT_MAXKEY VISIT_FIELD (maxkey) +#define VISIT_MINKEY VISIT_FIELD (minkey) + + +bool +bson_iter_visit_all (bson_iter_t *iter, /* INOUT */ + const bson_visitor_t *visitor, /* IN */ + void *data) /* IN */ +{ + uint32_t bson_type; + const char *key; + bool unsupported; + + BSON_ASSERT (iter); + BSON_ASSERT (visitor); + + while (_bson_iter_next_internal (iter, 0, &key, &bson_type, &unsupported)) { + if (*key && !bson_utf8_validate (key, strlen (key), false)) { + iter->err_off = iter->off; + break; + } + + if (VISIT_BEFORE (iter, key, data)) { + return true; + } + + switch (bson_type) { + case BSON_TYPE_DOUBLE: + + if (VISIT_DOUBLE (iter, key, bson_iter_double (iter), data)) { + return true; + } + + break; + case BSON_TYPE_UTF8: { + uint32_t utf8_len; + const char *utf8; + + utf8 = bson_iter_utf8 (iter, &utf8_len); + + if (!bson_utf8_validate (utf8, utf8_len, true)) { + iter->err_off = iter->off; + return true; + } + + if (VISIT_UTF8 (iter, key, utf8_len, utf8, data)) { + return true; + } + } break; + case BSON_TYPE_DOCUMENT: { + const uint8_t *docbuf = NULL; + uint32_t doclen = 0; + bson_t b; + + bson_iter_document (iter, &doclen, &docbuf); + + if (bson_init_static (&b, docbuf, doclen) && + VISIT_DOCUMENT (iter, key, &b, data)) { + return true; + } + } break; + case BSON_TYPE_ARRAY: { + const uint8_t *docbuf = NULL; + uint32_t doclen = 0; + bson_t b; + + bson_iter_array (iter, &doclen, &docbuf); + + if (bson_init_static (&b, docbuf, doclen) && + VISIT_ARRAY (iter, key, &b, data)) { + return true; + } + } break; + case BSON_TYPE_BINARY: { + const uint8_t *binary = NULL; + bson_subtype_t subtype = BSON_SUBTYPE_BINARY; + uint32_t binary_len = 0; + + bson_iter_binary (iter, &subtype, &binary_len, &binary); + + if (VISIT_BINARY (iter, key, subtype, binary_len, binary, data)) { + return true; + } + } break; + case BSON_TYPE_UNDEFINED: + + if (VISIT_UNDEFINED (iter, key, data)) { + return true; + } + + break; + case BSON_TYPE_OID: + + if (VISIT_OID (iter, key, bson_iter_oid (iter), data)) { + return true; + } + + break; + case BSON_TYPE_BOOL: + + if (VISIT_BOOL (iter, key, bson_iter_bool (iter), data)) { + return true; + } + + break; + case BSON_TYPE_DATE_TIME: + + if (VISIT_DATE_TIME (iter, key, bson_iter_date_time (iter), data)) { + return true; + } + + break; + case BSON_TYPE_NULL: + + if (VISIT_NULL (iter, key, data)) { + return true; + } + + break; + case BSON_TYPE_REGEX: { + const char *regex = NULL; + const char *options = NULL; + regex = bson_iter_regex (iter, &options); + + if (!bson_utf8_validate (regex, strlen (regex), true)) { + iter->err_off = iter->off; + return true; + } + + if (VISIT_REGEX (iter, key, regex, options, data)) { + return true; + } + } break; + case BSON_TYPE_DBPOINTER: { + uint32_t collection_len = 0; + const char *collection = NULL; + const bson_oid_t *oid = NULL; + + bson_iter_dbpointer (iter, &collection_len, &collection, &oid); + + if (!bson_utf8_validate (collection, collection_len, true)) { + iter->err_off = iter->off; + return true; + } + + if (VISIT_DBPOINTER ( + iter, key, collection_len, collection, oid, data)) { + return true; + } + } break; + case BSON_TYPE_CODE: { + uint32_t code_len; + const char *code; + + code = bson_iter_code (iter, &code_len); + + if (!bson_utf8_validate (code, code_len, true)) { + iter->err_off = iter->off; + return true; + } + + if (VISIT_CODE (iter, key, code_len, code, data)) { + return true; + } + } break; + case BSON_TYPE_SYMBOL: { + uint32_t symbol_len; + const char *symbol; + + symbol = bson_iter_symbol (iter, &symbol_len); + + if (!bson_utf8_validate (symbol, symbol_len, true)) { + iter->err_off = iter->off; + return true; + } + + if (VISIT_SYMBOL (iter, key, symbol_len, symbol, data)) { + return true; + } + } break; + case BSON_TYPE_CODEWSCOPE: { + uint32_t length = 0; + const char *code; + const uint8_t *docbuf = NULL; + uint32_t doclen = 0; + bson_t b; + + code = bson_iter_codewscope (iter, &length, &doclen, &docbuf); + + if (!bson_utf8_validate (code, length, true)) { + iter->err_off = iter->off; + return true; + } + + if (bson_init_static (&b, docbuf, doclen) && + VISIT_CODEWSCOPE (iter, key, length, code, &b, data)) { + return true; + } + } break; + case BSON_TYPE_INT32: + + if (VISIT_INT32 (iter, key, bson_iter_int32 (iter), data)) { + return true; + } + + break; + case BSON_TYPE_TIMESTAMP: { + uint32_t timestamp; + uint32_t increment; + bson_iter_timestamp (iter, ×tamp, &increment); + + if (VISIT_TIMESTAMP (iter, key, timestamp, increment, data)) { + return true; + } + } break; + case BSON_TYPE_INT64: + + if (VISIT_INT64 (iter, key, bson_iter_int64 (iter), data)) { + return true; + } + + break; + case BSON_TYPE_DECIMAL128: { + bson_decimal128_t dec; + bson_iter_decimal128 (iter, &dec); + + if (VISIT_DECIMAL128 (iter, key, &dec, data)) { + return true; + } + } break; + case BSON_TYPE_MAXKEY: + + if (VISIT_MAXKEY (iter, bson_iter_key_unsafe (iter), data)) { + return true; + } + + break; + case BSON_TYPE_MINKEY: + + if (VISIT_MINKEY (iter, bson_iter_key_unsafe (iter), data)) { + return true; + } + + break; + case BSON_TYPE_EOD: + default: + break; + } + + if (VISIT_AFTER (iter, bson_iter_key_unsafe (iter), data)) { + return true; + } + } + + if (iter->err_off) { + if (unsupported && visitor->visit_unsupported_type && + bson_utf8_validate (key, strlen (key), false)) { + visitor->visit_unsupported_type (iter, key, bson_type, data); + return false; + } + + VISIT_CORRUPT (iter, data); + } + +#undef VISIT_FIELD + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_overwrite_bool -- + * + * Overwrites the current BSON_TYPE_BOOLEAN field with a new value. + * This is performed in-place and therefore no keys are moved. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_overwrite_bool (bson_iter_t *iter, /* IN */ + bool value) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_BOOL) { + memcpy ((void *) (iter->raw + iter->d1), &value, 1); + } +} + + +void +bson_iter_overwrite_oid (bson_iter_t *iter, const bson_oid_t *value) +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_OID) { + memcpy ( + (void *) (iter->raw + iter->d1), value->bytes, sizeof (value->bytes)); + } +} + + +void +bson_iter_overwrite_timestamp (bson_iter_t *iter, + uint32_t timestamp, + uint32_t increment) +{ + uint64_t value; + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_TIMESTAMP) { + value = ((((uint64_t) timestamp) << 32U) | ((uint64_t) increment)); + value = BSON_UINT64_TO_LE (value); + memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); + } +} + + +void +bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value) +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DATE_TIME) { + value = BSON_UINT64_TO_LE (value); + memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_overwrite_int32 -- + * + * Overwrites the current BSON_TYPE_INT32 field with a new value. + * This is performed in-place and therefore no keys are moved. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_overwrite_int32 (bson_iter_t *iter, /* IN */ + int32_t value) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_INT32) { +#if BSON_BYTE_ORDER != BSON_LITTLE_ENDIAN + value = BSON_UINT32_TO_LE (value); +#endif + memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_overwrite_int64 -- + * + * Overwrites the current BSON_TYPE_INT64 field with a new value. + * This is performed in-place and therefore no keys are moved. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_overwrite_int64 (bson_iter_t *iter, /* IN */ + int64_t value) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_INT64) { +#if BSON_BYTE_ORDER != BSON_LITTLE_ENDIAN + value = BSON_UINT64_TO_LE (value); +#endif + memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_overwrite_double -- + * + * Overwrites the current BSON_TYPE_DOUBLE field with a new value. + * This is performed in-place and therefore no keys are moved. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_iter_overwrite_double (bson_iter_t *iter, /* IN */ + double value) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DOUBLE) { + value = BSON_DOUBLE_TO_LE (value); + memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_overwrite_decimal128 -- + * + * Overwrites the current BSON_TYPE_DECIMAL128 field with a new value. + * This is performed in-place and therefore no keys are moved. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ +void +bson_iter_overwrite_decimal128 (bson_iter_t *iter, /* IN */ + bson_decimal128_t *value) /* IN */ +{ + BSON_ASSERT (iter); + + if (ITER_TYPE (iter) == BSON_TYPE_DECIMAL128) { +#if BSON_BYTE_ORDER != BSON_LITTLE_ENDIAN + uint64_t data[2]; + data[0] = BSON_UINT64_TO_LE (value->low); + data[1] = BSON_UINT64_TO_LE (value->high); + memcpy ((void *) (iter->raw + iter->d1), data, sizeof (data)); +#else + memcpy ((void *) (iter->raw + iter->d1), value, sizeof (*value)); +#endif + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_iter_value -- + * + * Retrieves a bson_value_t containing the boxed value of the current + * element. The result of this function valid until the state of + * iter has been changed (through the use of bson_iter_next()). + * + * Returns: + * A bson_value_t that should not be modified or freed. If you need + * to hold on to the value, use bson_value_copy(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const bson_value_t * +bson_iter_value (bson_iter_t *iter) /* IN */ +{ + bson_value_t *value; + + BSON_ASSERT (iter); + + value = &iter->value; + value->value_type = ITER_TYPE (iter); + + switch (value->value_type) { + case BSON_TYPE_DOUBLE: + value->value.v_double = bson_iter_double (iter); + break; + case BSON_TYPE_UTF8: + value->value.v_utf8.str = + (char *) bson_iter_utf8 (iter, &value->value.v_utf8.len); + break; + case BSON_TYPE_DOCUMENT: + bson_iter_document (iter, + &value->value.v_doc.data_len, + (const uint8_t **) &value->value.v_doc.data); + break; + case BSON_TYPE_ARRAY: + bson_iter_array (iter, + &value->value.v_doc.data_len, + (const uint8_t **) &value->value.v_doc.data); + break; + case BSON_TYPE_BINARY: + bson_iter_binary (iter, + &value->value.v_binary.subtype, + &value->value.v_binary.data_len, + (const uint8_t **) &value->value.v_binary.data); + break; + case BSON_TYPE_OID: + bson_oid_copy (bson_iter_oid (iter), &value->value.v_oid); + break; + case BSON_TYPE_BOOL: + value->value.v_bool = bson_iter_bool (iter); + break; + case BSON_TYPE_DATE_TIME: + value->value.v_datetime = bson_iter_date_time (iter); + break; + case BSON_TYPE_REGEX: + value->value.v_regex.regex = (char *) bson_iter_regex ( + iter, (const char **) &value->value.v_regex.options); + break; + case BSON_TYPE_DBPOINTER: { + const bson_oid_t *oid; + + bson_iter_dbpointer (iter, + &value->value.v_dbpointer.collection_len, + (const char **) &value->value.v_dbpointer.collection, + &oid); + bson_oid_copy (oid, &value->value.v_dbpointer.oid); + break; + } + case BSON_TYPE_CODE: + value->value.v_code.code = + (char *) bson_iter_code (iter, &value->value.v_code.code_len); + break; + case BSON_TYPE_SYMBOL: + value->value.v_symbol.symbol = + (char *) bson_iter_symbol (iter, &value->value.v_symbol.len); + break; + case BSON_TYPE_CODEWSCOPE: + value->value.v_codewscope.code = (char *) bson_iter_codewscope ( + iter, + &value->value.v_codewscope.code_len, + &value->value.v_codewscope.scope_len, + (const uint8_t **) &value->value.v_codewscope.scope_data); + break; + case BSON_TYPE_INT32: + value->value.v_int32 = bson_iter_int32 (iter); + break; + case BSON_TYPE_TIMESTAMP: + bson_iter_timestamp (iter, + &value->value.v_timestamp.timestamp, + &value->value.v_timestamp.increment); + break; + case BSON_TYPE_INT64: + value->value.v_int64 = bson_iter_int64 (iter); + break; + case BSON_TYPE_DECIMAL128: + bson_iter_decimal128 (iter, &(value->value.v_decimal128)); + break; + case BSON_TYPE_NULL: + case BSON_TYPE_UNDEFINED: + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + break; + case BSON_TYPE_EOD: + default: + return NULL; + } + + return value; +} + +uint32_t +bson_iter_key_len (const bson_iter_t *iter) +{ + /* + * f i e l d n a m e \0 _ + * ^ ^ + * | | + * iter->key iter->d1 + * + */ + BSON_ASSERT (iter->d1 > iter->key); + return iter->d1 - iter->key - 1; +} + +bool +bson_iter_init_from_data_at_offset (bson_iter_t *iter, + const uint8_t *data, + size_t length, + uint32_t offset, + uint32_t keylen) +{ + const char *key; + uint32_t bson_type; + bool unsupported; + + BSON_ASSERT (iter); + BSON_ASSERT (data); + + if (BSON_UNLIKELY ((length < 5) || (length > INT_MAX))) { + memset (iter, 0, sizeof *iter); + return false; + } + + iter->raw = (uint8_t *) data; + iter->len = (uint32_t) length; + iter->off = 0; + iter->type = 0; + iter->key = 0; + iter->next_off = offset; + iter->err_off = 0; + + if (!_bson_iter_next_internal ( + iter, keylen, &key, &bson_type, &unsupported)) { + memset (iter, 0, sizeof *iter); + return false; + } + + return true; +} + +uint32_t +bson_iter_offset (bson_iter_t *iter) +{ + return iter->off; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.h new file mode 100644 index 0000000..d48ca0f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-iter.h @@ -0,0 +1,550 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_ITER_H +#define BSON_ITER_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson.h" +#include "bson/bson-endian.h" +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +#define BSON_ITER_HOLDS_DOUBLE(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DOUBLE) + +#define BSON_ITER_HOLDS_UTF8(iter) (bson_iter_type ((iter)) == BSON_TYPE_UTF8) + +#define BSON_ITER_HOLDS_DOCUMENT(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DOCUMENT) + +#define BSON_ITER_HOLDS_ARRAY(iter) (bson_iter_type ((iter)) == BSON_TYPE_ARRAY) + +#define BSON_ITER_HOLDS_BINARY(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_BINARY) + +#define BSON_ITER_HOLDS_UNDEFINED(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_UNDEFINED) + +#define BSON_ITER_HOLDS_OID(iter) (bson_iter_type ((iter)) == BSON_TYPE_OID) + +#define BSON_ITER_HOLDS_BOOL(iter) (bson_iter_type ((iter)) == BSON_TYPE_BOOL) + +#define BSON_ITER_HOLDS_DATE_TIME(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DATE_TIME) + +#define BSON_ITER_HOLDS_NULL(iter) (bson_iter_type ((iter)) == BSON_TYPE_NULL) + +#define BSON_ITER_HOLDS_REGEX(iter) (bson_iter_type ((iter)) == BSON_TYPE_REGEX) + +#define BSON_ITER_HOLDS_DBPOINTER(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DBPOINTER) + +#define BSON_ITER_HOLDS_CODE(iter) (bson_iter_type ((iter)) == BSON_TYPE_CODE) + +#define BSON_ITER_HOLDS_SYMBOL(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_SYMBOL) + +#define BSON_ITER_HOLDS_CODEWSCOPE(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_CODEWSCOPE) + +#define BSON_ITER_HOLDS_INT32(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT32) + +#define BSON_ITER_HOLDS_TIMESTAMP(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_TIMESTAMP) + +#define BSON_ITER_HOLDS_INT64(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT64) + +#define BSON_ITER_HOLDS_DECIMAL128(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_DECIMAL128) + +#define BSON_ITER_HOLDS_MAXKEY(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_MAXKEY) + +#define BSON_ITER_HOLDS_MINKEY(iter) \ + (bson_iter_type ((iter)) == BSON_TYPE_MINKEY) + +#define BSON_ITER_HOLDS_INT(iter) \ + (BSON_ITER_HOLDS_INT32 (iter) || BSON_ITER_HOLDS_INT64 (iter)) + +#define BSON_ITER_HOLDS_NUMBER(iter) \ + (BSON_ITER_HOLDS_INT (iter) || BSON_ITER_HOLDS_DOUBLE (iter)) + +#define BSON_ITER_IS_KEY(iter, key) \ + (0 == strcmp ((key), bson_iter_key ((iter)))) + + +BSON_EXPORT (const bson_value_t *) +bson_iter_value (bson_iter_t *iter); + + +/** + * bson_iter_utf8_len_unsafe: + * @iter: a bson_iter_t. + * + * Returns the length of a string currently pointed to by @iter. This performs + * no validation so the is responsible for knowing the BSON is valid. Calling + * bson_validate() is one way to do this ahead of time. + */ +static BSON_INLINE uint32_t +bson_iter_utf8_len_unsafe (const bson_iter_t *iter) +{ + int32_t val; + + memcpy (&val, iter->raw + iter->d1, sizeof (val)); + val = BSON_UINT32_FROM_LE (val); + return BSON_MAX (0, val - 1); +} + + +BSON_EXPORT (void) +bson_iter_array (const bson_iter_t *iter, + uint32_t *array_len, + const uint8_t **array); + + +BSON_EXPORT (void) +bson_iter_binary (const bson_iter_t *iter, + bson_subtype_t *subtype, + uint32_t *binary_len, + const uint8_t **binary); + + +BSON_EXPORT (const char *) +bson_iter_code (const bson_iter_t *iter, uint32_t *length); + + +/** + * bson_iter_code_unsafe: + * @iter: A bson_iter_t. + * @length: A location for the length of the resulting string. + * + * Like bson_iter_code() but performs no integrity checks. + * + * Returns: A string that should not be modified or freed. + */ +static BSON_INLINE const char * +bson_iter_code_unsafe (const bson_iter_t *iter, uint32_t *length) +{ + *length = bson_iter_utf8_len_unsafe (iter); + return (const char *) (iter->raw + iter->d2); +} + + +BSON_EXPORT (const char *) +bson_iter_codewscope (const bson_iter_t *iter, + uint32_t *length, + uint32_t *scope_len, + const uint8_t **scope); + + +BSON_EXPORT (void) +bson_iter_dbpointer (const bson_iter_t *iter, + uint32_t *collection_len, + const char **collection, + const bson_oid_t **oid); + + +BSON_EXPORT (void) +bson_iter_document (const bson_iter_t *iter, + uint32_t *document_len, + const uint8_t **document); + + +BSON_EXPORT (double) +bson_iter_double (const bson_iter_t *iter); + +BSON_EXPORT (double) +bson_iter_as_double (const bson_iter_t *iter); + +/** + * bson_iter_double_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_double() but does not perform an integrity checking. + * + * Returns: A double. + */ +static BSON_INLINE double +bson_iter_double_unsafe (const bson_iter_t *iter) +{ + double val; + + memcpy (&val, iter->raw + iter->d1, sizeof (val)); + return BSON_DOUBLE_FROM_LE (val); +} + + +BSON_EXPORT (bool) +bson_iter_init (bson_iter_t *iter, const bson_t *bson); + +BSON_EXPORT (bool) +bson_iter_init_from_data (bson_iter_t *iter, + const uint8_t *data, + size_t length); + + +BSON_EXPORT (bool) +bson_iter_init_find (bson_iter_t *iter, const bson_t *bson, const char *key); + + +BSON_EXPORT (bool) +bson_iter_init_find_w_len (bson_iter_t *iter, + const bson_t *bson, + const char *key, + int keylen); + + +BSON_EXPORT (bool) +bson_iter_init_find_case (bson_iter_t *iter, + const bson_t *bson, + const char *key); + +BSON_EXPORT (bool) +bson_iter_init_from_data_at_offset (bson_iter_t *iter, + const uint8_t *data, + size_t length, + uint32_t offset, + uint32_t keylen); + +BSON_EXPORT (int32_t) +bson_iter_int32 (const bson_iter_t *iter); + + +/** + * bson_iter_int32_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_int32() but with no integrity checking. + * + * Returns: A 32-bit signed integer. + */ +static BSON_INLINE int32_t +bson_iter_int32_unsafe (const bson_iter_t *iter) +{ + int32_t val; + + memcpy (&val, iter->raw + iter->d1, sizeof (val)); + return BSON_UINT32_FROM_LE (val); +} + + +BSON_EXPORT (int64_t) +bson_iter_int64 (const bson_iter_t *iter); + + +BSON_EXPORT (int64_t) +bson_iter_as_int64 (const bson_iter_t *iter); + + +/** + * bson_iter_int64_unsafe: + * @iter: a bson_iter_t. + * + * Similar to bson_iter_int64() but without integrity checking. + * + * Returns: A 64-bit signed integer. + */ +static BSON_INLINE int64_t +bson_iter_int64_unsafe (const bson_iter_t *iter) +{ + int64_t val; + + memcpy (&val, iter->raw + iter->d1, sizeof (val)); + return BSON_UINT64_FROM_LE (val); +} + + +BSON_EXPORT (bool) +bson_iter_find (bson_iter_t *iter, const char *key); + + +BSON_EXPORT (bool) +bson_iter_find_w_len (bson_iter_t *iter, const char *key, int keylen); + + +BSON_EXPORT (bool) +bson_iter_find_case (bson_iter_t *iter, const char *key); + + +BSON_EXPORT (bool) +bson_iter_find_descendant (bson_iter_t *iter, + const char *dotkey, + bson_iter_t *descendant); + + +BSON_EXPORT (bool) +bson_iter_next (bson_iter_t *iter); + + +BSON_EXPORT (const bson_oid_t *) +bson_iter_oid (const bson_iter_t *iter); + + +/** + * bson_iter_oid_unsafe: + * @iter: A #bson_iter_t. + * + * Similar to bson_iter_oid() but performs no integrity checks. + * + * Returns: A #bson_oid_t that should not be modified or freed. + */ +static BSON_INLINE const bson_oid_t * +bson_iter_oid_unsafe (const bson_iter_t *iter) +{ + return (const bson_oid_t *) (iter->raw + iter->d1); +} + + +BSON_EXPORT (bool) +bson_iter_decimal128 (const bson_iter_t *iter, bson_decimal128_t *dec); + + +/** + * bson_iter_decimal128_unsafe: + * @iter: A #bson_iter_t. + * + * Similar to bson_iter_decimal128() but performs no integrity checks. + * + * Returns: A #bson_decimal128_t. + */ +static BSON_INLINE void +bson_iter_decimal128_unsafe (const bson_iter_t *iter, bson_decimal128_t *dec) +{ + uint64_t low_le; + uint64_t high_le; + + memcpy (&low_le, iter->raw + iter->d1, sizeof (low_le)); + memcpy (&high_le, iter->raw + iter->d1 + 8, sizeof (high_le)); + + dec->low = BSON_UINT64_FROM_LE (low_le); + dec->high = BSON_UINT64_FROM_LE (high_le); +} + + +BSON_EXPORT (const char *) +bson_iter_key (const bson_iter_t *iter); + +BSON_EXPORT (uint32_t) +bson_iter_key_len (const bson_iter_t *iter); + + +/** + * bson_iter_key_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_key() but performs no integrity checking. + * + * Returns: A string that should not be modified or freed. + */ +static BSON_INLINE const char * +bson_iter_key_unsafe (const bson_iter_t *iter) +{ + return (const char *) (iter->raw + iter->key); +} + + +BSON_EXPORT (const char *) +bson_iter_utf8 (const bson_iter_t *iter, uint32_t *length); + + +/** + * bson_iter_utf8_unsafe: + * + * Similar to bson_iter_utf8() but performs no integrity checking. + * + * Returns: A string that should not be modified or freed. + */ +static BSON_INLINE const char * +bson_iter_utf8_unsafe (const bson_iter_t *iter, size_t *length) +{ + *length = bson_iter_utf8_len_unsafe (iter); + return (const char *) (iter->raw + iter->d2); +} + + +BSON_EXPORT (char *) +bson_iter_dup_utf8 (const bson_iter_t *iter, uint32_t *length); + + +BSON_EXPORT (int64_t) +bson_iter_date_time (const bson_iter_t *iter); + + +BSON_EXPORT (time_t) +bson_iter_time_t (const bson_iter_t *iter); + + +/** + * bson_iter_time_t_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_time_t() but performs no integrity checking. + * + * Returns: A time_t containing the number of seconds since UNIX epoch + * in UTC. + */ +static BSON_INLINE time_t +bson_iter_time_t_unsafe (const bson_iter_t *iter) +{ + return (time_t) (bson_iter_int64_unsafe (iter) / 1000UL); +} + + +BSON_EXPORT (void) +bson_iter_timeval (const bson_iter_t *iter, struct timeval *tv); + + +/** + * bson_iter_timeval_unsafe: + * @iter: A bson_iter_t. + * @tv: A struct timeval. + * + * Similar to bson_iter_timeval() but performs no integrity checking. + */ +static BSON_INLINE void +bson_iter_timeval_unsafe (const bson_iter_t *iter, struct timeval *tv) +{ + int64_t value = bson_iter_int64_unsafe (iter); +#ifdef BSON_OS_WIN32 + tv->tv_sec = (long) (value / 1000); +#else + tv->tv_sec = (suseconds_t) (value / 1000); +#endif + tv->tv_usec = (value % 1000) * 1000; +} + + +BSON_EXPORT (void) +bson_iter_timestamp (const bson_iter_t *iter, + uint32_t *timestamp, + uint32_t *increment); + + +BSON_EXPORT (bool) +bson_iter_bool (const bson_iter_t *iter); + + +/** + * bson_iter_bool_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_bool() but performs no integrity checking. + * + * Returns: true or false. + */ +static BSON_INLINE bool +bson_iter_bool_unsafe (const bson_iter_t *iter) +{ + char val; + + memcpy (&val, iter->raw + iter->d1, 1); + return !!val; +} + + +BSON_EXPORT (bool) +bson_iter_as_bool (const bson_iter_t *iter); + + +BSON_EXPORT (const char *) +bson_iter_regex (const bson_iter_t *iter, const char **options); + + +BSON_EXPORT (const char *) +bson_iter_symbol (const bson_iter_t *iter, uint32_t *length); + + +BSON_EXPORT (bson_type_t) +bson_iter_type (const bson_iter_t *iter); + + +/** + * bson_iter_type_unsafe: + * @iter: A bson_iter_t. + * + * Similar to bson_iter_type() but performs no integrity checking. + * + * Returns: A bson_type_t. + */ +static BSON_INLINE bson_type_t +bson_iter_type_unsafe (const bson_iter_t *iter) +{ + return (bson_type_t) (iter->raw + iter->type)[0]; +} + + +BSON_EXPORT (bool) +bson_iter_recurse (const bson_iter_t *iter, bson_iter_t *child); + + +BSON_EXPORT (void) +bson_iter_overwrite_int32 (bson_iter_t *iter, int32_t value); + + +BSON_EXPORT (void) +bson_iter_overwrite_int64 (bson_iter_t *iter, int64_t value); + + +BSON_EXPORT (void) +bson_iter_overwrite_double (bson_iter_t *iter, double value); + + +BSON_EXPORT (void) +bson_iter_overwrite_decimal128 (bson_iter_t *iter, bson_decimal128_t *value); + + +BSON_EXPORT (void) +bson_iter_overwrite_bool (bson_iter_t *iter, bool value); + + +BSON_EXPORT (void) +bson_iter_overwrite_oid (bson_iter_t *iter, const bson_oid_t *value); + + +BSON_EXPORT (void) +bson_iter_overwrite_timestamp (bson_iter_t *iter, + uint32_t timestamp, + uint32_t increment); + + +BSON_EXPORT (void) +bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value); + + +BSON_EXPORT (bool) +bson_iter_visit_all (bson_iter_t *iter, + const bson_visitor_t *visitor, + void *data); + +BSON_EXPORT (uint32_t) +bson_iter_offset (bson_iter_t *iter); + + +BSON_END_DECLS + + +#endif /* BSON_ITER_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.c new file mode 100644 index 0000000..a41fb1d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.c @@ -0,0 +1,2408 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include + +#include "bson/bson.h" +#include "bson/bson-config.h" +#include "bson/bson-json.h" +#include "bson/bson-iso8601-private.h" + +#include "common-b64-private.h" +#include "jsonsl/jsonsl.h" + +#ifdef _WIN32 +#include +#include +#endif + +#ifndef _MSC_VER +#include +#endif + +#ifdef _MSC_VER +#define SSCANF sscanf_s +#else +#define SSCANF sscanf +#endif + +#define STACK_MAX 100 +#define BSON_JSON_DEFAULT_BUF_SIZE (1 << 14) +#define AT_LEAST_0(x) ((x) >= 0 ? (x) : 0) + + +#define READ_STATE_ENUM(ENUM) BSON_JSON_##ENUM, +#define GENERATE_STRING(STRING) #STRING, + +#define FOREACH_READ_STATE(RS) \ + RS (REGULAR) \ + RS (DONE) \ + RS (ERROR) \ + RS (IN_START_MAP) \ + RS (IN_BSON_TYPE) \ + RS (IN_BSON_TYPE_DATE_NUMBERLONG) \ + RS (IN_BSON_TYPE_DATE_ENDMAP) \ + RS (IN_BSON_TYPE_TIMESTAMP_STARTMAP) \ + RS (IN_BSON_TYPE_TIMESTAMP_VALUES) \ + RS (IN_BSON_TYPE_TIMESTAMP_ENDMAP) \ + RS (IN_BSON_TYPE_REGEX_STARTMAP) \ + RS (IN_BSON_TYPE_REGEX_VALUES) \ + RS (IN_BSON_TYPE_REGEX_ENDMAP) \ + RS (IN_BSON_TYPE_BINARY_VALUES) \ + RS (IN_BSON_TYPE_BINARY_ENDMAP) \ + RS (IN_BSON_TYPE_SCOPE_STARTMAP) \ + RS (IN_BSON_TYPE_DBPOINTER_STARTMAP) \ + RS (IN_SCOPE) \ + RS (IN_DBPOINTER) + +typedef enum { FOREACH_READ_STATE (READ_STATE_ENUM) } bson_json_read_state_t; + +static const char *read_state_names[] = {FOREACH_READ_STATE (GENERATE_STRING)}; + +#define BSON_STATE_ENUM(ENUM) BSON_JSON_LF_##ENUM, + +#define FOREACH_BSON_STATE(BS) \ + /* legacy {$regex: "...", $options: "..."} */ \ + BS (REGEX) \ + BS (OPTIONS) \ + /* modern $regularExpression: {pattern: "...", options: "..."} */ \ + BS (REGULAR_EXPRESSION_PATTERN) \ + BS (REGULAR_EXPRESSION_OPTIONS) \ + BS (CODE) \ + BS (SCOPE) \ + BS (OID) \ + BS (BINARY) \ + BS (TYPE) \ + BS (DATE) \ + BS (TIMESTAMP_T) \ + BS (TIMESTAMP_I) \ + BS (UNDEFINED) \ + BS (MINKEY) \ + BS (MAXKEY) \ + BS (INT32) \ + BS (INT64) \ + BS (DOUBLE) \ + BS (DECIMAL128) \ + BS (DBPOINTER) \ + BS (SYMBOL) \ + BS (DBREF) + +typedef enum { + FOREACH_BSON_STATE (BSON_STATE_ENUM) +} bson_json_read_bson_state_t; + +static const char *bson_state_names[] = {FOREACH_BSON_STATE (GENERATE_STRING)}; + +typedef struct { + uint8_t *buf; + size_t n_bytes; + size_t len; +} bson_json_buf_t; + + +typedef enum { + BSON_JSON_FRAME_INITIAL = 0, + BSON_JSON_FRAME_ARRAY, + BSON_JSON_FRAME_DOC, + BSON_JSON_FRAME_SCOPE, + BSON_JSON_FRAME_DBPOINTER, +} bson_json_frame_type_t; + + +typedef struct { + int i; + bson_json_frame_type_t type; + bool has_ref; + bool has_id; + bson_t bson; +} bson_json_stack_frame_t; + + +typedef union { + struct { + bool has_pattern; + bool has_options; + bool is_legacy; + } regex; + struct { + bool has_oid; + bson_oid_t oid; + } oid; + struct { + bool has_binary; + bool has_subtype; + bson_subtype_t type; + bool is_legacy; + } binary; + struct { + bool has_date; + int64_t date; + } date; + struct { + bool has_t; + bool has_i; + uint32_t t; + uint32_t i; + } timestamp; + struct { + bool has_undefined; + } undefined; + struct { + bool has_minkey; + } minkey; + struct { + bool has_maxkey; + } maxkey; + struct { + int32_t value; + } v_int32; + struct { + int64_t value; + } v_int64; + struct { + double value; + } v_double; + struct { + bson_decimal128_t value; + } v_decimal128; +} bson_json_bson_data_t; + + +/* collect info while parsing a {$code: "...", $scope: {...}} object */ +typedef struct { + bool has_code; + bool has_scope; + bool in_scope; + bson_json_buf_t key_buf; + bson_json_buf_t code_buf; +} bson_json_code_t; + + +static void +_bson_json_code_cleanup (bson_json_code_t *code_data) +{ + bson_free (code_data->key_buf.buf); + bson_free (code_data->code_buf.buf); +} + + +typedef struct { + bson_t *bson; + bson_json_stack_frame_t stack[STACK_MAX]; + int n; + const char *key; + bson_json_buf_t key_buf; + bson_json_buf_t unescaped; + bson_json_read_state_t read_state; + bson_json_read_bson_state_t bson_state; + bson_type_t bson_type; + bson_json_buf_t bson_type_buf[3]; + bson_json_bson_data_t bson_type_data; + bson_json_code_t code_data; + bson_json_buf_t dbpointer_key; +} bson_json_reader_bson_t; + + +typedef struct { + void *data; + bson_json_reader_cb cb; + bson_json_destroy_cb dcb; + uint8_t *buf; + size_t buf_size; + size_t bytes_read; + size_t bytes_parsed; + bool all_whitespace; +} bson_json_reader_producer_t; + + +struct _bson_json_reader_t { + bson_json_reader_producer_t producer; + bson_json_reader_bson_t bson; + jsonsl_t json; + ssize_t json_text_pos; + bool should_reset; + ssize_t advance; + bson_json_buf_t tok_accumulator; + bson_error_t *error; +}; + + +typedef struct { + int fd; + bool do_close; +} bson_json_reader_handle_fd_t; + + +/* forward decl */ +static void +_bson_json_save_map_key (bson_json_reader_bson_t *bson, + const uint8_t *val, + size_t len); + + +static void +_noop (void) +{ +} + +#define STACK_ELE(_delta, _name) (bson->stack[(_delta) + bson->n]._name) +#define STACK_BSON(_delta) \ + (((_delta) + bson->n) == 0 ? bson->bson : &STACK_ELE (_delta, bson)) +#define STACK_BSON_PARENT STACK_BSON (-1) +#define STACK_BSON_CHILD STACK_BSON (0) +#define STACK_I STACK_ELE (0, i) +#define STACK_FRAME_TYPE STACK_ELE (0, type) +#define STACK_IS_INITIAL (STACK_FRAME_TYPE == BSON_JSON_FRAME_INITIAL) +#define STACK_IS_ARRAY (STACK_FRAME_TYPE == BSON_JSON_FRAME_ARRAY) +#define STACK_IS_DOC (STACK_FRAME_TYPE == BSON_JSON_FRAME_DOC) +#define STACK_IS_SCOPE (STACK_FRAME_TYPE == BSON_JSON_FRAME_SCOPE) +#define STACK_IS_DBPOINTER (STACK_FRAME_TYPE == BSON_JSON_FRAME_DBPOINTER) +#define FRAME_TYPE_HAS_BSON(_type) \ + ((_type) == BSON_JSON_FRAME_SCOPE || (_type) == BSON_JSON_FRAME_DBPOINTER) +#define STACK_HAS_BSON FRAME_TYPE_HAS_BSON (STACK_FRAME_TYPE) +#define STACK_HAS_REF STACK_ELE (0, has_ref) +#define STACK_HAS_ID STACK_ELE (0, has_id) +#define STACK_PUSH(frame_type) \ + do { \ + if (bson->n >= (STACK_MAX - 1)) { \ + return; \ + } \ + bson->n++; \ + if (STACK_HAS_BSON) { \ + if (FRAME_TYPE_HAS_BSON (frame_type)) { \ + bson_reinit (STACK_BSON_CHILD); \ + } else { \ + bson_destroy (STACK_BSON_CHILD); \ + } \ + } else if (FRAME_TYPE_HAS_BSON (frame_type)) { \ + bson_init (STACK_BSON_CHILD); \ + } \ + STACK_FRAME_TYPE = frame_type; \ + } while (0) +#define STACK_PUSH_ARRAY(statement) \ + do { \ + STACK_PUSH (BSON_JSON_FRAME_ARRAY); \ + STACK_I = 0; \ + if (bson->n != 0) { \ + statement; \ + } \ + } while (0) +#define STACK_PUSH_DOC(statement) \ + do { \ + STACK_PUSH (BSON_JSON_FRAME_DOC); \ + STACK_HAS_REF = false; \ + STACK_HAS_ID = false; \ + if (bson->n != 0) { \ + statement; \ + } \ + } while (0) +#define STACK_PUSH_SCOPE \ + do { \ + STACK_PUSH (BSON_JSON_FRAME_SCOPE); \ + bson->code_data.in_scope = true; \ + } while (0) +#define STACK_PUSH_DBPOINTER \ + do { \ + STACK_PUSH (BSON_JSON_FRAME_DBPOINTER); \ + } while (0) +#define STACK_POP_ARRAY(statement) \ + do { \ + if (!STACK_IS_ARRAY) { \ + return; \ + } \ + if (bson->n < 0) { \ + return; \ + } \ + if (bson->n > 0) { \ + statement; \ + } \ + bson->n--; \ + } while (0) +#define STACK_POP_DOC(statement) \ + do { \ + if (STACK_IS_ARRAY) { \ + return; \ + } \ + if (bson->n < 0) { \ + return; \ + } \ + if (bson->n > 0) { \ + statement; \ + } \ + bson->n--; \ + } while (0) +#define STACK_POP_SCOPE \ + do { \ + STACK_POP_DOC (_noop ()); \ + bson->code_data.in_scope = false; \ + } while (0); +#define STACK_POP_DBPOINTER STACK_POP_DOC (_noop ()) +#define BASIC_CB_PREAMBLE \ + const char *key; \ + size_t len; \ + bson_json_reader_bson_t *bson = &reader->bson; \ + _bson_json_read_fixup_key (bson); \ + key = bson->key; \ + len = bson->key_buf.len; +#define BASIC_CB_BAIL_IF_NOT_NORMAL(_type) \ + if (bson->read_state != BSON_JSON_REGULAR) { \ + _bson_json_read_set_error (reader, \ + "Invalid read of %s in state %s", \ + (_type), \ + read_state_names[bson->read_state]); \ + return; \ + } else if (!key) { \ + _bson_json_read_set_error (reader, \ + "Invalid read of %s without key in state %s", \ + (_type), \ + read_state_names[bson->read_state]); \ + return; \ + } +#define HANDLE_OPTION(_key, _type, _state) \ + (len == strlen (_key) && strncmp ((const char *) val, (_key), len) == 0) \ + { \ + if (bson->bson_type && bson->bson_type != (_type)) { \ + _bson_json_read_set_error (reader, \ + "Invalid key \"%s\". Looking for values " \ + "for type \"%s\", got \"%s\"", \ + (_key), \ + _bson_json_type_name (bson->bson_type), \ + _bson_json_type_name (_type)); \ + return; \ + } \ + bson->bson_type = (_type); \ + bson->bson_state = (_state); \ + } + + +static void +_bson_json_read_set_error (bson_json_reader_t *reader, const char *fmt, ...) + BSON_GNUC_PRINTF (2, 3); + + +static void +_bson_json_read_set_error (bson_json_reader_t *reader, /* IN */ + const char *fmt, /* IN */ + ...) +{ + va_list ap; + + if (reader->error) { + reader->error->domain = BSON_ERROR_JSON; + reader->error->code = BSON_JSON_ERROR_READ_INVALID_PARAM; + va_start (ap, fmt); + bson_vsnprintf ( + reader->error->message, sizeof reader->error->message, fmt, ap); + va_end (ap); + reader->error->message[sizeof reader->error->message - 1] = '\0'; + } + + reader->bson.read_state = BSON_JSON_ERROR; + jsonsl_stop (reader->json); +} + + +static void +_bson_json_read_corrupt (bson_json_reader_t *reader, const char *fmt, ...) + BSON_GNUC_PRINTF (2, 3); + + +static void +_bson_json_read_corrupt (bson_json_reader_t *reader, /* IN */ + const char *fmt, /* IN */ + ...) +{ + va_list ap; + + if (reader->error) { + reader->error->domain = BSON_ERROR_JSON; + reader->error->code = BSON_JSON_ERROR_READ_CORRUPT_JS; + va_start (ap, fmt); + bson_vsnprintf ( + reader->error->message, sizeof reader->error->message, fmt, ap); + va_end (ap); + reader->error->message[sizeof reader->error->message - 1] = '\0'; + } + + reader->bson.read_state = BSON_JSON_ERROR; + jsonsl_stop (reader->json); +} + + +static void +_bson_json_buf_ensure (bson_json_buf_t *buf, /* IN */ + size_t len) /* IN */ +{ + if (buf->n_bytes < len) { + bson_free (buf->buf); + + buf->n_bytes = bson_next_power_of_two (len); + buf->buf = bson_malloc (buf->n_bytes); + } +} + + +static void +_bson_json_buf_set (bson_json_buf_t *buf, const void *from, size_t len) +{ + _bson_json_buf_ensure (buf, len + 1); + memcpy (buf->buf, from, len); + buf->buf[len] = '\0'; + buf->len = len; +} + + +static void +_bson_json_buf_append (bson_json_buf_t *buf, const void *from, size_t len) +{ + size_t len_with_null = len + 1; + + if (buf->len == 0) { + _bson_json_buf_ensure (buf, len_with_null); + } else if (buf->n_bytes < buf->len + len_with_null) { + buf->n_bytes = bson_next_power_of_two (buf->len + len_with_null); + buf->buf = bson_realloc (buf->buf, buf->n_bytes); + } + + memcpy (buf->buf + buf->len, from, len); + buf->len += len; + buf->buf[buf->len] = '\0'; +} + + +static const char * +_bson_json_type_name (bson_type_t type) +{ + switch (type) { + case BSON_TYPE_EOD: + return "end of document"; + case BSON_TYPE_DOUBLE: + return "double"; + case BSON_TYPE_UTF8: + return "utf-8"; + case BSON_TYPE_DOCUMENT: + return "document"; + case BSON_TYPE_ARRAY: + return "array"; + case BSON_TYPE_BINARY: + return "binary"; + case BSON_TYPE_UNDEFINED: + return "undefined"; + case BSON_TYPE_OID: + return "objectid"; + case BSON_TYPE_BOOL: + return "bool"; + case BSON_TYPE_DATE_TIME: + return "datetime"; + case BSON_TYPE_NULL: + return "null"; + case BSON_TYPE_REGEX: + return "regex"; + case BSON_TYPE_DBPOINTER: + return "dbpointer"; + case BSON_TYPE_CODE: + return "code"; + case BSON_TYPE_SYMBOL: + return "symbol"; + case BSON_TYPE_CODEWSCOPE: + return "code with scope"; + case BSON_TYPE_INT32: + return "int32"; + case BSON_TYPE_TIMESTAMP: + return "timestamp"; + case BSON_TYPE_INT64: + return "int64"; + case BSON_TYPE_DECIMAL128: + return "decimal128"; + case BSON_TYPE_MAXKEY: + return "maxkey"; + case BSON_TYPE_MINKEY: + return "minkey"; + default: + return ""; + } +} + + +static void +_bson_json_read_fixup_key (bson_json_reader_bson_t *bson) /* IN */ +{ + bson_json_read_state_t rs = bson->read_state; + + if (bson->n >= 0 && STACK_IS_ARRAY && rs == BSON_JSON_REGULAR) { + _bson_json_buf_ensure (&bson->key_buf, 12); + bson->key_buf.len = bson_uint32_to_string ( + STACK_I, &bson->key, (char *) bson->key_buf.buf, 12); + STACK_I++; + } +} + + +static void +_bson_json_read_null (bson_json_reader_t *reader) +{ + BASIC_CB_PREAMBLE; + BASIC_CB_BAIL_IF_NOT_NORMAL ("null"); + + bson_append_null (STACK_BSON_CHILD, key, (int) len); +} + + +static void +_bson_json_read_boolean (bson_json_reader_t *reader, /* IN */ + int val) /* IN */ +{ + BASIC_CB_PREAMBLE; + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE && + bson->bson_state == BSON_JSON_LF_UNDEFINED) { + bson->bson_type_data.undefined.has_undefined = true; + return; + } + + BASIC_CB_BAIL_IF_NOT_NORMAL ("boolean"); + + bson_append_bool (STACK_BSON_CHILD, key, (int) len, val); +} + + +/* sign is -1 or 1 */ +static void +_bson_json_read_integer (bson_json_reader_t *reader, uint64_t val, int64_t sign) +{ + bson_json_read_state_t rs; + bson_json_read_bson_state_t bs; + + BASIC_CB_PREAMBLE; + + if (sign == 1 && val > INT64_MAX) { + _bson_json_read_set_error ( + reader, "Number \"%" PRIu64 "\" is out of range", val); + + return; + } else if (sign == -1 && val > ((uint64_t) INT64_MAX + 1)) { + _bson_json_read_set_error ( + reader, "Number \"-%" PRIu64 "\" is out of range", val); + + return; + } + + rs = bson->read_state; + bs = bson->bson_state; + + if (rs == BSON_JSON_REGULAR) { + BASIC_CB_BAIL_IF_NOT_NORMAL ("integer"); + + if (val <= INT32_MAX || (sign == -1 && val <= (uint64_t) INT32_MAX + 1)) { + bson_append_int32 ( + STACK_BSON_CHILD, key, (int) len, (int) (val * sign)); + } else if (sign == -1) { + bson_append_int64 (STACK_BSON_CHILD, key, (int) len, (int64_t) -val); + } else { + bson_append_int64 (STACK_BSON_CHILD, key, (int) len, (int64_t) val); + } + } else if (rs == BSON_JSON_IN_BSON_TYPE || + rs == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_VALUES) { + switch (bs) { + case BSON_JSON_LF_DATE: + bson->bson_type_data.date.has_date = true; + bson->bson_type_data.date.date = sign * val; + break; + case BSON_JSON_LF_TIMESTAMP_T: + if (sign == -1) { + _bson_json_read_set_error ( + reader, "Invalid timestamp value: \"-%" PRIu64 "\"", val); + return; + } + + bson->bson_type_data.timestamp.has_t = true; + bson->bson_type_data.timestamp.t = (uint32_t) val; + break; + case BSON_JSON_LF_TIMESTAMP_I: + if (sign == -1) { + _bson_json_read_set_error ( + reader, "Invalid timestamp value: \"-%" PRIu64 "\"", val); + return; + } + + bson->bson_type_data.timestamp.has_i = true; + bson->bson_type_data.timestamp.i = (uint32_t) val; + break; + case BSON_JSON_LF_MINKEY: + if (sign == -1) { + _bson_json_read_set_error ( + reader, "Invalid MinKey value: \"-%" PRIu64 "\"", val); + return; + } else if (val != 1) { + _bson_json_read_set_error ( + reader, "Invalid MinKey value: \"%" PRIu64 "\"", val); + } + + bson->bson_type_data.minkey.has_minkey = true; + break; + case BSON_JSON_LF_MAXKEY: + if (sign == -1) { + _bson_json_read_set_error ( + reader, "Invalid MinKey value: \"-%" PRIu64 "\"", val); + return; + } else if (val != 1) { + _bson_json_read_set_error ( + reader, "Invalid MinKey value: \"%" PRIu64 "\"", val); + } + + bson->bson_type_data.maxkey.has_maxkey = true; + break; + case BSON_JSON_LF_INT32: + case BSON_JSON_LF_INT64: + _bson_json_read_set_error ( + reader, + "Invalid state for integer read: %s, " + "expected number as quoted string like \"123\"", + bson_state_names[bs]); + break; + case BSON_JSON_LF_REGEX: + case BSON_JSON_LF_OPTIONS: + case BSON_JSON_LF_REGULAR_EXPRESSION_PATTERN: + case BSON_JSON_LF_REGULAR_EXPRESSION_OPTIONS: + case BSON_JSON_LF_CODE: + case BSON_JSON_LF_SCOPE: + case BSON_JSON_LF_OID: + case BSON_JSON_LF_BINARY: + case BSON_JSON_LF_TYPE: + case BSON_JSON_LF_UNDEFINED: + case BSON_JSON_LF_DOUBLE: + case BSON_JSON_LF_DECIMAL128: + case BSON_JSON_LF_DBPOINTER: + case BSON_JSON_LF_SYMBOL: + case BSON_JSON_LF_DBREF: + default: + _bson_json_read_set_error (reader, + "Unexpected integer %s%" PRIu64 + " in type \"%s\"", + sign == -1 ? "-" : "", + val, + _bson_json_type_name (bson->bson_type)); + } + } else { + _bson_json_read_set_error (reader, + "Unexpected integer %s%" PRIu64 + " in state \"%s\"", + sign == -1 ? "-" : "", + val, + read_state_names[rs]); + } +} + + +static bool +_bson_json_parse_double (bson_json_reader_t *reader, + const char *val, + size_t vlen, + double *d) +{ + errno = 0; + *d = strtod (val, NULL); + +#ifdef _MSC_VER + /* Microsoft's strtod parses "NaN", "Infinity", "-Infinity" as 0 */ + if (*d == 0.0) { + if (!_strnicmp (val, "nan", vlen)) { +#ifdef NAN + *d = NAN; +#else + /* Visual Studio 2010 doesn't define NAN or INFINITY + * https://msdn.microsoft.com/en-us/library/w22adx1s(v=vs.100).aspx */ + unsigned long nan[2] = {0xffffffff, 0x7fffffff}; + *d = *(double *) nan; +#endif + return true; + } else if (!_strnicmp (val, "infinity", vlen)) { +#ifdef INFINITY + *d = INFINITY; +#else + unsigned long inf[2] = {0x00000000, 0x7ff00000}; + *d = *(double *) inf; +#endif + return true; + } else if (!_strnicmp (val, "-infinity", vlen)) { +#ifdef INFINITY + *d = -INFINITY; +#else + unsigned long inf[2] = {0x00000000, 0xfff00000}; + *d = *(double *) inf; +#endif + return true; + } + } + + if ((*d == HUGE_VAL || *d == -HUGE_VAL) && errno == ERANGE) { + _bson_json_read_set_error ( + reader, "Number \"%.*s\" is out of range", (int) vlen, val); + + return false; + } +#else + /* not MSVC - set err on overflow, but avoid err for infinity */ + if ((*d == HUGE_VAL || *d == -HUGE_VAL) && errno == ERANGE && + strncasecmp (val, "infinity", vlen) && + strncasecmp (val, "-infinity", vlen)) { + _bson_json_read_set_error ( + reader, "Number \"%.*s\" is out of range", (int) vlen, val); + + return false; + } + +#endif /* _MSC_VER */ + return true; +} + + +static void +_bson_json_read_double (bson_json_reader_t *reader, /* IN */ + double val) /* IN */ +{ + BASIC_CB_PREAMBLE; + BASIC_CB_BAIL_IF_NOT_NORMAL ("double"); + + if (!bson_append_double (STACK_BSON_CHILD, key, (int) len, val)) { + _bson_json_read_set_error (reader, "Cannot append double value %g", val); + } +} + + +static bool +_bson_json_read_int64_or_set_error (bson_json_reader_t *reader, /* IN */ + const unsigned char *val, /* IN */ + size_t vlen, /* IN */ + int64_t *v64) /* OUT */ +{ + bson_json_reader_bson_t *bson = &reader->bson; + char *endptr = NULL; + + _bson_json_read_fixup_key (bson); + errno = 0; + *v64 = bson_ascii_strtoll ((const char *) val, &endptr, 10); + + if (((*v64 == INT64_MIN) || (*v64 == INT64_MAX)) && (errno == ERANGE)) { + _bson_json_read_set_error (reader, "Number \"%s\" is out of range", val); + return false; + } + + if (endptr != ((const char *) val + vlen)) { + _bson_json_read_set_error (reader, "Number \"%s\" is invalid", val); + return false; + } + + return true; +} + + +/* parse a value for "base64", "subType" or legacy "$binary" or "$type" */ +static void +_bson_json_parse_binary_elem (bson_json_reader_t *reader, + const char *val_w_null, + size_t vlen) +{ + bson_json_read_bson_state_t bs; + bson_json_bson_data_t *data; + int binary_len; + + BASIC_CB_PREAMBLE; + + bs = bson->bson_state; + data = &bson->bson_type_data; + + if (bs == BSON_JSON_LF_BINARY) { + data->binary.has_binary = true; + binary_len = bson_b64_pton (val_w_null, NULL, 0); + if (binary_len < 0) { + _bson_json_read_set_error ( + reader, + "Invalid input string \"%s\", looking for base64-encoded binary", + val_w_null); + } + + _bson_json_buf_ensure (&bson->bson_type_buf[0], (size_t) binary_len + 1); + if (bson_b64_pton (val_w_null, + bson->bson_type_buf[0].buf, + (size_t) binary_len + 1) < 0) { + _bson_json_read_set_error ( + reader, + "Invalid input string \"%s\", looking for base64-encoded binary", + val_w_null); + } + + bson->bson_type_buf[0].len = (size_t) binary_len; + } else if (bs == BSON_JSON_LF_TYPE) { + data->binary.has_subtype = true; + + if (SSCANF (val_w_null, "%02x", &data->binary.type) != 1) { + if (!data->binary.is_legacy || data->binary.has_binary) { + /* misformatted subtype, like {$binary: {base64: "", subType: "x"}}, + * or legacy {$binary: "", $type: "x"} */ + _bson_json_read_set_error ( + reader, + "Invalid input string \"%s\", looking for binary subtype", + val_w_null); + } else { + /* actually a query operator: {x: {$type: "array"}}*/ + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_DOC (bson_append_document_begin ( + STACK_BSON_PARENT, key, (int) len, STACK_BSON_CHILD)); + + bson_append_utf8 (STACK_BSON_CHILD, + "$type", + 5, + (const char *) val_w_null, + (int) vlen); + } + } + } +} + + +static void +_bson_json_read_string (bson_json_reader_t *reader, /* IN */ + const unsigned char *val, /* IN */ + size_t vlen) /* IN */ +{ + bson_json_read_state_t rs; + bson_json_read_bson_state_t bs; + + BASIC_CB_PREAMBLE; + + rs = bson->read_state; + bs = bson->bson_state; + + if (!bson_utf8_validate ((const char *) val, vlen, true /*allow null*/)) { + _bson_json_read_corrupt (reader, "invalid bytes in UTF8 string"); + return; + } + + if (rs == BSON_JSON_REGULAR) { + BASIC_CB_BAIL_IF_NOT_NORMAL ("string"); + bson_append_utf8 ( + STACK_BSON_CHILD, key, (int) len, (const char *) val, (int) vlen); + } else if (rs == BSON_JSON_IN_BSON_TYPE_SCOPE_STARTMAP || + rs == BSON_JSON_IN_BSON_TYPE_DBPOINTER_STARTMAP) { + _bson_json_read_set_error (reader, + "Invalid read of \"%s\" in state \"%s\"", + val, + read_state_names[rs]); + } else if (rs == BSON_JSON_IN_BSON_TYPE_BINARY_VALUES) { + const char *val_w_null; + _bson_json_buf_set (&bson->bson_type_buf[2], val, vlen); + val_w_null = (const char *) bson->bson_type_buf[2].buf; + + _bson_json_parse_binary_elem (reader, val_w_null, vlen); + } else if (rs == BSON_JSON_IN_BSON_TYPE || + rs == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_VALUES || + rs == BSON_JSON_IN_BSON_TYPE_REGEX_VALUES || + rs == BSON_JSON_IN_BSON_TYPE_DATE_NUMBERLONG) { + const char *val_w_null; + _bson_json_buf_set (&bson->bson_type_buf[2], val, vlen); + val_w_null = (const char *) bson->bson_type_buf[2].buf; + + switch (bs) { + case BSON_JSON_LF_REGEX: + bson->bson_type_data.regex.is_legacy = true; + /* FALL THROUGH */ + case BSON_JSON_LF_REGULAR_EXPRESSION_PATTERN: + bson->bson_type_data.regex.has_pattern = true; + _bson_json_buf_set (&bson->bson_type_buf[0], val, vlen); + break; + case BSON_JSON_LF_OPTIONS: + bson->bson_type_data.regex.is_legacy = true; + /* FALL THROUGH */ + case BSON_JSON_LF_REGULAR_EXPRESSION_OPTIONS: + bson->bson_type_data.regex.has_options = true; + _bson_json_buf_set (&bson->bson_type_buf[1], val, vlen); + break; + case BSON_JSON_LF_OID: + + if (vlen != 24) { + goto BAD_PARSE; + } + + bson->bson_type_data.oid.has_oid = true; + bson_oid_init_from_string (&bson->bson_type_data.oid.oid, val_w_null); + break; + case BSON_JSON_LF_BINARY: + case BSON_JSON_LF_TYPE: + bson->bson_type_data.binary.is_legacy = true; + _bson_json_parse_binary_elem (reader, val_w_null, vlen); + break; + case BSON_JSON_LF_INT32: { + int64_t v64; + if (!_bson_json_read_int64_or_set_error (reader, val, vlen, &v64)) { + /* the error is set, return and let the reader exit */ + return; + } + + if (v64 < INT32_MIN || v64 > INT32_MAX) { + goto BAD_PARSE; + } + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + bson->bson_type_data.v_int32.value = (int32_t) v64; + } else { + goto BAD_PARSE; + } + } break; + case BSON_JSON_LF_INT64: { + int64_t v64; + if (!_bson_json_read_int64_or_set_error (reader, val, vlen, &v64)) { + /* the error is set, return and let the reader exit */ + return; + } + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + bson->bson_type_data.v_int64.value = v64; + } else if (bson->read_state == + BSON_JSON_IN_BSON_TYPE_DATE_NUMBERLONG) { + bson->bson_type_data.date.has_date = true; + bson->bson_type_data.date.date = v64; + } else { + goto BAD_PARSE; + } + } break; + case BSON_JSON_LF_DOUBLE: { + if (!_bson_json_parse_double (reader, + (const char *) val, + vlen, + &bson->bson_type_data.v_double.value)) { + /* the error is set, return and let the reader exit */ + return; + } + } break; + case BSON_JSON_LF_DATE: { + int64_t v64; + + if (!_bson_iso8601_date_parse ( + (char *) val, (int) vlen, &v64, reader->error)) { + jsonsl_stop (reader->json); + } else { + bson->bson_type_data.date.has_date = true; + bson->bson_type_data.date.date = v64; + } + } break; + case BSON_JSON_LF_DECIMAL128: { + bson_decimal128_t decimal128; + bson_decimal128_from_string (val_w_null, &decimal128); + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + bson->bson_type_data.v_decimal128.value = decimal128; + } else { + goto BAD_PARSE; + } + } break; + case BSON_JSON_LF_CODE: + _bson_json_buf_set (&bson->code_data.code_buf, val, vlen); + break; + case BSON_JSON_LF_SYMBOL: + bson_append_symbol ( + STACK_BSON_CHILD, key, (int) len, (const char *) val, (int) vlen); + break; + case BSON_JSON_LF_DBREF: + /* the "$ref" of a {$ref: "...", $id: ... }, append normally */ + bson_append_utf8 ( + STACK_BSON_CHILD, key, (int) len, (const char *) val, (int) vlen); + bson->read_state = BSON_JSON_REGULAR; + break; + case BSON_JSON_LF_SCOPE: + case BSON_JSON_LF_TIMESTAMP_T: + case BSON_JSON_LF_TIMESTAMP_I: + case BSON_JSON_LF_UNDEFINED: + case BSON_JSON_LF_MINKEY: + case BSON_JSON_LF_MAXKEY: + case BSON_JSON_LF_DBPOINTER: + default: + goto BAD_PARSE; + } + + return; + BAD_PARSE: + _bson_json_read_set_error (reader, + "Invalid input string \"%s\", looking for %s", + val_w_null, + bson_state_names[bs]); + } else { + _bson_json_read_set_error ( + reader, "Invalid state to look for string: %s", read_state_names[rs]); + } +} + + +static void +_bson_json_read_start_map (bson_json_reader_t *reader) /* IN */ +{ + BASIC_CB_PREAMBLE; + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + if (bson->bson_state == BSON_JSON_LF_DATE) { + bson->read_state = BSON_JSON_IN_BSON_TYPE_DATE_NUMBERLONG; + } else if (bson->bson_state == BSON_JSON_LF_BINARY) { + bson->read_state = BSON_JSON_IN_BSON_TYPE_BINARY_VALUES; + } else if (bson->bson_state == BSON_JSON_LF_TYPE) { + /* special case, we started parsing {$type: {$numberInt: "2"}} and we + * expected a legacy Binary format. now we see the second "{", so + * backtrack and parse $type query operator. */ + bson->read_state = BSON_JSON_IN_START_MAP; + STACK_PUSH_DOC (bson_append_document_begin ( + STACK_BSON_PARENT, key, len, STACK_BSON_CHILD)); + _bson_json_save_map_key (bson, (const uint8_t *) "$type", 5); + } + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_STARTMAP) { + bson->read_state = BSON_JSON_IN_BSON_TYPE_TIMESTAMP_VALUES; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_SCOPE_STARTMAP) { + bson->read_state = BSON_JSON_IN_SCOPE; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_DBPOINTER_STARTMAP) { + bson->read_state = BSON_JSON_IN_DBPOINTER; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_REGEX_STARTMAP) { + bson->read_state = BSON_JSON_IN_BSON_TYPE_REGEX_VALUES; + } else { + bson->read_state = BSON_JSON_IN_START_MAP; + } + + /* silence some warnings */ + (void) len; + (void) key; +} + + +static bool +_is_known_key (const char *key, size_t len) +{ + bool ret; + +#define IS_KEY(k) (len == strlen (k) && (0 == memcmp (k, key, len))) + + ret = (IS_KEY ("$regularExpression") || IS_KEY ("$regex") || + IS_KEY ("$options") || IS_KEY ("$code") || IS_KEY ("$scope") || + IS_KEY ("$oid") || IS_KEY ("$binary") || IS_KEY ("$type") || + IS_KEY ("$date") || IS_KEY ("$undefined") || IS_KEY ("$maxKey") || + IS_KEY ("$minKey") || IS_KEY ("$timestamp") || + IS_KEY ("$numberInt") || IS_KEY ("$numberLong") || + IS_KEY ("$numberDouble") || IS_KEY ("$numberDecimal") || + IS_KEY ("$numberInt") || IS_KEY ("$numberLong") || + IS_KEY ("$numberDouble") || IS_KEY ("$numberDecimal") || + IS_KEY ("$dbPointer") || IS_KEY ("$symbol")); + +#undef IS_KEY + + return ret; +} + +static void +_bson_json_save_map_key (bson_json_reader_bson_t *bson, + const uint8_t *val, + size_t len) +{ + _bson_json_buf_set (&bson->key_buf, val, len); + bson->key = (const char *) bson->key_buf.buf; +} + + +static void +_bson_json_read_code_or_scope_key (bson_json_reader_bson_t *bson, + bool is_scope, + const uint8_t *val, + size_t len) +{ + bson_json_code_t *code = &bson->code_data; + + if (code->in_scope) { + /* we're reading something weirdly nested, e.g. we just read "$code" in + * "$scope: {x: {$code: {}}}". just create the subdoc within the scope. */ + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_DOC (bson_append_document_begin (STACK_BSON_PARENT, + bson->key, + (int) bson->key_buf.len, + STACK_BSON_CHILD)); + _bson_json_save_map_key (bson, val, len); + } else { + if (!bson->code_data.key_buf.len) { + /* save the key, e.g. {"key": {"$code": "return x", "$scope":{"x":1}}}, + * in case it is overwritten while parsing scope sub-object */ + _bson_json_buf_set ( + &bson->code_data.key_buf, bson->key_buf.buf, bson->key_buf.len); + } + + if (is_scope) { + bson->bson_type = BSON_TYPE_CODEWSCOPE; + bson->read_state = BSON_JSON_IN_BSON_TYPE_SCOPE_STARTMAP; + bson->bson_state = BSON_JSON_LF_SCOPE; + bson->code_data.has_scope = true; + } else { + bson->bson_type = BSON_TYPE_CODE; + bson->bson_state = BSON_JSON_LF_CODE; + bson->code_data.has_code = true; + } + } +} + + +static void +_bson_json_bad_key_in_type (bson_json_reader_t *reader, /* IN */ + const uint8_t *val) /* IN */ +{ + bson_json_reader_bson_t *bson = &reader->bson; + + _bson_json_read_set_error ( + reader, + "Invalid key \"%s\". Looking for values for type \"%s\"", + val, + _bson_json_type_name (bson->bson_type)); +} + + +static void +_bson_json_read_map_key (bson_json_reader_t *reader, /* IN */ + const uint8_t *val, /* IN */ + size_t len) /* IN */ +{ + bson_json_reader_bson_t *bson = &reader->bson; + + if (!bson_utf8_validate ((const char *) val, len, true /* allow null */)) { + _bson_json_read_corrupt (reader, "invalid bytes in UTF8 string"); + return; + } + + if (bson->read_state == BSON_JSON_IN_START_MAP) { + if (len > 0 && val[0] == '$' && _is_known_key ((const char *) val, len) && + bson->n >= 0 /* key is in subdocument */) { + bson->read_state = BSON_JSON_IN_BSON_TYPE; + bson->bson_type = (bson_type_t) 0; + memset (&bson->bson_type_data, 0, sizeof bson->bson_type_data); + } else { + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_DOC (bson_append_document_begin (STACK_BSON_PARENT, + bson->key, + (int) bson->key_buf.len, + STACK_BSON_CHILD)); + } + } else if (bson->read_state == BSON_JSON_IN_SCOPE) { + /* we've read "key" in {$code: "", $scope: {key: ""}}*/ + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_SCOPE; + _bson_json_save_map_key (bson, val, len); + } else if (bson->read_state == BSON_JSON_IN_DBPOINTER) { + /* we've read "$ref" or "$id" in {$dbPointer: {$ref: ..., $id: ...}} */ + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_DBPOINTER; + _bson_json_save_map_key (bson, val, len); + } + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + if + HANDLE_OPTION ("$regex", BSON_TYPE_REGEX, BSON_JSON_LF_REGEX) + else if + HANDLE_OPTION ("$options", BSON_TYPE_REGEX, BSON_JSON_LF_OPTIONS) + else if + HANDLE_OPTION ("$oid", BSON_TYPE_OID, BSON_JSON_LF_OID) + else if + HANDLE_OPTION ("$binary", BSON_TYPE_BINARY, BSON_JSON_LF_BINARY) + else if + HANDLE_OPTION ("$type", BSON_TYPE_BINARY, BSON_JSON_LF_TYPE) + else if + HANDLE_OPTION ("$date", BSON_TYPE_DATE_TIME, BSON_JSON_LF_DATE) + else if + HANDLE_OPTION ( + "$undefined", BSON_TYPE_UNDEFINED, BSON_JSON_LF_UNDEFINED) + else if + HANDLE_OPTION ("$minKey", BSON_TYPE_MINKEY, BSON_JSON_LF_MINKEY) + else if + HANDLE_OPTION ("$maxKey", BSON_TYPE_MAXKEY, BSON_JSON_LF_MAXKEY) + else if + HANDLE_OPTION ("$numberInt", BSON_TYPE_INT32, BSON_JSON_LF_INT32) + else if + HANDLE_OPTION ("$numberLong", BSON_TYPE_INT64, BSON_JSON_LF_INT64) + else if + HANDLE_OPTION ("$numberDouble", BSON_TYPE_DOUBLE, BSON_JSON_LF_DOUBLE) + else if + HANDLE_OPTION ("$symbol", BSON_TYPE_SYMBOL, BSON_JSON_LF_SYMBOL) + else if + HANDLE_OPTION ( + "$numberDecimal", BSON_TYPE_DECIMAL128, BSON_JSON_LF_DECIMAL128) + else if (!strcmp ("$timestamp", (const char *) val)) { + bson->bson_type = BSON_TYPE_TIMESTAMP; + bson->read_state = BSON_JSON_IN_BSON_TYPE_TIMESTAMP_STARTMAP; + } else if (!strcmp ("$regularExpression", (const char *) val)) { + bson->bson_type = BSON_TYPE_REGEX; + bson->read_state = BSON_JSON_IN_BSON_TYPE_REGEX_STARTMAP; + } else if (!strcmp ("$dbPointer", (const char *) val)) { + /* start parsing "key": {"$dbPointer": {...}}, save "key" for later */ + _bson_json_buf_set ( + &bson->dbpointer_key, bson->key_buf.buf, bson->key_buf.len); + + bson->bson_type = BSON_TYPE_DBPOINTER; + bson->read_state = BSON_JSON_IN_BSON_TYPE_DBPOINTER_STARTMAP; + } else if (!strcmp ("$code", (const char *) val)) { + _bson_json_read_code_or_scope_key ( + bson, false /* is_scope */, val, len); + } else if (!strcmp ("$scope", (const char *) val)) { + _bson_json_read_code_or_scope_key ( + bson, true /* is_scope */, val, len); + } else { + _bson_json_bad_key_in_type (reader, val); + } + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_DATE_NUMBERLONG) { + if + HANDLE_OPTION ("$numberLong", BSON_TYPE_DATE_TIME, BSON_JSON_LF_INT64) + else { + _bson_json_bad_key_in_type (reader, val); + } + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_VALUES) { + if + HANDLE_OPTION ("t", BSON_TYPE_TIMESTAMP, BSON_JSON_LF_TIMESTAMP_T) + else if + HANDLE_OPTION ("i", BSON_TYPE_TIMESTAMP, BSON_JSON_LF_TIMESTAMP_I) + else { + _bson_json_bad_key_in_type (reader, val); + } + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_REGEX_VALUES) { + if + HANDLE_OPTION ( + "pattern", BSON_TYPE_REGEX, BSON_JSON_LF_REGULAR_EXPRESSION_PATTERN) + else if + HANDLE_OPTION ( + "options", BSON_TYPE_REGEX, BSON_JSON_LF_REGULAR_EXPRESSION_OPTIONS) + else { + _bson_json_bad_key_in_type (reader, val); + } + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_BINARY_VALUES) { + if + HANDLE_OPTION ("base64", BSON_TYPE_BINARY, BSON_JSON_LF_BINARY) + else if + HANDLE_OPTION ("subType", BSON_TYPE_BINARY, BSON_JSON_LF_TYPE) + else { + _bson_json_bad_key_in_type (reader, val); + } + } else { + _bson_json_save_map_key (bson, val, len); + + /* in x: {$ref: "collection", $id: {$oid: "..."}, $db: "..." } */ + if (bson->n > 0) { + if (!strcmp ("$ref", (const char *) val)) { + STACK_HAS_REF = true; + bson->read_state = BSON_JSON_IN_BSON_TYPE; + bson->bson_state = BSON_JSON_LF_DBREF; + } else if (!strcmp ("$id", (const char *) val)) { + STACK_HAS_ID = true; + } else if (!strcmp ("$db", (const char *) val)) { + bson->read_state = BSON_JSON_IN_BSON_TYPE; + bson->bson_state = BSON_JSON_LF_DBREF; + } + } + } +} + + +static void +_bson_json_read_append_binary (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + bson_json_bson_data_t *data = &bson->bson_type_data; + + if (data->binary.is_legacy) { + if (!data->binary.has_binary) { + _bson_json_read_set_error ( + reader, + "Missing \"$binary\" after \"$type\" reading type \"binary\""); + return; + } else if (!data->binary.has_subtype) { + _bson_json_read_set_error ( + reader, + "Missing \"$type\" after \"$binary\" reading type \"binary\""); + return; + } + } else { + if (!data->binary.has_binary) { + _bson_json_read_set_error ( + reader, + "Missing \"base64\" after \"subType\" reading type \"binary\""); + return; + } else if (!data->binary.has_subtype) { + _bson_json_read_set_error ( + reader, + "Missing \"subType\" after \"base64\" reading type \"binary\""); + return; + } + } + + if (!bson_append_binary (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + data->binary.type, + bson->bson_type_buf[0].buf, + (uint32_t) bson->bson_type_buf[0].len)) { + _bson_json_read_set_error (reader, "Error storing binary data"); + } +} + + +static void +_bson_json_read_append_regex (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + bson_json_bson_data_t *data = &bson->bson_type_data; + if (data->regex.is_legacy) { + if (!data->regex.has_pattern) { + _bson_json_read_set_error (reader, + "Missing \"$regex\" after \"$options\""); + return; + } + if (!data->regex.has_options) { + _bson_json_read_set_error (reader, + "Missing \"$options\" after \"$regex\""); + return; + } + } else if (!data->regex.has_pattern) { + _bson_json_read_set_error ( + reader, "Missing \"pattern\" after \"options\" in regular expression"); + return; + } else if (!data->regex.has_options) { + _bson_json_read_set_error ( + reader, "Missing \"options\" after \"pattern\" in regular expression"); + return; + } + + if (!bson_append_regex (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + (char *) bson->bson_type_buf[0].buf, + (char *) bson->bson_type_buf[1].buf)) { + _bson_json_read_set_error (reader, "Error storing regex"); + } +} + + +static void +_bson_json_read_append_code (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + bson_json_code_t *code_data; + char *code = NULL; + bson_t *scope = NULL; + bool r; + + code_data = &bson->code_data; + + BSON_ASSERT (!code_data->in_scope); + + if (!code_data->has_code) { + _bson_json_read_set_error (reader, "Missing $code after $scope"); + return; + } + + code = (char *) code_data->code_buf.buf; + + if (code_data->has_scope) { + scope = STACK_BSON (1); + } + + /* creates BSON "code" elem, or "code with scope" if scope is not NULL */ + r = bson_append_code_with_scope (STACK_BSON_CHILD, + (const char *) code_data->key_buf.buf, + (int) code_data->key_buf.len, + code, + scope); + + if (!r) { + _bson_json_read_set_error (reader, "Error storing Javascript code"); + } + + /* keep the buffer but truncate it */ + code_data->key_buf.len = 0; + code_data->has_code = code_data->has_scope = false; +} + + +static void +_bson_json_read_append_dbpointer (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + bson_t *db_pointer; + bson_iter_t iter; + const char *ns = NULL; + const bson_oid_t *oid = NULL; + bool r; + + BSON_ASSERT (reader->bson.dbpointer_key.buf); + + db_pointer = STACK_BSON (1); + if (!bson_iter_init (&iter, db_pointer)) { + _bson_json_read_set_error (reader, "Error storing DBPointer"); + return; + } + + while (bson_iter_next (&iter)) { + if (!strcmp (bson_iter_key (&iter), "$id")) { + if (!BSON_ITER_HOLDS_OID (&iter)) { + _bson_json_read_set_error ( + reader, "$dbPointer.$id must be like {\"$oid\": ...\"}"); + return; + } + + oid = bson_iter_oid (&iter); + } else if (!strcmp (bson_iter_key (&iter), "$ref")) { + if (!BSON_ITER_HOLDS_UTF8 (&iter)) { + _bson_json_read_set_error ( + reader, + "$dbPointer.$ref must be a string like \"db.collection\""); + return; + } + + ns = bson_iter_utf8 (&iter, NULL); + } else { + _bson_json_read_set_error (reader, + "$dbPointer contains invalid key: \"%s\"", + bson_iter_key (&iter)); + return; + } + } + + if (!oid || !ns) { + _bson_json_read_set_error (reader, + "$dbPointer requires both $id and $ref"); + return; + } + + r = bson_append_dbpointer (STACK_BSON_CHILD, + (char *) reader->bson.dbpointer_key.buf, + (int) reader->bson.dbpointer_key.len, + ns, + oid); + + if (!r) { + _bson_json_read_set_error (reader, "Error storing DBPointer"); + } +} + + +static void +_bson_json_read_append_oid (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + if (!bson_append_oid (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + &bson->bson_type_data.oid.oid)) { + _bson_json_read_set_error (reader, "Error storing ObjectId"); + } +} + + +static void +_bson_json_read_append_date_time (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + if (!bson_append_date_time (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + bson->bson_type_data.date.date)) { + _bson_json_read_set_error (reader, "Error storing datetime"); + } +} + + +static void +_bson_json_read_append_timestamp (bson_json_reader_t *reader, /* IN */ + bson_json_reader_bson_t *bson) /* IN */ +{ + if (!bson->bson_type_data.timestamp.has_t) { + _bson_json_read_set_error ( + reader, "Missing t after $timestamp in BSON_TYPE_TIMESTAMP"); + return; + } else if (!bson->bson_type_data.timestamp.has_i) { + _bson_json_read_set_error ( + reader, "Missing i after $timestamp in BSON_TYPE_TIMESTAMP"); + return; + } + + bson_append_timestamp (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + bson->bson_type_data.timestamp.t, + bson->bson_type_data.timestamp.i); +} + + +static void +_bad_extended_json (bson_json_reader_t *reader) +{ + _bson_json_read_corrupt (reader, "Invalid MongoDB extended JSON"); +} + + +static void +_bson_json_read_end_map (bson_json_reader_t *reader) /* IN */ +{ + bson_json_reader_bson_t *bson = &reader->bson; + bool r = true; + + if (bson->read_state == BSON_JSON_IN_START_MAP) { + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_DOC (bson_append_document_begin (STACK_BSON_PARENT, + bson->key, + (int) bson->key_buf.len, + STACK_BSON_CHILD)); + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_SCOPE_STARTMAP) { + bson->read_state = BSON_JSON_REGULAR; + STACK_PUSH_SCOPE; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_DBPOINTER_STARTMAP) { + /* we've read last "}" in "{$dbPointer: {$id: ..., $ref: ...}}" */ + _bson_json_read_append_dbpointer (reader, bson); + bson->read_state = BSON_JSON_REGULAR; + return; + } + + if (bson->read_state == BSON_JSON_IN_BSON_TYPE) { + if (!bson->key) { + /* invalid, like {$numberLong: "1"} at the document top level */ + _bad_extended_json (reader); + return; + } + + bson->read_state = BSON_JSON_REGULAR; + switch (bson->bson_type) { + case BSON_TYPE_REGEX: + _bson_json_read_append_regex (reader, bson); + break; + case BSON_TYPE_CODE: + case BSON_TYPE_CODEWSCOPE: + /* we've read the closing "}" in "{$code: ..., $scope: ...}" */ + _bson_json_read_append_code (reader, bson); + break; + case BSON_TYPE_OID: + _bson_json_read_append_oid (reader, bson); + break; + case BSON_TYPE_BINARY: + _bson_json_read_append_binary (reader, bson); + break; + case BSON_TYPE_DATE_TIME: + _bson_json_read_append_date_time (reader, bson); + break; + case BSON_TYPE_UNDEFINED: + r = bson_append_undefined ( + STACK_BSON_CHILD, bson->key, (int) bson->key_buf.len); + break; + case BSON_TYPE_MINKEY: + r = bson_append_minkey ( + STACK_BSON_CHILD, bson->key, (int) bson->key_buf.len); + break; + case BSON_TYPE_MAXKEY: + r = bson_append_maxkey ( + STACK_BSON_CHILD, bson->key, (int) bson->key_buf.len); + break; + case BSON_TYPE_INT32: + r = bson_append_int32 (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + bson->bson_type_data.v_int32.value); + break; + case BSON_TYPE_INT64: + r = bson_append_int64 (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + bson->bson_type_data.v_int64.value); + break; + case BSON_TYPE_DOUBLE: + r = bson_append_double (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + bson->bson_type_data.v_double.value); + break; + case BSON_TYPE_DECIMAL128: + r = bson_append_decimal128 (STACK_BSON_CHILD, + bson->key, + (int) bson->key_buf.len, + &bson->bson_type_data.v_decimal128.value); + break; + case BSON_TYPE_DBPOINTER: + /* shouldn't set type to DBPointer unless inside $dbPointer: {...} */ + _bson_json_read_set_error ( + reader, + "Internal error: shouldn't be in state BSON_TYPE_DBPOINTER"); + break; + case BSON_TYPE_SYMBOL: + break; + case BSON_TYPE_EOD: + case BSON_TYPE_UTF8: + case BSON_TYPE_DOCUMENT: + case BSON_TYPE_ARRAY: + case BSON_TYPE_BOOL: + case BSON_TYPE_NULL: + case BSON_TYPE_TIMESTAMP: + default: + _bson_json_read_set_error ( + reader, + "Internal error: can't parse JSON wrapper for type \"%s\"", + _bson_json_type_name (bson->bson_type)); + break; + } + + if (!r) { + _bson_json_read_set_error ( + reader, + "Cannot append value at end of JSON object for key %s", + bson->key); + } + + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_VALUES) { + if (!bson->key) { + _bad_extended_json (reader); + return; + } + + bson->read_state = BSON_JSON_IN_BSON_TYPE_TIMESTAMP_ENDMAP; + _bson_json_read_append_timestamp (reader, bson); + return; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_REGEX_VALUES) { + if (!bson->key) { + _bad_extended_json (reader); + return; + } + + bson->read_state = BSON_JSON_IN_BSON_TYPE_REGEX_ENDMAP; + _bson_json_read_append_regex (reader, bson); + return; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_BINARY_VALUES) { + if (!bson->key) { + _bad_extended_json (reader); + return; + } + + bson->read_state = BSON_JSON_IN_BSON_TYPE_BINARY_ENDMAP; + _bson_json_read_append_binary (reader, bson); + return; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_TIMESTAMP_ENDMAP) { + bson->read_state = BSON_JSON_REGULAR; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_REGEX_ENDMAP) { + bson->read_state = BSON_JSON_REGULAR; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_BINARY_ENDMAP) { + bson->read_state = BSON_JSON_REGULAR; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_DATE_NUMBERLONG) { + if (!bson->key) { + _bad_extended_json (reader); + return; + } + + bson->read_state = BSON_JSON_IN_BSON_TYPE_DATE_ENDMAP; + + _bson_json_read_append_date_time (reader, bson); + return; + } else if (bson->read_state == BSON_JSON_IN_BSON_TYPE_DATE_ENDMAP) { + bson->read_state = BSON_JSON_REGULAR; + } else if (bson->read_state == BSON_JSON_REGULAR) { + if (STACK_IS_SCOPE) { + bson->read_state = BSON_JSON_IN_BSON_TYPE; + bson->bson_type = BSON_TYPE_CODE; + STACK_POP_SCOPE; + } else if (STACK_IS_DBPOINTER) { + bson->read_state = BSON_JSON_IN_BSON_TYPE_DBPOINTER_STARTMAP; + STACK_POP_DBPOINTER; + } else { + if (STACK_HAS_ID != STACK_HAS_REF) { + _bson_json_read_set_error ( + reader, "%s", "DBRef object must have both $ref and $id keys"); + } + + STACK_POP_DOC ( + bson_append_document_end (STACK_BSON_PARENT, STACK_BSON_CHILD)); + } + + if (bson->n == -1) { + bson->read_state = BSON_JSON_DONE; + } + } else if (bson->read_state == BSON_JSON_IN_SCOPE) { + /* empty $scope */ + BSON_ASSERT (bson->code_data.has_scope); + STACK_PUSH_SCOPE; + STACK_POP_SCOPE; + bson->read_state = BSON_JSON_IN_BSON_TYPE; + bson->bson_type = BSON_TYPE_CODE; + } else if (bson->read_state == BSON_JSON_IN_DBPOINTER) { + /* empty $dbPointer??? */ + _bson_json_read_set_error (reader, "Empty $dbPointer"); + } else { + _bson_json_read_set_error ( + reader, "Invalid state \"%s\"", read_state_names[bson->read_state]); + } +} + + +static void +_bson_json_read_start_array (bson_json_reader_t *reader) /* IN */ +{ + const char *key; + size_t len; + bson_json_reader_bson_t *bson = &reader->bson; + + if (bson->read_state != BSON_JSON_REGULAR) { + _bson_json_read_set_error (reader, + "Invalid read of \"[\" in state \"%s\"", + read_state_names[bson->read_state]); + return; + } + + if (bson->n == -1) { + STACK_PUSH_ARRAY (_noop ()); + } else { + _bson_json_read_fixup_key (bson); + key = bson->key; + len = bson->key_buf.len; + + STACK_PUSH_ARRAY (bson_append_array_begin ( + STACK_BSON_PARENT, key, (int) len, STACK_BSON_CHILD)); + } +} + + +static void +_bson_json_read_end_array (bson_json_reader_t *reader) /* IN */ +{ + bson_json_reader_bson_t *bson = &reader->bson; + + if (bson->read_state != BSON_JSON_REGULAR) { + _bson_json_read_set_error (reader, + "Invalid read of \"]\" in state \"%s\"", + read_state_names[bson->read_state]); + return; + } + + STACK_POP_ARRAY ( + bson_append_array_end (STACK_BSON_PARENT, STACK_BSON_CHILD)); + if (bson->n == -1) { + bson->read_state = BSON_JSON_DONE; + } +} + + +/* put unescaped text in reader->bson.unescaped, or set reader->error. + * json_text has length len and it is not null-terminated. */ +static bool +_bson_json_unescape (bson_json_reader_t *reader, + struct jsonsl_state_st *state, + const char *json_text, + ssize_t len) +{ + bson_json_reader_bson_t *reader_bson; + jsonsl_error_t err; + + reader_bson = &reader->bson; + + /* add 1 for NULL */ + _bson_json_buf_ensure (&reader_bson->unescaped, (size_t) len + 1); + + /* length of unescaped str is always <= len */ + reader_bson->unescaped.len = jsonsl_util_unescape ( + json_text, (char *) reader_bson->unescaped.buf, (size_t) len, NULL, &err); + + if (err != JSONSL_ERROR_SUCCESS) { + bson_set_error (reader->error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "error near position %d: \"%s\"", + (int) state->pos_begin, + jsonsl_strerror (err)); + return false; + } + + reader_bson->unescaped.buf[reader_bson->unescaped.len] = '\0'; + + return true; +} + + +/* read the buffered JSON plus new data, and fill out @len with its length */ +static const char * +_get_json_text (jsonsl_t json, /* IN */ + struct jsonsl_state_st *state, /* IN */ + const char *buf /* IN */, + ssize_t *len /* OUT */) +{ + bson_json_reader_t *reader; + ssize_t bytes_available; + + reader = (bson_json_reader_t *) json->data; + + BSON_ASSERT (state->pos_cur > state->pos_begin); + + *len = (ssize_t) (state->pos_cur - state->pos_begin); + + bytes_available = buf - json->base; + + if (*len <= bytes_available) { + /* read directly from stream, not from saved JSON */ + return buf - (size_t) *len; + } else { + /* combine saved text with new data from the jsonsl_t */ + ssize_t append = buf - json->base; + + if (append > 0) { + _bson_json_buf_append ( + &reader->tok_accumulator, buf - append, (size_t) append); + } + + return (const char *) reader->tok_accumulator.buf; + } +} + + +static void +_push_callback (jsonsl_t json, + jsonsl_action_t action, + struct jsonsl_state_st *state, + const char *buf) +{ + bson_json_reader_t *reader = (bson_json_reader_t *) json->data; + + switch (state->type) { + case JSONSL_T_STRING: + case JSONSL_T_HKEY: + case JSONSL_T_SPECIAL: + case JSONSL_T_UESCAPE: + reader->json_text_pos = state->pos_begin; + break; + case JSONSL_T_OBJECT: + _bson_json_read_start_map (reader); + break; + case JSONSL_T_LIST: + _bson_json_read_start_array (reader); + break; + default: + break; + } +} + + +static void +_pop_callback (jsonsl_t json, + jsonsl_action_t action, + struct jsonsl_state_st *state, + const char *buf) +{ + bson_json_reader_t *reader; + bson_json_reader_bson_t *reader_bson; + ssize_t len; + double d; + const char *obj_text; + + reader = (bson_json_reader_t *) json->data; + reader_bson = &reader->bson; + + switch (state->type) { + case JSONSL_T_HKEY: + case JSONSL_T_STRING: + obj_text = _get_json_text (json, state, buf, &len); + BSON_ASSERT (obj_text[0] == '"'); + + /* remove start/end quotes, replace backslash-escapes, null-terminate */ + /* you'd think it would be faster to check if state->nescapes > 0 first, + * but tests show no improvement */ + if (!_bson_json_unescape (reader, state, obj_text + 1, len - 1)) { + /* reader->error is set */ + jsonsl_stop (json); + break; + } + + if (state->type == JSONSL_T_HKEY) { + _bson_json_read_map_key ( + reader, reader_bson->unescaped.buf, reader_bson->unescaped.len); + } else { + _bson_json_read_string ( + reader, reader_bson->unescaped.buf, reader_bson->unescaped.len); + } + break; + case JSONSL_T_OBJECT: + _bson_json_read_end_map (reader); + break; + case JSONSL_T_LIST: + _bson_json_read_end_array (reader); + break; + case JSONSL_T_SPECIAL: + obj_text = _get_json_text (json, state, buf, &len); + if (state->special_flags & JSONSL_SPECIALf_NUMNOINT) { + if (_bson_json_parse_double (reader, obj_text, (size_t) len, &d)) { + _bson_json_read_double (reader, d); + } + } else if (state->special_flags & JSONSL_SPECIALf_NUMERIC) { + /* jsonsl puts the unsigned value in state->nelem */ + _bson_json_read_integer ( + reader, + state->nelem, + state->special_flags & JSONSL_SPECIALf_SIGNED ? -1 : 1); + } else if (state->special_flags & JSONSL_SPECIALf_BOOLEAN) { + _bson_json_read_boolean (reader, obj_text[0] == 't' ? 1 : 0); + } else if (state->special_flags & JSONSL_SPECIALf_NULL) { + _bson_json_read_null (reader); + } + break; + default: + break; + } + + reader->json_text_pos = -1; + reader->tok_accumulator.len = 0; +} + + +static int +_error_callback (jsonsl_t json, + jsonsl_error_t err, + struct jsonsl_state_st *state, + char *errat) +{ + bson_json_reader_t *reader = (bson_json_reader_t *) json->data; + + if (err == JSONSL_ERROR_CANT_INSERT && *errat == '{') { + /* start the next document */ + reader->should_reset = true; + reader->advance = errat - json->base; + return 0; + } + + bson_set_error (reader->error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "Got parse error at \"%c\", position %d: \"%s\"", + *errat, + (int) json->pos, + jsonsl_strerror (err)); + + return 0; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_json_reader_read -- + * + * Read the next json document from @reader and write its value + * into @bson. @bson will be allocated as part of this process. + * + * @bson MUST be initialized before calling this function as it + * will not be initialized automatically. The reasoning for this + * is so that you can chain together bson_json_reader_t with + * other components like bson_writer_t. + * + * Returns: + * 1 if successful and data was read. + * 0 if successful and no data was read. + * -1 if there was an error and @error is set. + * + * Side effects: + * @error may be set. + * + *-------------------------------------------------------------------------- + */ + +int +bson_json_reader_read (bson_json_reader_t *reader, /* IN */ + bson_t *bson, /* IN */ + bson_error_t *error) /* OUT */ +{ + bson_json_reader_producer_t *p; + ssize_t start_pos; + ssize_t r; + ssize_t buf_offset; + ssize_t accum; + bson_error_t error_tmp; + int ret = 0; + + BSON_ASSERT (reader); + BSON_ASSERT (bson); + + p = &reader->producer; + + reader->bson.bson = bson; + reader->bson.n = -1; + reader->bson.read_state = BSON_JSON_REGULAR; + reader->error = error ? error : &error_tmp; + memset (reader->error, 0, sizeof (bson_error_t)); + + for (;;) { + start_pos = reader->json->pos; + + if (p->bytes_read > 0) { + /* leftover data from previous JSON doc in the stream */ + r = p->bytes_read; + } else { + /* read a chunk of bytes by executing the callback */ + r = p->cb (p->data, p->buf, p->buf_size); + } + + if (r < 0) { + if (error) { + bson_set_error (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CB_FAILURE, + "reader cb failed"); + } + ret = -1; + goto cleanup; + } else if (r == 0) { + break; + } else { + ret = 1; + p->bytes_read = (size_t) r; + + jsonsl_feed (reader->json, (const jsonsl_char_t *) p->buf, (size_t) r); + + if (reader->should_reset) { + /* end of a document */ + jsonsl_reset (reader->json); + reader->should_reset = false; + + /* advance past already-parsed data */ + memmove (p->buf, p->buf + reader->advance, r - reader->advance); + p->bytes_read -= reader->advance; + ret = 1; + goto cleanup; + } + + if (reader->error->domain) { + ret = -1; + goto cleanup; + } + + /* accumulate a key or string value */ + if (reader->json_text_pos != -1) { + if (reader->json_text_pos < reader->json->pos) { + accum = BSON_MIN (reader->json->pos - reader->json_text_pos, r); + /* if this chunk stopped mid-token, buf_offset is how far into + * our current chunk the token begins. */ + buf_offset = AT_LEAST_0 (reader->json_text_pos - start_pos); + _bson_json_buf_append (&reader->tok_accumulator, + p->buf + buf_offset, + (size_t) accum); + } + } + + p->bytes_read = 0; + } + } + +cleanup: + if (ret == 1 && reader->bson.read_state != BSON_JSON_DONE) { + /* data ended in the middle */ + _bson_json_read_corrupt (reader, "%s", "Incomplete JSON"); + return -1; + } + + return ret; +} + + +bson_json_reader_t * +bson_json_reader_new (void *data, /* IN */ + bson_json_reader_cb cb, /* IN */ + bson_json_destroy_cb dcb, /* IN */ + bool allow_multiple, /* unused */ + size_t buf_size) /* IN */ +{ + bson_json_reader_t *r; + bson_json_reader_producer_t *p; + + r = bson_malloc0 (sizeof *r); + r->json = jsonsl_new (STACK_MAX); + r->json->error_callback = _error_callback; + r->json->action_callback_PUSH = _push_callback; + r->json->action_callback_POP = _pop_callback; + r->json->data = r; + r->json_text_pos = -1; + jsonsl_enable_all_callbacks (r->json); + + p = &r->producer; + + p->data = data; + p->cb = cb; + p->dcb = dcb; + p->buf_size = buf_size ? buf_size : BSON_JSON_DEFAULT_BUF_SIZE; + p->buf = bson_malloc (p->buf_size); + + return r; +} + + +void +bson_json_reader_destroy (bson_json_reader_t *reader) /* IN */ +{ + int i; + bson_json_reader_producer_t *p; + bson_json_reader_bson_t *b; + + if (!reader) { + return; + } + + p = &reader->producer; + b = &reader->bson; + + if (reader->producer.dcb) { + reader->producer.dcb (reader->producer.data); + } + + bson_free (p->buf); + bson_free (b->key_buf.buf); + bson_free (b->unescaped.buf); + bson_free (b->dbpointer_key.buf); + + /* destroy each bson_t initialized in parser stack frames */ + for (i = 1; i < STACK_MAX; i++) { + if (b->stack[i].type == BSON_JSON_FRAME_INITIAL) { + /* highest the stack grew */ + break; + } + + if (FRAME_TYPE_HAS_BSON (b->stack[i].type)) { + bson_destroy (&b->stack[i].bson); + } + } + + for (i = 0; i < 3; i++) { + bson_free (b->bson_type_buf[i].buf); + } + + _bson_json_code_cleanup (&b->code_data); + + jsonsl_destroy (reader->json); + bson_free (reader->tok_accumulator.buf); + bson_free (reader); +} + + +typedef struct { + const uint8_t *data; + size_t len; + size_t bytes_parsed; +} bson_json_data_reader_t; + + +static ssize_t +_bson_json_data_reader_cb (void *_ctx, uint8_t *buf, size_t len) +{ + size_t bytes; + bson_json_data_reader_t *ctx = (bson_json_data_reader_t *) _ctx; + + if (!ctx->data) { + return -1; + } + + bytes = BSON_MIN (len, ctx->len - ctx->bytes_parsed); + + memcpy (buf, ctx->data + ctx->bytes_parsed, bytes); + + ctx->bytes_parsed += bytes; + + return bytes; +} + + +bson_json_reader_t * +bson_json_data_reader_new (bool allow_multiple, /* IN */ + size_t size) /* IN */ +{ + bson_json_data_reader_t *dr = bson_malloc0 (sizeof *dr); + + return bson_json_reader_new ( + dr, &_bson_json_data_reader_cb, &bson_free, allow_multiple, size); +} + + +void +bson_json_data_reader_ingest (bson_json_reader_t *reader, /* IN */ + const uint8_t *data, /* IN */ + size_t len) /* IN */ +{ + bson_json_data_reader_t *ctx = + (bson_json_data_reader_t *) reader->producer.data; + + ctx->data = data; + ctx->len = len; + ctx->bytes_parsed = 0; +} + + +bson_t * +bson_new_from_json (const uint8_t *data, /* IN */ + ssize_t len, /* IN */ + bson_error_t *error) /* OUT */ +{ + bson_json_reader_t *reader; + bson_t *bson; + int r; + + BSON_ASSERT (data); + + if (len < 0) { + len = (ssize_t) strlen ((const char *) data); + } + + bson = bson_new (); + reader = bson_json_data_reader_new (false, BSON_JSON_DEFAULT_BUF_SIZE); + bson_json_data_reader_ingest (reader, data, len); + r = bson_json_reader_read (reader, bson, error); + bson_json_reader_destroy (reader); + + if (r == 0) { + bson_set_error (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Empty JSON string"); + } + + if (r != 1) { + bson_destroy (bson); + return NULL; + } + + return bson; +} + + +bool +bson_init_from_json (bson_t *bson, /* OUT */ + const char *data, /* IN */ + ssize_t len, /* IN */ + bson_error_t *error) /* OUT */ +{ + bson_json_reader_t *reader; + int r; + + BSON_ASSERT (bson); + BSON_ASSERT (data); + + if (len < 0) { + len = strlen (data); + } + + bson_init (bson); + + reader = bson_json_data_reader_new (false, BSON_JSON_DEFAULT_BUF_SIZE); + bson_json_data_reader_ingest (reader, (const uint8_t *) data, len); + r = bson_json_reader_read (reader, bson, error); + bson_json_reader_destroy (reader); + + if (r == 0) { + bson_set_error (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Empty JSON string"); + } + + if (r != 1) { + bson_destroy (bson); + return false; + } + + return true; +} + + +static void +_bson_json_reader_handle_fd_destroy (void *handle) /* IN */ +{ + bson_json_reader_handle_fd_t *fd = handle; + + if (fd) { + if ((fd->fd != -1) && fd->do_close) { +#ifdef _WIN32 + _close (fd->fd); +#else + close (fd->fd); +#endif + } + bson_free (fd); + } +} + + +static ssize_t +_bson_json_reader_handle_fd_read (void *handle, /* IN */ + uint8_t *buf, /* IN */ + size_t len) /* IN */ +{ + bson_json_reader_handle_fd_t *fd = handle; + ssize_t ret = -1; + + if (fd && (fd->fd != -1)) { + again: +#ifdef BSON_OS_WIN32 + ret = _read (fd->fd, buf, (unsigned int) len); +#else + ret = read (fd->fd, buf, len); +#endif + if ((ret == -1) && (errno == EAGAIN)) { + goto again; + } + } + + return ret; +} + + +bson_json_reader_t * +bson_json_reader_new_from_fd (int fd, /* IN */ + bool close_on_destroy) /* IN */ +{ + bson_json_reader_handle_fd_t *handle; + + BSON_ASSERT (fd != -1); + + handle = bson_malloc0 (sizeof *handle); + handle->fd = fd; + handle->do_close = close_on_destroy; + + return bson_json_reader_new (handle, + _bson_json_reader_handle_fd_read, + _bson_json_reader_handle_fd_destroy, + true, + BSON_JSON_DEFAULT_BUF_SIZE); +} + + +bson_json_reader_t * +bson_json_reader_new_from_file (const char *path, /* IN */ + bson_error_t *error) /* OUT */ +{ + char errmsg_buf[BSON_ERROR_BUFFER_SIZE]; + char *errmsg; + int fd = -1; + + BSON_ASSERT (path); + +#ifdef BSON_OS_WIN32 + _sopen_s (&fd, path, (_O_RDONLY | _O_BINARY), _SH_DENYNO, _S_IREAD); +#else + fd = open (path, O_RDONLY); +#endif + + if (fd == -1) { + errmsg = bson_strerror_r (errno, errmsg_buf, sizeof errmsg_buf); + bson_set_error ( + error, BSON_ERROR_READER, BSON_ERROR_READER_BADFD, "%s", errmsg); + return NULL; + } + + return bson_json_reader_new_from_fd (fd, true); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.h new file mode 100644 index 0000000..838be0e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-json.h @@ -0,0 +1,76 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_JSON_H +#define BSON_JSON_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson.h" + + +BSON_BEGIN_DECLS + + +typedef struct _bson_json_reader_t bson_json_reader_t; + + +typedef enum { + BSON_JSON_ERROR_READ_CORRUPT_JS = 1, + BSON_JSON_ERROR_READ_INVALID_PARAM, + BSON_JSON_ERROR_READ_CB_FAILURE, +} bson_json_error_code_t; + + +typedef ssize_t (*bson_json_reader_cb) (void *handle, + uint8_t *buf, + size_t count); +typedef void (*bson_json_destroy_cb) (void *handle); + + +BSON_EXPORT (bson_json_reader_t *) +bson_json_reader_new (void *data, + bson_json_reader_cb cb, + bson_json_destroy_cb dcb, + bool allow_multiple, + size_t buf_size); +BSON_EXPORT (bson_json_reader_t *) +bson_json_reader_new_from_fd (int fd, bool close_on_destroy); +BSON_EXPORT (bson_json_reader_t *) +bson_json_reader_new_from_file (const char *filename, bson_error_t *error); +BSON_EXPORT (void) +bson_json_reader_destroy (bson_json_reader_t *reader); +BSON_EXPORT (int) +bson_json_reader_read (bson_json_reader_t *reader, + bson_t *bson, + bson_error_t *error); +BSON_EXPORT (bson_json_reader_t *) +bson_json_data_reader_new (bool allow_multiple, size_t size); +BSON_EXPORT (void) +bson_json_data_reader_ingest (bson_json_reader_t *reader, + const uint8_t *data, + size_t len); + + +BSON_END_DECLS + + +#endif /* BSON_JSON_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.c new file mode 100644 index 0000000..8c11c9a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.c @@ -0,0 +1,170 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "bson/bson-keys.h" +#include "bson/bson-string.h" + + +static const char *gUint32Strs[] = { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", + "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", + "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", + "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", + "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", + "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", + "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", + "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", + "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", + "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", + "121", "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", + "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", + "143", "144", "145", "146", "147", "148", "149", "150", "151", "152", "153", + "154", "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", + "165", "166", "167", "168", "169", "170", "171", "172", "173", "174", "175", + "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186", + "187", "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", + "198", "199", "200", "201", "202", "203", "204", "205", "206", "207", "208", + "209", "210", "211", "212", "213", "214", "215", "216", "217", "218", "219", + "220", "221", "222", "223", "224", "225", "226", "227", "228", "229", "230", + "231", "232", "233", "234", "235", "236", "237", "238", "239", "240", "241", + "242", "243", "244", "245", "246", "247", "248", "249", "250", "251", "252", + "253", "254", "255", "256", "257", "258", "259", "260", "261", "262", "263", + "264", "265", "266", "267", "268", "269", "270", "271", "272", "273", "274", + "275", "276", "277", "278", "279", "280", "281", "282", "283", "284", "285", + "286", "287", "288", "289", "290", "291", "292", "293", "294", "295", "296", + "297", "298", "299", "300", "301", "302", "303", "304", "305", "306", "307", + "308", "309", "310", "311", "312", "313", "314", "315", "316", "317", "318", + "319", "320", "321", "322", "323", "324", "325", "326", "327", "328", "329", + "330", "331", "332", "333", "334", "335", "336", "337", "338", "339", "340", + "341", "342", "343", "344", "345", "346", "347", "348", "349", "350", "351", + "352", "353", "354", "355", "356", "357", "358", "359", "360", "361", "362", + "363", "364", "365", "366", "367", "368", "369", "370", "371", "372", "373", + "374", "375", "376", "377", "378", "379", "380", "381", "382", "383", "384", + "385", "386", "387", "388", "389", "390", "391", "392", "393", "394", "395", + "396", "397", "398", "399", "400", "401", "402", "403", "404", "405", "406", + "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", + "418", "419", "420", "421", "422", "423", "424", "425", "426", "427", "428", + "429", "430", "431", "432", "433", "434", "435", "436", "437", "438", "439", + "440", "441", "442", "443", "444", "445", "446", "447", "448", "449", "450", + "451", "452", "453", "454", "455", "456", "457", "458", "459", "460", "461", + "462", "463", "464", "465", "466", "467", "468", "469", "470", "471", "472", + "473", "474", "475", "476", "477", "478", "479", "480", "481", "482", "483", + "484", "485", "486", "487", "488", "489", "490", "491", "492", "493", "494", + "495", "496", "497", "498", "499", "500", "501", "502", "503", "504", "505", + "506", "507", "508", "509", "510", "511", "512", "513", "514", "515", "516", + "517", "518", "519", "520", "521", "522", "523", "524", "525", "526", "527", + "528", "529", "530", "531", "532", "533", "534", "535", "536", "537", "538", + "539", "540", "541", "542", "543", "544", "545", "546", "547", "548", "549", + "550", "551", "552", "553", "554", "555", "556", "557", "558", "559", "560", + "561", "562", "563", "564", "565", "566", "567", "568", "569", "570", "571", + "572", "573", "574", "575", "576", "577", "578", "579", "580", "581", "582", + "583", "584", "585", "586", "587", "588", "589", "590", "591", "592", "593", + "594", "595", "596", "597", "598", "599", "600", "601", "602", "603", "604", + "605", "606", "607", "608", "609", "610", "611", "612", "613", "614", "615", + "616", "617", "618", "619", "620", "621", "622", "623", "624", "625", "626", + "627", "628", "629", "630", "631", "632", "633", "634", "635", "636", "637", + "638", "639", "640", "641", "642", "643", "644", "645", "646", "647", "648", + "649", "650", "651", "652", "653", "654", "655", "656", "657", "658", "659", + "660", "661", "662", "663", "664", "665", "666", "667", "668", "669", "670", + "671", "672", "673", "674", "675", "676", "677", "678", "679", "680", "681", + "682", "683", "684", "685", "686", "687", "688", "689", "690", "691", "692", + "693", "694", "695", "696", "697", "698", "699", "700", "701", "702", "703", + "704", "705", "706", "707", "708", "709", "710", "711", "712", "713", "714", + "715", "716", "717", "718", "719", "720", "721", "722", "723", "724", "725", + "726", "727", "728", "729", "730", "731", "732", "733", "734", "735", "736", + "737", "738", "739", "740", "741", "742", "743", "744", "745", "746", "747", + "748", "749", "750", "751", "752", "753", "754", "755", "756", "757", "758", + "759", "760", "761", "762", "763", "764", "765", "766", "767", "768", "769", + "770", "771", "772", "773", "774", "775", "776", "777", "778", "779", "780", + "781", "782", "783", "784", "785", "786", "787", "788", "789", "790", "791", + "792", "793", "794", "795", "796", "797", "798", "799", "800", "801", "802", + "803", "804", "805", "806", "807", "808", "809", "810", "811", "812", "813", + "814", "815", "816", "817", "818", "819", "820", "821", "822", "823", "824", + "825", "826", "827", "828", "829", "830", "831", "832", "833", "834", "835", + "836", "837", "838", "839", "840", "841", "842", "843", "844", "845", "846", + "847", "848", "849", "850", "851", "852", "853", "854", "855", "856", "857", + "858", "859", "860", "861", "862", "863", "864", "865", "866", "867", "868", + "869", "870", "871", "872", "873", "874", "875", "876", "877", "878", "879", + "880", "881", "882", "883", "884", "885", "886", "887", "888", "889", "890", + "891", "892", "893", "894", "895", "896", "897", "898", "899", "900", "901", + "902", "903", "904", "905", "906", "907", "908", "909", "910", "911", "912", + "913", "914", "915", "916", "917", "918", "919", "920", "921", "922", "923", + "924", "925", "926", "927", "928", "929", "930", "931", "932", "933", "934", + "935", "936", "937", "938", "939", "940", "941", "942", "943", "944", "945", + "946", "947", "948", "949", "950", "951", "952", "953", "954", "955", "956", + "957", "958", "959", "960", "961", "962", "963", "964", "965", "966", "967", + "968", "969", "970", "971", "972", "973", "974", "975", "976", "977", "978", + "979", "980", "981", "982", "983", "984", "985", "986", "987", "988", "989", + "990", "991", "992", "993", "994", "995", "996", "997", "998", "999"}; + + +/* + *-------------------------------------------------------------------------- + * + * bson_uint32_to_string -- + * + * Converts @value to a string. + * + * If @value is from 0 to 1000, it will use a constant string in the + * data section of the library. + * + * If not, a string will be formatted using @str and snprintf(). This + * is much slower, of course and therefore we try to optimize it out. + * + * @strptr will always be set. It will either point to @str or a + * constant string. You will want to use this as your key. + * + * Parameters: + * @value: A #uint32_t to convert to string. + * @strptr: (out): A pointer to the resulting string. + * @str: (out): Storage for a string made with snprintf. + * @size: Size of @str. + * + * Returns: + * The number of bytes in the resulting string. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +size_t +bson_uint32_to_string (uint32_t value, /* IN */ + const char **strptr, /* OUT */ + char *str, /* OUT */ + size_t size) /* IN */ +{ + if (value < 1000) { + *strptr = gUint32Strs[value]; + + if (value < 10) { + return 1; + } else if (value < 100) { + return 2; + } else { + return 3; + } + } + + *strptr = str; + + return bson_snprintf (str, size, "%u", value); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.h new file mode 100644 index 0000000..61a895f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-keys.h @@ -0,0 +1,39 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_KEYS_H +#define BSON_KEYS_H + + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (size_t) +bson_uint32_to_string (uint32_t value, + const char **strptr, + char *str, + size_t size); + + +BSON_END_DECLS + + +#endif /* BSON_KEYS_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-macros.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-macros.h new file mode 100644 index 0000000..3618e1c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-macros.h @@ -0,0 +1,296 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_MACROS_H +#define BSON_MACROS_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include + +#ifdef __cplusplus +#include +#endif + +#include "bson/bson-config.h" + + +#if BSON_OS == 1 +#define BSON_OS_UNIX +#elif BSON_OS == 2 +#define BSON_OS_WIN32 +#else +#error "Unknown operating system." +#endif + + +#ifdef __cplusplus +#define BSON_BEGIN_DECLS extern "C" { +#define BSON_END_DECLS } +#else +#define BSON_BEGIN_DECLS +#define BSON_END_DECLS +#endif + + +#if defined(__GNUC__) +#define BSON_GNUC_CHECK_VERSION(major, minor) \ + ((__GNUC__ > (major)) || \ + ((__GNUC__ == (major)) && (__GNUC_MINOR__ >= (minor)))) +#else +#define BSON_GNUC_CHECK_VERSION(major, minor) 0 +#endif + + +#if defined(__GNUC__) +#define BSON_GNUC_IS_VERSION(major, minor) \ + ((__GNUC__ == (major)) && (__GNUC_MINOR__ == (minor))) +#else +#define BSON_GNUC_IS_VERSION(major, minor) 0 +#endif + + +/* Decorate public functions: + * - if BSON_STATIC, we're compiling a program that uses libbson as a static + * library, don't decorate functions + * - else if BSON_COMPILATION, we're compiling a static or shared libbson, mark + * public functions for export from the shared lib (which has no effect on + * the static lib) + * - else, we're compiling a program that uses libbson as a shared library, + * mark public functions as DLL imports for Microsoft Visual C + */ + +#ifdef _MSC_VER +/* + * Microsoft Visual C + */ +#ifdef BSON_STATIC +#define BSON_API +#elif defined(BSON_COMPILATION) +#define BSON_API __declspec(dllexport) +#else +#define BSON_API __declspec(dllimport) +#endif +#define BSON_CALL __cdecl + +#elif defined(__GNUC__) +/* + * GCC + */ +#ifdef BSON_STATIC +#define BSON_API +#elif defined(BSON_COMPILATION) +#define BSON_API __attribute__ ((visibility ("default"))) +#else +#define BSON_API +#endif +#define BSON_CALL + +#else +/* + * Other compilers + */ +#define BSON_API +#define BSON_CALL + +#endif + +#define BSON_EXPORT(type) BSON_API type BSON_CALL + + +#ifdef MIN +#define BSON_MIN MIN +#elif defined(__cplusplus) +#define BSON_MIN(a, b) ((std::min) (a, b)) +#elif defined(_MSC_VER) +#define BSON_MIN(a, b) ((a) < (b) ? (a) : (b)) +#else +#define BSON_MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + + +#ifdef MAX +#define BSON_MAX MAX +#elif defined(__cplusplus) +#define BSON_MAX(a, b) ((std::max) (a, b)) +#elif defined(_MSC_VER) +#define BSON_MAX(a, b) ((a) > (b) ? (a) : (b)) +#else +#define BSON_MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + + +#ifdef ABS +#define BSON_ABS ABS +#else +#define BSON_ABS(a) (((a) < 0) ? ((a) * -1) : (a)) +#endif + +#ifdef _MSC_VER +#ifdef _WIN64 +#define BSON_ALIGN_OF_PTR 8 +#else +#define BSON_ALIGN_OF_PTR 4 +#endif +#else +#define BSON_ALIGN_OF_PTR (sizeof (void *)) +#endif + +#ifdef BSON_EXTRA_ALIGN +#if defined(_MSC_VER) +#define BSON_ALIGNED_BEGIN(_N) __declspec(align (_N)) +#define BSON_ALIGNED_END(_N) +#else +#define BSON_ALIGNED_BEGIN(_N) +#define BSON_ALIGNED_END(_N) __attribute__ ((aligned (_N))) +#endif +#else +#if defined(_MSC_VER) +#define BSON_ALIGNED_BEGIN(_N) __declspec(align (BSON_ALIGN_OF_PTR)) +#define BSON_ALIGNED_END(_N) +#else +#define BSON_ALIGNED_BEGIN(_N) +#define BSON_ALIGNED_END(_N) \ + __attribute__ ( \ + (aligned ((_N) > BSON_ALIGN_OF_PTR ? BSON_ALIGN_OF_PTR : (_N)))) +#endif +#endif + + +#define bson_str_empty(s) (!s[0]) +#define bson_str_empty0(s) (!s || !s[0]) + + +#if defined(_WIN32) +#define BSON_FUNC __FUNCTION__ +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L +#define BSON_FUNC __FUNCTION__ +#else +#define BSON_FUNC __func__ +#endif + +#define BSON_ASSERT(test) \ + do { \ + if (!(BSON_LIKELY (test))) { \ + fprintf (stderr, \ + "%s:%d %s(): precondition failed: %s\n", \ + __FILE__, \ + __LINE__, \ + BSON_FUNC, \ + #test); \ + abort (); \ + } \ + } while (0) + +/* obsolete macros, preserved for compatibility */ +#define BSON_STATIC_ASSERT(s) BSON_STATIC_ASSERT_ (s, __LINE__) +#define BSON_STATIC_ASSERT_JOIN(a, b) BSON_STATIC_ASSERT_JOIN2 (a, b) +#define BSON_STATIC_ASSERT_JOIN2(a, b) a##b +#define BSON_STATIC_ASSERT_(s, l) \ + typedef char BSON_STATIC_ASSERT_JOIN (static_assert_test_, \ + __LINE__)[(s) ? 1 : -1] + +/* modern macros */ +#define BSON_STATIC_ASSERT2(_name, _s) \ + BSON_STATIC_ASSERT2_ (_s, __LINE__, _name) +#define BSON_STATIC_ASSERT_JOIN3(_a, _b, _name) \ + BSON_STATIC_ASSERT_JOIN4 (_a, _b, _name) +#define BSON_STATIC_ASSERT_JOIN4(_a, _b, _name) _a##_b##_name +#define BSON_STATIC_ASSERT2_(_s, _l, _name) \ + typedef char BSON_STATIC_ASSERT_JOIN3 ( \ + static_assert_test_, __LINE__, _name)[(_s) ? 1 : -1] + + +#if defined(__GNUC__) +#define BSON_GNUC_PURE __attribute__ ((pure)) +#define BSON_GNUC_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) +#else +#define BSON_GNUC_PURE +#define BSON_GNUC_WARN_UNUSED_RESULT +#endif + + +#if BSON_GNUC_CHECK_VERSION(4, 0) && !defined(_WIN32) +#define BSON_GNUC_NULL_TERMINATED __attribute__ ((sentinel)) +#define BSON_GNUC_INTERNAL __attribute__ ((visibility ("hidden"))) +#else +#define BSON_GNUC_NULL_TERMINATED +#define BSON_GNUC_INTERNAL +#endif + + +#if defined(__GNUC__) +#define BSON_LIKELY(x) __builtin_expect (!!(x), 1) +#define BSON_UNLIKELY(x) __builtin_expect (!!(x), 0) +#else +#define BSON_LIKELY(v) v +#define BSON_UNLIKELY(v) v +#endif + + +#if defined(__clang__) +#define BSON_GNUC_PRINTF(f, v) __attribute__ ((format (printf, f, v))) +#elif BSON_GNUC_CHECK_VERSION(4, 4) +#define BSON_GNUC_PRINTF(f, v) __attribute__ ((format (gnu_printf, f, v))) +#else +#define BSON_GNUC_PRINTF(f, v) +#endif + + +#if defined(__LP64__) || defined(_LP64) +#define BSON_WORD_SIZE 64 +#else +#define BSON_WORD_SIZE 32 +#endif + + +#if defined(_MSC_VER) +#define BSON_INLINE __inline +#else +#define BSON_INLINE __inline__ +#endif + + +#ifdef _MSC_VER +#define BSON_ENSURE_ARRAY_PARAM_SIZE(_n) +#define BSON_TYPEOF decltype +#else +#define BSON_ENSURE_ARRAY_PARAM_SIZE(_n) static(_n) +#define BSON_TYPEOF typeof +#endif + + +#if BSON_GNUC_CHECK_VERSION(3, 1) +#define BSON_GNUC_DEPRECATED __attribute__ ((__deprecated__)) +#else +#define BSON_GNUC_DEPRECATED +#endif + + +#if BSON_GNUC_CHECK_VERSION(4, 5) +#define BSON_GNUC_DEPRECATED_FOR(f) \ + __attribute__ ((deprecated ("Use " #f " instead"))) +#else +#define BSON_GNUC_DEPRECATED_FOR(f) BSON_GNUC_DEPRECATED +#endif + + +#endif /* BSON_MACROS_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.c new file mode 100644 index 0000000..8e5a6e8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.c @@ -0,0 +1,24 @@ +#include "bson/bson-compat.h" + +#include "bson/bson-md5.h" +#include "common-md5-private.h" + + +void +bson_md5_init (bson_md5_t *pms) +{ + _bson_md5_init (pms); +} + + +void +bson_md5_append (bson_md5_t *pms, const uint8_t *data, uint32_t nbytes) +{ + _bson_md5_append (pms, data, nbytes); +} + +void +bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) +{ + _bson_md5_finish (pms, digest); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.h new file mode 100644 index 0000000..fb7f01e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-md5.h @@ -0,0 +1,92 @@ +/* + Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgement in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.h is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Removed support for non-ANSI compilers; removed + references to Ghostscript; clarified derivation from RFC 1321; + now handles byte order either statically or dynamically. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke . + 1999-05-03 lpd Original version. + */ + + +/* + * The following MD5 implementation has been modified to use types as + * specified in libbson. + */ + + +#ifndef BSON_MD5_H +#define BSON_MD5_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-endian.h" + + +BSON_BEGIN_DECLS + + +typedef struct { + uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t abcd[4]; /* digest buffer */ + uint8_t buf[64]; /* accumulate block */ +} bson_md5_t; + + +BSON_EXPORT (void) +bson_md5_init (bson_md5_t *pms) BSON_GNUC_DEPRECATED; +BSON_EXPORT (void) +bson_md5_append (bson_md5_t *pms, + const uint8_t *data, + uint32_t nbytes) BSON_GNUC_DEPRECATED; +BSON_EXPORT (void) +bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) BSON_GNUC_DEPRECATED; + + +BSON_END_DECLS + + +#endif /* BSON_MD5_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.c new file mode 100644 index 0000000..87ad39c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.c @@ -0,0 +1,311 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include + +#include "bson/bson-atomic.h" +#include "bson/bson-config.h" +#include "bson/bson-memory.h" + + +static bson_mem_vtable_t gMemVtable = { + malloc, + calloc, +#ifdef BSON_HAVE_REALLOCF + reallocf, +#else + realloc, +#endif + free, +}; + + +/* + *-------------------------------------------------------------------------- + * + * bson_malloc -- + * + * Allocates @num_bytes of memory and returns a pointer to it. If + * malloc failed to allocate the memory, abort() is called. + * + * Libbson does not try to handle OOM conditions as it is beyond the + * scope of this library to handle so appropriately. + * + * Parameters: + * @num_bytes: The number of bytes to allocate. + * + * Returns: + * A pointer if successful; otherwise abort() is called and this + * function will never return. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void * +bson_malloc (size_t num_bytes) /* IN */ +{ + void *mem = NULL; + + if (BSON_LIKELY (num_bytes)) { + if (BSON_UNLIKELY (!(mem = gMemVtable.malloc (num_bytes)))) { + fprintf (stderr, "Failure to allocate memory in bson_malloc(). errno: %d.\n", errno); + abort (); + } + } + + return mem; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_malloc0 -- + * + * Like bson_malloc() except the memory is zeroed first. This is + * similar to calloc() except that abort() is called in case of + * failure to allocate memory. + * + * Parameters: + * @num_bytes: The number of bytes to allocate. + * + * Returns: + * A pointer if successful; otherwise abort() is called and this + * function will never return. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void * +bson_malloc0 (size_t num_bytes) /* IN */ +{ + void *mem = NULL; + + if (BSON_LIKELY (num_bytes)) { + if (BSON_UNLIKELY (!(mem = gMemVtable.calloc (1, num_bytes)))) { + fprintf (stderr, "Failure to allocate memory in bson_malloc0(). errno: %d.\n", errno); + abort (); + } + } + + return mem; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_realloc -- + * + * This function behaves similar to realloc() except that if there is + * a failure abort() is called. + * + * Parameters: + * @mem: The memory to realloc, or NULL. + * @num_bytes: The size of the new allocation or 0 to free. + * + * Returns: + * The new allocation if successful; otherwise abort() is called and + * this function never returns. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void * +bson_realloc (void *mem, /* IN */ + size_t num_bytes) /* IN */ +{ + /* + * Not all platforms are guaranteed to free() the memory if a call to + * realloc() with a size of zero occurs. Windows, Linux, and FreeBSD do, + * however, OS X does not. + */ + if (BSON_UNLIKELY (num_bytes == 0)) { + gMemVtable.free (mem); + return NULL; + } + + mem = gMemVtable.realloc (mem, num_bytes); + + if (BSON_UNLIKELY (!mem)) { + fprintf (stderr, "Failure to re-allocate memory in bson_realloc(). errno: %d.\n", errno); + abort (); + } + + return mem; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_realloc_ctx -- + * + * This wraps bson_realloc and provides a compatible api for similar + * functions with a context + * + * Parameters: + * @mem: The memory to realloc, or NULL. + * @num_bytes: The size of the new allocation or 0 to free. + * @ctx: Ignored + * + * Returns: + * The new allocation if successful; otherwise abort() is called and + * this function never returns. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + + +void * +bson_realloc_ctx (void *mem, /* IN */ + size_t num_bytes, /* IN */ + void *ctx) /* IN */ +{ + return bson_realloc (mem, num_bytes); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_free -- + * + * Frees @mem using the underlying allocator. + * + * Currently, this only calls free() directly, but that is subject to + * change. + * + * Parameters: + * @mem: An allocation to free. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_free (void *mem) /* IN */ +{ + gMemVtable.free (mem); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_zero_free -- + * + * Frees @mem using the underlying allocator. @size bytes of @mem will + * be zeroed before freeing the memory. This is useful in scenarios + * where @mem contains passwords or other sensitive information. + * + * Parameters: + * @mem: An allocation to free. + * @size: The number of bytes in @mem. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_zero_free (void *mem, /* IN */ + size_t size) /* IN */ +{ + if (BSON_LIKELY (mem)) { + memset (mem, 0, size); + gMemVtable.free (mem); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_mem_set_vtable -- + * + * This function will change our allocation vtable. + * + * It is imperative that this is called at the beginning of the + * process before any memory has been allocated by the default + * allocator. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_mem_set_vtable (const bson_mem_vtable_t *vtable) +{ + BSON_ASSERT (vtable); + + if (!vtable->malloc || !vtable->calloc || !vtable->realloc || + !vtable->free) { + fprintf (stderr, + "Failure to install BSON vtable, " + "missing functions.\n"); + return; + } + + gMemVtable = *vtable; +} + +void +bson_mem_restore_vtable (void) +{ + bson_mem_vtable_t vtable = { + malloc, + calloc, +#ifdef BSON_HAVE_REALLOCF + reallocf, +#else + realloc, +#endif + free, + }; + + bson_mem_set_vtable (&vtable); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.h new file mode 100644 index 0000000..363804f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-memory.h @@ -0,0 +1,67 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_MEMORY_H +#define BSON_MEMORY_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +typedef void *(*bson_realloc_func) (void *mem, size_t num_bytes, void *ctx); + + +typedef struct _bson_mem_vtable_t { + void *(*malloc) (size_t num_bytes); + void *(*calloc) (size_t n_members, size_t num_bytes); + void *(*realloc) (void *mem, size_t num_bytes); + void (*free) (void *mem); + void *padding[4]; +} bson_mem_vtable_t; + + +BSON_EXPORT (void) +bson_mem_set_vtable (const bson_mem_vtable_t *vtable); +BSON_EXPORT (void) +bson_mem_restore_vtable (void); +BSON_EXPORT (void *) +bson_malloc (size_t num_bytes); +BSON_EXPORT (void *) +bson_malloc0 (size_t num_bytes); +BSON_EXPORT (void *) +bson_realloc (void *mem, size_t num_bytes); +BSON_EXPORT (void *) +bson_realloc_ctx (void *mem, size_t num_bytes, void *ctx); +BSON_EXPORT (void) +bson_free (void *mem); +BSON_EXPORT (void) +bson_zero_free (void *mem, size_t size); + + +BSON_END_DECLS + + +#endif /* BSON_MEMORY_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.c new file mode 100644 index 0000000..f77225a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.c @@ -0,0 +1,516 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "bson/bson-compat.h" + +#include +#include +#include +#include + +#include "bson/bson-context-private.h" +#include "bson/bson-oid.h" +#include "bson/bson-string.h" + + +/* + * This table contains an array of two character pairs for every possible + * uint8_t. It is used as a lookup table when encoding a bson_oid_t + * to hex formatted ASCII. Performing two characters at a time roughly + * reduces the number of operations by one-half. + */ +static const uint16_t gHexCharPairs[] = { +#if BSON_BYTE_ORDER == BSON_BIG_ENDIAN + 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12385, + 12386, 12387, 12388, 12389, 12390, 12592, 12593, 12594, 12595, 12596, 12597, + 12598, 12599, 12600, 12601, 12641, 12642, 12643, 12644, 12645, 12646, 12848, + 12849, 12850, 12851, 12852, 12853, 12854, 12855, 12856, 12857, 12897, 12898, + 12899, 12900, 12901, 12902, 13104, 13105, 13106, 13107, 13108, 13109, 13110, + 13111, 13112, 13113, 13153, 13154, 13155, 13156, 13157, 13158, 13360, 13361, + 13362, 13363, 13364, 13365, 13366, 13367, 13368, 13369, 13409, 13410, 13411, + 13412, 13413, 13414, 13616, 13617, 13618, 13619, 13620, 13621, 13622, 13623, + 13624, 13625, 13665, 13666, 13667, 13668, 13669, 13670, 13872, 13873, 13874, + 13875, 13876, 13877, 13878, 13879, 13880, 13881, 13921, 13922, 13923, 13924, + 13925, 13926, 14128, 14129, 14130, 14131, 14132, 14133, 14134, 14135, 14136, + 14137, 14177, 14178, 14179, 14180, 14181, 14182, 14384, 14385, 14386, 14387, + 14388, 14389, 14390, 14391, 14392, 14393, 14433, 14434, 14435, 14436, 14437, + 14438, 14640, 14641, 14642, 14643, 14644, 14645, 14646, 14647, 14648, 14649, + 14689, 14690, 14691, 14692, 14693, 14694, 24880, 24881, 24882, 24883, 24884, + 24885, 24886, 24887, 24888, 24889, 24929, 24930, 24931, 24932, 24933, 24934, + 25136, 25137, 25138, 25139, 25140, 25141, 25142, 25143, 25144, 25145, 25185, + 25186, 25187, 25188, 25189, 25190, 25392, 25393, 25394, 25395, 25396, 25397, + 25398, 25399, 25400, 25401, 25441, 25442, 25443, 25444, 25445, 25446, 25648, + 25649, 25650, 25651, 25652, 25653, 25654, 25655, 25656, 25657, 25697, 25698, + 25699, 25700, 25701, 25702, 25904, 25905, 25906, 25907, 25908, 25909, 25910, + 25911, 25912, 25913, 25953, 25954, 25955, 25956, 25957, 25958, 26160, 26161, + 26162, 26163, 26164, 26165, 26166, 26167, 26168, 26169, 26209, 26210, 26211, + 26212, 26213, 26214 +#else + 12336, 12592, 12848, 13104, 13360, 13616, 13872, 14128, 14384, 14640, 24880, + 25136, 25392, 25648, 25904, 26160, 12337, 12593, 12849, 13105, 13361, 13617, + 13873, 14129, 14385, 14641, 24881, 25137, 25393, 25649, 25905, 26161, 12338, + 12594, 12850, 13106, 13362, 13618, 13874, 14130, 14386, 14642, 24882, 25138, + 25394, 25650, 25906, 26162, 12339, 12595, 12851, 13107, 13363, 13619, 13875, + 14131, 14387, 14643, 24883, 25139, 25395, 25651, 25907, 26163, 12340, 12596, + 12852, 13108, 13364, 13620, 13876, 14132, 14388, 14644, 24884, 25140, 25396, + 25652, 25908, 26164, 12341, 12597, 12853, 13109, 13365, 13621, 13877, 14133, + 14389, 14645, 24885, 25141, 25397, 25653, 25909, 26165, 12342, 12598, 12854, + 13110, 13366, 13622, 13878, 14134, 14390, 14646, 24886, 25142, 25398, 25654, + 25910, 26166, 12343, 12599, 12855, 13111, 13367, 13623, 13879, 14135, 14391, + 14647, 24887, 25143, 25399, 25655, 25911, 26167, 12344, 12600, 12856, 13112, + 13368, 13624, 13880, 14136, 14392, 14648, 24888, 25144, 25400, 25656, 25912, + 26168, 12345, 12601, 12857, 13113, 13369, 13625, 13881, 14137, 14393, 14649, + 24889, 25145, 25401, 25657, 25913, 26169, 12385, 12641, 12897, 13153, 13409, + 13665, 13921, 14177, 14433, 14689, 24929, 25185, 25441, 25697, 25953, 26209, + 12386, 12642, 12898, 13154, 13410, 13666, 13922, 14178, 14434, 14690, 24930, + 25186, 25442, 25698, 25954, 26210, 12387, 12643, 12899, 13155, 13411, 13667, + 13923, 14179, 14435, 14691, 24931, 25187, 25443, 25699, 25955, 26211, 12388, + 12644, 12900, 13156, 13412, 13668, 13924, 14180, 14436, 14692, 24932, 25188, + 25444, 25700, 25956, 26212, 12389, 12645, 12901, 13157, 13413, 13669, 13925, + 14181, 14437, 14693, 24933, 25189, 25445, 25701, 25957, 26213, 12390, 12646, + 12902, 13158, 13414, 13670, 13926, 14182, 14438, 14694, 24934, 25190, 25446, + 25702, 25958, 26214 +#endif +}; + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_init_sequence -- + * + * Initializes @oid with the next oid in the sequence. The first 4 + * bytes contain the current time and the following 8 contain a 64-bit + * integer in big-endian format. + * + * The bson_oid_t generated by this function is not guaranteed to be + * globally unique. Only unique within this context. It is however, + * guaranteed to be sequential. + * + * Returns: + * None. + * + * Side effects: + * @oid is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_init_sequence (bson_oid_t *oid, /* OUT */ + bson_context_t *context) /* IN */ +{ + uint32_t now = (uint32_t) (time (NULL)); + + if (!context) { + context = bson_context_get_default (); + } + + now = BSON_UINT32_TO_BE (now); + + memcpy (&oid->bytes[0], &now, sizeof (now)); + context->oid_get_seq64 (context, oid); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_init -- + * + * Generates bytes for a new bson_oid_t and stores them in @oid. The + * bytes will be generated according to the specification and includes + * the current time, a 3 byte hash of the hostname, pid (or tid), and + * monotonic counter. + * + * The bson_oid_t generated by this function is not guaranteed to be + * globally unique. Only unique within this context. It is however, + * guaranteed to be sequential. + * + * Returns: + * None. + * + * Side effects: + * @oid is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_init (bson_oid_t *oid, /* OUT */ + bson_context_t *context) /* IN */ +{ + uint32_t now = (uint32_t) (time (NULL)); + + BSON_ASSERT (oid); + + if (!context) { + context = bson_context_get_default (); + } + + now = BSON_UINT32_TO_BE (now); + memcpy (&oid->bytes[0], &now, sizeof (now)); + + context->oid_get_host (context, oid); + context->oid_get_pid (context, oid); + context->oid_get_seq32 (context, oid); +} + + +/** + * bson_oid_init_from_data: + * @oid: A bson_oid_t to initialize. + * @bytes: A 12-byte buffer to copy into @oid. + * + */ +/* + *-------------------------------------------------------------------------- + * + * bson_oid_init_from_data -- + * + * Initializes an @oid from @data. @data MUST be a buffer of at least + * 12 bytes. This method is analogous to memcpy()'ing data into @oid. + * + * Returns: + * None. + * + * Side effects: + * @oid is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_init_from_data (bson_oid_t *oid, /* OUT */ + const uint8_t *data) /* IN */ +{ + BSON_ASSERT (oid); + BSON_ASSERT (data); + + memcpy (oid, data, 12); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_init_from_string -- + * + * Parses @str containing hex formatted bytes of an object id and + * places the bytes in @oid. + * + * Parameters: + * @oid: A bson_oid_t + * @str: A string containing at least 24 characters. + * + * Returns: + * None. + * + * Side effects: + * @oid is initialized. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_init_from_string (bson_oid_t *oid, /* OUT */ + const char *str) /* IN */ +{ + BSON_ASSERT (oid); + BSON_ASSERT (str); + + bson_oid_init_from_string_unsafe (oid, str); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_get_time_t -- + * + * Fetches the time for which @oid was created. + * + * Returns: + * A time_t. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +time_t +bson_oid_get_time_t (const bson_oid_t *oid) /* IN */ +{ + BSON_ASSERT (oid); + + return bson_oid_get_time_t_unsafe (oid); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_to_string -- + * + * Formats a bson_oid_t into a string. @str must contain enough bytes + * for the resulting string which is 25 bytes with a terminating + * NUL-byte. + * + * Parameters: + * @oid: A bson_oid_t. + * @str: A location to store the resulting string. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_to_string (const bson_oid_t *oid, /* IN */ + char str[BSON_ENSURE_ARRAY_PARAM_SIZE (25)]) /* OUT */ +{ +#if !defined(__i386__) && !defined(__x86_64__) && !defined(_M_IX86) && \ + !defined(_M_X64) + BSON_ASSERT (oid); + BSON_ASSERT (str); + + bson_snprintf (str, + 25, + "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + oid->bytes[0], + oid->bytes[1], + oid->bytes[2], + oid->bytes[3], + oid->bytes[4], + oid->bytes[5], + oid->bytes[6], + oid->bytes[7], + oid->bytes[8], + oid->bytes[9], + oid->bytes[10], + oid->bytes[11]); +#else + uint16_t *dst; + uint8_t *id = (uint8_t *) oid; + + BSON_ASSERT (oid); + BSON_ASSERT (str); + + dst = (uint16_t *) (void *) str; + dst[0] = gHexCharPairs[id[0]]; + dst[1] = gHexCharPairs[id[1]]; + dst[2] = gHexCharPairs[id[2]]; + dst[3] = gHexCharPairs[id[3]]; + dst[4] = gHexCharPairs[id[4]]; + dst[5] = gHexCharPairs[id[5]]; + dst[6] = gHexCharPairs[id[6]]; + dst[7] = gHexCharPairs[id[7]]; + dst[8] = gHexCharPairs[id[8]]; + dst[9] = gHexCharPairs[id[9]]; + dst[10] = gHexCharPairs[id[10]]; + dst[11] = gHexCharPairs[id[11]]; + str[24] = '\0'; +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_hash -- + * + * Hashes the bytes of the provided bson_oid_t using DJB hash. This + * allows bson_oid_t to be used as keys in a hash table. + * + * Returns: + * A hash value corresponding to @oid. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +uint32_t +bson_oid_hash (const bson_oid_t *oid) /* IN */ +{ + BSON_ASSERT (oid); + + return bson_oid_hash_unsafe (oid); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_compare -- + * + * A qsort() style compare function that will return less than zero if + * @oid1 is less than @oid2, zero if they are the same, and greater + * than zero if @oid2 is greater than @oid1. + * + * Returns: + * A qsort() style compare integer. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +int +bson_oid_compare (const bson_oid_t *oid1, /* IN */ + const bson_oid_t *oid2) /* IN */ +{ + BSON_ASSERT (oid1); + BSON_ASSERT (oid2); + + return bson_oid_compare_unsafe (oid1, oid2); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_equal -- + * + * Compares for equality of @oid1 and @oid2. If they are equal, then + * true is returned, otherwise false. + * + * Returns: + * A boolean indicating the equality of @oid1 and @oid2. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_oid_equal (const bson_oid_t *oid1, /* IN */ + const bson_oid_t *oid2) /* IN */ +{ + BSON_ASSERT (oid1); + BSON_ASSERT (oid2); + + return bson_oid_equal_unsafe (oid1, oid2); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_copy -- + * + * Copies the contents of @src to @dst. + * + * Parameters: + * @src: A bson_oid_t to copy from. + * @dst: A bson_oid_t to copy to. + * + * Returns: + * None. + * + * Side effects: + * @dst will contain a copy of the data in @src. + * + *-------------------------------------------------------------------------- + */ + +void +bson_oid_copy (const bson_oid_t *src, /* IN */ + bson_oid_t *dst) /* OUT */ +{ + BSON_ASSERT (src); + BSON_ASSERT (dst); + + bson_oid_copy_unsafe (src, dst); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_oid_is_valid -- + * + * Validates that @str is a valid OID string. @length MUST be 24, but + * is provided as a parameter to simplify calling code. + * + * Parameters: + * @str: A string to validate. + * @length: The length of @str. + * + * Returns: + * true if @str can be passed to bson_oid_init_from_string(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_oid_is_valid (const char *str, /* IN */ + size_t length) /* IN */ +{ + size_t i; + + BSON_ASSERT (str); + + if ((length == 25) && (str[24] == '\0')) { + length = 24; + } + + if (length == 24) { + for (i = 0; i < length; i++) { + switch (str[i]) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + break; + default: + return false; + } + } + return true; + } + + return false; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.h new file mode 100644 index 0000000..4a4f85f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-oid.h @@ -0,0 +1,246 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_OID_H +#define BSON_OID_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include + +#include "bson/bson-context.h" +#include "bson/bson-macros.h" +#include "bson/bson-types.h" +#include "bson/bson-endian.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (int) +bson_oid_compare (const bson_oid_t *oid1, const bson_oid_t *oid2); +BSON_EXPORT (void) +bson_oid_copy (const bson_oid_t *src, bson_oid_t *dst); +BSON_EXPORT (bool) +bson_oid_equal (const bson_oid_t *oid1, const bson_oid_t *oid2); +BSON_EXPORT (bool) +bson_oid_is_valid (const char *str, size_t length); +BSON_EXPORT (time_t) +bson_oid_get_time_t (const bson_oid_t *oid); +BSON_EXPORT (uint32_t) +bson_oid_hash (const bson_oid_t *oid); +BSON_EXPORT (void) +bson_oid_init (bson_oid_t *oid, bson_context_t *context); +BSON_EXPORT (void) +bson_oid_init_from_data (bson_oid_t *oid, const uint8_t *data); +BSON_EXPORT (void) +bson_oid_init_from_string (bson_oid_t *oid, const char *str); +BSON_EXPORT (void) +bson_oid_init_sequence (bson_oid_t *oid, bson_context_t *context); +BSON_EXPORT (void) +bson_oid_to_string (const bson_oid_t *oid, char str[25]); + + +/** + * bson_oid_compare_unsafe: + * @oid1: A bson_oid_t. + * @oid2: A bson_oid_t. + * + * Performs a qsort() style comparison between @oid1 and @oid2. + * + * This function is meant to be as fast as possible and therefore performs + * no argument validation. That is the callers responsibility. + * + * Returns: An integer < 0 if @oid1 is less than @oid2. Zero if they are equal. + * An integer > 0 if @oid1 is greater than @oid2. + */ +static BSON_INLINE int +bson_oid_compare_unsafe (const bson_oid_t *oid1, const bson_oid_t *oid2) +{ + return memcmp (oid1, oid2, sizeof *oid1); +} + + +/** + * bson_oid_equal_unsafe: + * @oid1: A bson_oid_t. + * @oid2: A bson_oid_t. + * + * Checks the equality of @oid1 and @oid2. + * + * This function is meant to be as fast as possible and therefore performs + * no checks for argument validity. That is the callers responsibility. + * + * Returns: true if @oid1 and @oid2 are equal; otherwise false. + */ +static BSON_INLINE bool +bson_oid_equal_unsafe (const bson_oid_t *oid1, const bson_oid_t *oid2) +{ + return !memcmp (oid1, oid2, sizeof *oid1); +} + +/** + * bson_oid_hash_unsafe: + * @oid: A bson_oid_t. + * + * This function performs a DJB style hash upon the bytes contained in @oid. + * The result is a hash key suitable for use in a hashtable. + * + * This function is meant to be as fast as possible and therefore performs no + * validation of arguments. The caller is responsible to ensure they are + * passing valid arguments. + * + * Returns: A uint32_t containing a hash code. + */ +static BSON_INLINE uint32_t +bson_oid_hash_unsafe (const bson_oid_t *oid) +{ + uint32_t hash = 5381; + uint32_t i; + + for (i = 0; i < sizeof oid->bytes; i++) { + hash = ((hash << 5) + hash) + oid->bytes[i]; + } + + return hash; +} + + +/** + * bson_oid_copy_unsafe: + * @src: A bson_oid_t to copy from. + * @dst: A bson_oid_t to copy into. + * + * Copies the contents of @src into @dst. This function is meant to be as + * fast as possible and therefore performs no argument checking. It is the + * callers responsibility to ensure they are passing valid data into the + * function. + */ +static BSON_INLINE void +bson_oid_copy_unsafe (const bson_oid_t *src, bson_oid_t *dst) +{ + memcpy (dst, src, sizeof *src); +} + + +/** + * bson_oid_parse_hex_char: + * @hex: A character to parse to its integer value. + * + * This function contains a jump table to return the integer value for a + * character containing a hexadecimal value (0-9, a-f, A-F). If the character + * is not a hexadecimal character then zero is returned. + * + * Returns: An integer between 0 and 15. + */ +static BSON_INLINE uint8_t +bson_oid_parse_hex_char (char hex) +{ + switch (hex) { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + case 'a': + case 'A': + return 0xa; + case 'b': + case 'B': + return 0xb; + case 'c': + case 'C': + return 0xc; + case 'd': + case 'D': + return 0xd; + case 'e': + case 'E': + return 0xe; + case 'f': + case 'F': + return 0xf; + default: + return 0; + } +} + + +/** + * bson_oid_init_from_string_unsafe: + * @oid: A bson_oid_t to store the result. + * @str: A 24-character hexadecimal encoded string. + * + * Parses a string containing 24 hexadecimal encoded bytes into a bson_oid_t. + * This function is meant to be as fast as possible and inlined into your + * code. For that purpose, the function does not perform any sort of bounds + * checking and it is the callers responsibility to ensure they are passing + * valid input to the function. + */ +static BSON_INLINE void +bson_oid_init_from_string_unsafe (bson_oid_t *oid, const char *str) +{ + int i; + + for (i = 0; i < 12; i++) { + oid->bytes[i] = ((bson_oid_parse_hex_char (str[2 * i]) << 4) | + (bson_oid_parse_hex_char (str[2 * i + 1]))); + } +} + + +/** + * bson_oid_get_time_t_unsafe: + * @oid: A bson_oid_t. + * + * Fetches the time @oid was generated. + * + * Returns: A time_t containing the UNIX timestamp of generation. + */ +static BSON_INLINE time_t +bson_oid_get_time_t_unsafe (const bson_oid_t *oid) +{ + uint32_t t; + + memcpy (&t, oid, sizeof (t)); + return BSON_UINT32_FROM_BE (t); +} + + +BSON_END_DECLS + + +#endif /* BSON_OID_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-private.h new file mode 100644 index 0000000..6ffcf20 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-private.h @@ -0,0 +1,102 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_PRIVATE_H +#define BSON_PRIVATE_H + + +#include "bson/bson-macros.h" +#include "bson/bson-memory.h" +#include "bson/bson-types.h" + + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#define BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#define END_IGNORE_DEPRECATIONS _Pragma ("GCC diagnostic pop") +#elif defined(__clang__) +#define BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("clang diagnostic push") \ + _Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#define END_IGNORE_DEPRECATIONS _Pragma ("clang diagnostic pop") +#else +#define BEGIN_IGNORE_DEPRECATIONS +#define END_IGNORE_DEPRECATIONS +#endif + + +BSON_BEGIN_DECLS + + +typedef enum { + BSON_FLAG_NONE = 0, + BSON_FLAG_INLINE = (1 << 0), + BSON_FLAG_STATIC = (1 << 1), + BSON_FLAG_RDONLY = (1 << 2), + BSON_FLAG_CHILD = (1 << 3), + BSON_FLAG_IN_CHILD = (1 << 4), + BSON_FLAG_NO_FREE = (1 << 5), +} bson_flags_t; + + +#ifdef BSON_MEMCHECK +#define BSON_INLINE_DATA_SIZE (120 - sizeof (char*)) +#else +#define BSON_INLINE_DATA_SIZE 120 +#endif + + +BSON_ALIGNED_BEGIN (128) +typedef struct { + bson_flags_t flags; + uint32_t len; +#ifdef BSON_MEMCHECK + char *canary; +#endif + uint8_t data[BSON_INLINE_DATA_SIZE]; +} bson_impl_inline_t BSON_ALIGNED_END (128); + + +BSON_STATIC_ASSERT2 (impl_inline_t, sizeof (bson_impl_inline_t) == 128); + + +BSON_ALIGNED_BEGIN (128) +typedef struct { + bson_flags_t flags; /* flags describing the bson_t */ + uint32_t len; /* length of bson document in bytes */ + bson_t *parent; /* parent bson if a child */ + uint32_t depth; /* Subdocument depth. */ + uint8_t **buf; /* pointer to buffer pointer */ + size_t *buflen; /* pointer to buffer length */ + size_t offset; /* our offset inside *buf */ + uint8_t *alloc; /* buffer that we own. */ + size_t alloclen; /* length of buffer that we own. */ + bson_realloc_func realloc; /* our realloc implementation */ + void *realloc_func_ctx; /* context for our realloc func */ +} bson_impl_alloc_t BSON_ALIGNED_END (128); + + +BSON_STATIC_ASSERT2 (impl_alloc_t, sizeof (bson_impl_alloc_t) <= 128); + + +#define BSON_REGEX_OPTIONS_SORTED "ilmsux" + +BSON_END_DECLS + + +#endif /* BSON_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.c new file mode 100644 index 0000000..d8534be --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.c @@ -0,0 +1,834 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "bson/bson.h" + +#include +#include +#ifdef BSON_OS_WIN32 +#include +#include +#endif +#include +#include +#include +#include + +#include "bson/bson-reader.h" +#include "bson/bson-memory.h" + + +typedef enum { + BSON_READER_HANDLE = 1, + BSON_READER_DATA = 2, +} bson_reader_type_t; + + +typedef struct { + bson_reader_type_t type; + void *handle; + bool done : 1; + bool failed : 1; + size_t end; + size_t len; + size_t offset; + size_t bytes_read; + bson_t inline_bson; + uint8_t *data; + bson_reader_read_func_t read_func; + bson_reader_destroy_func_t destroy_func; +} bson_reader_handle_t; + + +typedef struct { + int fd; + bool do_close; +} bson_reader_handle_fd_t; + + +typedef struct { + bson_reader_type_t type; + const uint8_t *data; + size_t length; + size_t offset; + bson_t inline_bson; +} bson_reader_data_t; + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_fill_buffer -- + * + * Attempt to read as much as possible until the underlying buffer + * in @reader is filled or we have reached end-of-stream or + * read failure. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_reader_handle_fill_buffer (bson_reader_handle_t *reader) /* IN */ +{ + ssize_t ret; + + /* + * Handle first read specially. + */ + if ((!reader->done) && (!reader->offset) && (!reader->end)) { + ret = reader->read_func (reader->handle, &reader->data[0], reader->len); + + if (ret <= 0) { + reader->done = true; + return; + } + reader->bytes_read += ret; + + reader->end = ret; + return; + } + + /* + * Move valid data to head. + */ + memmove (&reader->data[0], + &reader->data[reader->offset], + reader->end - reader->offset); + reader->end = reader->end - reader->offset; + reader->offset = 0; + + /* + * Read in data to fill the buffer. + */ + ret = reader->read_func ( + reader->handle, &reader->data[reader->end], reader->len - reader->end); + + if (ret <= 0) { + reader->done = true; + reader->failed = (ret < 0); + } else { + reader->bytes_read += ret; + reader->end += ret; + } + + BSON_ASSERT (reader->offset == 0); + BSON_ASSERT (reader->end <= reader->len); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_new_from_handle -- + * + * Allocates and initializes a new bson_reader_t using the opaque + * handle provided. + * + * Parameters: + * @handle: an opaque handle to use to read data. + * @rf: a function to perform reads on @handle. + * @df: a function to release @handle, or NULL. + * + * Returns: + * A newly allocated bson_reader_t if successful, otherwise NULL. + * Free the successful result with bson_reader_destroy(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_reader_t * +bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df) +{ + bson_reader_handle_t *real; + + BSON_ASSERT (handle); + BSON_ASSERT (rf); + + real = bson_malloc0 (sizeof *real); + real->type = BSON_READER_HANDLE; + real->data = bson_malloc0 (1024); + real->handle = handle; + real->len = 1024; + real->offset = 0; + + bson_reader_set_read_func ((bson_reader_t *) real, rf); + + if (df) { + bson_reader_set_destroy_func ((bson_reader_t *) real, df); + } + + _bson_reader_handle_fill_buffer (real); + + return (bson_reader_t *) real; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_fd_destroy -- + * + * Cleanup allocations associated with state created in + * bson_reader_new_from_fd(). + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_reader_handle_fd_destroy (void *handle) /* IN */ +{ + bson_reader_handle_fd_t *fd = handle; + + if (fd) { + if ((fd->fd != -1) && fd->do_close) { +#ifdef _WIN32 + _close (fd->fd); +#else + close (fd->fd); +#endif + } + bson_free (fd); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_fd_read -- + * + * Perform read on opaque handle created in + * bson_reader_new_from_fd(). + * + * The underlying file descriptor is read from the current position + * using the bson_reader_handle_fd_t allocated. + * + * Returns: + * -1 on failure. + * 0 on end of stream. + * Greater than zero on success. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static ssize_t +_bson_reader_handle_fd_read (void *handle, /* IN */ + void *buf, /* IN */ + size_t len) /* IN */ +{ + bson_reader_handle_fd_t *fd = handle; + ssize_t ret = -1; + + if (fd && (fd->fd != -1)) { + again: +#ifdef BSON_OS_WIN32 + ret = _read (fd->fd, buf, (unsigned int) len); +#else + ret = read (fd->fd, buf, len); +#endif + if ((ret == -1) && (errno == EAGAIN)) { + goto again; + } + } + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_new_from_fd -- + * + * Create a new bson_reader_t using the file-descriptor provided. + * + * Parameters: + * @fd: a libc style file-descriptor. + * @close_on_destroy: if close() should be called on @fd when + * bson_reader_destroy() is called. + * + * Returns: + * A newly allocated bson_reader_t on success; otherwise NULL. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_reader_t * +bson_reader_new_from_fd (int fd, /* IN */ + bool close_on_destroy) /* IN */ +{ + bson_reader_handle_fd_t *handle; + + BSON_ASSERT (fd != -1); + + handle = bson_malloc0 (sizeof *handle); + handle->fd = fd; + handle->do_close = close_on_destroy; + + return bson_reader_new_from_handle ( + handle, _bson_reader_handle_fd_read, _bson_reader_handle_fd_destroy); +} + + +/** + * bson_reader_set_read_func: + * @reader: A bson_reader_t. + * + * Note that @reader must be initialized by bson_reader_init_from_handle(), or + * data + * will be destroyed. + */ +/* + *-------------------------------------------------------------------------- + * + * bson_reader_set_read_func -- + * + * Set the read func to be provided for @reader. + * + * You probably want to use bson_reader_new_from_handle() or + * bson_reader_new_from_fd() instead. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_reader_set_read_func (bson_reader_t *reader, /* IN */ + bson_reader_read_func_t func) /* IN */ +{ + bson_reader_handle_t *real = (bson_reader_handle_t *) reader; + + BSON_ASSERT (reader->type == BSON_READER_HANDLE); + + real->read_func = func; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_set_destroy_func -- + * + * Set the function to cleanup state when @reader is destroyed. + * + * You probably want bson_reader_new_from_fd() or + * bson_reader_new_from_handle() instead. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_reader_set_destroy_func (bson_reader_t *reader, /* IN */ + bson_reader_destroy_func_t func) /* IN */ +{ + bson_reader_handle_t *real = (bson_reader_handle_t *) reader; + + BSON_ASSERT (reader->type == BSON_READER_HANDLE); + + real->destroy_func = func; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_grow_buffer -- + * + * Grow the buffer to the next power of two. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static void +_bson_reader_handle_grow_buffer (bson_reader_handle_t *reader) /* IN */ +{ + size_t size; + + size = reader->len * 2; + reader->data = bson_realloc (reader->data, size); + reader->len = size; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_tell -- + * + * Tell the current position within the underlying file-descriptor. + * + * Returns: + * An off_t containing the current offset. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static off_t +_bson_reader_handle_tell (bson_reader_handle_t *reader) /* IN */ +{ + off_t off; + + off = (off_t) reader->bytes_read; + off -= (off_t) reader->end; + off += (off_t) reader->offset; + + return off; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_handle_read -- + * + * Read the next chunk of data from the underlying file descriptor + * and return a bson_t which should not be modified. + * + * There was a failure if NULL is returned and @reached_eof is + * not set to true. + * + * Returns: + * NULL on failure or end of stream. + * + * Side effects: + * @reached_eof is set if non-NULL. + * + *-------------------------------------------------------------------------- + */ + +static const bson_t * +_bson_reader_handle_read (bson_reader_handle_t *reader, /* IN */ + bool *reached_eof) /* IN */ +{ + int32_t blen; + + if (reached_eof) { + *reached_eof = false; + } + + while (!reader->done) { + if ((reader->end - reader->offset) < 4) { + _bson_reader_handle_fill_buffer (reader); + continue; + } + + memcpy (&blen, &reader->data[reader->offset], sizeof blen); + blen = BSON_UINT32_FROM_LE (blen); + + if (blen < 5) { + return NULL; + } + + if (blen > (int32_t) (reader->end - reader->offset)) { + if (blen > (int32_t) reader->len) { + _bson_reader_handle_grow_buffer (reader); + } + + _bson_reader_handle_fill_buffer (reader); + continue; + } + + if (!bson_init_static (&reader->inline_bson, + &reader->data[reader->offset], + (uint32_t) blen)) { + return NULL; + } + + reader->offset += blen; + + return &reader->inline_bson; + } + + if (reached_eof) { + *reached_eof = reader->done && !reader->failed; + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_new_from_data -- + * + * Allocates and initializes a new bson_reader_t that reads the memory + * provided as a stream of BSON documents. + * + * Parameters: + * @data: A buffer to read BSON documents from. + * @length: The length of @data. + * + * Returns: + * A newly allocated bson_reader_t that should be freed with + * bson_reader_destroy(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_reader_t * +bson_reader_new_from_data (const uint8_t *data, /* IN */ + size_t length) /* IN */ +{ + bson_reader_data_t *real; + + BSON_ASSERT (data); + + real = (bson_reader_data_t *) bson_malloc0 (sizeof *real); + real->type = BSON_READER_DATA; + real->data = data; + real->length = length; + real->offset = 0; + + return (bson_reader_t *) real; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_data_read -- + * + * Read the next document from the underlying buffer. + * + * Returns: + * NULL on failure or end of stream. + * a bson_t which should not be modified. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static const bson_t * +_bson_reader_data_read (bson_reader_data_t *reader, /* IN */ + bool *reached_eof) /* IN */ +{ + int32_t blen; + + if (reached_eof) { + *reached_eof = false; + } + + if ((reader->offset + 4) < reader->length) { + memcpy (&blen, &reader->data[reader->offset], sizeof blen); + blen = BSON_UINT32_FROM_LE (blen); + + if (blen < 5) { + return NULL; + } + + if (blen > (int32_t) (reader->length - reader->offset)) { + return NULL; + } + + if (!bson_init_static (&reader->inline_bson, + &reader->data[reader->offset], + (uint32_t) blen)) { + return NULL; + } + + reader->offset += blen; + + return &reader->inline_bson; + } + + if (reached_eof) { + *reached_eof = (reader->offset == reader->length); + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_reader_data_tell -- + * + * Tell the current position in the underlying buffer. + * + * Returns: + * An off_t of the current offset. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static off_t +_bson_reader_data_tell (bson_reader_data_t *reader) /* IN */ +{ + return (off_t) reader->offset; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_destroy -- + * + * Release a bson_reader_t created with bson_reader_new_from_data(), + * bson_reader_new_from_fd(), or bson_reader_new_from_handle(). + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_reader_destroy (bson_reader_t *reader) /* IN */ +{ + if (!reader) { + return; + } + + switch (reader->type) { + case 0: + break; + case BSON_READER_HANDLE: { + bson_reader_handle_t *handle = (bson_reader_handle_t *) reader; + + if (handle->destroy_func) { + handle->destroy_func (handle->handle); + } + + bson_free (handle->data); + } break; + case BSON_READER_DATA: + break; + default: + fprintf (stderr, "No such reader type: %02x\n", reader->type); + break; + } + + reader->type = 0; + + bson_free (reader); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_read -- + * + * Reads the next bson_t in the underlying memory or storage. The + * resulting bson_t should not be modified or freed. You may copy it + * and iterate over it. Functions that take a const bson_t* are safe + * to use. + * + * This structure does not survive calls to bson_reader_read() or + * bson_reader_destroy() as it uses memory allocated by the reader or + * underlying storage/memory. + * + * If NULL is returned then @reached_eof will be set to true if the + * end of the file or buffer was reached. This indicates if there was + * an error parsing the document stream. + * + * Returns: + * A const bson_t that should not be modified or freed. + * NULL on failure or end of stream. + * + * Side effects: + * @reached_eof is set if non-NULL. + * + *-------------------------------------------------------------------------- + */ + +const bson_t * +bson_reader_read (bson_reader_t *reader, /* IN */ + bool *reached_eof) /* OUT */ +{ + BSON_ASSERT (reader); + + switch (reader->type) { + case BSON_READER_HANDLE: + return _bson_reader_handle_read ((bson_reader_handle_t *) reader, + reached_eof); + + case BSON_READER_DATA: + return _bson_reader_data_read ((bson_reader_data_t *) reader, + reached_eof); + + default: + fprintf (stderr, "No such reader type: %02x\n", reader->type); + break; + } + + return NULL; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_tell -- + * + * Return the current position in the underlying reader. This will + * always be at the beginning of a bson document or end of file. + * + * Returns: + * An off_t containing the current offset. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +off_t +bson_reader_tell (bson_reader_t *reader) /* IN */ +{ + BSON_ASSERT (reader); + + switch (reader->type) { + case BSON_READER_HANDLE: + return _bson_reader_handle_tell ((bson_reader_handle_t *) reader); + + case BSON_READER_DATA: + return _bson_reader_data_tell ((bson_reader_data_t *) reader); + + default: + fprintf (stderr, "No such reader type: %02x\n", reader->type); + return -1; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_new_from_file -- + * + * A convenience function to open a file containing sequential + * bson documents and read them using bson_reader_t. + * + * Returns: + * A new bson_reader_t if successful, otherwise NULL and + * @error is set. Free the non-NULL result with + * bson_reader_destroy(). + * + * Side effects: + * @error may be set. + * + *-------------------------------------------------------------------------- + */ + +bson_reader_t * +bson_reader_new_from_file (const char *path, /* IN */ + bson_error_t *error) /* OUT */ +{ + char errmsg_buf[BSON_ERROR_BUFFER_SIZE]; + char *errmsg; + int fd; + + BSON_ASSERT (path); + +#ifdef BSON_OS_WIN32 + if (_sopen_s (&fd, path, (_O_RDONLY | _O_BINARY), _SH_DENYNO, 0) != 0) { + fd = -1; + } +#else + fd = open (path, O_RDONLY); +#endif + + if (fd == -1) { + errmsg = bson_strerror_r (errno, errmsg_buf, sizeof errmsg_buf); + bson_set_error ( + error, BSON_ERROR_READER, BSON_ERROR_READER_BADFD, "%s", errmsg); + return NULL; + } + + return bson_reader_new_from_fd (fd, true); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_reset -- + * + * Restore the reader to its initial state. Valid only for readers + * created with bson_reader_new_from_data. + * + *-------------------------------------------------------------------------- + */ + +void +bson_reader_reset (bson_reader_t *reader) +{ + bson_reader_data_t *real = (bson_reader_data_t *) reader; + + if (real->type != BSON_READER_DATA) { + fprintf (stderr, "Reader type cannot be reset\n"); + return; + } + + real->offset = 0; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.h new file mode 100644 index 0000000..3b7e19b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-reader.h @@ -0,0 +1,120 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_READER_H +#define BSON_READER_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-compat.h" +#include "bson/bson-oid.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +#define BSON_ERROR_READER_BADFD 1 + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_read_func_t -- + * + * This function is a callback used by bson_reader_t to read the + * next chunk of data from the underlying opaque file descriptor. + * + * This function is meant to operate similar to the read() function + * as part of libc on UNIX-like systems. + * + * Parameters: + * @handle: The handle to read from. + * @buf: The buffer to read into. + * @count: The number of bytes to read. + * + * Returns: + * 0 for end of stream. + * -1 for read failure. + * Greater than zero for number of bytes read into @buf. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +typedef ssize_t (*bson_reader_read_func_t) (void *handle, /* IN */ + void *buf, /* IN */ + size_t count); /* IN */ + + +/* + *-------------------------------------------------------------------------- + * + * bson_reader_destroy_func_t -- + * + * Destroy callback to release any resources associated with the + * opaque handle. + * + * Parameters: + * @handle: the handle provided to bson_reader_new_from_handle(). + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +typedef void (*bson_reader_destroy_func_t) (void *handle); /* IN */ + + +BSON_EXPORT (bson_reader_t *) +bson_reader_new_from_handle (void *handle, + bson_reader_read_func_t rf, + bson_reader_destroy_func_t df); +BSON_EXPORT (bson_reader_t *) +bson_reader_new_from_fd (int fd, bool close_on_destroy); +BSON_EXPORT (bson_reader_t *) +bson_reader_new_from_file (const char *path, bson_error_t *error); +BSON_EXPORT (bson_reader_t *) +bson_reader_new_from_data (const uint8_t *data, size_t length); +BSON_EXPORT (void) +bson_reader_destroy (bson_reader_t *reader); +BSON_EXPORT (void) +bson_reader_set_read_func (bson_reader_t *reader, bson_reader_read_func_t func); +BSON_EXPORT (void) +bson_reader_set_destroy_func (bson_reader_t *reader, + bson_reader_destroy_func_t func); +BSON_EXPORT (const bson_t *) +bson_reader_read (bson_reader_t *reader, bool *reached_eof); +BSON_EXPORT (off_t) +bson_reader_tell (bson_reader_t *reader); +BSON_EXPORT (void) +bson_reader_reset (bson_reader_t *reader); + +BSON_END_DECLS + + +#endif /* BSON_READER_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.c new file mode 100644 index 0000000..d30204e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.c @@ -0,0 +1,829 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "bson/bson-compat.h" +#include "bson/bson-string.h" +#include "bson/bson-memory.h" +#include "bson/bson-utf8.h" + +#ifdef BSON_HAVE_STRINGS_H +#include +#else +#include +#endif + +/* + *-------------------------------------------------------------------------- + * + * bson_string_new -- + * + * Create a new bson_string_t. + * + * bson_string_t is a power-of-2 allocation growing string. Every + * time data is appended the next power of two size is chosen for + * the allocation. Pretty standard stuff. + * + * It is UTF-8 aware through the use of bson_string_append_unichar(). + * The proper UTF-8 character sequence will be used. + * + * Parameters: + * @str: a string to copy or NULL. + * + * Returns: + * A newly allocated bson_string_t that should be freed with + * bson_string_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_string_t * +bson_string_new (const char *str) /* IN */ +{ + bson_string_t *ret; + + ret = bson_malloc0 (sizeof *ret); + ret->len = str ? (int) strlen (str) : 0; + ret->alloc = ret->len + 1; + + if (!bson_is_power_of_two (ret->alloc)) { + ret->alloc = (uint32_t) bson_next_power_of_two ((size_t) ret->alloc); + } + + BSON_ASSERT (ret->alloc >= 1); + + ret->str = bson_malloc (ret->alloc); + + if (str) { + memcpy (ret->str, str, ret->len); + } + ret->str[ret->len] = '\0'; + + ret->str[ret->len] = '\0'; + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_free -- + * + * Free the bson_string_t @string and related allocations. + * + * If @free_segment is false, then the strings buffer will be + * returned and is not freed. Otherwise, NULL is returned. + * + * Returns: + * The string->str if free_segment is false. + * Otherwise NULL. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_string_free (bson_string_t *string, /* IN */ + bool free_segment) /* IN */ +{ + char *ret = NULL; + + BSON_ASSERT (string); + + if (!free_segment) { + ret = string->str; + } else { + bson_free (string->str); + } + + bson_free (string); + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_append -- + * + * Append the UTF-8 string @str to @string. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_string_append (bson_string_t *string, /* IN */ + const char *str) /* IN */ +{ + uint32_t len; + + BSON_ASSERT (string); + BSON_ASSERT (str); + + len = (uint32_t) strlen (str); + + if ((string->alloc - string->len - 1) < len) { + string->alloc += len; + if (!bson_is_power_of_two (string->alloc)) { + string->alloc = + (uint32_t) bson_next_power_of_two ((size_t) string->alloc); + } + string->str = bson_realloc (string->str, string->alloc); + } + + memcpy (string->str + string->len, str, len); + string->len += len; + string->str[string->len] = '\0'; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_append_c -- + * + * Append the ASCII character @c to @string. + * + * Do not use this if you are working with UTF-8 sequences, + * use bson_string_append_unichar(). + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_string_append_c (bson_string_t *string, /* IN */ + char c) /* IN */ +{ + char cc[2]; + + BSON_ASSERT (string); + + if (BSON_UNLIKELY (string->alloc == (string->len + 1))) { + cc[0] = c; + cc[1] = '\0'; + bson_string_append (string, cc); + return; + } + + string->str[string->len++] = c; + string->str[string->len] = '\0'; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_append_unichar -- + * + * Append the bson_unichar_t @unichar to the string @string. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_string_append_unichar (bson_string_t *string, /* IN */ + bson_unichar_t unichar) /* IN */ +{ + uint32_t len; + char str[8]; + + BSON_ASSERT (string); + BSON_ASSERT (unichar); + + bson_utf8_from_unichar (unichar, str, &len); + + if (len <= 6) { + str[len] = '\0'; + bson_string_append (string, str); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_append_printf -- + * + * Format a string according to @format and append it to @string. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_string_append_printf (bson_string_t *string, const char *format, ...) +{ + va_list args; + char *ret; + + BSON_ASSERT (string); + BSON_ASSERT (format); + + va_start (args, format); + ret = bson_strdupv_printf (format, args); + va_end (args); + bson_string_append (string, ret); + bson_free (ret); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_string_truncate -- + * + * Truncate the string @string to @len bytes. + * + * The underlying memory will be released via realloc() down to + * the minimum required size specified by @len. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_string_truncate (bson_string_t *string, /* IN */ + uint32_t len) /* IN */ +{ + uint32_t alloc; + + BSON_ASSERT (string); + BSON_ASSERT (len < INT_MAX); + + alloc = len + 1; + + if (alloc < 16) { + alloc = 16; + } + + if (!bson_is_power_of_two (alloc)) { + alloc = (uint32_t) bson_next_power_of_two ((size_t) alloc); + } + + string->str = bson_realloc (string->str, alloc); + string->alloc = alloc; + string->len = len; + + string->str[string->len] = '\0'; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strdup -- + * + * Portable strdup(). + * + * Returns: + * A newly allocated string that should be freed with bson_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_strdup (const char *str) /* IN */ +{ + long len; + char *out; + + if (!str) { + return NULL; + } + + len = (long) strlen (str); + out = bson_malloc (len + 1); + + if (!out) { + return NULL; + } + + memcpy (out, str, len + 1); + + return out; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strdupv_printf -- + * + * Like bson_strdup_printf() but takes a va_list. + * + * Returns: + * A newly allocated string that should be freed with bson_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_strdupv_printf (const char *format, /* IN */ + va_list args) /* IN */ +{ + va_list my_args; + char *buf; + int len = 32; + int n; + + BSON_ASSERT (format); + + buf = bson_malloc0 (len); + + while (true) { + va_copy (my_args, args); + n = bson_vsnprintf (buf, len, format, my_args); + va_end (my_args); + + if (n > -1 && n < len) { + return buf; + } + + if (n > -1) { + len = n + 1; + } else { + len *= 2; + } + + buf = bson_realloc (buf, len); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strdup_printf -- + * + * Convenience function that formats a string according to @format + * and returns a copy of it. + * + * Returns: + * A newly created string that should be freed with bson_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_strdup_printf (const char *format, /* IN */ + ...) /* IN */ +{ + va_list args; + char *ret; + + BSON_ASSERT (format); + + va_start (args, format); + ret = bson_strdupv_printf (format, args); + va_end (args); + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strndup -- + * + * A portable strndup(). + * + * Returns: + * A newly allocated string that should be freed with bson_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_strndup (const char *str, /* IN */ + size_t n_bytes) /* IN */ +{ + char *ret; + + BSON_ASSERT (str); + + ret = bson_malloc (n_bytes + 1); + bson_strncpy (ret, str, n_bytes + 1); + + return ret; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strfreev -- + * + * Frees each string in a NULL terminated array of strings. + * This also frees the underlying array. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_strfreev (char **str) /* IN */ +{ + int i; + + if (str) { + for (i = 0; str[i]; i++) + bson_free (str[i]); + bson_free (str); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strnlen -- + * + * A portable strnlen(). + * + * Returns: + * The length of @s up to @maxlen. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +size_t +bson_strnlen (const char *s, /* IN */ + size_t maxlen) /* IN */ +{ +#ifdef BSON_HAVE_STRNLEN + return strnlen (s, maxlen); +#else + size_t i; + + for (i = 0; i < maxlen; i++) { + if (s[i] == '\0') { + return i; + } + } + + return maxlen; +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_strncpy -- + * + * A portable strncpy. + * + * Copies @src into @dst, which must be @size bytes or larger. + * The result is guaranteed to be \0 terminated. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_strncpy (char *dst, /* IN */ + const char *src, /* IN */ + size_t size) /* IN */ +{ + if (size == 0) { + return; + } + +#ifdef _MSC_VER + strncpy_s (dst, size, src, _TRUNCATE); +#else + strncpy (dst, src, size); + dst[size - 1] = '\0'; +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_vsnprintf -- + * + * A portable vsnprintf. + * + * If more than @size bytes are required (exluding the null byte), + * then @size bytes will be written to @string and the return value + * is the number of bytes required. + * + * This function will always return a NULL terminated string. + * + * Returns: + * The number of bytes required for @format excluding the null byte. + * + * Side effects: + * @str is initialized with the formatted string. + * + *-------------------------------------------------------------------------- + */ + +int +bson_vsnprintf (char *str, /* IN */ + size_t size, /* IN */ + const char *format, /* IN */ + va_list ap) /* IN */ +{ +#ifdef _MSC_VER + int r = -1; + + BSON_ASSERT (str); + + if (size == 0) { + return 0; + } + + r = _vsnprintf_s (str, size, _TRUNCATE, format, ap); + if (r == -1) { + r = _vscprintf (format, ap); + } + + str[size - 1] = '\0'; + + return r; +#else + int r; + + BSON_ASSERT (str); + + if (size == 0) { + return 0; + } + + r = vsnprintf (str, size, format, ap); + str[size - 1] = '\0'; + return r; +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_snprintf -- + * + * A portable snprintf. + * + * If @format requires more than @size bytes, then @size bytes are + * written and the result is the number of bytes required (excluding + * the null byte). + * + * This function will always return a NULL terminated string. + * + * Returns: + * The number of bytes required for @format. + * + * Side effects: + * @str is initialized. + * + *-------------------------------------------------------------------------- + */ + +int +bson_snprintf (char *str, /* IN */ + size_t size, /* IN */ + const char *format, /* IN */ + ...) +{ + int r; + va_list ap; + + BSON_ASSERT (str); + + va_start (ap, format); + r = bson_vsnprintf (str, size, format, ap); + va_end (ap); + + return r; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_ascii_strtoll -- + * + * A portable strtoll. + * + * Convert a string to a 64-bit signed integer according to the given + * @base, which must be 16, 10, or 8. Leading whitespace will be ignored. + * + * If base is 0 is passed in, the base is inferred from the string's + * leading characters. Base-16 numbers start with "0x" or "0X", base-8 + * numbers start with "0", base-10 numbers start with a digit from 1 to 9. + * + * If @e is not NULL, it will be assigned the address of the first invalid + * character of @s, or its null terminating byte if the entire string was + * valid. + * + * If an invalid value is encountered, errno will be set to EINVAL and + * zero will be returned. If the number is out of range, errno is set to + * ERANGE and LLONG_MAX or LLONG_MIN is returned. + * + * Returns: + * The result of the conversion. + * + * Side effects: + * errno will be set on error. + * + *-------------------------------------------------------------------------- + */ + +int64_t +bson_ascii_strtoll (const char *s, char **e, int base) +{ + char *tok = (char *) s; + char *digits_start; + char c; + int64_t number = 0; + int64_t sign = 1; + int64_t cutoff; + int64_t cutlim; + + errno = 0; + + if (!s) { + errno = EINVAL; + return 0; + } + + c = *tok; + + while (isspace (c)) { + c = *++tok; + } + + if (c == '-') { + sign = -1; + c = *++tok; + } else if (c == '+') { + c = *++tok; + } else if (!isdigit (c)) { + errno = EINVAL; + return 0; + } + + /* from here down, inspired by NetBSD's strtoll */ + if ((base == 0 || base == 16) && c == '0' && + (tok[1] == 'x' || tok[1] == 'X')) { + tok += 2; + c = *tok; + base = 16; + } + + if (base == 0) { + base = c == '0' ? 8 : 10; + } + + /* Cutoff is the greatest magnitude we'll be able to multiply by base without + * range error. If the current number is past cutoff and we see valid digit, + * fail. If the number is *equal* to cutoff, then the next digit must be less + * than cutlim, otherwise fail. + */ + cutoff = sign == -1 ? INT64_MIN : INT64_MAX; + cutlim = (int) (cutoff % base); + cutoff /= base; + if (sign == -1) { + if (cutlim > 0) { + cutlim -= base; + cutoff += 1; + } + cutlim = -cutlim; + } + + digits_start = tok; + + while ((c = *tok)) { + if (isdigit (c)) { + c -= '0'; + } else if (isalpha (c)) { + c -= isupper (c) ? 'A' - 10 : 'a' - 10; + } else { + /* end of number string */ + break; + } + + if (c >= base) { + break; + } + + if (sign == -1) { + if (number < cutoff || (number == cutoff && c > cutlim)) { + number = INT64_MIN; + errno = ERANGE; + break; + } else { + number *= base; + number -= c; + } + } else { + if (number > cutoff || (number == cutoff && c > cutlim)) { + number = INT64_MAX; + errno = ERANGE; + break; + } else { + number *= base; + number += c; + } + } + + tok++; + } + + /* did we parse any digits at all? */ + if (e != NULL && tok > digits_start) { + *e = tok; + } + + return number; +} + + +int +bson_strcasecmp (const char *s1, const char *s2) +{ +#ifdef BSON_OS_WIN32 + return _stricmp (s1, s2); +#else + return strcasecmp (s1, s2); +#endif +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.h new file mode 100644 index 0000000..690a6b7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-string.h @@ -0,0 +1,87 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_STRING_H +#define BSON_STRING_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +typedef struct { + char *str; + uint32_t len; + uint32_t alloc; +} bson_string_t; + + +BSON_EXPORT (bson_string_t *) +bson_string_new (const char *str); +BSON_EXPORT (char *) +bson_string_free (bson_string_t *string, bool free_segment); +BSON_EXPORT (void) +bson_string_append (bson_string_t *string, const char *str); +BSON_EXPORT (void) +bson_string_append_c (bson_string_t *string, char str); +BSON_EXPORT (void) +bson_string_append_unichar (bson_string_t *string, bson_unichar_t unichar); +BSON_EXPORT (void) +bson_string_append_printf (bson_string_t *string, const char *format, ...) + BSON_GNUC_PRINTF (2, 3); +BSON_EXPORT (void) +bson_string_truncate (bson_string_t *string, uint32_t len); +BSON_EXPORT (char *) +bson_strdup (const char *str); +BSON_EXPORT (char *) +bson_strdup_printf (const char *format, ...) BSON_GNUC_PRINTF (1, 2); +BSON_EXPORT (char *) +bson_strdupv_printf (const char *format, va_list args) BSON_GNUC_PRINTF (1, 0); +BSON_EXPORT (char *) +bson_strndup (const char *str, size_t n_bytes); +BSON_EXPORT (void) +bson_strncpy (char *dst, const char *src, size_t size); +BSON_EXPORT (int) +bson_vsnprintf (char *str, size_t size, const char *format, va_list ap) + BSON_GNUC_PRINTF (3, 0); +BSON_EXPORT (int) +bson_snprintf (char *str, size_t size, const char *format, ...) + BSON_GNUC_PRINTF (3, 4); +BSON_EXPORT (void) +bson_strfreev (char **strv); +BSON_EXPORT (size_t) +bson_strnlen (const char *s, size_t maxlen); +BSON_EXPORT (int64_t) +bson_ascii_strtoll (const char *str, char **endptr, int base); +BSON_EXPORT (int) +bson_strcasecmp (const char *s1, const char *s2); + + +BSON_END_DECLS + + +#endif /* BSON_STRING_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm-private.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm-private.h new file mode 100644 index 0000000..5e86b20 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm-private.h @@ -0,0 +1,49 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_TIMEGM_PRIVATE_H +#define BSON_TIMEGM_PRIVATE_H + + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" + + +BSON_BEGIN_DECLS + +/* avoid system-dependent struct tm definitions */ +struct bson_tm { + int64_t tm_sec; /* seconds after the minute [0-60] */ + int64_t tm_min; /* minutes after the hour [0-59] */ + int64_t tm_hour; /* hours since midnight [0-23] */ + int64_t tm_mday; /* day of the month [1-31] */ + int64_t tm_mon; /* months since January [0-11] */ + int64_t tm_year; /* years since 1900 */ + int64_t tm_wday; /* days since Sunday [0-6] */ + int64_t tm_yday; /* days since January 1 [0-365] */ + int64_t tm_isdst; /* Daylight Savings Time flag */ + int64_t tm_gmtoff; /* offset from CUT in seconds */ + char *tm_zone; /* timezone abbreviation */ +}; + +int64_t +_bson_timegm (struct bson_tm *const tmp); + +BSON_END_DECLS + + +#endif /* BSON_TIMEGM_PRIVATE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm.c new file mode 100644 index 0000000..20b0011 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-timegm.c @@ -0,0 +1,795 @@ +/* +** The original version of this file is in the public domain, so clarified as of +** 1996-06-05 by Arthur David Olson. +*/ + +/* +** Leap second handling from Bradley White. +** POSIX-style TZ environment variable handling from Guy Harris. +** Updated to use int64_t's instead of system-dependent definitions of int64_t +** and struct tm by A. Jesse Jiryu Davis for MongoDB, Inc. +*/ + +#include "bson/bson-compat.h" +#include "bson/bson-macros.h" +#include "bson/bson-timegm-private.h" + +#include "errno.h" +#include "string.h" +#include /* for INT64_MAX and INT64_MIN */ + +/* Unlike 's isdigit, this also works if c < 0 | c > UCHAR_MAX. */ +#define is_digit(c) ((unsigned) (c) - '0' <= 9) + +#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +#define ATTRIBUTE_CONST __attribute__ ((const)) +#define ATTRIBUTE_PURE __attribute__ ((__pure__)) +#define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +#define ATTRIBUTE_CONST /* empty */ +#define ATTRIBUTE_PURE /* empty */ +#define ATTRIBUTE_FORMAT(spec) /* empty */ +#endif + +#if !defined _Noreturn && \ + (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112) +#if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) +#define _Noreturn __attribute__((__noreturn__)) +#else +#define _Noreturn +#endif +#endif + +#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901) && \ + !defined restrict +#define restrict /* empty */ +#endif + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshift-negative-value" +#endif + +/* The minimum and maximum finite time values. */ +static int64_t const time_t_min = INT64_MIN; +static int64_t const time_t_max = INT64_MAX; + +#ifdef __clang__ +#pragma clang diagnostic pop +#pragma clang diagnostic pop +#endif + +#ifndef TZ_MAX_TIMES +#define TZ_MAX_TIMES 2000 +#endif /* !defined TZ_MAX_TIMES */ + +#ifndef TZ_MAX_TYPES +/* This must be at least 17 for Europe/Samara and Europe/Vilnius. */ +#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ +#endif /* !defined TZ_MAX_TYPES */ + +#ifndef TZ_MAX_CHARS +#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ + /* (limited by what unsigned chars can hold) */ +#endif /* !defined TZ_MAX_CHARS */ + +#ifndef TZ_MAX_LEAPS +#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ +#endif /* !defined TZ_MAX_LEAPS */ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define DAYSPERWEEK 7 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR 12 + +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_JANUARY 0 +#define TM_FEBRUARY 1 +#define TM_MARCH 2 +#define TM_APRIL 3 +#define TM_MAY 4 +#define TM_JUNE 5 +#define TM_JULY 6 +#define TM_AUGUST 7 +#define TM_SEPTEMBER 8 +#define TM_OCTOBER 9 +#define TM_NOVEMBER 10 +#define TM_DECEMBER 11 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + +/* +** Since everything in isleap is modulo 400 (or a factor of 400), we know that +** isleap(y) == isleap(y % 400) +** and so +** isleap(a + b) == isleap((a + b) % 400) +** or +** isleap(a + b) == isleap(a % 400 + b % 400) +** This is true even if % means modulo rather than Fortran remainder +** (which is allowed by C89 but not C99). +** We use this to avoid addition overflow problems. +*/ + +#define isleap_sum(a, b) isleap ((a) % 400 + (b) % 400) + +#ifndef TZ_ABBR_MAX_LEN +#define TZ_ABBR_MAX_LEN 16 +#endif /* !defined TZ_ABBR_MAX_LEN */ + +#ifndef TZ_ABBR_CHAR_SET +#define TZ_ABBR_CHAR_SET \ + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" +#endif /* !defined TZ_ABBR_CHAR_SET */ + +#ifndef TZ_ABBR_ERR_CHAR +#define TZ_ABBR_ERR_CHAR '_' +#endif /* !defined TZ_ABBR_ERR_CHAR */ + +#ifndef WILDABBR +/* +** Someone might make incorrect use of a time zone abbreviation: +** 1. They might reference tzname[0] before calling tzset (explicitly +** or implicitly). +** 2. They might reference tzname[1] before calling tzset (explicitly +** or implicitly). +** 3. They might reference tzname[1] after setting to a time zone +** in which Daylight Saving Time is never observed. +** 4. They might reference tzname[0] after setting to a time zone +** in which Standard Time is never observed. +** 5. They might reference tm.TM_ZONE after calling offtime. +** What's best to do in the above cases is open to debate; +** for now, we just set things up so that in any of the five cases +** WILDABBR is used. Another possibility: initialize tzname[0] to the +** string "tzname[0] used before set", and similarly for the other cases. +** And another: initialize tzname[0] to "ERA", with an explanation in the +** manual page of what this "time zone abbreviation" means (doing this so +** that tzname[0] has the "normal" length of three characters). +*/ +#define WILDABBR " " +#endif /* !defined WILDABBR */ + +#ifdef TM_ZONE +static const char wildabbr[] = WILDABBR; +static const char gmt[] = "GMT"; +#endif + +struct ttinfo { /* time type information */ + int_fast32_t tt_gmtoff; /* UT offset in seconds */ + int tt_isdst; /* used to set tm_isdst */ + int tt_abbrind; /* abbreviation list index */ + int tt_ttisstd; /* true if transition is std time */ + int tt_ttisgmt; /* true if transition is UT */ +}; + +struct lsinfo { /* leap second information */ + int64_t ls_trans; /* transition time */ + int_fast64_t ls_corr; /* correction to apply */ +}; + +#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b)) + +#ifdef TZNAME_MAX +#define MY_TZNAME_MAX TZNAME_MAX +#endif /* defined TZNAME_MAX */ +#ifndef TZNAME_MAX +#define MY_TZNAME_MAX 255 +#endif /* !defined TZNAME_MAX */ + +struct state { + int leapcnt; + int timecnt; + int typecnt; + int charcnt; + int goback; + int goahead; + int64_t ats[TZ_MAX_TIMES]; + unsigned char types[TZ_MAX_TIMES]; + struct ttinfo ttis[TZ_MAX_TYPES]; + char chars[BIGGEST (TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; + struct lsinfo lsis[TZ_MAX_LEAPS]; + int defaulttype; /* for early times or if no transitions */ +}; + +struct rule { + int r_type; /* type of rule--see below */ + int r_day; /* day number of rule */ + int r_week; /* week number of rule */ + int r_mon; /* month number of rule */ + int_fast32_t r_time; /* transition time of rule */ +}; + +#define JULIAN_DAY 0 /* Jn - Julian day */ +#define DAY_OF_YEAR 1 /* n - day of year */ +#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ + +/* +** Prototypes for static functions. +*/ + +static void +gmtload (struct state *sp); +static struct bson_tm * +gmtsub (const int64_t *timep, int_fast32_t offset, struct bson_tm *tmp); +static int64_t +increment_overflow (int64_t *number, int64_t delta); +static int64_t +leaps_thru_end_of (int64_t y) ATTRIBUTE_PURE; +static int64_t +increment_overflow32 (int_fast32_t *number, int64_t delta); +static int64_t +normalize_overflow32 (int_fast32_t *tensptr, int64_t *unitsptr, int64_t base); +static int64_t +normalize_overflow (int64_t *tensptr, int64_t *unitsptr, int64_t base); +static int64_t +time1 (struct bson_tm *tmp, + struct bson_tm *(*funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + int_fast32_t offset); +static int64_t +time2 (struct bson_tm *tmp, + struct bson_tm *(*funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + int_fast32_t offset, + int64_t *okayp); +static int64_t +time2sub (struct bson_tm *tmp, + struct bson_tm *(*funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + int_fast32_t offset, + int64_t *okayp, + int64_t do_norm_secs); +static struct bson_tm * +timesub (const int64_t *timep, + int_fast32_t offset, + const struct state *sp, + struct bson_tm *tmp); +static int64_t +tmcomp (const struct bson_tm *atmp, const struct bson_tm *btmp); + +static struct state gmtmem; +#define gmtptr (&gmtmem) + +static int gmt_is_set; + +static const int mon_lengths[2][MONSPERYEAR] = { + {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, + {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; + +static const int year_lengths[2] = {DAYSPERNYEAR, DAYSPERLYEAR}; + +static void +gmtload (struct state *const sp) +{ + memset (sp, 0, sizeof (struct state)); + sp->typecnt = 1; + sp->charcnt = 4; + sp->chars[0] = 'G'; + sp->chars[1] = 'M'; + sp->chars[2] = 'T'; +} + +/* +** gmtsub is to gmtime as localsub is to localtime. +*/ + +static struct bson_tm * +gmtsub (const int64_t *const timep, + const int_fast32_t offset, + struct bson_tm *const tmp) +{ + register struct bson_tm *result; + + if (!gmt_is_set) { + gmt_is_set = true; + gmtload (gmtptr); + } + result = timesub (timep, offset, gmtptr, tmp); +#ifdef TM_ZONE + /* + ** Could get fancy here and deliver something such as + ** "UT+xxxx" or "UT-xxxx" if offset is non-zero, + ** but this is no time for a treasure hunt. + */ + tmp->TM_ZONE = offset ? wildabbr : gmtptr ? gmtptr->chars : gmt; +#endif /* defined TM_ZONE */ + return result; +} + +/* +** Return the number of leap years through the end of the given year +** where, to make the math easy, the answer for year zero is defined as zero. +*/ + +static int64_t +leaps_thru_end_of (register const int64_t y) +{ + return (y >= 0) ? (y / 4 - y / 100 + y / 400) + : -(leaps_thru_end_of (-(y + 1)) + 1); +} + +static struct bson_tm * +timesub (const int64_t *const timep, + const int_fast32_t offset, + register const struct state *const sp, + register struct bson_tm *const tmp) +{ + register const struct lsinfo *lp; + register int64_t tdays; + register int64_t idays; /* unsigned would be so 2003 */ + register int_fast64_t rem; + int64_t y; + register const int *ip; + register int_fast64_t corr; + register int64_t hit; + register int64_t i; + + corr = 0; + hit = 0; + i = (sp == NULL) ? 0 : sp->leapcnt; + while (--i >= 0) { + lp = &sp->lsis[i]; + if (*timep >= lp->ls_trans) { + if (*timep == lp->ls_trans) { + hit = ((i == 0 && lp->ls_corr > 0) || + lp->ls_corr > sp->lsis[i - 1].ls_corr); + if (hit) + while (i > 0 && + sp->lsis[i].ls_trans == sp->lsis[i - 1].ls_trans + 1 && + sp->lsis[i].ls_corr == sp->lsis[i - 1].ls_corr + 1) { + ++hit; + --i; + } + } + corr = lp->ls_corr; + break; + } + } + y = EPOCH_YEAR; + tdays = *timep / SECSPERDAY; + rem = *timep - tdays * SECSPERDAY; + while (tdays < 0 || tdays >= year_lengths[isleap (y)]) { + int64_t newy; + register int64_t tdelta; + register int64_t idelta; + register int64_t leapdays; + + tdelta = tdays / DAYSPERLYEAR; + idelta = tdelta; + if (idelta == 0) + idelta = (tdays < 0) ? -1 : 1; + newy = y; + if (increment_overflow (&newy, idelta)) + return NULL; + leapdays = leaps_thru_end_of (newy - 1) - leaps_thru_end_of (y - 1); + tdays -= ((int64_t) newy - y) * DAYSPERNYEAR; + tdays -= leapdays; + y = newy; + } + { + register int_fast32_t seconds; + + seconds = (int_fast32_t) (tdays * SECSPERDAY); + tdays = seconds / SECSPERDAY; + rem += seconds - tdays * SECSPERDAY; + } + /* + ** Given the range, we can now fearlessly cast... + */ + idays = (int64_t) tdays; + rem += offset - corr; + while (rem < 0) { + rem += SECSPERDAY; + --idays; + } + while (rem >= SECSPERDAY) { + rem -= SECSPERDAY; + ++idays; + } + while (idays < 0) { + if (increment_overflow (&y, -1)) + return NULL; + idays += year_lengths[isleap (y)]; + } + while (idays >= year_lengths[isleap (y)]) { + idays -= year_lengths[isleap (y)]; + if (increment_overflow (&y, 1)) + return NULL; + } + tmp->tm_year = y; + if (increment_overflow (&tmp->tm_year, -TM_YEAR_BASE)) + return NULL; + tmp->tm_yday = idays; + /* + ** The "extra" mods below avoid overflow problems. + */ + tmp->tm_wday = + EPOCH_WDAY + + ((y - EPOCH_YEAR) % DAYSPERWEEK) * (DAYSPERNYEAR % DAYSPERWEEK) + + leaps_thru_end_of (y - 1) - leaps_thru_end_of (EPOCH_YEAR - 1) + idays; + tmp->tm_wday %= DAYSPERWEEK; + if (tmp->tm_wday < 0) + tmp->tm_wday += DAYSPERWEEK; + tmp->tm_hour = (int64_t) (rem / SECSPERHOUR); + rem %= SECSPERHOUR; + tmp->tm_min = (int64_t) (rem / SECSPERMIN); + /* + ** A positive leap second requires a special + ** representation. This uses "... ??:59:60" et seq. + */ + tmp->tm_sec = (int64_t) (rem % SECSPERMIN) + hit; + ip = mon_lengths[isleap (y)]; + for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon)) + idays -= ip[tmp->tm_mon]; + tmp->tm_mday = (int64_t) (idays + 1); + tmp->tm_isdst = 0; +#ifdef TM_GMTOFF + tmp->TM_GMTOFF = offset; +#endif /* defined TM_GMTOFF */ + return tmp; +} + +/* +** Adapted from code provided by Robert Elz, who writes: +** The "best" way to do mktime I think is based on an idea of Bob +** Kridle's (so its said...) from a long time ago. +** It does a binary search of the int64_t space. Since int64_t's are +** just 32 bits, its a max of 32 iterations (even at 64 bits it +** would still be very reasonable). +*/ + +#ifndef WRONG +#define WRONG (-1) +#endif /* !defined WRONG */ + +/* +** Normalize logic courtesy Paul Eggert. +*/ + +static int64_t +increment_overflow (int64_t *const ip, int64_t j) +{ + register int64_t const i = *ip; + + /* + ** If i >= 0 there can only be overflow if i + j > INT_MAX + ** or if j > INT_MAX - i; given i >= 0, INT_MAX - i cannot overflow. + ** If i < 0 there can only be overflow if i + j < INT_MIN + ** or if j < INT_MIN - i; given i < 0, INT_MIN - i cannot overflow. + */ + if ((i >= 0) ? (j > INT_MAX - i) : (j < INT_MIN - i)) + return true; + *ip += j; + return false; +} + +static int64_t +increment_overflow32 (int_fast32_t *const lp, int64_t const m) +{ + register int_fast32_t const l = *lp; + + if ((l >= 0) ? (m > INT_FAST32_MAX - l) : (m < INT_FAST32_MIN - l)) + return true; + *lp += m; + return false; +} + +static int64_t +normalize_overflow (int64_t *const tensptr, int64_t *const unitsptr, const int64_t base) +{ + register int64_t tensdelta; + + tensdelta = + (*unitsptr >= 0) ? (*unitsptr / base) : (-1 - (-1 - *unitsptr) / base); + *unitsptr -= tensdelta * base; + return increment_overflow (tensptr, tensdelta); +} + +static int64_t +normalize_overflow32 (int_fast32_t *const tensptr, + int64_t *const unitsptr, + const int64_t base) +{ + register int64_t tensdelta; + + tensdelta = + (*unitsptr >= 0) ? (*unitsptr / base) : (-1 - (-1 - *unitsptr) / base); + *unitsptr -= tensdelta * base; + return increment_overflow32 (tensptr, tensdelta); +} + +static int64_t +tmcomp (register const struct bson_tm *const atmp, + register const struct bson_tm *const btmp) +{ + register int64_t result; + + if (atmp->tm_year != btmp->tm_year) + return atmp->tm_year < btmp->tm_year ? -1 : 1; + if ((result = (atmp->tm_mon - btmp->tm_mon)) == 0 && + (result = (atmp->tm_mday - btmp->tm_mday)) == 0 && + (result = (atmp->tm_hour - btmp->tm_hour)) == 0 && + (result = (atmp->tm_min - btmp->tm_min)) == 0) + result = atmp->tm_sec - btmp->tm_sec; + return result; +} + +static int64_t +time2sub (struct bson_tm *const tmp, + struct bson_tm *(*const funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + const int_fast32_t offset, + int64_t *const okayp, + const int64_t do_norm_secs) +{ + register const struct state *sp; + register int64_t dir; + register int64_t i, j; + register int64_t saved_seconds; + register int_fast32_t li; + register int64_t lo; + register int64_t hi; + int_fast32_t y; + int64_t newt; + int64_t t; + struct bson_tm yourtm, mytm; + + *okayp = false; + yourtm = *tmp; + if (do_norm_secs) { + if (normalize_overflow (&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN)) + return WRONG; + } + if (normalize_overflow (&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR)) + return WRONG; + if (normalize_overflow (&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY)) + return WRONG; + y = (int_fast32_t) yourtm.tm_year; + if (normalize_overflow32 (&y, &yourtm.tm_mon, MONSPERYEAR)) + return WRONG; + /* + ** Turn y into an actual year number for now. + ** It is converted back to an offset from TM_YEAR_BASE later. + */ + if (increment_overflow32 (&y, TM_YEAR_BASE)) + return WRONG; + while (yourtm.tm_mday <= 0) { + if (increment_overflow32 (&y, -1)) + return WRONG; + li = y + (1 < yourtm.tm_mon); + yourtm.tm_mday += year_lengths[isleap (li)]; + } + while (yourtm.tm_mday > DAYSPERLYEAR) { + li = y + (1 < yourtm.tm_mon); + yourtm.tm_mday -= year_lengths[isleap (li)]; + if (increment_overflow32 (&y, 1)) + return WRONG; + } + for (;;) { + i = mon_lengths[isleap (y)][yourtm.tm_mon]; + if (yourtm.tm_mday <= i) + break; + yourtm.tm_mday -= i; + if (++yourtm.tm_mon >= MONSPERYEAR) { + yourtm.tm_mon = 0; + if (increment_overflow32 (&y, 1)) + return WRONG; + } + } + if (increment_overflow32 (&y, -TM_YEAR_BASE)) + return WRONG; + yourtm.tm_year = y; + if (yourtm.tm_year != y) + return WRONG; + if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN) + saved_seconds = 0; + else if (y + TM_YEAR_BASE < EPOCH_YEAR) { + /* + ** We can't set tm_sec to 0, because that might push the + ** time below the minimum representable time. + ** Set tm_sec to 59 instead. + ** This assumes that the minimum representable time is + ** not in the same minute that a leap second was deleted from, + ** which is a safer assumption than using 58 would be. + */ + if (increment_overflow (&yourtm.tm_sec, 1 - SECSPERMIN)) + return WRONG; + saved_seconds = yourtm.tm_sec; + yourtm.tm_sec = SECSPERMIN - 1; + } else { + saved_seconds = yourtm.tm_sec; + yourtm.tm_sec = 0; + } + /* + ** Do a binary search. + */ + lo = INT64_MIN; + hi = INT64_MAX; + + for (;;) { + t = lo / 2 + hi / 2; + if (t < lo) + t = lo; + else if (t > hi) + t = hi; + if ((*funcp) (&t, offset, &mytm) == NULL) { + /* + ** Assume that t is too extreme to be represented in + ** a struct bson_tm; arrange things so that it is less + ** extreme on the next pass. + */ + dir = (t > 0) ? 1 : -1; + } else + dir = tmcomp (&mytm, &yourtm); + if (dir != 0) { + if (t == lo) { + if (t == time_t_max) + return WRONG; + ++t; + ++lo; + } else if (t == hi) { + if (t == time_t_min) + return WRONG; + --t; + --hi; + } + if (lo > hi) + return WRONG; + if (dir > 0) + hi = t; + else + lo = t; + continue; + } + if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst) + break; + /* + ** Right time, wrong type. + ** Hunt for right time, right type. + ** It's okay to guess wrong since the guess + ** gets checked. + */ + sp = (const struct state *) gmtptr; + if (sp == NULL) + return WRONG; + for (i = sp->typecnt - 1; i >= 0; --i) { + if (sp->ttis[i].tt_isdst != yourtm.tm_isdst) + continue; + for (j = sp->typecnt - 1; j >= 0; --j) { + if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) + continue; + newt = t + sp->ttis[j].tt_gmtoff - sp->ttis[i].tt_gmtoff; + if ((*funcp) (&newt, offset, &mytm) == NULL) + continue; + if (tmcomp (&mytm, &yourtm) != 0) + continue; + if (mytm.tm_isdst != yourtm.tm_isdst) + continue; + /* + ** We have a match. + */ + t = newt; + goto label; + } + } + return WRONG; + } +label: + newt = t + saved_seconds; + if ((newt < t) != (saved_seconds < 0)) + return WRONG; + t = newt; + if ((*funcp) (&t, offset, tmp)) + *okayp = true; + return t; +} + +static int64_t +time2 (struct bson_tm *const tmp, + struct bson_tm *(*const funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + const int_fast32_t offset, + int64_t *const okayp) +{ + int64_t t; + + /* + ** First try without normalization of seconds + ** (in case tm_sec contains a value associated with a leap second). + ** If that fails, try with normalization of seconds. + */ + t = time2sub (tmp, funcp, offset, okayp, false); + return *okayp ? t : time2sub (tmp, funcp, offset, okayp, true); +} + +static int64_t +time1 (struct bson_tm *const tmp, + struct bson_tm *(*const funcp) (const int64_t *, int_fast32_t, struct bson_tm *), + const int_fast32_t offset) +{ + register int64_t t; + register const struct state *sp; + register int64_t samei, otheri; + register int64_t sameind, otherind; + register int64_t i; + register int64_t nseen; + int64_t seen[TZ_MAX_TYPES]; + int64_t types[TZ_MAX_TYPES]; + int64_t okay; + + if (tmp == NULL) { + errno = EINVAL; + return WRONG; + } + if (tmp->tm_isdst > 1) + tmp->tm_isdst = 1; + t = time2 (tmp, funcp, offset, &okay); + if (okay) + return t; + if (tmp->tm_isdst < 0) +#ifdef PCTS + /* + ** POSIX Conformance Test Suite code courtesy Grant Sullivan. + */ + tmp->tm_isdst = 0; /* reset to std and try again */ +#else + return t; +#endif /* !defined PCTS */ + /* + ** We're supposed to assume that somebody took a time of one type + ** and did some math on it that yielded a "struct tm" that's bad. + ** We try to divine the type they started from and adjust to the + ** type they need. + */ + sp = (const struct state *) gmtptr; + if (sp == NULL) + return WRONG; + for (i = 0; i < sp->typecnt; ++i) + seen[i] = false; + nseen = 0; + for (i = sp->timecnt - 1; i >= 0; --i) + if (!seen[sp->types[i]]) { + seen[sp->types[i]] = true; + types[nseen++] = sp->types[i]; + } + for (sameind = 0; sameind < nseen; ++sameind) { + samei = types[sameind]; + if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) + continue; + for (otherind = 0; otherind < nseen; ++otherind) { + otheri = types[otherind]; + if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) + continue; + tmp->tm_sec += sp->ttis[otheri].tt_gmtoff - sp->ttis[samei].tt_gmtoff; + tmp->tm_isdst = !tmp->tm_isdst; + t = time2 (tmp, funcp, offset, &okay); + if (okay) + return t; + tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff - sp->ttis[samei].tt_gmtoff; + tmp->tm_isdst = !tmp->tm_isdst; + } + } + return WRONG; +} + +int64_t +_bson_timegm (struct bson_tm *const tmp) +{ + if (tmp != NULL) + tmp->tm_isdst = 0; + return time1 (tmp, gmtsub, 0L); +} + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-types.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-types.h new file mode 100644 index 0000000..7582421 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-types.h @@ -0,0 +1,567 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_TYPES_H +#define BSON_TYPES_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include +#include + +#include "bson/bson-macros.h" +#include "bson/bson-config.h" +#include "bson/bson-compat.h" +#include "bson/bson-endian.h" + +BSON_BEGIN_DECLS + + +/* + *-------------------------------------------------------------------------- + * + * bson_unichar_t -- + * + * bson_unichar_t provides an unsigned 32-bit type for containing + * unicode characters. When iterating UTF-8 sequences, this should + * be used to avoid losing the high-bits of non-ascii characters. + * + * See also: + * bson_string_append_unichar() + * + *-------------------------------------------------------------------------- + */ + +typedef uint32_t bson_unichar_t; + + +/** + * bson_context_flags_t: + * + * This enumeration is used to configure a bson_context_t. + * + * %BSON_CONTEXT_NONE: Use default options. + * %BSON_CONTEXT_THREAD_SAFE: Context will be called from multiple threads. + * %BSON_CONTEXT_DISABLE_PID_CACHE: Call getpid() instead of caching the + * result of getpid() when initializing the context. + * %BSON_CONTEXT_DISABLE_HOST_CACHE: Call gethostname() instead of caching the + * result of gethostname() when initializing the context. + */ +typedef enum { + BSON_CONTEXT_NONE = 0, + BSON_CONTEXT_THREAD_SAFE = (1 << 0), + BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1), + BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2), +#ifdef BSON_HAVE_SYSCALL_TID + BSON_CONTEXT_USE_TASK_ID = (1 << 3), +#endif +} bson_context_flags_t; + + +/** + * bson_context_t: + * + * This structure manages context for the bson library. It handles + * configuration for thread-safety and other performance related requirements. + * Consumers will create a context and may use multiple under a variety of + * situations. + * + * If your program calls fork(), you should initialize a new bson_context_t + * using bson_context_init(). + * + * If you are using threading, it is suggested that you use a bson_context_t + * per thread for best performance. Alternatively, you can initialize the + * bson_context_t with BSON_CONTEXT_THREAD_SAFE, although a performance penalty + * will be incurred. + * + * Many functions will require that you provide a bson_context_t such as OID + * generation. + * + * This structure is opaque in that you cannot see the contents of the + * structure. However, it is stack allocatable in that enough padding is + * provided in _bson_context_t to hold the structure. + */ +typedef struct _bson_context_t bson_context_t; + + +/** + * bson_t: + * + * This structure manages a buffer whose contents are a properly formatted + * BSON document. You may perform various transforms on the BSON documents. + * Additionally, it can be iterated over using bson_iter_t. + * + * See bson_iter_init() for iterating the contents of a bson_t. + * + * When building a bson_t structure using the various append functions, + * memory allocations may occur. That is performed using power of two + * allocations and realloc(). + * + * See http://bsonspec.org for the BSON document spec. + * + * This structure is meant to fit in two sequential 64-byte cachelines. + */ +#ifdef BSON_MEMCHECK +BSON_ALIGNED_BEGIN (128) +typedef struct _bson_t { + uint32_t flags; /* Internal flags for the bson_t. */ + uint32_t len; /* Length of BSON data. */ + char *canary; /* For valgrind check */ + uint8_t padding[120 - sizeof (char*)]; +} bson_t BSON_ALIGNED_END (128); +#else +BSON_ALIGNED_BEGIN (128) +typedef struct _bson_t { + uint32_t flags; /* Internal flags for the bson_t. */ + uint32_t len; /* Length of BSON data. */ + uint8_t padding[120]; /* Padding for stack allocation. */ +} bson_t BSON_ALIGNED_END (128); +#endif + + +/** + * BSON_INITIALIZER: + * + * This macro can be used to initialize a #bson_t structure on the stack + * without calling bson_init(). + * + * |[ + * bson_t b = BSON_INITIALIZER; + * ]| + */ +#ifdef BSON_MEMCHECK +#define BSON_INITIALIZER \ + { \ + 3, 5, \ + bson_malloc (1), \ + { \ + 5 \ + }, \ + } +#else +#define BSON_INITIALIZER \ + { \ + 3, 5, \ + { \ + 5 \ + } \ + } +#endif + + +BSON_STATIC_ASSERT2 (bson_t, sizeof (bson_t) == 128); + + +/** + * bson_oid_t: + * + * This structure contains the binary form of a BSON Object Id as specified + * on http://bsonspec.org. If you would like the bson_oid_t in string form + * see bson_oid_to_string() or bson_oid_to_string_r(). + */ +typedef struct { + uint8_t bytes[12]; +} bson_oid_t; + +BSON_STATIC_ASSERT2 (oid_t, sizeof (bson_oid_t) == 12); + +/** + * bson_decimal128_t: + * + * @high The high-order bytes of the decimal128. This field contains sign, + * combination bits, exponent, and part of the coefficient continuation. + * @low The low-order bytes of the decimal128. This field contains the second + * part of the coefficient continuation. + * + * This structure is a boxed type containing the value for the BSON decimal128 + * type. The structure stores the 128 bits such that they correspond to the + * native format for the IEEE decimal128 type, if it is implemented. + **/ +typedef struct { +#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN + uint64_t low; + uint64_t high; +#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN + uint64_t high; + uint64_t low; +#endif +} bson_decimal128_t; + + +/** + * bson_validate_flags_t: + * + * This enumeration is used for validation of BSON documents. It allows + * selective control on what you wish to validate. + * + * %BSON_VALIDATE_NONE: No additional validation occurs. + * %BSON_VALIDATE_UTF8: Check that strings are valid UTF-8. + * %BSON_VALIDATE_DOLLAR_KEYS: Check that keys do not start with $. + * %BSON_VALIDATE_DOT_KEYS: Check that keys do not contain a period. + * %BSON_VALIDATE_UTF8_ALLOW_NULL: Allow NUL bytes in UTF-8 text. + * %BSON_VALIDATE_EMPTY_KEYS: Prohibit zero-length field names + */ +typedef enum { + BSON_VALIDATE_NONE = 0, + BSON_VALIDATE_UTF8 = (1 << 0), + BSON_VALIDATE_DOLLAR_KEYS = (1 << 1), + BSON_VALIDATE_DOT_KEYS = (1 << 2), + BSON_VALIDATE_UTF8_ALLOW_NULL = (1 << 3), + BSON_VALIDATE_EMPTY_KEYS = (1 << 4), +} bson_validate_flags_t; + + +/** + * bson_type_t: + * + * This enumeration contains all of the possible types within a BSON document. + * Use bson_iter_type() to fetch the type of a field while iterating over it. + */ +typedef enum { + BSON_TYPE_EOD = 0x00, + BSON_TYPE_DOUBLE = 0x01, + BSON_TYPE_UTF8 = 0x02, + BSON_TYPE_DOCUMENT = 0x03, + BSON_TYPE_ARRAY = 0x04, + BSON_TYPE_BINARY = 0x05, + BSON_TYPE_UNDEFINED = 0x06, + BSON_TYPE_OID = 0x07, + BSON_TYPE_BOOL = 0x08, + BSON_TYPE_DATE_TIME = 0x09, + BSON_TYPE_NULL = 0x0A, + BSON_TYPE_REGEX = 0x0B, + BSON_TYPE_DBPOINTER = 0x0C, + BSON_TYPE_CODE = 0x0D, + BSON_TYPE_SYMBOL = 0x0E, + BSON_TYPE_CODEWSCOPE = 0x0F, + BSON_TYPE_INT32 = 0x10, + BSON_TYPE_TIMESTAMP = 0x11, + BSON_TYPE_INT64 = 0x12, + BSON_TYPE_DECIMAL128 = 0x13, + BSON_TYPE_MAXKEY = 0x7F, + BSON_TYPE_MINKEY = 0xFF, +} bson_type_t; + + +/** + * bson_subtype_t: + * + * This enumeration contains the various subtypes that may be used in a binary + * field. See http://bsonspec.org for more information. + */ +typedef enum { + BSON_SUBTYPE_BINARY = 0x00, + BSON_SUBTYPE_FUNCTION = 0x01, + BSON_SUBTYPE_BINARY_DEPRECATED = 0x02, + BSON_SUBTYPE_UUID_DEPRECATED = 0x03, + BSON_SUBTYPE_UUID = 0x04, + BSON_SUBTYPE_MD5 = 0x05, + BSON_SUBTYPE_USER = 0x80, +} bson_subtype_t; + + +/* + *-------------------------------------------------------------------------- + * + * bson_value_t -- + * + * A boxed type to contain various bson_type_t types. + * + * See also: + * bson_value_copy() + * bson_value_destroy() + * + *-------------------------------------------------------------------------- + */ + +BSON_ALIGNED_BEGIN (8) +typedef struct _bson_value_t { + bson_type_t value_type; + int32_t padding; + union { + bson_oid_t v_oid; + int64_t v_int64; + int32_t v_int32; + int8_t v_int8; + double v_double; + bool v_bool; + int64_t v_datetime; + struct { + uint32_t timestamp; + uint32_t increment; + } v_timestamp; + struct { + char *str; + uint32_t len; + } v_utf8; + struct { + uint8_t *data; + uint32_t data_len; + } v_doc; + struct { + uint8_t *data; + uint32_t data_len; + bson_subtype_t subtype; + } v_binary; + struct { + char *regex; + char *options; + } v_regex; + struct { + char *collection; + uint32_t collection_len; + bson_oid_t oid; + } v_dbpointer; + struct { + char *code; + uint32_t code_len; + } v_code; + struct { + char *code; + uint8_t *scope_data; + uint32_t code_len; + uint32_t scope_len; + } v_codewscope; + struct { + char *symbol; + uint32_t len; + } v_symbol; + bson_decimal128_t v_decimal128; + } value; +} bson_value_t BSON_ALIGNED_END (8); + + +/** + * bson_iter_t: + * + * This structure manages iteration over a bson_t structure. It keeps track + * of the location of the current key and value within the buffer. Using the + * various functions to get the value of the iter will read from these + * locations. + * + * This structure is safe to discard on the stack. No cleanup is necessary + * after using it. + */ +BSON_ALIGNED_BEGIN (128) +typedef struct { + const uint8_t *raw; /* The raw buffer being iterated. */ + uint32_t len; /* The length of raw. */ + uint32_t off; /* The offset within the buffer. */ + uint32_t type; /* The offset of the type byte. */ + uint32_t key; /* The offset of the key byte. */ + uint32_t d1; /* The offset of the first data byte. */ + uint32_t d2; /* The offset of the second data byte. */ + uint32_t d3; /* The offset of the third data byte. */ + uint32_t d4; /* The offset of the fourth data byte. */ + uint32_t next_off; /* The offset of the next field. */ + uint32_t err_off; /* The offset of the error. */ + bson_value_t value; /* Internal value for various state. */ +} bson_iter_t BSON_ALIGNED_END (128); + + +/** + * bson_reader_t: + * + * This structure is used to iterate over a sequence of BSON documents. It + * allows for them to be iterated with the possibility of no additional + * memory allocations under certain circumstances such as reading from an + * incoming mongo packet. + */ + +BSON_ALIGNED_BEGIN (BSON_ALIGN_OF_PTR) +typedef struct { + uint32_t type; + /*< private >*/ +} bson_reader_t BSON_ALIGNED_END (BSON_ALIGN_OF_PTR); + + +/** + * bson_visitor_t: + * + * This structure contains a series of pointers that can be executed for + * each field of a BSON document based on the field type. + * + * For example, if an int32 field is found, visit_int32 will be called. + * + * When visiting each field using bson_iter_visit_all(), you may provide a + * data pointer that will be provided with each callback. This might be useful + * if you are marshaling to another language. + * + * You may pre-maturely stop the visitation of fields by returning true in your + * visitor. Returning false will continue visitation to further fields. + */ +BSON_ALIGNED_BEGIN (8) +typedef struct { + /* run before / after descending into a document */ + bool (*visit_before) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_after) (const bson_iter_t *iter, const char *key, void *data); + /* corrupt BSON, or unsupported type and visit_unsupported_type not set */ + void (*visit_corrupt) (const bson_iter_t *iter, void *data); + /* normal bson field callbacks */ + bool (*visit_double) (const bson_iter_t *iter, + const char *key, + double v_double, + void *data); + bool (*visit_utf8) (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data); + bool (*visit_document) (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + bool (*visit_array) (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); + bool (*visit_binary) (const bson_iter_t *iter, + const char *key, + bson_subtype_t v_subtype, + size_t v_binary_len, + const uint8_t *v_binary, + void *data); + /* normal field with deprecated "Undefined" BSON type */ + bool (*visit_undefined) (const bson_iter_t *iter, + const char *key, + void *data); + bool (*visit_oid) (const bson_iter_t *iter, + const char *key, + const bson_oid_t *v_oid, + void *data); + bool (*visit_bool) (const bson_iter_t *iter, + const char *key, + bool v_bool, + void *data); + bool (*visit_date_time) (const bson_iter_t *iter, + const char *key, + int64_t msec_since_epoch, + void *data); + bool (*visit_null) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_regex) (const bson_iter_t *iter, + const char *key, + const char *v_regex, + const char *v_options, + void *data); + bool (*visit_dbpointer) (const bson_iter_t *iter, + const char *key, + size_t v_collection_len, + const char *v_collection, + const bson_oid_t *v_oid, + void *data); + bool (*visit_code) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + void *data); + bool (*visit_symbol) (const bson_iter_t *iter, + const char *key, + size_t v_symbol_len, + const char *v_symbol, + void *data); + bool (*visit_codewscope) (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data); + bool (*visit_int32) (const bson_iter_t *iter, + const char *key, + int32_t v_int32, + void *data); + bool (*visit_timestamp) (const bson_iter_t *iter, + const char *key, + uint32_t v_timestamp, + uint32_t v_increment, + void *data); + bool (*visit_int64) (const bson_iter_t *iter, + const char *key, + int64_t v_int64, + void *data); + bool (*visit_maxkey) (const bson_iter_t *iter, const char *key, void *data); + bool (*visit_minkey) (const bson_iter_t *iter, const char *key, void *data); + /* if set, called instead of visit_corrupt when an apparently valid BSON + * includes an unrecognized field type (reading future version of BSON) */ + void (*visit_unsupported_type) (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data); + bool (*visit_decimal128) (const bson_iter_t *iter, + const char *key, + const bson_decimal128_t *v_decimal128, + void *data); + + void *padding[7]; +} bson_visitor_t BSON_ALIGNED_END (8); + +#define BSON_ERROR_BUFFER_SIZE 504 + +BSON_ALIGNED_BEGIN (8) +typedef struct _bson_error_t { + uint32_t domain; + uint32_t code; + char message[BSON_ERROR_BUFFER_SIZE]; +} bson_error_t BSON_ALIGNED_END (8); + + +BSON_STATIC_ASSERT2 (error_t, sizeof (bson_error_t) == 512); + + +/** + * bson_next_power_of_two: + * @v: A 32-bit unsigned integer of required bytes. + * + * Determines the next larger power of two for the value of @v + * in a constant number of operations. + * + * It is up to the caller to guarantee this will not overflow. + * + * Returns: The next power of 2 from @v. + */ +static BSON_INLINE size_t +bson_next_power_of_two (size_t v) +{ + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; +#if BSON_WORD_SIZE == 64 + v |= v >> 32; +#endif + v++; + + return v; +} + + +static BSON_INLINE bool +bson_is_power_of_two (uint32_t v) +{ + return ((v != 0) && ((v & (v - 1)) == 0)); +} + + +BSON_END_DECLS + + +#endif /* BSON_TYPES_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.c new file mode 100644 index 0000000..b9ace45 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.c @@ -0,0 +1,459 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "bson/bson-memory.h" +#include "bson/bson-string.h" +#include "bson/bson-utf8.h" + + +/* + *-------------------------------------------------------------------------- + * + * _bson_utf8_get_sequence -- + * + * Determine the sequence length of the first UTF-8 character in + * @utf8. The sequence length is stored in @seq_length and the mask + * for the first character is stored in @first_mask. + * + * Returns: + * None. + * + * Side effects: + * @seq_length is set. + * @first_mask is set. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE void +_bson_utf8_get_sequence (const char *utf8, /* IN */ + uint8_t *seq_length, /* OUT */ + uint8_t *first_mask) /* OUT */ +{ + unsigned char c = *(const unsigned char *) utf8; + uint8_t m; + uint8_t n; + + /* + * See the following[1] for a description of what the given multi-byte + * sequences will be based on the bits set of the first byte. We also need + * to mask the first byte based on that. All subsequent bytes are masked + * against 0x3F. + * + * [1] http://www.joelonsoftware.com/articles/Unicode.html + */ + + if ((c & 0x80) == 0) { + n = 1; + m = 0x7F; + } else if ((c & 0xE0) == 0xC0) { + n = 2; + m = 0x1F; + } else if ((c & 0xF0) == 0xE0) { + n = 3; + m = 0x0F; + } else if ((c & 0xF8) == 0xF0) { + n = 4; + m = 0x07; + } else { + n = 0; + m = 0; + } + + *seq_length = n; + *first_mask = m; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_utf8_validate -- + * + * Validates that @utf8 is a valid UTF-8 string. Note that we only + * support UTF-8 characters which have sequence length less than or equal + * to 4 bytes (RFC 3629). + * + * If @allow_null is true, then \0 is allowed within @utf8_len bytes + * of @utf8. Generally, this is bad practice since the main point of + * UTF-8 strings is that they can be used with strlen() and friends. + * However, some languages such as Python can send UTF-8 encoded + * strings with NUL's in them. + * + * Parameters: + * @utf8: A UTF-8 encoded string. + * @utf8_len: The length of @utf8 in bytes. + * @allow_null: If \0 is allowed within @utf8, exclusing trailing \0. + * + * Returns: + * true if @utf8 is valid UTF-8. otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_utf8_validate (const char *utf8, /* IN */ + size_t utf8_len, /* IN */ + bool allow_null) /* IN */ +{ + bson_unichar_t c; + uint8_t first_mask; + uint8_t seq_length; + unsigned i; + unsigned j; + + BSON_ASSERT (utf8); + + for (i = 0; i < utf8_len; i += seq_length) { + _bson_utf8_get_sequence (&utf8[i], &seq_length, &first_mask); + + /* + * Ensure we have a valid multi-byte sequence length. + */ + if (!seq_length) { + return false; + } + + /* + * Ensure we have enough bytes left. + */ + if ((utf8_len - i) < seq_length) { + return false; + } + + /* + * Also calculate the next char as a unichar so we can + * check code ranges for non-shortest form. + */ + c = utf8[i] & first_mask; + + /* + * Check the high-bits for each additional sequence byte. + */ + for (j = i + 1; j < (i + seq_length); j++) { + c = (c << 6) | (utf8[j] & 0x3F); + if ((utf8[j] & 0xC0) != 0x80) { + return false; + } + } + + /* + * Check for NULL bytes afterwards. + * + * Hint: if you want to optimize this function, starting here to do + * this in the same pass as the data above would probably be a good + * idea. You would add a branch into the inner loop, but save possibly + * on cache-line bouncing on larger strings. Just a thought. + */ + if (!allow_null) { + for (j = 0; j < seq_length; j++) { + if (((i + j) > utf8_len) || !utf8[i + j]) { + return false; + } + } + } + + /* + * Code point won't fit in utf-16, not allowed. + */ + if (c > 0x0010FFFF) { + return false; + } + + /* + * Byte is in reserved range for UTF-16 high-marks + * for surrogate pairs. + */ + if ((c & 0xFFFFF800) == 0xD800) { + return false; + } + + /* + * Check non-shortest form unicode. + */ + switch (seq_length) { + case 1: + if (c <= 0x007F) { + continue; + } + return false; + + case 2: + if ((c >= 0x0080) && (c <= 0x07FF)) { + continue; + } else if (c == 0) { + /* Two-byte representation for NULL. */ + if (!allow_null) { + return false; + } + continue; + } + return false; + + case 3: + if (((c >= 0x0800) && (c <= 0x0FFF)) || + ((c >= 0x1000) && (c <= 0xFFFF))) { + continue; + } + return false; + + case 4: + if (((c >= 0x10000) && (c <= 0x3FFFF)) || + ((c >= 0x40000) && (c <= 0xFFFFF)) || + ((c >= 0x100000) && (c <= 0x10FFFF))) { + continue; + } + return false; + + default: + return false; + } + } + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_utf8_escape_for_json -- + * + * Allocates a new string matching @utf8 except that special + * characters in JSON will be escaped. The resulting string is also + * UTF-8 encoded. + * + * Both " and \ characters will be escaped. Additionally, if a NUL + * byte is found before @utf8_len bytes, it will be converted to the + * two byte UTF-8 sequence. + * + * Parameters: + * @utf8: A UTF-8 encoded string. + * @utf8_len: The length of @utf8 in bytes or -1 if NUL terminated. + * + * Returns: + * A newly allocated string that should be freed with bson_free(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +char * +bson_utf8_escape_for_json (const char *utf8, /* IN */ + ssize_t utf8_len) /* IN */ +{ + bson_unichar_t c; + bson_string_t *str; + bool length_provided = true; + const char *end; + + BSON_ASSERT (utf8); + + str = bson_string_new (NULL); + + if (utf8_len < 0) { + length_provided = false; + utf8_len = strlen (utf8); + } + + end = utf8 + utf8_len; + + while (utf8 < end) { + c = bson_utf8_get_char (utf8); + + switch (c) { + case '\\': + case '"': + bson_string_append_c (str, '\\'); + bson_string_append_unichar (str, c); + break; + case '\b': + bson_string_append (str, "\\b"); + break; + case '\f': + bson_string_append (str, "\\f"); + break; + case '\n': + bson_string_append (str, "\\n"); + break; + case '\r': + bson_string_append (str, "\\r"); + break; + case '\t': + bson_string_append (str, "\\t"); + break; + default: + if (c < ' ') { + bson_string_append_printf (str, "\\u%04x", (unsigned) c); + } else { + bson_string_append_unichar (str, c); + } + break; + } + + if (c) { + utf8 = bson_utf8_next_char (utf8); + } else { + if (length_provided && !*utf8) { + /* we escaped nil as '\u0000', now advance past it */ + utf8++; + } else { + /* invalid UTF-8 */ + bson_string_free (str, true); + return NULL; + } + } + } + + return bson_string_free (str, false); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_utf8_get_char -- + * + * Fetches the next UTF-8 character from the UTF-8 sequence. + * + * Parameters: + * @utf8: A string containing validated UTF-8. + * + * Returns: + * A 32-bit bson_unichar_t reprsenting the multi-byte sequence. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_unichar_t +bson_utf8_get_char (const char *utf8) /* IN */ +{ + bson_unichar_t c; + uint8_t mask; + uint8_t num; + int i; + + BSON_ASSERT (utf8); + + _bson_utf8_get_sequence (utf8, &num, &mask); + c = (*utf8) & mask; + + for (i = 1; i < num; i++) { + c = (c << 6) | (utf8[i] & 0x3F); + } + + return c; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_utf8_next_char -- + * + * Returns an incremented pointer to the beginning of the next + * multi-byte sequence in @utf8. + * + * Parameters: + * @utf8: A string containing validated UTF-8. + * + * Returns: + * An incremented pointer in @utf8. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +const char * +bson_utf8_next_char (const char *utf8) /* IN */ +{ + uint8_t mask; + uint8_t num; + + BSON_ASSERT (utf8); + + _bson_utf8_get_sequence (utf8, &num, &mask); + + return utf8 + num; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_utf8_from_unichar -- + * + * Converts the unichar to a sequence of utf8 bytes and stores those + * in @utf8. The number of bytes in the sequence are stored in @len. + * + * Parameters: + * @unichar: A bson_unichar_t. + * @utf8: A location for the multi-byte sequence. + * @len: A location for number of bytes stored in @utf8. + * + * Returns: + * None. + * + * Side effects: + * @utf8 is set. + * @len is set. + * + *-------------------------------------------------------------------------- + */ + +void +bson_utf8_from_unichar (bson_unichar_t unichar, /* IN */ + char utf8[BSON_ENSURE_ARRAY_PARAM_SIZE (6)], /* OUT */ + uint32_t *len) /* OUT */ +{ + BSON_ASSERT (utf8); + BSON_ASSERT (len); + + if (unichar <= 0x7F) { + utf8[0] = unichar; + *len = 1; + } else if (unichar <= 0x7FF) { + *len = 2; + utf8[0] = 0xC0 | ((unichar >> 6) & 0x3F); + utf8[1] = 0x80 | ((unichar) &0x3F); + } else if (unichar <= 0xFFFF) { + *len = 3; + utf8[0] = 0xE0 | ((unichar >> 12) & 0xF); + utf8[1] = 0x80 | ((unichar >> 6) & 0x3F); + utf8[2] = 0x80 | ((unichar) &0x3F); + } else if (unichar <= 0x1FFFFF) { + *len = 4; + utf8[0] = 0xF0 | ((unichar >> 18) & 0x7); + utf8[1] = 0x80 | ((unichar >> 12) & 0x3F); + utf8[2] = 0x80 | ((unichar >> 6) & 0x3F); + utf8[3] = 0x80 | ((unichar) &0x3F); + } else { + *len = 0; + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.h new file mode 100644 index 0000000..ac2dd84 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-utf8.h @@ -0,0 +1,49 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_UTF8_H +#define BSON_UTF8_H + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (bool) +bson_utf8_validate (const char *utf8, size_t utf8_len, bool allow_null); +BSON_EXPORT (char *) +bson_utf8_escape_for_json (const char *utf8, ssize_t utf8_len); +BSON_EXPORT (bson_unichar_t) +bson_utf8_get_char (const char *utf8); +BSON_EXPORT (const char *) +bson_utf8_next_char (const char *utf8); +BSON_EXPORT (void) +bson_utf8_from_unichar (bson_unichar_t unichar, char utf8[6], uint32_t *len); + + +BSON_END_DECLS + + +#endif /* BSON_UTF8_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.c new file mode 100644 index 0000000..d0d0667 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.c @@ -0,0 +1,194 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-memory.h" +#include "bson/bson-string.h" +#include "bson/bson-value.h" +#include "bson/bson-oid.h" + + +void +bson_value_copy (const bson_value_t *src, /* IN */ + bson_value_t *dst) /* OUT */ +{ + BSON_ASSERT (src); + BSON_ASSERT (dst); + + dst->value_type = src->value_type; + + switch (src->value_type) { + case BSON_TYPE_DOUBLE: + dst->value.v_double = src->value.v_double; + break; + case BSON_TYPE_UTF8: + dst->value.v_utf8.len = src->value.v_utf8.len; + dst->value.v_utf8.str = bson_malloc (src->value.v_utf8.len + 1); + memcpy ( + dst->value.v_utf8.str, src->value.v_utf8.str, dst->value.v_utf8.len); + dst->value.v_utf8.str[dst->value.v_utf8.len] = '\0'; + break; + case BSON_TYPE_DOCUMENT: + case BSON_TYPE_ARRAY: + dst->value.v_doc.data_len = src->value.v_doc.data_len; + dst->value.v_doc.data = bson_malloc (src->value.v_doc.data_len); + memcpy (dst->value.v_doc.data, + src->value.v_doc.data, + dst->value.v_doc.data_len); + break; + case BSON_TYPE_BINARY: + dst->value.v_binary.subtype = src->value.v_binary.subtype; + dst->value.v_binary.data_len = src->value.v_binary.data_len; + dst->value.v_binary.data = bson_malloc (src->value.v_binary.data_len); + if (dst->value.v_binary.data_len) { + memcpy (dst->value.v_binary.data, src->value.v_binary.data, + dst->value.v_binary.data_len); + } + break; + case BSON_TYPE_OID: + bson_oid_copy (&src->value.v_oid, &dst->value.v_oid); + break; + case BSON_TYPE_BOOL: + dst->value.v_bool = src->value.v_bool; + break; + case BSON_TYPE_DATE_TIME: + dst->value.v_datetime = src->value.v_datetime; + break; + case BSON_TYPE_REGEX: + dst->value.v_regex.regex = bson_strdup (src->value.v_regex.regex); + dst->value.v_regex.options = bson_strdup (src->value.v_regex.options); + break; + case BSON_TYPE_DBPOINTER: + dst->value.v_dbpointer.collection_len = + src->value.v_dbpointer.collection_len; + dst->value.v_dbpointer.collection = + bson_malloc (src->value.v_dbpointer.collection_len + 1); + memcpy (dst->value.v_dbpointer.collection, + src->value.v_dbpointer.collection, + dst->value.v_dbpointer.collection_len); + dst->value.v_dbpointer.collection[dst->value.v_dbpointer.collection_len] = + '\0'; + bson_oid_copy (&src->value.v_dbpointer.oid, &dst->value.v_dbpointer.oid); + break; + case BSON_TYPE_CODE: + dst->value.v_code.code_len = src->value.v_code.code_len; + dst->value.v_code.code = bson_malloc (src->value.v_code.code_len + 1); + memcpy (dst->value.v_code.code, + src->value.v_code.code, + dst->value.v_code.code_len); + dst->value.v_code.code[dst->value.v_code.code_len] = '\0'; + break; + case BSON_TYPE_SYMBOL: + dst->value.v_symbol.len = src->value.v_symbol.len; + dst->value.v_symbol.symbol = bson_malloc (src->value.v_symbol.len + 1); + memcpy (dst->value.v_symbol.symbol, + src->value.v_symbol.symbol, + dst->value.v_symbol.len); + dst->value.v_symbol.symbol[dst->value.v_symbol.len] = '\0'; + break; + case BSON_TYPE_CODEWSCOPE: + dst->value.v_codewscope.code_len = src->value.v_codewscope.code_len; + dst->value.v_codewscope.code = + bson_malloc (src->value.v_codewscope.code_len + 1); + memcpy (dst->value.v_codewscope.code, + src->value.v_codewscope.code, + dst->value.v_codewscope.code_len); + dst->value.v_codewscope.code[dst->value.v_codewscope.code_len] = '\0'; + dst->value.v_codewscope.scope_len = src->value.v_codewscope.scope_len; + dst->value.v_codewscope.scope_data = + bson_malloc (src->value.v_codewscope.scope_len); + memcpy (dst->value.v_codewscope.scope_data, + src->value.v_codewscope.scope_data, + dst->value.v_codewscope.scope_len); + break; + case BSON_TYPE_INT32: + dst->value.v_int32 = src->value.v_int32; + break; + case BSON_TYPE_TIMESTAMP: + dst->value.v_timestamp.timestamp = src->value.v_timestamp.timestamp; + dst->value.v_timestamp.increment = src->value.v_timestamp.increment; + break; + case BSON_TYPE_INT64: + dst->value.v_int64 = src->value.v_int64; + break; + case BSON_TYPE_DECIMAL128: + dst->value.v_decimal128 = src->value.v_decimal128; + break; + case BSON_TYPE_UNDEFINED: + case BSON_TYPE_NULL: + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + break; + case BSON_TYPE_EOD: + default: + BSON_ASSERT (false); + return; + } +} + + +void +bson_value_destroy (bson_value_t *value) /* IN */ +{ + if (!value) { + return; + } + + switch (value->value_type) { + case BSON_TYPE_UTF8: + bson_free (value->value.v_utf8.str); + break; + case BSON_TYPE_DOCUMENT: + case BSON_TYPE_ARRAY: + bson_free (value->value.v_doc.data); + break; + case BSON_TYPE_BINARY: + bson_free (value->value.v_binary.data); + break; + case BSON_TYPE_REGEX: + bson_free (value->value.v_regex.regex); + bson_free (value->value.v_regex.options); + break; + case BSON_TYPE_DBPOINTER: + bson_free (value->value.v_dbpointer.collection); + break; + case BSON_TYPE_CODE: + bson_free (value->value.v_code.code); + break; + case BSON_TYPE_SYMBOL: + bson_free (value->value.v_symbol.symbol); + break; + case BSON_TYPE_CODEWSCOPE: + bson_free (value->value.v_codewscope.code); + bson_free (value->value.v_codewscope.scope_data); + break; + case BSON_TYPE_DOUBLE: + case BSON_TYPE_UNDEFINED: + case BSON_TYPE_OID: + case BSON_TYPE_BOOL: + case BSON_TYPE_DATE_TIME: + case BSON_TYPE_NULL: + case BSON_TYPE_INT32: + case BSON_TYPE_TIMESTAMP: + case BSON_TYPE_INT64: + case BSON_TYPE_DECIMAL128: + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + case BSON_TYPE_EOD: + default: + break; + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.h new file mode 100644 index 0000000..7930e3c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-value.h @@ -0,0 +1,38 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_VALUE_H +#define BSON_VALUE_H + + +#include "bson/bson-macros.h" +#include "bson/bson-types.h" + + +BSON_BEGIN_DECLS + + +BSON_EXPORT (void) +bson_value_copy (const bson_value_t *src, bson_value_t *dst); +BSON_EXPORT (void) +bson_value_destroy (bson_value_t *value); + + +BSON_END_DECLS + + +#endif /* BSON_VALUE_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.c new file mode 100644 index 0000000..6a6e133 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.c @@ -0,0 +1,77 @@ +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-version.h" +#include "bson/bson-version-functions.h" + + +/** + * bson_get_major_version: + * + * Helper function to return the runtime major version of the library. + */ +int +bson_get_major_version (void) +{ + return BSON_MAJOR_VERSION; +} + + +/** + * bson_get_minor_version: + * + * Helper function to return the runtime minor version of the library. + */ +int +bson_get_minor_version (void) +{ + return BSON_MINOR_VERSION; +} + +/** + * bson_get_micro_version: + * + * Helper function to return the runtime micro version of the library. + */ +int +bson_get_micro_version (void) +{ + return BSON_MICRO_VERSION; +} + +/** + * bson_get_version: + * + * Helper function to return the runtime string version of the library. + */ +const char * +bson_get_version (void) +{ + return BSON_VERSION_S; +} + +/** + * bson_check_version: + * + * True if libmongoc's version is greater than or equal to the required + * version. + */ +bool +bson_check_version (int required_major, int required_minor, int required_micro) +{ + return BSON_CHECK_VERSION (required_major, required_minor, required_micro); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.h new file mode 100644 index 0000000..97bcb96 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version-functions.h @@ -0,0 +1,43 @@ +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#ifndef BSON_VERSION_FUNCTIONS_H +#define BSON_VERSION_FUNCTIONS_H + +#include "bson/bson-types.h" + +BSON_BEGIN_DECLS + +BSON_EXPORT (int) +bson_get_major_version (void); +BSON_EXPORT (int) +bson_get_minor_version (void); +BSON_EXPORT (int) +bson_get_micro_version (void); +BSON_EXPORT (const char *) +bson_get_version (void); +BSON_EXPORT (bool) +bson_check_version (int required_major, int required_minor, int required_micro); + +BSON_END_DECLS + +#endif /* BSON_VERSION_FUNCTIONS_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h new file mode 100644 index 0000000..3c744c3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h @@ -0,0 +1,101 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#ifndef BSON_VERSION_H +#define BSON_VERSION_H + + +/** + * BSON_MAJOR_VERSION: + * + * BSON major version component (e.g. 1 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MAJOR_VERSION (1) + + +/** + * BSON_MINOR_VERSION: + * + * BSON minor version component (e.g. 2 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MINOR_VERSION (13) + + +/** + * BSON_MICRO_VERSION: + * + * BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MICRO_VERSION (1) + + +/** + * BSON_PRERELEASE_VERSION: + * + * BSON prerelease version component (e.g. rc0 if %BSON_VERSION is 1.2.3-rc0) + */ +#define BSON_PRERELEASE_VERSION () + +/** + * BSON_VERSION: + * + * BSON version. + */ +#define BSON_VERSION (1.13.1) + + +/** + * BSON_VERSION_S: + * + * BSON version, encoded as a string, useful for printing and + * concatenation. + */ +#define BSON_VERSION_S "1.13.1" + + +/** + * BSON_VERSION_HEX: + * + * BSON version, encoded as an hexadecimal number, useful for + * integer comparisons. + */ +#define BSON_VERSION_HEX (BSON_MAJOR_VERSION << 24 | \ + BSON_MINOR_VERSION << 16 | \ + BSON_MICRO_VERSION << 8) + + +/** + * BSON_CHECK_VERSION: + * @major: required major version + * @minor: required minor version + * @micro: required micro version + * + * Compile-time version checking. Evaluates to %TRUE if the version + * of BSON is greater than the required one. + */ +#define BSON_CHECK_VERSION(major,minor,micro) \ + (BSON_MAJOR_VERSION > (major) || \ + (BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION > (minor)) || \ + (BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION == (minor) && \ + BSON_MICRO_VERSION >= (micro))) + +#endif /* BSON_VERSION_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h.in b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h.in new file mode 100644 index 0000000..4637412 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-version.h.in @@ -0,0 +1,101 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION) +#error "Only can be included directly." +#endif + + +#ifndef BSON_VERSION_H +#define BSON_VERSION_H + + +/** + * BSON_MAJOR_VERSION: + * + * BSON major version component (e.g. 1 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MAJOR_VERSION (@BSON_MAJOR_VERSION@) + + +/** + * BSON_MINOR_VERSION: + * + * BSON minor version component (e.g. 2 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MINOR_VERSION (@BSON_MINOR_VERSION@) + + +/** + * BSON_MICRO_VERSION: + * + * BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3) + */ +#define BSON_MICRO_VERSION (@BSON_MICRO_VERSION@) + + +/** + * BSON_PRERELEASE_VERSION: + * + * BSON prerelease version component (e.g. rc0 if %BSON_VERSION is 1.2.3-rc0) + */ +#define BSON_PRERELEASE_VERSION (@BSON_PRERELEASE_VERSION@) + +/** + * BSON_VERSION: + * + * BSON version. + */ +#define BSON_VERSION (@BSON_VERSION@) + + +/** + * BSON_VERSION_S: + * + * BSON version, encoded as a string, useful for printing and + * concatenation. + */ +#define BSON_VERSION_S "@BSON_VERSION@" + + +/** + * BSON_VERSION_HEX: + * + * BSON version, encoded as an hexadecimal number, useful for + * integer comparisons. + */ +#define BSON_VERSION_HEX (BSON_MAJOR_VERSION << 24 | \ + BSON_MINOR_VERSION << 16 | \ + BSON_MICRO_VERSION << 8) + + +/** + * BSON_CHECK_VERSION: + * @major: required major version + * @minor: required minor version + * @micro: required micro version + * + * Compile-time version checking. Evaluates to %TRUE if the version + * of BSON is greater than the required one. + */ +#define BSON_CHECK_VERSION(major,minor,micro) \ + (BSON_MAJOR_VERSION > (major) || \ + (BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION > (minor)) || \ + (BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION == (minor) && \ + BSON_MICRO_VERSION >= (micro))) + +#endif /* BSON_VERSION_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.c new file mode 100644 index 0000000..cef849b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.c @@ -0,0 +1,271 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson-private.h" +#include "bson/bson-writer.h" + + +struct _bson_writer_t { + bool ready; + uint8_t **buf; + size_t *buflen; + size_t offset; + bson_realloc_func realloc_func; + void *realloc_func_ctx; + bson_t b; +}; + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_new -- + * + * Creates a new instance of bson_writer_t using the buffer, length, + * offset, and realloc() function supplied. + * + * The caller is expected to clean up the structure when finished + * using bson_writer_destroy(). + * + * Parameters: + * @buf: (inout): A pointer to a target buffer. + * @buflen: (inout): A pointer to the buffer length. + * @offset: The offset in the target buffer to start from. + * @realloc_func: A realloc() style function or NULL. + * + * Returns: + * A newly allocated bson_writer_t that should be freed with + * bson_writer_destroy(). + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bson_writer_t * +bson_writer_new (uint8_t **buf, /* IN */ + size_t *buflen, /* IN */ + size_t offset, /* IN */ + bson_realloc_func realloc_func, /* IN */ + void *realloc_func_ctx) /* IN */ +{ + bson_writer_t *writer; + + writer = bson_malloc0 (sizeof *writer); + writer->buf = buf; + writer->buflen = buflen; + writer->offset = offset; + writer->realloc_func = realloc_func; + writer->realloc_func_ctx = realloc_func_ctx; + writer->ready = true; + + return writer; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_destroy -- + * + * Cleanup after @writer and release any allocated memory. Note that + * the buffer supplied to bson_writer_new() is NOT freed from this + * method. The caller is responsible for that. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_writer_destroy (bson_writer_t *writer) /* IN */ +{ + bson_free (writer); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_get_length -- + * + * Fetches the current length of the content written by the buffer + * (including the initial offset). This includes a partly written + * document currently being written. + * + * This is useful if you want to check to see if you've passed a given + * memory boundary that cannot be sent in a packet. See + * bson_writer_rollback() to abort the current document being written. + * + * Returns: + * The number of bytes written plus initial offset. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +size_t +bson_writer_get_length (bson_writer_t *writer) /* IN */ +{ + return writer->offset + writer->b.len; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_begin -- + * + * Begins writing a new document. The caller may use the bson + * structure to write out a new BSON document. When completed, the + * caller must call either bson_writer_end() or + * bson_writer_rollback(). + * + * Parameters: + * @writer: A bson_writer_t. + * @bson: (out): A location for a bson_t*. + * + * Returns: + * true if the underlying realloc was successful; otherwise false. + * + * Side effects: + * @bson is initialized if true is returned. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_writer_begin (bson_writer_t *writer, /* IN */ + bson_t **bson) /* OUT */ +{ + bson_impl_alloc_t *b; + bool grown = false; + + BSON_ASSERT (writer); + BSON_ASSERT (writer->ready); + BSON_ASSERT (bson); + + writer->ready = false; + + memset (&writer->b, 0, sizeof (bson_t)); + + b = (bson_impl_alloc_t *) &writer->b; + b->flags = BSON_FLAG_STATIC | BSON_FLAG_NO_FREE; + b->len = 5; + b->parent = NULL; + b->buf = writer->buf; + b->buflen = writer->buflen; + b->offset = writer->offset; + b->alloc = NULL; + b->alloclen = 0; + b->realloc = writer->realloc_func; + b->realloc_func_ctx = writer->realloc_func_ctx; + + while ((writer->offset + writer->b.len) > *writer->buflen) { + if (!writer->realloc_func) { + memset (&writer->b, 0, sizeof (bson_t)); + writer->ready = true; + return false; + } + grown = true; + + if (!*writer->buflen) { + *writer->buflen = 64; + } else { + (*writer->buflen) *= 2; + } + } + + if (grown) { + *writer->buf = writer->realloc_func ( + *writer->buf, *writer->buflen, writer->realloc_func_ctx); + } + + memset ((*writer->buf) + writer->offset + 1, 0, 5); + (*writer->buf)[writer->offset] = 5; + + *bson = &writer->b; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_end -- + * + * Complete writing of a bson_writer_t to the buffer supplied. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_writer_end (bson_writer_t *writer) /* IN */ +{ + BSON_ASSERT (writer); + BSON_ASSERT (!writer->ready); + + writer->offset += writer->b.len; + memset (&writer->b, 0, sizeof (bson_t)); + writer->ready = true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_writer_rollback -- + * + * Abort the appending of the current bson_t to the memory region + * managed by @writer. This is useful if you detected that you went + * past a particular memory limit. For example, MongoDB has 48MB + * message limits. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +void +bson_writer_rollback (bson_writer_t *writer) /* IN */ +{ + BSON_ASSERT (writer); + + if (writer->b.len) { + memset (&writer->b, 0, sizeof (bson_t)); + } + + writer->ready = true; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.h new file mode 100644 index 0000000..9719c0c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson-writer.h @@ -0,0 +1,63 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_WRITER_H +#define BSON_WRITER_H + + +#include "bson/bson.h" + + +BSON_BEGIN_DECLS + + +/** + * bson_writer_t: + * + * The bson_writer_t structure is a helper for writing a series of BSON + * documents to a single malloc() buffer. You can provide a realloc() style + * function to grow the buffer as you go. + * + * This is useful if you want to build a series of BSON documents right into + * the target buffer for an outgoing packet. The offset parameter allows you to + * start at an offset of the target buffer. + */ +typedef struct _bson_writer_t bson_writer_t; + + +BSON_EXPORT (bson_writer_t *) +bson_writer_new (uint8_t **buf, + size_t *buflen, + size_t offset, + bson_realloc_func realloc_func, + void *realloc_func_ctx); +BSON_EXPORT (void) +bson_writer_destroy (bson_writer_t *writer); +BSON_EXPORT (size_t) +bson_writer_get_length (bson_writer_t *writer); +BSON_EXPORT (bool) +bson_writer_begin (bson_writer_t *writer, bson_t **bson); +BSON_EXPORT (void) +bson_writer_end (bson_writer_t *writer); +BSON_EXPORT (void) +bson_writer_rollback (bson_writer_t *writer); + + +BSON_END_DECLS + + +#endif /* BSON_WRITER_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.c new file mode 100644 index 0000000..59aee48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.c @@ -0,0 +1,3513 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "bson/bson.h" +#include "bson/bson-config.h" +#include "bson/bson-private.h" +#include "bson/bson-string.h" +#include "bson/bson-iso8601-private.h" + +#include "common-b64-private.h" + +#include +#include + + +#ifndef BSON_MAX_RECURSION +#define BSON_MAX_RECURSION 200 +#endif + + +typedef enum { + BSON_VALIDATE_PHASE_START, + BSON_VALIDATE_PHASE_TOP, + BSON_VALIDATE_PHASE_LF_REF_KEY, + BSON_VALIDATE_PHASE_LF_REF_UTF8, + BSON_VALIDATE_PHASE_LF_ID_KEY, + BSON_VALIDATE_PHASE_LF_DB_KEY, + BSON_VALIDATE_PHASE_LF_DB_UTF8, + BSON_VALIDATE_PHASE_NOT_DBREF, +} bson_validate_phase_t; + + +typedef enum { + BSON_JSON_MODE_LEGACY, + BSON_JSON_MODE_CANONICAL, + BSON_JSON_MODE_RELAXED, +} bson_json_mode_t; + + +/* + * Structures. + */ +typedef struct { + bson_validate_flags_t flags; + ssize_t err_offset; + bson_validate_phase_t phase; + bson_error_t error; +} bson_validate_state_t; + + +typedef struct { + uint32_t count; + bool keys; + ssize_t *err_offset; + uint32_t depth; + bson_string_t *str; + bson_json_mode_t mode; +} bson_json_state_t; + + +/* + * Forward declarations. + */ +static bool +_bson_as_json_visit_array (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data); +static bool +_bson_as_json_visit_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); +static char * +_bson_as_json_visit_all (const bson_t *bson, + size_t *length, + bson_json_mode_t mode); + +/* + * Globals. + */ +static const uint8_t gZero; + +/* + *-------------------------------------------------------------------------- + * + * _bson_impl_inline_grow -- + * + * Document growth implementation for documents that currently + * contain stack based buffers. The document may be switched to + * a malloc based buffer. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_impl_inline_grow (bson_impl_inline_t *impl, /* IN */ + size_t size) /* IN */ +{ + bson_impl_alloc_t *alloc = (bson_impl_alloc_t *) impl; + uint8_t *data; + size_t req; + + if (((size_t) impl->len + size) <= sizeof impl->data) { + return true; + } + + req = bson_next_power_of_two (impl->len + size); + + if (req <= INT32_MAX) { + data = bson_malloc (req); + + memcpy (data, impl->data, impl->len); +#ifdef BSON_MEMCHECK + bson_free (impl->canary); +#endif + alloc->flags &= ~BSON_FLAG_INLINE; + alloc->parent = NULL; + alloc->depth = 0; + alloc->buf = &alloc->alloc; + alloc->buflen = &alloc->alloclen; + alloc->offset = 0; + alloc->alloc = data; + alloc->alloclen = req; + alloc->realloc = bson_realloc_ctx; + alloc->realloc_func_ctx = NULL; + + return true; + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_impl_alloc_grow -- + * + * Document growth implementation for documents containing malloc + * based buffers. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_impl_alloc_grow (bson_impl_alloc_t *impl, /* IN */ + size_t size) /* IN */ +{ + size_t req; + + /* + * Determine how many bytes we need for this document in the buffer + * including necessary trailing bytes for parent documents. + */ + req = (impl->offset + impl->len + size + impl->depth); + + if (req <= *impl->buflen) { + return true; + } + + req = bson_next_power_of_two (req); + + if ((req <= INT32_MAX) && impl->realloc) { + *impl->buf = impl->realloc (*impl->buf, req, impl->realloc_func_ctx); + *impl->buflen = req; + return true; + } + + return false; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_grow -- + * + * Grows the bson_t structure to be large enough to contain @size + * bytes. + * + * Returns: + * true if successful, false if the size would overflow. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_grow (bson_t *bson, /* IN */ + uint32_t size) /* IN */ +{ + if ((bson->flags & BSON_FLAG_INLINE)) { + return _bson_impl_inline_grow ((bson_impl_inline_t *) bson, size); + } + + return _bson_impl_alloc_grow ((bson_impl_alloc_t *) bson, size); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_data -- + * + * A helper function to return the contents of the bson document + * taking into account the polymorphic nature of bson_t. + * + * Returns: + * A buffer which should not be modified or freed. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE uint8_t * +_bson_data (const bson_t *bson) /* IN */ +{ + if ((bson->flags & BSON_FLAG_INLINE)) { + return ((bson_impl_inline_t *) bson)->data; + } else { + bson_impl_alloc_t *impl = (bson_impl_alloc_t *) bson; + return (*impl->buf) + impl->offset; + } +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_encode_length -- + * + * Helper to encode the length of the bson_t in the first 4 bytes + * of the bson document. Little endian format is used as specified + * by bsonspec. + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE void +_bson_encode_length (bson_t *bson) /* IN */ +{ +#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN + memcpy (_bson_data (bson), &bson->len, sizeof (bson->len)); +#else + uint32_t length_le = BSON_UINT32_TO_LE (bson->len); + memcpy (_bson_data (bson), &length_le, sizeof (length_le)); +#endif +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_append_va -- + * + * Appends the length,buffer pairs to the bson_t. @n_bytes is an + * optimization to perform one array growth rather than many small + * growths. + * + * @bson: A bson_t + * @n_bytes: The number of bytes to append to the document. + * @n_pairs: The number of length,buffer pairs. + * @first_len: Length of first buffer. + * @first_data: First buffer. + * @args: va_list of additional tuples. + * + * Returns: + * true if the bytes were appended successfully. + * false if it bson would overflow INT_MAX. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE bool +_bson_append_va (bson_t *bson, /* IN */ + uint32_t n_bytes, /* IN */ + uint32_t n_pairs, /* IN */ + uint32_t first_len, /* IN */ + const uint8_t *first_data, /* IN */ + va_list args) /* IN */ +{ + const uint8_t *data; + uint32_t data_len; + uint8_t *buf; + + BSON_ASSERT (!(bson->flags & BSON_FLAG_IN_CHILD)); + BSON_ASSERT (!(bson->flags & BSON_FLAG_RDONLY)); + + if (BSON_UNLIKELY (!_bson_grow (bson, n_bytes))) { + return false; + } + + data = first_data; + data_len = first_len; + + buf = _bson_data (bson) + bson->len - 1; + + do { + n_pairs--; + memcpy (buf, data, data_len); + bson->len += data_len; + buf += data_len; + + if (n_pairs) { + data_len = va_arg (args, uint32_t); + data = va_arg (args, const uint8_t *); + } + } while (n_pairs); + + _bson_encode_length (bson); + + *buf = '\0'; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_append -- + * + * Variadic function to append length,buffer pairs to a bson_t. If the + * append would cause the bson_t to overflow a 32-bit length, it will + * return false and no append will have occurred. + * + * Parameters: + * @bson: A bson_t. + * @n_pairs: Number of length,buffer pairs. + * @n_bytes: the total number of bytes being appended. + * @first_len: Length of first buffer. + * @first_data: First buffer. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_append (bson_t *bson, /* IN */ + uint32_t n_pairs, /* IN */ + uint32_t n_bytes, /* IN */ + uint32_t first_len, /* IN */ + const uint8_t *first_data, /* IN */ + ...) +{ + va_list args; + bool ok; + + BSON_ASSERT (n_pairs); + BSON_ASSERT (first_len); + BSON_ASSERT (first_data); + + /* + * Check to see if this append would overflow 32-bit signed integer. I know + * what you're thinking. BSON uses a signed 32-bit length field? Yeah. It + * does. + */ + if (BSON_UNLIKELY (n_bytes > (BSON_MAX_SIZE - bson->len))) { + return false; + } + + va_start (args, first_data); + ok = _bson_append_va (bson, n_bytes, n_pairs, first_len, first_data, args); + va_end (args); + + return ok; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_append_bson_begin -- + * + * Begin appending a subdocument or subarray to the document using + * the key provided by @key. + * + * If @key_length is < 0, then strlen() will be called on @key + * to determine the length. + * + * @key_type MUST be either BSON_TYPE_DOCUMENT or BSON_TYPE_ARRAY. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * @child is initialized if true is returned. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_append_bson_begin (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + bson_type_t child_type, /* IN */ + bson_t *child) /* OUT */ +{ + const uint8_t type = child_type; + const uint8_t empty[5] = {5}; + bson_impl_alloc_t *aparent = (bson_impl_alloc_t *) bson; + bson_impl_alloc_t *achild = (bson_impl_alloc_t *) child; + + BSON_ASSERT (!(bson->flags & BSON_FLAG_RDONLY)); + BSON_ASSERT (!(bson->flags & BSON_FLAG_IN_CHILD)); + BSON_ASSERT (key); + BSON_ASSERT ((child_type == BSON_TYPE_DOCUMENT) || + (child_type == BSON_TYPE_ARRAY)); + BSON_ASSERT (child); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + /* + * If the parent is an inline bson_t, then we need to convert + * it to a heap allocated buffer. This makes extending buffers + * of child bson documents much simpler logic, as they can just + * realloc the *buf pointer. + */ + if ((bson->flags & BSON_FLAG_INLINE)) { + BSON_ASSERT (bson->len <= 120); + if (!_bson_grow (bson, 128 - bson->len)) { + return false; + } + BSON_ASSERT (!(bson->flags & BSON_FLAG_INLINE)); + } + + /* + * Append the type and key for the field. + */ + if (!_bson_append (bson, + 4, + (1 + key_length + 1 + 5), + 1, + &type, + key_length, + key, + 1, + &gZero, + 5, + empty)) { + return false; + } + + /* + * Mark the document as working on a child document so that no + * further modifications can happen until the caller has called + * bson_append_{document,array}_end(). + */ + bson->flags |= BSON_FLAG_IN_CHILD; + + /* + * Initialize the child bson_t structure and point it at the parents + * buffers. This allows us to realloc directly from the child without + * walking up to the parent bson_t. + */ + achild->flags = (BSON_FLAG_CHILD | BSON_FLAG_NO_FREE | BSON_FLAG_STATIC); + + if ((bson->flags & BSON_FLAG_CHILD)) { + achild->depth = ((bson_impl_alloc_t *) bson)->depth + 1; + } else { + achild->depth = 1; + } + + achild->parent = bson; + achild->buf = aparent->buf; + achild->buflen = aparent->buflen; + achild->offset = aparent->offset + aparent->len - 1 - 5; + achild->len = 5; + achild->alloc = NULL; + achild->alloclen = 0; + achild->realloc = aparent->realloc; + achild->realloc_func_ctx = aparent->realloc_func_ctx; + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_append_bson_end -- + * + * Complete a call to _bson_append_bson_begin. + * + * Returns: + * true if successful. + * + * Side effects: + * @child is destroyed and no longer valid after calling this + * function. + * + *-------------------------------------------------------------------------- + */ + +static bool +_bson_append_bson_end (bson_t *bson, /* IN */ + bson_t *child) /* IN */ +{ + BSON_ASSERT (bson); + BSON_ASSERT ((bson->flags & BSON_FLAG_IN_CHILD)); + BSON_ASSERT (!(child->flags & BSON_FLAG_IN_CHILD)); + + /* + * Unmark the IN_CHILD flag. + */ + bson->flags &= ~BSON_FLAG_IN_CHILD; + + /* + * Now that we are done building the sub-document, add the size to the + * parent, not including the default 5 byte empty document already added. + */ + bson->len = (bson->len + child->len - 5); + + /* + * Ensure we have a \0 byte at the end and proper length encoded at + * the beginning of the document. + */ + _bson_data (bson)[bson->len - 1] = '\0'; + _bson_encode_length (bson); + + return true; +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_array_begin -- + * + * Start appending a new array. + * + * Use @child to append to the data area for the given field. + * + * It is a programming error to call any other bson function on + * @bson until bson_append_array_end() has been called. It is + * valid to call bson_append*() functions on @child. + * + * This function is useful to allow building nested documents using + * a single buffer owned by the top-level bson document. + * + * Returns: + * true if successful; otherwise false and @child is invalid. + * + * Side effects: + * @child is initialized if true is returned. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_array_begin (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + bson_t *child) /* IN */ +{ + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (child); + + return _bson_append_bson_begin ( + bson, key, key_length, BSON_TYPE_ARRAY, child); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_array_end -- + * + * Complete a call to bson_append_array_begin(). + * + * It is safe to append other fields to @bson after calling this + * function. + * + * Returns: + * true if successful. + * + * Side effects: + * @child is invalid after calling this function. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_array_end (bson_t *bson, /* IN */ + bson_t *child) /* IN */ +{ + BSON_ASSERT (bson); + BSON_ASSERT (child); + + return _bson_append_bson_end (bson, child); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_document_begin -- + * + * Start appending a new document. + * + * Use @child to append to the data area for the given field. + * + * It is a programming error to call any other bson function on + * @bson until bson_append_document_end() has been called. It is + * valid to call bson_append*() functions on @child. + * + * This function is useful to allow building nested documents using + * a single buffer owned by the top-level bson document. + * + * Returns: + * true if successful; otherwise false and @child is invalid. + * + * Side effects: + * @child is initialized if true is returned. + * + *-------------------------------------------------------------------------- + */ +bool +bson_append_document_begin (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + bson_t *child) /* IN */ +{ + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (child); + + return _bson_append_bson_begin ( + bson, key, key_length, BSON_TYPE_DOCUMENT, child); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_document_end -- + * + * Complete a call to bson_append_document_begin(). + * + * It is safe to append new fields to @bson after calling this + * function, if true is returned. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * @child is destroyed and invalid after calling this function. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_document_end (bson_t *bson, /* IN */ + bson_t *child) /* IN */ +{ + BSON_ASSERT (bson); + BSON_ASSERT (child); + + return _bson_append_bson_end (bson, child); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_array -- + * + * Append an array to @bson. + * + * Generally, bson_append_array_begin() will result in faster code + * since few buffers need to be malloced. + * + * Returns: + * true if successful; otherwise false indicating INT_MAX overflow. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_array (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + const bson_t *array) /* IN */ +{ + static const uint8_t type = BSON_TYPE_ARRAY; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (array); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + /* + * Let's be a bit pedantic and ensure the array has properly formatted key + * names. We will verify this simply by checking the first element for "0" + * if the array is non-empty. + */ + if (array && !bson_empty (array)) { + bson_iter_t iter; + + if (bson_iter_init (&iter, array) && bson_iter_next (&iter)) { + if (0 != strcmp ("0", bson_iter_key (&iter))) { + fprintf (stderr, + "%s(): invalid array detected. first element of array " + "parameter is not \"0\".\n", + BSON_FUNC); + } + } + } + + return _bson_append (bson, + 4, + (1 + key_length + 1 + array->len), + 1, + &type, + key_length, + key, + 1, + &gZero, + array->len, + _bson_data (array)); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_binary -- + * + * Append binary data to @bson. The field will have the + * BSON_TYPE_BINARY type. + * + * Parameters: + * @subtype: the BSON Binary Subtype. See bsonspec.org for more + * information. + * @binary: a pointer to the raw binary data. + * @length: the size of @binary in bytes. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_binary (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + bson_subtype_t subtype, /* IN */ + const uint8_t *binary, /* IN */ + uint32_t length) /* IN */ +{ + static const uint8_t type = BSON_TYPE_BINARY; + uint32_t length_le; + uint32_t deprecated_length_le; + uint8_t subtype8 = 0; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (binary); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + subtype8 = subtype; + + if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) { + length_le = BSON_UINT32_TO_LE (length + 4); + deprecated_length_le = BSON_UINT32_TO_LE (length); + + return _bson_append (bson, + 7, + (1 + key_length + 1 + 4 + 1 + 4 + length), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + 1, + &subtype8, + 4, + &deprecated_length_le, + length, + binary); + } else { + length_le = BSON_UINT32_TO_LE (length); + + return _bson_append (bson, + 6, + (1 + key_length + 1 + 4 + 1 + length), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + 1, + &subtype8, + length, + binary); + } +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_bool -- + * + * Append a new field to @bson with the name @key. The value is + * a boolean indicated by @value. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_bool (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + bool value) /* IN */ +{ + static const uint8_t type = BSON_TYPE_BOOL; + uint8_t abyte = !!value; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 1), + 1, + &type, + key_length, + key, + 1, + &gZero, + 1, + &abyte); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_code -- + * + * Append a new field to @bson containing javascript code. + * + * @javascript MUST be a zero terminated UTF-8 string. It MUST NOT + * containing embedded \0 characters. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + * See also: + * bson_append_code_with_scope(). + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_code (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + const char *javascript) /* IN */ +{ + static const uint8_t type = BSON_TYPE_CODE; + uint32_t length; + uint32_t length_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (javascript); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + length = (int) strlen (javascript) + 1; + length_le = BSON_UINT32_TO_LE (length); + + return _bson_append (bson, + 5, + (1 + key_length + 1 + 4 + length), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + length, + javascript); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_code_with_scope -- + * + * Append a new field to @bson containing javascript code with + * supplied scope. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_code_with_scope (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + const char *javascript, /* IN */ + const bson_t *scope) /* IN */ +{ + static const uint8_t type = BSON_TYPE_CODEWSCOPE; + uint32_t codews_length_le; + uint32_t codews_length; + uint32_t js_length_le; + uint32_t js_length; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (javascript); + + if (scope == NULL) { + return bson_append_code (bson, key, key_length, javascript); + } + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + js_length = (int) strlen (javascript) + 1; + js_length_le = BSON_UINT32_TO_LE (js_length); + + codews_length = 4 + 4 + js_length + scope->len; + codews_length_le = BSON_UINT32_TO_LE (codews_length); + + return _bson_append (bson, + 7, + (1 + key_length + 1 + 4 + 4 + js_length + scope->len), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &codews_length_le, + 4, + &js_length_le, + js_length, + javascript, + scope->len, + _bson_data (scope)); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_dbpointer -- + * + * This BSON data type is DEPRECATED. + * + * Append a BSON dbpointer field to @bson. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_dbpointer (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + const char *collection, /* IN */ + const bson_oid_t *oid) +{ + static const uint8_t type = BSON_TYPE_DBPOINTER; + uint32_t length; + uint32_t length_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (collection); + BSON_ASSERT (oid); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + length = (int) strlen (collection) + 1; + length_le = BSON_UINT32_TO_LE (length); + + return _bson_append (bson, + 6, + (1 + key_length + 1 + 4 + length + 12), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + length, + collection, + 12, + oid); +} + + +/* + *-------------------------------------------------------------------------- + * + * bson_append_document -- + * + * Append a new field to @bson containing a BSON document. + * + * In general, using bson_append_document_begin() results in faster + * code and less memory fragmentation. + * + * Returns: + * true if successful; otherwise false. + * + * Side effects: + * None. + * + * See also: + * bson_append_document_begin(). + * + *-------------------------------------------------------------------------- + */ + +bool +bson_append_document (bson_t *bson, /* IN */ + const char *key, /* IN */ + int key_length, /* IN */ + const bson_t *value) /* IN */ +{ + static const uint8_t type = BSON_TYPE_DOCUMENT; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (value); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append (bson, + 4, + (1 + key_length + 1 + value->len), + 1, + &type, + key_length, + key, + 1, + &gZero, + value->len, + _bson_data (value)); +} + + +bool +bson_append_double (bson_t *bson, const char *key, int key_length, double value) +{ + static const uint8_t type = BSON_TYPE_DOUBLE; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + +#if BSON_BYTE_ORDER == BSON_BIG_ENDIAN + value = BSON_DOUBLE_TO_LE (value); +#endif + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 8), + 1, + &type, + key_length, + key, + 1, + &gZero, + 8, + &value); +} + + +bool +bson_append_int32 (bson_t *bson, const char *key, int key_length, int32_t value) +{ + static const uint8_t type = BSON_TYPE_INT32; + uint32_t value_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + value_le = BSON_UINT32_TO_LE (value); + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 4), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &value_le); +} + + +bool +bson_append_int64 (bson_t *bson, const char *key, int key_length, int64_t value) +{ + static const uint8_t type = BSON_TYPE_INT64; + uint64_t value_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + value_le = BSON_UINT64_TO_LE (value); + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 8), + 1, + &type, + key_length, + key, + 1, + &gZero, + 8, + &value_le); +} + + +bool +bson_append_decimal128 (bson_t *bson, + const char *key, + int key_length, + const bson_decimal128_t *value) +{ + static const uint8_t type = BSON_TYPE_DECIMAL128; + uint64_t value_le[2]; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (value); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + value_le[0] = BSON_UINT64_TO_LE (value->low); + value_le[1] = BSON_UINT64_TO_LE (value->high); + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 16), + 1, + &type, + key_length, + key, + 1, + &gZero, + 16, + value_le); +} + + +bool +bson_append_iter (bson_t *bson, + const char *key, + int key_length, + const bson_iter_t *iter) +{ + bool ret = false; + + BSON_ASSERT (bson); + BSON_ASSERT (iter); + + if (!key) { + key = bson_iter_key (iter); + key_length = -1; + } + + switch (bson_iter_type_unsafe (iter)) { + case BSON_TYPE_EOD: + return false; + case BSON_TYPE_DOUBLE: + ret = bson_append_double (bson, key, key_length, bson_iter_double (iter)); + break; + case BSON_TYPE_UTF8: { + uint32_t len = 0; + const char *str; + + str = bson_iter_utf8 (iter, &len); + ret = bson_append_utf8 (bson, key, key_length, str, len); + } break; + case BSON_TYPE_DOCUMENT: { + const uint8_t *buf = NULL; + uint32_t len = 0; + bson_t doc; + + bson_iter_document (iter, &len, &buf); + + if (bson_init_static (&doc, buf, len)) { + ret = bson_append_document (bson, key, key_length, &doc); + bson_destroy (&doc); + } + } break; + case BSON_TYPE_ARRAY: { + const uint8_t *buf = NULL; + uint32_t len = 0; + bson_t doc; + + bson_iter_array (iter, &len, &buf); + + if (bson_init_static (&doc, buf, len)) { + ret = bson_append_array (bson, key, key_length, &doc); + bson_destroy (&doc); + } + } break; + case BSON_TYPE_BINARY: { + const uint8_t *binary = NULL; + bson_subtype_t subtype = BSON_SUBTYPE_BINARY; + uint32_t len = 0; + + bson_iter_binary (iter, &subtype, &len, &binary); + ret = bson_append_binary (bson, key, key_length, subtype, binary, len); + } break; + case BSON_TYPE_UNDEFINED: + ret = bson_append_undefined (bson, key, key_length); + break; + case BSON_TYPE_OID: + ret = bson_append_oid (bson, key, key_length, bson_iter_oid (iter)); + break; + case BSON_TYPE_BOOL: + ret = bson_append_bool (bson, key, key_length, bson_iter_bool (iter)); + break; + case BSON_TYPE_DATE_TIME: + ret = bson_append_date_time ( + bson, key, key_length, bson_iter_date_time (iter)); + break; + case BSON_TYPE_NULL: + ret = bson_append_null (bson, key, key_length); + break; + case BSON_TYPE_REGEX: { + const char *regex; + const char *options; + + regex = bson_iter_regex (iter, &options); + ret = bson_append_regex (bson, key, key_length, regex, options); + } break; + case BSON_TYPE_DBPOINTER: { + const bson_oid_t *oid; + uint32_t len; + const char *collection; + + bson_iter_dbpointer (iter, &len, &collection, &oid); + ret = bson_append_dbpointer (bson, key, key_length, collection, oid); + } break; + case BSON_TYPE_CODE: { + uint32_t len; + const char *code; + + code = bson_iter_code (iter, &len); + ret = bson_append_code (bson, key, key_length, code); + } break; + case BSON_TYPE_SYMBOL: { + uint32_t len; + const char *symbol; + + symbol = bson_iter_symbol (iter, &len); + ret = bson_append_symbol (bson, key, key_length, symbol, len); + } break; + case BSON_TYPE_CODEWSCOPE: { + const uint8_t *scope = NULL; + uint32_t scope_len = 0; + uint32_t len = 0; + const char *javascript = NULL; + bson_t doc; + + javascript = bson_iter_codewscope (iter, &len, &scope_len, &scope); + + if (bson_init_static (&doc, scope, scope_len)) { + ret = bson_append_code_with_scope ( + bson, key, key_length, javascript, &doc); + bson_destroy (&doc); + } + } break; + case BSON_TYPE_INT32: + ret = bson_append_int32 (bson, key, key_length, bson_iter_int32 (iter)); + break; + case BSON_TYPE_TIMESTAMP: { + uint32_t ts; + uint32_t inc; + + bson_iter_timestamp (iter, &ts, &inc); + ret = bson_append_timestamp (bson, key, key_length, ts, inc); + } break; + case BSON_TYPE_INT64: + ret = bson_append_int64 (bson, key, key_length, bson_iter_int64 (iter)); + break; + case BSON_TYPE_DECIMAL128: { + bson_decimal128_t dec; + + if (!bson_iter_decimal128 (iter, &dec)) { + return false; + } + + ret = bson_append_decimal128 (bson, key, key_length, &dec); + } break; + case BSON_TYPE_MAXKEY: + ret = bson_append_maxkey (bson, key, key_length); + break; + case BSON_TYPE_MINKEY: + ret = bson_append_minkey (bson, key, key_length); + break; + default: + break; + } + + return ret; +} + + +bool +bson_append_maxkey (bson_t *bson, const char *key, int key_length) +{ + static const uint8_t type = BSON_TYPE_MAXKEY; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append ( + bson, 3, (1 + key_length + 1), 1, &type, key_length, key, 1, &gZero); +} + + +bool +bson_append_minkey (bson_t *bson, const char *key, int key_length) +{ + static const uint8_t type = BSON_TYPE_MINKEY; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append ( + bson, 3, (1 + key_length + 1), 1, &type, key_length, key, 1, &gZero); +} + + +bool +bson_append_null (bson_t *bson, const char *key, int key_length) +{ + static const uint8_t type = BSON_TYPE_NULL; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append ( + bson, 3, (1 + key_length + 1), 1, &type, key_length, key, 1, &gZero); +} + + +bool +bson_append_oid (bson_t *bson, + const char *key, + int key_length, + const bson_oid_t *value) +{ + static const uint8_t type = BSON_TYPE_OID; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (value); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 12), + 1, + &type, + key_length, + key, + 1, + &gZero, + 12, + value); +} + + +/* + *-------------------------------------------------------------------------- + * + * _bson_append_regex_options_sorted -- + * + * Helper to append regex options to a buffer in a sorted order. + * Any duplicate or unsupported options will be ignored. + * + * Parameters: + * @buffer: Buffer to which sorted options will be appended + * @options: Regex options + * + * Returns: + * None. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +static BSON_INLINE void +_bson_append_regex_options_sorted (bson_string_t *buffer, /* IN */ + const char *options) /* IN */ +{ + const char *c; + + for (c = BSON_REGEX_OPTIONS_SORTED; *c; c++) { + if (strchr (options, *c)) { + bson_string_append_c (buffer, *c); + } + } +} + + +bool +bson_append_regex (bson_t *bson, + const char *key, + int key_length, + const char *regex, + const char *options) +{ + return bson_append_regex_w_len (bson, key, key_length, regex, -1, options); +} + + +bool +bson_append_regex_w_len (bson_t *bson, + const char *key, + int key_length, + const char *regex, + int regex_length, + const char *options) +{ + static const uint8_t type = BSON_TYPE_REGEX; + bson_string_t *options_sorted; + bool r; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + if (regex_length < 0) { + regex_length = (int) strlen (regex); + } + + if (!regex) { + regex = ""; + } + + if (!options) { + options = ""; + } + + options_sorted = bson_string_new (NULL); + + _bson_append_regex_options_sorted (options_sorted, options); + + r = _bson_append ( + bson, + 6, + (1 + key_length + 1 + regex_length + 1 + options_sorted->len + 1), + 1, + &type, + key_length, + key, + 1, + &gZero, + regex_length, + regex, + 1, + &gZero, + options_sorted->len + 1, + options_sorted->str); + + bson_string_free (options_sorted, true); + + return r; +} + + +bool +bson_append_utf8 ( + bson_t *bson, const char *key, int key_length, const char *value, int length) +{ + static const uint8_t type = BSON_TYPE_UTF8; + uint32_t length_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (BSON_UNLIKELY (!value)) { + return bson_append_null (bson, key, key_length); + } + + if (BSON_UNLIKELY (key_length < 0)) { + key_length = (int) strlen (key); + } + + if (BSON_UNLIKELY (length < 0)) { + length = (int) strlen (value); + } + + length_le = BSON_UINT32_TO_LE (length + 1); + + return _bson_append (bson, + 6, + (1 + key_length + 1 + 4 + length + 1), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + length, + value, + 1, + &gZero); +} + + +bool +bson_append_symbol ( + bson_t *bson, const char *key, int key_length, const char *value, int length) +{ + static const uint8_t type = BSON_TYPE_SYMBOL; + uint32_t length_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (!value) { + return bson_append_null (bson, key, key_length); + } + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + if (length < 0) { + length = (int) strlen (value); + } + + length_le = BSON_UINT32_TO_LE (length + 1); + + return _bson_append (bson, + 6, + (1 + key_length + 1 + 4 + length + 1), + 1, + &type, + key_length, + key, + 1, + &gZero, + 4, + &length_le, + length, + value, + 1, + &gZero); +} + + +bool +bson_append_time_t (bson_t *bson, const char *key, int key_length, time_t value) +{ +#ifdef BSON_OS_WIN32 + struct timeval tv = {(long) value, 0}; +#else + struct timeval tv = {value, 0}; +#endif + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + return bson_append_timeval (bson, key, key_length, &tv); +} + + +bool +bson_append_timestamp (bson_t *bson, + const char *key, + int key_length, + uint32_t timestamp, + uint32_t increment) +{ + static const uint8_t type = BSON_TYPE_TIMESTAMP; + uint64_t value; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + value = ((((uint64_t) timestamp) << 32) | ((uint64_t) increment)); + value = BSON_UINT64_TO_LE (value); + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 8), + 1, + &type, + key_length, + key, + 1, + &gZero, + 8, + &value); +} + + +bool +bson_append_now_utc (bson_t *bson, const char *key, int key_length) +{ + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (key_length >= -1); + + return bson_append_time_t (bson, key, key_length, time (NULL)); +} + + +bool +bson_append_date_time (bson_t *bson, + const char *key, + int key_length, + int64_t value) +{ + static const uint8_t type = BSON_TYPE_DATE_TIME; + uint64_t value_le; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + value_le = BSON_UINT64_TO_LE (value); + + return _bson_append (bson, + 4, + (1 + key_length + 1 + 8), + 1, + &type, + key_length, + key, + 1, + &gZero, + 8, + &value_le); +} + + +bool +bson_append_timeval (bson_t *bson, + const char *key, + int key_length, + struct timeval *value) +{ + uint64_t unix_msec; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (value); + + unix_msec = + (((uint64_t) value->tv_sec) * 1000UL) + (value->tv_usec / 1000UL); + return bson_append_date_time (bson, key, key_length, unix_msec); +} + + +bool +bson_append_undefined (bson_t *bson, const char *key, int key_length) +{ + static const uint8_t type = BSON_TYPE_UNDEFINED; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (key_length < 0) { + key_length = (int) strlen (key); + } + + return _bson_append ( + bson, 3, (1 + key_length + 1), 1, &type, key_length, key, 1, &gZero); +} + + +bool +bson_append_value (bson_t *bson, + const char *key, + int key_length, + const bson_value_t *value) +{ + bson_t local; + bool ret = false; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + BSON_ASSERT (value); + + switch (value->value_type) { + case BSON_TYPE_DOUBLE: + ret = bson_append_double (bson, key, key_length, value->value.v_double); + break; + case BSON_TYPE_UTF8: + ret = bson_append_utf8 (bson, + key, + key_length, + value->value.v_utf8.str, + value->value.v_utf8.len); + break; + case BSON_TYPE_DOCUMENT: + if (bson_init_static ( + &local, value->value.v_doc.data, value->value.v_doc.data_len)) { + ret = bson_append_document (bson, key, key_length, &local); + bson_destroy (&local); + } + break; + case BSON_TYPE_ARRAY: + if (bson_init_static ( + &local, value->value.v_doc.data, value->value.v_doc.data_len)) { + ret = bson_append_array (bson, key, key_length, &local); + bson_destroy (&local); + } + break; + case BSON_TYPE_BINARY: + ret = bson_append_binary (bson, + key, + key_length, + value->value.v_binary.subtype, + value->value.v_binary.data, + value->value.v_binary.data_len); + break; + case BSON_TYPE_UNDEFINED: + ret = bson_append_undefined (bson, key, key_length); + break; + case BSON_TYPE_OID: + ret = bson_append_oid (bson, key, key_length, &value->value.v_oid); + break; + case BSON_TYPE_BOOL: + ret = bson_append_bool (bson, key, key_length, value->value.v_bool); + break; + case BSON_TYPE_DATE_TIME: + ret = + bson_append_date_time (bson, key, key_length, value->value.v_datetime); + break; + case BSON_TYPE_NULL: + ret = bson_append_null (bson, key, key_length); + break; + case BSON_TYPE_REGEX: + ret = bson_append_regex (bson, + key, + key_length, + value->value.v_regex.regex, + value->value.v_regex.options); + break; + case BSON_TYPE_DBPOINTER: + ret = bson_append_dbpointer (bson, + key, + key_length, + value->value.v_dbpointer.collection, + &value->value.v_dbpointer.oid); + break; + case BSON_TYPE_CODE: + ret = bson_append_code (bson, key, key_length, value->value.v_code.code); + break; + case BSON_TYPE_SYMBOL: + ret = bson_append_symbol (bson, + key, + key_length, + value->value.v_symbol.symbol, + value->value.v_symbol.len); + break; + case BSON_TYPE_CODEWSCOPE: + if (bson_init_static (&local, + value->value.v_codewscope.scope_data, + value->value.v_codewscope.scope_len)) { + ret = bson_append_code_with_scope ( + bson, key, key_length, value->value.v_codewscope.code, &local); + bson_destroy (&local); + } + break; + case BSON_TYPE_INT32: + ret = bson_append_int32 (bson, key, key_length, value->value.v_int32); + break; + case BSON_TYPE_TIMESTAMP: + ret = bson_append_timestamp (bson, + key, + key_length, + value->value.v_timestamp.timestamp, + value->value.v_timestamp.increment); + break; + case BSON_TYPE_INT64: + ret = bson_append_int64 (bson, key, key_length, value->value.v_int64); + break; + case BSON_TYPE_DECIMAL128: + ret = bson_append_decimal128 ( + bson, key, key_length, &(value->value.v_decimal128)); + break; + case BSON_TYPE_MAXKEY: + ret = bson_append_maxkey (bson, key, key_length); + break; + case BSON_TYPE_MINKEY: + ret = bson_append_minkey (bson, key, key_length); + break; + case BSON_TYPE_EOD: + default: + break; + } + + return ret; +} + + +void +bson_init (bson_t *bson) +{ + bson_impl_inline_t *impl = (bson_impl_inline_t *) bson; + + BSON_ASSERT (bson); + +#ifdef BSON_MEMCHECK + impl->canary = bson_malloc (1); +#endif + impl->flags = BSON_FLAG_INLINE | BSON_FLAG_STATIC; + impl->len = 5; + impl->data[0] = 5; + impl->data[1] = 0; + impl->data[2] = 0; + impl->data[3] = 0; + impl->data[4] = 0; +} + + +void +bson_reinit (bson_t *bson) +{ + uint8_t *data; + + BSON_ASSERT (bson); + + data = _bson_data (bson); + + bson->len = 5; + + data[0] = 5; + data[1] = 0; + data[2] = 0; + data[3] = 0; + data[4] = 0; +} + + +bool +bson_init_static (bson_t *bson, const uint8_t *data, size_t length) +{ + bson_impl_alloc_t *impl = (bson_impl_alloc_t *) bson; + uint32_t len_le; + + BSON_ASSERT (bson); + BSON_ASSERT (data); + + if ((length < 5) || (length > INT_MAX)) { + return false; + } + + memcpy (&len_le, data, sizeof (len_le)); + + if ((size_t) BSON_UINT32_FROM_LE (len_le) != length) { + return false; + } + + if (data[length - 1]) { + return false; + } + + impl->flags = BSON_FLAG_STATIC | BSON_FLAG_RDONLY; + impl->len = (uint32_t) length; + impl->parent = NULL; + impl->depth = 0; + impl->buf = &impl->alloc; + impl->buflen = &impl->alloclen; + impl->offset = 0; + impl->alloc = (uint8_t *) data; + impl->alloclen = length; + impl->realloc = NULL; + impl->realloc_func_ctx = NULL; + + return true; +} + + +bson_t * +bson_new (void) +{ + bson_impl_inline_t *impl; + bson_t *bson; + + bson = bson_malloc (sizeof *bson); + + impl = (bson_impl_inline_t *) bson; + impl->flags = BSON_FLAG_INLINE; + impl->len = 5; +#ifdef BSON_MEMCHECK + impl->canary = bson_malloc (1); +#endif + impl->data[0] = 5; + impl->data[1] = 0; + impl->data[2] = 0; + impl->data[3] = 0; + impl->data[4] = 0; + + return bson; +} + + +bson_t * +bson_sized_new (size_t size) +{ + bson_impl_alloc_t *impl_a; + bson_t *b; + + BSON_ASSERT (size <= INT32_MAX); + + b = bson_malloc (sizeof *b); + impl_a = (bson_impl_alloc_t *) b; + + if (size <= BSON_INLINE_DATA_SIZE) { + bson_init (b); + b->flags &= ~BSON_FLAG_STATIC; + } else { + impl_a->flags = BSON_FLAG_NONE; + impl_a->len = 5; + impl_a->parent = NULL; + impl_a->depth = 0; + impl_a->buf = &impl_a->alloc; + impl_a->buflen = &impl_a->alloclen; + impl_a->offset = 0; + impl_a->alloclen = BSON_MAX (5, size); + impl_a->alloc = bson_malloc (impl_a->alloclen); + impl_a->alloc[0] = 5; + impl_a->alloc[1] = 0; + impl_a->alloc[2] = 0; + impl_a->alloc[3] = 0; + impl_a->alloc[4] = 0; + impl_a->realloc = bson_realloc_ctx; + impl_a->realloc_func_ctx = NULL; + } + + return b; +} + + +bson_t * +bson_new_from_data (const uint8_t *data, size_t length) +{ + uint32_t len_le; + bson_t *bson; + + BSON_ASSERT (data); + + if ((length < 5) || (length > INT_MAX) || data[length - 1]) { + return NULL; + } + + memcpy (&len_le, data, sizeof (len_le)); + + if (length != (size_t) BSON_UINT32_FROM_LE (len_le)) { + return NULL; + } + + bson = bson_sized_new (length); + memcpy (_bson_data (bson), data, length); + bson->len = (uint32_t) length; + + return bson; +} + + +bson_t * +bson_new_from_buffer (uint8_t **buf, + size_t *buf_len, + bson_realloc_func realloc_func, + void *realloc_func_ctx) +{ + bson_impl_alloc_t *impl; + uint32_t len_le; + uint32_t length; + bson_t *bson; + + BSON_ASSERT (buf); + BSON_ASSERT (buf_len); + + if (!realloc_func) { + realloc_func = bson_realloc_ctx; + } + + bson = bson_malloc0 (sizeof *bson); + impl = (bson_impl_alloc_t *) bson; + + if (!*buf) { + length = 5; + len_le = BSON_UINT32_TO_LE (length); + *buf_len = 5; + *buf = realloc_func (*buf, *buf_len, realloc_func_ctx); + memcpy (*buf, &len_le, sizeof (len_le)); + (*buf)[4] = '\0'; + } else { + if ((*buf_len < 5) || (*buf_len > INT_MAX)) { + bson_free (bson); + return NULL; + } + + memcpy (&len_le, *buf, sizeof (len_le)); + length = BSON_UINT32_FROM_LE (len_le); + } + + if ((*buf)[length - 1]) { + bson_free (bson); + return NULL; + } + + impl->flags = BSON_FLAG_NO_FREE; + impl->len = length; + impl->buf = buf; + impl->buflen = buf_len; + impl->realloc = realloc_func; + impl->realloc_func_ctx = realloc_func_ctx; + + return bson; +} + + +bson_t * +bson_copy (const bson_t *bson) +{ + const uint8_t *data; + + BSON_ASSERT (bson); + + data = _bson_data (bson); + return bson_new_from_data (data, bson->len); +} + + +void +bson_copy_to (const bson_t *src, bson_t *dst) +{ + const uint8_t *data; + bson_impl_alloc_t *adst; + size_t len; + + BSON_ASSERT (src); + BSON_ASSERT (dst); + + if ((src->flags & BSON_FLAG_INLINE)) { +#ifdef BSON_MEMCHECK + dst->len = src->len; + dst->canary = malloc (1); + memcpy (dst->padding, src->padding, sizeof dst->padding); +#else + memcpy (dst, src, sizeof *dst); +#endif + dst->flags = (BSON_FLAG_STATIC | BSON_FLAG_INLINE); + return; + } + + data = _bson_data (src); + len = bson_next_power_of_two ((size_t) src->len); + + adst = (bson_impl_alloc_t *) dst; + adst->flags = BSON_FLAG_STATIC; + adst->len = src->len; + adst->parent = NULL; + adst->depth = 0; + adst->buf = &adst->alloc; + adst->buflen = &adst->alloclen; + adst->offset = 0; + adst->alloc = bson_malloc (len); + adst->alloclen = len; + adst->realloc = bson_realloc_ctx; + adst->realloc_func_ctx = NULL; + memcpy (adst->alloc, data, src->len); +} + + +static bool +should_ignore (const char *first_exclude, va_list args, const char *name) +{ + bool ret = false; + const char *exclude = first_exclude; + va_list args_copy; + + va_copy (args_copy, args); + + do { + if (!strcmp (name, exclude)) { + ret = true; + break; + } + } while ((exclude = va_arg (args_copy, const char *))); + + va_end (args_copy); + + return ret; +} + + +static void +_bson_copy_to_excluding_va (const bson_t *src, + bson_t *dst, + const char *first_exclude, + va_list args) +{ + bson_iter_t iter; + + if (bson_iter_init (&iter, src)) { + while (bson_iter_next (&iter)) { + if (!should_ignore (first_exclude, args, bson_iter_key (&iter))) { + if (!bson_append_iter (dst, NULL, 0, &iter)) { + /* + * This should not be able to happen since we are copying + * from within a valid bson_t. + */ + BSON_ASSERT (false); + return; + } + } + } + } +} + + +void +bson_copy_to_excluding (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) +{ + va_list args; + + BSON_ASSERT (src); + BSON_ASSERT (dst); + BSON_ASSERT (first_exclude); + + bson_init (dst); + + va_start (args, first_exclude); + _bson_copy_to_excluding_va (src, dst, first_exclude, args); + va_end (args); +} + +void +bson_copy_to_excluding_noinit (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) +{ + va_list args; + + BSON_ASSERT (src); + BSON_ASSERT (dst); + BSON_ASSERT (first_exclude); + + va_start (args, first_exclude); + _bson_copy_to_excluding_va (src, dst, first_exclude, args); + va_end (args); +} + + +void +bson_destroy (bson_t *bson) +{ + if (!bson) { + return; + } + + if (!(bson->flags & + (BSON_FLAG_RDONLY | BSON_FLAG_INLINE | BSON_FLAG_NO_FREE))) { + bson_free (*((bson_impl_alloc_t *) bson)->buf); + } + +#ifdef BSON_MEMCHECK + if (bson->flags & BSON_FLAG_INLINE) { + bson_free (bson->canary); + } +#endif + + if (!(bson->flags & BSON_FLAG_STATIC)) { + bson_free (bson); + } +} + + +uint8_t * +bson_reserve_buffer (bson_t *bson, uint32_t size) +{ + if (bson->flags & + (BSON_FLAG_CHILD | BSON_FLAG_IN_CHILD | BSON_FLAG_RDONLY)) { + return NULL; + } + + if (!_bson_grow (bson, size)) { + return NULL; + } + + if (bson->flags & BSON_FLAG_INLINE) { + /* bson_grow didn't spill over */ + ((bson_impl_inline_t *) bson)->len = size; + } else { + ((bson_impl_alloc_t *) bson)->len = size; + } + + return _bson_data (bson); +} + + +bool +bson_steal (bson_t *dst, bson_t *src) +{ + bson_impl_inline_t *src_inline; + bson_impl_inline_t *dst_inline; + bson_impl_alloc_t *alloc; + + BSON_ASSERT (dst); + BSON_ASSERT (src); + + bson_init (dst); + + if (src->flags & (BSON_FLAG_CHILD | BSON_FLAG_IN_CHILD | BSON_FLAG_RDONLY)) { + return false; + } + + if (src->flags & BSON_FLAG_INLINE) { + src_inline = (bson_impl_inline_t *) src; + dst_inline = (bson_impl_inline_t *) dst; + dst_inline->len = src_inline->len; + memcpy (dst_inline->data, src_inline->data, sizeof src_inline->data); + + /* for consistency, src is always invalid after steal, even if inline */ + src->len = 0; +#ifdef BSON_MEMCHECK + bson_free (src->canary); +#endif + } else { +#ifdef BSON_MEMCHECK + bson_free (dst->canary); +#endif + memcpy (dst, src, sizeof (bson_t)); + alloc = (bson_impl_alloc_t *) dst; + alloc->flags |= BSON_FLAG_STATIC; + alloc->buf = &alloc->alloc; + alloc->buflen = &alloc->alloclen; + } + + if (!(src->flags & BSON_FLAG_STATIC)) { + bson_free (src); + } else { + /* src is invalid after steal */ + src->len = 0; + } + + return true; +} + + +uint8_t * +bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length) +{ + uint8_t *ret = NULL; + + BSON_ASSERT (bson); + + if (length) { + *length = bson->len; + } + + if (!steal) { + bson_destroy (bson); + return NULL; + } + + if ((bson->flags & + (BSON_FLAG_CHILD | BSON_FLAG_IN_CHILD | BSON_FLAG_RDONLY))) { + /* Do nothing */ + } else if ((bson->flags & BSON_FLAG_INLINE)) { + bson_impl_inline_t *inl; + + inl = (bson_impl_inline_t *) bson; + ret = bson_malloc (bson->len); + memcpy (ret, inl->data, bson->len); + } else { + bson_impl_alloc_t *alloc; + + alloc = (bson_impl_alloc_t *) bson; + ret = *alloc->buf; + *alloc->buf = NULL; + } + + bson_destroy (bson); + + return ret; +} + + +const uint8_t * +bson_get_data (const bson_t *bson) +{ + BSON_ASSERT (bson); + + return _bson_data (bson); +} + + +uint32_t +bson_count_keys (const bson_t *bson) +{ + uint32_t count = 0; + bson_iter_t iter; + + BSON_ASSERT (bson); + + if (bson_iter_init (&iter, bson)) { + while (bson_iter_next (&iter)) { + count++; + } + } + + return count; +} + + +bool +bson_has_field (const bson_t *bson, const char *key) +{ + bson_iter_t iter; + bson_iter_t child; + + BSON_ASSERT (bson); + BSON_ASSERT (key); + + if (NULL != strchr (key, '.')) { + return (bson_iter_init (&iter, bson) && + bson_iter_find_descendant (&iter, key, &child)); + } + + return bson_iter_init_find (&iter, bson, key); +} + + +int +bson_compare (const bson_t *bson, const bson_t *other) +{ + const uint8_t *data1; + const uint8_t *data2; + size_t len1; + size_t len2; + int64_t ret; + + data1 = _bson_data (bson) + 4; + len1 = bson->len - 4; + + data2 = _bson_data (other) + 4; + len2 = other->len - 4; + + if (len1 == len2) { + return memcmp (data1, data2, len1); + } + + ret = memcmp (data1, data2, BSON_MIN (len1, len2)); + + if (ret == 0) { + ret = (int64_t) (len1 - len2); + } + + return (ret < 0) ? -1 : (ret > 0); +} + + +bool +bson_equal (const bson_t *bson, const bson_t *other) +{ + return !bson_compare (bson, other); +} + + +static bool +_bson_as_json_visit_utf8 (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + + escaped = bson_utf8_escape_for_json (v_utf8, v_utf8_len); + + if (escaped) { + bson_string_append (state->str, "\""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\""); + bson_free (escaped); + return false; + } + + return true; +} + + +static bool +_bson_as_json_visit_int32 (const bson_iter_t *iter, + const char *key, + int32_t v_int32, + void *data) +{ + bson_json_state_t *state = data; + + if (state->mode == BSON_JSON_MODE_CANONICAL) { + bson_string_append_printf ( + state->str, "{ \"$numberInt\" : \"%" PRId32 "\" }", v_int32); + } else { + bson_string_append_printf (state->str, "%" PRId32, v_int32); + } + + return false; +} + + +static bool +_bson_as_json_visit_int64 (const bson_iter_t *iter, + const char *key, + int64_t v_int64, + void *data) +{ + bson_json_state_t *state = data; + + if (state->mode == BSON_JSON_MODE_CANONICAL) { + bson_string_append_printf ( + state->str, "{ \"$numberLong\" : \"%" PRId64 "\"}", v_int64); + } else { + bson_string_append_printf (state->str, "%" PRId64, v_int64); + } + + return false; +} + + +static bool +_bson_as_json_visit_decimal128 (const bson_iter_t *iter, + const char *key, + const bson_decimal128_t *value, + void *data) +{ + bson_json_state_t *state = data; + char decimal128_string[BSON_DECIMAL128_STRING]; + bson_decimal128_to_string (value, decimal128_string); + + bson_string_append (state->str, "{ \"$numberDecimal\" : \""); + bson_string_append (state->str, decimal128_string); + bson_string_append (state->str, "\" }"); + + return false; +} + + +static bool +_bson_as_json_visit_double (const bson_iter_t *iter, + const char *key, + double v_double, + void *data) +{ + bson_json_state_t *state = data; + bson_string_t *str = state->str; + uint32_t start_len; + bool legacy; + + /* Determine if legacy (i.e. unwrapped) output should be used. Relaxed mode + * will use this for nan and inf values, which we check manually since old + * platforms may not have isinf or isnan. */ + legacy = state->mode == BSON_JSON_MODE_LEGACY || + (state->mode == BSON_JSON_MODE_RELAXED && + !(v_double != v_double || v_double * 0 != 0)); + + if (!legacy) { + bson_string_append (state->str, "{ \"$numberDouble\" : \""); + } + + if (!legacy && v_double != v_double) { + bson_string_append (str, "NaN"); + } else if (!legacy && v_double * 0 != 0) { + if (v_double > 0) { + bson_string_append (str, "Infinity"); + } else { + bson_string_append (str, "-Infinity"); + } + } else { + start_len = str->len; + bson_string_append_printf (str, "%.20g", v_double); + + /* ensure trailing ".0" to distinguish "3" from "3.0" */ + if (strspn (&str->str[start_len], "0123456789-") == + str->len - start_len) { + bson_string_append (str, ".0"); + } + } + + if (!legacy) { + bson_string_append (state->str, "\" }"); + } + + return false; +} + + +static bool +_bson_as_json_visit_undefined (const bson_iter_t *iter, + const char *key, + void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, "{ \"$undefined\" : true }"); + + return false; +} + + +static bool +_bson_as_json_visit_null (const bson_iter_t *iter, const char *key, void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, "null"); + + return false; +} + + +static bool +_bson_as_json_visit_oid (const bson_iter_t *iter, + const char *key, + const bson_oid_t *oid, + void *data) +{ + bson_json_state_t *state = data; + char str[25]; + + bson_oid_to_string (oid, str); + bson_string_append (state->str, "{ \"$oid\" : \""); + bson_string_append (state->str, str); + bson_string_append (state->str, "\" }"); + + return false; +} + + +static bool +_bson_as_json_visit_binary (const bson_iter_t *iter, + const char *key, + bson_subtype_t v_subtype, + size_t v_binary_len, + const uint8_t *v_binary, + void *data) +{ + bson_json_state_t *state = data; + size_t b64_len; + char *b64; + + b64_len = (v_binary_len / 3 + 1) * 4 + 1; + b64 = bson_malloc0 (b64_len); + BSON_ASSERT (bson_b64_ntop (v_binary, v_binary_len, b64, b64_len) != -1); + + if (state->mode == BSON_JSON_MODE_CANONICAL || + state->mode == BSON_JSON_MODE_RELAXED) { + bson_string_append (state->str, "{ \"$binary\" : { \"base64\": \""); + bson_string_append (state->str, b64); + bson_string_append (state->str, "\", \"subType\" : \""); + bson_string_append_printf (state->str, "%02x", v_subtype); + bson_string_append (state->str, "\" } }"); + } else { + bson_string_append (state->str, "{ \"$binary\" : \""); + bson_string_append (state->str, b64); + bson_string_append (state->str, "\", \"$type\" : \""); + bson_string_append_printf (state->str, "%02x", v_subtype); + bson_string_append (state->str, "\" }"); + } + + bson_free (b64); + + return false; +} + + +static bool +_bson_as_json_visit_bool (const bson_iter_t *iter, + const char *key, + bool v_bool, + void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, v_bool ? "true" : "false"); + + return false; +} + + +static bool +_bson_as_json_visit_date_time (const bson_iter_t *iter, + const char *key, + int64_t msec_since_epoch, + void *data) +{ + bson_json_state_t *state = data; + + if (state->mode == BSON_JSON_MODE_CANONICAL || + (state->mode == BSON_JSON_MODE_RELAXED && msec_since_epoch < 0)) { + bson_string_append (state->str, "{ \"$date\" : { \"$numberLong\" : \""); + bson_string_append_printf (state->str, "%" PRId64, msec_since_epoch); + bson_string_append (state->str, "\" } }"); + } else if (state->mode == BSON_JSON_MODE_RELAXED) { + bson_string_append (state->str, "{ \"$date\" : \""); + _bson_iso8601_date_format (msec_since_epoch, state->str); + bson_string_append (state->str, "\" }"); + } else { + bson_string_append (state->str, "{ \"$date\" : "); + bson_string_append_printf (state->str, "%" PRId64, msec_since_epoch); + bson_string_append (state->str, " }"); + } + + return false; +} + + +static bool +_bson_as_json_visit_regex (const bson_iter_t *iter, + const char *key, + const char *v_regex, + const char *v_options, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + + escaped = bson_utf8_escape_for_json (v_regex, -1); + if (!escaped) { + return true; + } + + if (state->mode == BSON_JSON_MODE_CANONICAL || + state->mode == BSON_JSON_MODE_RELAXED) { + bson_string_append (state->str, + "{ \"$regularExpression\" : { \"pattern\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\", \"options\" : \""); + _bson_append_regex_options_sorted (state->str, v_options); + bson_string_append (state->str, "\" } }"); + } else { + bson_string_append (state->str, "{ \"$regex\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\", \"$options\" : \""); + _bson_append_regex_options_sorted (state->str, v_options); + bson_string_append (state->str, "\" }"); + } + + bson_free (escaped); + + return false; +} + + +static bool +_bson_as_json_visit_timestamp (const bson_iter_t *iter, + const char *key, + uint32_t v_timestamp, + uint32_t v_increment, + void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, "{ \"$timestamp\" : { \"t\" : "); + bson_string_append_printf (state->str, "%u", v_timestamp); + bson_string_append (state->str, ", \"i\" : "); + bson_string_append_printf (state->str, "%u", v_increment); + bson_string_append (state->str, " } }"); + + return false; +} + + +static bool +_bson_as_json_visit_dbpointer (const bson_iter_t *iter, + const char *key, + size_t v_collection_len, + const char *v_collection, + const bson_oid_t *v_oid, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + char str[25]; + + escaped = bson_utf8_escape_for_json (v_collection, -1); + if (!escaped) { + return true; + } + + if (state->mode == BSON_JSON_MODE_CANONICAL || + state->mode == BSON_JSON_MODE_RELAXED) { + bson_string_append (state->str, "{ \"$dbPointer\" : { \"$ref\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\""); + + if (v_oid) { + bson_oid_to_string (v_oid, str); + bson_string_append (state->str, ", \"$id\" : { \"$oid\" : \""); + bson_string_append (state->str, str); + bson_string_append (state->str, "\" }"); + } + + bson_string_append (state->str, " } }"); + } else { + bson_string_append (state->str, "{ \"$ref\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\""); + + if (v_oid) { + bson_oid_to_string (v_oid, str); + bson_string_append (state->str, ", \"$id\" : \""); + bson_string_append (state->str, str); + bson_string_append (state->str, "\""); + } + + bson_string_append (state->str, " }"); + } + + bson_free (escaped); + + return false; +} + + +static bool +_bson_as_json_visit_minkey (const bson_iter_t *iter, + const char *key, + void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, "{ \"$minKey\" : 1 }"); + + return false; +} + + +static bool +_bson_as_json_visit_maxkey (const bson_iter_t *iter, + const char *key, + void *data) +{ + bson_json_state_t *state = data; + + bson_string_append (state->str, "{ \"$maxKey\" : 1 }"); + + return false; +} + + +static bool +_bson_as_json_visit_before (const bson_iter_t *iter, + const char *key, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + + if (state->count) { + bson_string_append (state->str, ", "); + } + + if (state->keys) { + escaped = bson_utf8_escape_for_json (key, -1); + if (escaped) { + bson_string_append (state->str, "\""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\" : "); + bson_free (escaped); + } else { + return true; + } + } + + state->count++; + + return false; +} + + +static void +_bson_as_json_visit_corrupt (const bson_iter_t *iter, void *data) +{ + *(((bson_json_state_t *) data)->err_offset) = iter->off; +} + + +static bool +_bson_as_json_visit_code (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + + escaped = bson_utf8_escape_for_json (v_code, v_code_len); + if (!escaped) { + return true; + } + + bson_string_append (state->str, "{ \"$code\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\" }"); + bson_free (escaped); + + return false; +} + + +static bool +_bson_as_json_visit_symbol (const bson_iter_t *iter, + const char *key, + size_t v_symbol_len, + const char *v_symbol, + void *data) +{ + bson_json_state_t *state = data; + char *escaped; + + escaped = bson_utf8_escape_for_json (v_symbol, v_symbol_len); + if (!escaped) { + return true; + } + + if (state->mode == BSON_JSON_MODE_CANONICAL || + state->mode == BSON_JSON_MODE_RELAXED) { + bson_string_append (state->str, "{ \"$symbol\" : \""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\" }"); + } else { + bson_string_append (state->str, "\""); + bson_string_append (state->str, escaped); + bson_string_append (state->str, "\""); + } + + bson_free (escaped); + + return false; +} + + +static bool +_bson_as_json_visit_codewscope (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data) +{ + bson_json_state_t *state = data; + char *code_escaped; + char *scope; + + code_escaped = bson_utf8_escape_for_json (v_code, v_code_len); + if (!code_escaped) { + return true; + } + + /* Encode scope with the same mode */ + scope = _bson_as_json_visit_all (v_scope, NULL, state->mode); + + if (!scope) { + bson_free (code_escaped); + return true; + } + + bson_string_append (state->str, "{ \"$code\" : \""); + bson_string_append (state->str, code_escaped); + bson_string_append (state->str, "\", \"$scope\" : "); + bson_string_append (state->str, scope); + bson_string_append (state->str, " }"); + + bson_free (code_escaped); + bson_free (scope); + + return false; +} + + +static const bson_visitor_t bson_as_json_visitors = { + _bson_as_json_visit_before, NULL, /* visit_after */ + _bson_as_json_visit_corrupt, _bson_as_json_visit_double, + _bson_as_json_visit_utf8, _bson_as_json_visit_document, + _bson_as_json_visit_array, _bson_as_json_visit_binary, + _bson_as_json_visit_undefined, _bson_as_json_visit_oid, + _bson_as_json_visit_bool, _bson_as_json_visit_date_time, + _bson_as_json_visit_null, _bson_as_json_visit_regex, + _bson_as_json_visit_dbpointer, _bson_as_json_visit_code, + _bson_as_json_visit_symbol, _bson_as_json_visit_codewscope, + _bson_as_json_visit_int32, _bson_as_json_visit_timestamp, + _bson_as_json_visit_int64, _bson_as_json_visit_maxkey, + _bson_as_json_visit_minkey, NULL, /* visit_unsupported_type */ + _bson_as_json_visit_decimal128, +}; + + +static bool +_bson_as_json_visit_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data) +{ + bson_json_state_t *state = data; + bson_json_state_t child_state = {0, true, state->err_offset}; + bson_iter_t child; + + if (state->depth >= BSON_MAX_RECURSION) { + bson_string_append (state->str, "{ ... }"); + return false; + } + + if (bson_iter_init (&child, v_document)) { + child_state.str = bson_string_new ("{ "); + child_state.depth = state->depth + 1; + child_state.mode = state->mode; + if (bson_iter_visit_all (&child, &bson_as_json_visitors, &child_state)) { + bson_string_free (child_state.str, true); + return true; + } + + bson_string_append (child_state.str, " }"); + bson_string_append (state->str, child_state.str->str); + bson_string_free (child_state.str, true); + } + + return false; +} + + +static bool +_bson_as_json_visit_array (const bson_iter_t *iter, + const char *key, + const bson_t *v_array, + void *data) +{ + bson_json_state_t *state = data; + bson_json_state_t child_state = {0, false, state->err_offset}; + bson_iter_t child; + + if (state->depth >= BSON_MAX_RECURSION) { + bson_string_append (state->str, "{ ... }"); + return false; + } + + if (bson_iter_init (&child, v_array)) { + child_state.str = bson_string_new ("[ "); + child_state.depth = state->depth + 1; + child_state.mode = state->mode; + if (bson_iter_visit_all (&child, &bson_as_json_visitors, &child_state)) { + bson_string_free (child_state.str, true); + return true; + } + + bson_string_append (child_state.str, " ]"); + bson_string_append (state->str, child_state.str->str); + bson_string_free (child_state.str, true); + } + + return false; +} + + +static char * +_bson_as_json_visit_all (const bson_t *bson, + size_t *length, + bson_json_mode_t mode) +{ + bson_json_state_t state; + bson_iter_t iter; + ssize_t err_offset = -1; + + BSON_ASSERT (bson); + + if (length) { + *length = 0; + } + + if (bson_empty0 (bson)) { + if (length) { + *length = 3; + } + + return bson_strdup ("{ }"); + } + + if (!bson_iter_init (&iter, bson)) { + return NULL; + } + + state.count = 0; + state.keys = true; + state.str = bson_string_new ("{ "); + state.depth = 0; + state.err_offset = &err_offset; + state.mode = mode; + + if (bson_iter_visit_all (&iter, &bson_as_json_visitors, &state) || + err_offset != -1) { + /* + * We were prematurely exited due to corruption or failed visitor. + */ + bson_string_free (state.str, true); + if (length) { + *length = 0; + } + return NULL; + } + + bson_string_append (state.str, " }"); + + if (length) { + *length = state.str->len; + } + + return bson_string_free (state.str, false); +} + + +char * +bson_as_canonical_extended_json (const bson_t *bson, size_t *length) +{ + return _bson_as_json_visit_all (bson, length, BSON_JSON_MODE_CANONICAL); +} + + +char * +bson_as_json (const bson_t *bson, size_t *length) +{ + return _bson_as_json_visit_all (bson, length, BSON_JSON_MODE_LEGACY); +} + + +char * +bson_as_relaxed_extended_json (const bson_t *bson, size_t *length) +{ + return _bson_as_json_visit_all (bson, length, BSON_JSON_MODE_RELAXED); +} + + +char * +bson_array_as_json (const bson_t *bson, size_t *length) +{ + bson_json_state_t state; + bson_iter_t iter; + ssize_t err_offset = -1; + + BSON_ASSERT (bson); + + if (length) { + *length = 0; + } + + if (bson_empty0 (bson)) { + if (length) { + *length = 3; + } + + return bson_strdup ("[ ]"); + } + + if (!bson_iter_init (&iter, bson)) { + return NULL; + } + + state.count = 0; + state.keys = false; + state.str = bson_string_new ("[ "); + state.depth = 0; + state.err_offset = &err_offset; + state.mode = BSON_JSON_MODE_LEGACY; + + if (bson_iter_visit_all (&iter, &bson_as_json_visitors, &state) || + err_offset != -1) { + /* + * We were prematurely exited due to corruption or failed visitor. + */ + bson_string_free (state.str, true); + if (length) { + *length = 0; + } + return NULL; + } + + bson_string_append (state.str, " ]"); + + if (length) { + *length = state.str->len; + } + + return bson_string_free (state.str, false); +} + + +#define VALIDATION_ERR(_flag, _msg, ...) \ + bson_set_error (&state->error, BSON_ERROR_INVALID, _flag, _msg, __VA_ARGS__) + +static bool +_bson_iter_validate_utf8 (const bson_iter_t *iter, + const char *key, + size_t v_utf8_len, + const char *v_utf8, + void *data) +{ + bson_validate_state_t *state = data; + bool allow_null; + + if ((state->flags & BSON_VALIDATE_UTF8)) { + allow_null = !!(state->flags & BSON_VALIDATE_UTF8_ALLOW_NULL); + + if (!bson_utf8_validate (v_utf8, v_utf8_len, allow_null)) { + state->err_offset = iter->off; + VALIDATION_ERR ( + BSON_VALIDATE_UTF8, "invalid utf8 string for key \"%s\"", key); + return true; + } + } + + if ((state->flags & BSON_VALIDATE_DOLLAR_KEYS)) { + if (state->phase == BSON_VALIDATE_PHASE_LF_REF_UTF8) { + state->phase = BSON_VALIDATE_PHASE_LF_ID_KEY; + } else if (state->phase == BSON_VALIDATE_PHASE_LF_DB_UTF8) { + state->phase = BSON_VALIDATE_PHASE_NOT_DBREF; + } + } + + return false; +} + + +static void +_bson_iter_validate_corrupt (const bson_iter_t *iter, void *data) +{ + bson_validate_state_t *state = data; + + state->err_offset = iter->err_off; + VALIDATION_ERR (BSON_VALIDATE_NONE, "%s", "corrupt BSON"); +} + + +static bool +_bson_iter_validate_before (const bson_iter_t *iter, + const char *key, + void *data) +{ + bson_validate_state_t *state = data; + + if ((state->flags & BSON_VALIDATE_EMPTY_KEYS)) { + if (key[0] == '\0') { + state->err_offset = iter->off; + VALIDATION_ERR (BSON_VALIDATE_EMPTY_KEYS, "%s", "empty key"); + return true; + } + } + + if ((state->flags & BSON_VALIDATE_DOLLAR_KEYS)) { + if (key[0] == '$') { + if (state->phase == BSON_VALIDATE_PHASE_LF_REF_KEY && + strcmp (key, "$ref") == 0) { + state->phase = BSON_VALIDATE_PHASE_LF_REF_UTF8; + } else if (state->phase == BSON_VALIDATE_PHASE_LF_ID_KEY && + strcmp (key, "$id") == 0) { + state->phase = BSON_VALIDATE_PHASE_LF_DB_KEY; + } else if (state->phase == BSON_VALIDATE_PHASE_LF_DB_KEY && + strcmp (key, "$db") == 0) { + state->phase = BSON_VALIDATE_PHASE_LF_DB_UTF8; + } else { + state->err_offset = iter->off; + VALIDATION_ERR (BSON_VALIDATE_DOLLAR_KEYS, + "keys cannot begin with \"$\": \"%s\"", + key); + return true; + } + } else if (state->phase == BSON_VALIDATE_PHASE_LF_ID_KEY || + state->phase == BSON_VALIDATE_PHASE_LF_REF_UTF8 || + state->phase == BSON_VALIDATE_PHASE_LF_DB_UTF8) { + state->err_offset = iter->off; + VALIDATION_ERR (BSON_VALIDATE_DOLLAR_KEYS, + "invalid key within DBRef subdocument: \"%s\"", + key); + return true; + } else { + state->phase = BSON_VALIDATE_PHASE_NOT_DBREF; + } + } + + if ((state->flags & BSON_VALIDATE_DOT_KEYS)) { + if (strstr (key, ".")) { + state->err_offset = iter->off; + VALIDATION_ERR ( + BSON_VALIDATE_DOT_KEYS, "keys cannot contain \".\": \"%s\"", key); + return true; + } + } + + return false; +} + + +static bool +_bson_iter_validate_codewscope (const bson_iter_t *iter, + const char *key, + size_t v_code_len, + const char *v_code, + const bson_t *v_scope, + void *data) +{ + bson_validate_state_t *state = data; + size_t offset = 0; + + if (!bson_validate (v_scope, state->flags, &offset)) { + state->err_offset = iter->off + offset; + VALIDATION_ERR (BSON_VALIDATE_NONE, "%s", "corrupt code-with-scope"); + return false; + } + + return true; +} + + +static bool +_bson_iter_validate_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data); + + +static const bson_visitor_t bson_validate_funcs = { + _bson_iter_validate_before, + NULL, /* visit_after */ + _bson_iter_validate_corrupt, + NULL, /* visit_double */ + _bson_iter_validate_utf8, + _bson_iter_validate_document, + _bson_iter_validate_document, /* visit_array */ + NULL, /* visit_binary */ + NULL, /* visit_undefined */ + NULL, /* visit_oid */ + NULL, /* visit_bool */ + NULL, /* visit_date_time */ + NULL, /* visit_null */ + NULL, /* visit_regex */ + NULL, /* visit_dbpoint */ + NULL, /* visit_code */ + NULL, /* visit_symbol */ + _bson_iter_validate_codewscope, +}; + + +static bool +_bson_iter_validate_document (const bson_iter_t *iter, + const char *key, + const bson_t *v_document, + void *data) +{ + bson_validate_state_t *state = data; + bson_iter_t child; + bson_validate_phase_t phase = state->phase; + + if (!bson_iter_init (&child, v_document)) { + state->err_offset = iter->off; + return true; + } + + if (state->phase == BSON_VALIDATE_PHASE_START) { + state->phase = BSON_VALIDATE_PHASE_TOP; + } else { + state->phase = BSON_VALIDATE_PHASE_LF_REF_KEY; + } + + (void) bson_iter_visit_all (&child, &bson_validate_funcs, state); + + if (state->phase == BSON_VALIDATE_PHASE_LF_ID_KEY || + state->phase == BSON_VALIDATE_PHASE_LF_REF_UTF8 || + state->phase == BSON_VALIDATE_PHASE_LF_DB_UTF8) { + if (state->err_offset <= 0) { + state->err_offset = iter->off; + } + + return true; + } + + state->phase = phase; + + return false; +} + + +static void +_bson_validate_internal (const bson_t *bson, bson_validate_state_t *state) +{ + bson_iter_t iter; + + state->err_offset = -1; + state->phase = BSON_VALIDATE_PHASE_START; + memset (&state->error, 0, sizeof state->error); + + if (!bson_iter_init (&iter, bson)) { + state->err_offset = 0; + VALIDATION_ERR (BSON_VALIDATE_NONE, "%s", "corrupt BSON"); + } else { + _bson_iter_validate_document (&iter, NULL, bson, state); + } +} + + +bool +bson_validate (const bson_t *bson, bson_validate_flags_t flags, size_t *offset) +{ + bson_validate_state_t state; + + state.flags = flags; + _bson_validate_internal (bson, &state); + + if (state.err_offset > 0 && offset) { + *offset = (size_t) state.err_offset; + } + + return state.err_offset < 0; +} + + +bool +bson_validate_with_error (const bson_t *bson, + bson_validate_flags_t flags, + bson_error_t *error) +{ + bson_validate_state_t state; + + state.flags = flags; + _bson_validate_internal (bson, &state); + + if (state.err_offset > 0 && error) { + memcpy (error, &state.error, sizeof *error); + } + + return state.err_offset < 0; +} + + +bool +bson_concat (bson_t *dst, const bson_t *src) +{ + BSON_ASSERT (dst); + BSON_ASSERT (src); + + if (!bson_empty (src)) { + return _bson_append ( + dst, 1, src->len - 5, src->len - 5, _bson_data (src) + 4); + } + + return true; +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.h new file mode 100644 index 0000000..2f4e9ef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/bson.h @@ -0,0 +1,1141 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef BSON_H +#define BSON_H + +#define BSON_INSIDE + +#include "bson/bson-compat.h" + +#include +#include + +#include "bson/bson-macros.h" +#include "bson/bson-config.h" +#include "bson/bson-atomic.h" +#include "bson/bson-context.h" +#include "bson/bson-clock.h" +#include "bson/bson-decimal128.h" +#include "bson/bson-error.h" +#include "bson/bson-iter.h" +#include "bson/bson-json.h" +#include "bson/bson-keys.h" +#include "bson/bson-md5.h" +#include "bson/bson-memory.h" +#include "bson/bson-oid.h" +#include "bson/bson-reader.h" +#include "bson/bson-string.h" +#include "bson/bson-types.h" +#include "bson/bson-utf8.h" +#include "bson/bson-value.h" +#include "bson/bson-version.h" +#include "bson/bson-version-functions.h" +#include "bson/bson-writer.h" +#include "bson/bcon.h" + +#undef BSON_INSIDE + + +BSON_BEGIN_DECLS + + +/** + * bson_empty: + * @b: a bson_t. + * + * Checks to see if @b is an empty BSON document. An empty BSON document is + * a 5 byte document which contains the length (4 bytes) and a single NUL + * byte indicating end of fields. + */ +#define bson_empty(b) (((b)->len == 5) || !bson_get_data ((b))[4]) + + +/** + * bson_empty0: + * + * Like bson_empty() but treats NULL the same as an empty bson_t document. + */ +#define bson_empty0(b) (!(b) || bson_empty (b)) + + +/** + * bson_clear: + * + * Easily free a bson document and set it to NULL. Use like: + * + * bson_t *doc = bson_new(); + * bson_clear (&doc); + * BSON_ASSERT (doc == NULL); + */ +#define bson_clear(bptr) \ + do { \ + if (*(bptr)) { \ + bson_destroy (*(bptr)); \ + *(bptr) = NULL; \ + } \ + } while (0) + + +/** + * BSON_MAX_SIZE: + * + * The maximum size in bytes of a BSON document. + */ +#define BSON_MAX_SIZE ((size_t) ((1U << 31) - 1)) + + +#define BSON_APPEND_ARRAY(b, key, val) \ + bson_append_array (b, key, (int) strlen (key), val) + +#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \ + bson_append_array_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_BINARY(b, key, subtype, val, len) \ + bson_append_binary (b, key, (int) strlen (key), subtype, val, len) + +#define BSON_APPEND_BOOL(b, key, val) \ + bson_append_bool (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE(b, key, val) \ + bson_append_code (b, key, (int) strlen (key), val) + +#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \ + bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) + +#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \ + bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) + +#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \ + bson_append_document_begin (b, key, (int) strlen (key), child) + +#define BSON_APPEND_DOUBLE(b, key, val) \ + bson_append_double (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DOCUMENT(b, key, val) \ + bson_append_document (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT32(b, key, val) \ + bson_append_int32 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_INT64(b, key, val) \ + bson_append_int64 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MINKEY(b, key) \ + bson_append_minkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_DECIMAL128(b, key, val) \ + bson_append_decimal128 (b, key, (int) strlen (key), val) + +#define BSON_APPEND_MAXKEY(b, key) \ + bson_append_maxkey (b, key, (int) strlen (key)) + +#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) + +#define BSON_APPEND_OID(b, key, val) \ + bson_append_oid (b, key, (int) strlen (key), val) + +#define BSON_APPEND_REGEX(b, key, val, opt) \ + bson_append_regex (b, key, (int) strlen (key), val, opt) + +#define BSON_APPEND_UTF8(b, key, val) \ + bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_SYMBOL(b, key, val) \ + bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val)) + +#define BSON_APPEND_TIME_T(b, key, val) \ + bson_append_time_t (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMEVAL(b, key, val) \ + bson_append_timeval (b, key, (int) strlen (key), val) + +#define BSON_APPEND_DATE_TIME(b, key, val) \ + bson_append_date_time (b, key, (int) strlen (key), val) + +#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \ + bson_append_timestamp (b, key, (int) strlen (key), val, inc) + +#define BSON_APPEND_UNDEFINED(b, key) \ + bson_append_undefined (b, key, (int) strlen (key)) + +#define BSON_APPEND_VALUE(b, key, val) \ + bson_append_value (b, key, (int) strlen (key), (val)) + + +/** + * bson_new: + * + * Allocates a new bson_t structure. Call the various bson_append_*() + * functions to add fields to the bson. You can iterate the bson_t at any + * time using a bson_iter_t and bson_iter_init(). + * + * Returns: A newly allocated bson_t that should be freed with bson_destroy(). + */ +BSON_EXPORT (bson_t *) +bson_new (void); + + +BSON_EXPORT (bson_t *) +bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error); + + +BSON_EXPORT (bool) +bson_init_from_json (bson_t *bson, + const char *data, + ssize_t len, + bson_error_t *error); + + +/** + * bson_init_static: + * @b: A pointer to a bson_t. + * @data: The data buffer to use. + * @length: The length of @data. + * + * Initializes a bson_t using @data and @length. This is ideal if you would + * like to use a stack allocation for your bson and do not need to grow the + * buffer. @data must be valid for the life of @b. + * + * Returns: true if initialized successfully; otherwise false. + */ +BSON_EXPORT (bool) +bson_init_static (bson_t *b, const uint8_t *data, size_t length); + + +/** + * bson_init: + * @b: A pointer to a bson_t. + * + * Initializes a bson_t for use. This function is useful to those that want a + * stack allocated bson_t. The usefulness of a stack allocated bson_t is + * marginal as the target buffer for content will still require heap + * allocations. It can help reduce heap fragmentation on allocators that do + * not employ SLAB/magazine semantics. + * + * You must call bson_destroy() with @b to release resources when you are done + * using @b. + */ +BSON_EXPORT (void) +bson_init (bson_t *b); + + +/** + * bson_reinit: + * @b: (inout): A bson_t. + * + * This is equivalent to calling bson_destroy() and bson_init() on a #bson_t. + * However, it will try to persist the existing malloc'd buffer if one exists. + * This is useful in cases where you want to reduce malloc overhead while + * building many documents. + */ +BSON_EXPORT (void) +bson_reinit (bson_t *b); + + +/** + * bson_new_from_data: + * @data: A buffer containing a serialized bson document. + * @length: The length of the document in bytes. + * + * Creates a new bson_t structure using the data provided. @data should contain + * at least @length bytes that can be copied into the new bson_t structure. + * + * Returns: A newly allocated bson_t that should be freed with bson_destroy(). + * If the first four bytes (little-endian) of data do not match @length, + * then NULL will be returned. + */ +BSON_EXPORT (bson_t *) +bson_new_from_data (const uint8_t *data, size_t length); + + +/** + * bson_new_from_buffer: + * @buf: A pointer to a buffer containing a serialized bson document. + * @buf_len: The length of the buffer in bytes. + * @realloc_fun: a realloc like function + * @realloc_fun_ctx: a context for the realloc function + * + * Creates a new bson_t structure using the data provided. @buf should contain + * a bson document, or null pointer should be passed for new allocations. + * + * Returns: A newly allocated bson_t that should be freed with bson_destroy(). + * The underlying buffer will be used and not be freed in destroy. + */ +BSON_EXPORT (bson_t *) +bson_new_from_buffer (uint8_t **buf, + size_t *buf_len, + bson_realloc_func realloc_func, + void *realloc_func_ctx); + + +/** + * bson_sized_new: + * @size: A size_t containing the number of bytes to allocate. + * + * This will allocate a new bson_t with enough bytes to hold a buffer + * sized @size. @size must be smaller than INT_MAX bytes. + * + * Returns: A newly allocated bson_t that should be freed with bson_destroy(). + */ +BSON_EXPORT (bson_t *) +bson_sized_new (size_t size); + + +/** + * bson_copy: + * @bson: A bson_t. + * + * Copies @bson into a newly allocated bson_t. You must call bson_destroy() + * when you are done with the resulting value to free its resources. + * + * Returns: A newly allocated bson_t that should be free'd with bson_destroy() + */ +BSON_EXPORT (bson_t *) +bson_copy (const bson_t *bson); + + +/** + * bson_copy_to: + * @src: The source bson_t. + * @dst: The destination bson_t. + * + * Initializes @dst and copies the content from @src into @dst. + */ +BSON_EXPORT (void) +bson_copy_to (const bson_t *src, bson_t *dst); + + +/** + * bson_copy_to_excluding: + * @src: A bson_t. + * @dst: A bson_t to initialize and copy into. + * @first_exclude: First field name to exclude. + * + * Copies @src into @dst excluding any field that is provided. + * This is handy for situations when you need to remove one or + * more fields in a bson_t. Note that bson_init() will be called + * on dst. + */ +BSON_EXPORT (void) +bson_copy_to_excluding (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED + BSON_GNUC_DEPRECATED_FOR (bson_copy_to_excluding_noinit); + +/** + * bson_copy_to_excluding_noinit: + * @src: A bson_t. + * @dst: A bson_t to initialize and copy into. + * @first_exclude: First field name to exclude. + * + * The same as bson_copy_to_excluding, but does not call bson_init() + * on the dst. This version should be preferred in new code, but the + * old function is left for backwards compatibility. + */ +BSON_EXPORT (void) +bson_copy_to_excluding_noinit (const bson_t *src, + bson_t *dst, + const char *first_exclude, + ...) BSON_GNUC_NULL_TERMINATED; + +/** + * bson_destroy: + * @bson: A bson_t. + * + * Frees the resources associated with @bson. + */ +BSON_EXPORT (void) +bson_destroy (bson_t *bson); + +BSON_EXPORT (uint8_t *) +bson_reserve_buffer (bson_t *bson, uint32_t size); + +BSON_EXPORT (bool) +bson_steal (bson_t *dst, bson_t *src); + + +/** + * bson_destroy_with_steal: + * @bson: A #bson_t. + * @steal: If ownership of the data buffer should be transferred to caller. + * @length: (out): location for the length of the buffer. + * + * Destroys @bson similar to calling bson_destroy() except that the underlying + * buffer will be returned and ownership transferred to the caller if @steal + * is non-zero. + * + * If length is non-NULL, the length of @bson will be stored in @length. + * + * It is a programming error to call this function with any bson that has + * been initialized static, or is being used to create a subdocument with + * functions such as bson_append_document_begin() or bson_append_array_begin(). + * + * Returns: a buffer owned by the caller if @steal is true. Otherwise NULL. + * If there was an error, NULL is returned. + */ +BSON_EXPORT (uint8_t *) +bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length); + + +/** + * bson_get_data: + * @bson: A bson_t. + * + * Fetched the data buffer for @bson of @bson->len bytes in length. + * + * Returns: A buffer that should not be modified or freed. + */ +BSON_EXPORT (const uint8_t *) +bson_get_data (const bson_t *bson); + + +/** + * bson_count_keys: + * @bson: A bson_t. + * + * Counts the number of elements found in @bson. + */ +BSON_EXPORT (uint32_t) +bson_count_keys (const bson_t *bson); + + +/** + * bson_has_field: + * @bson: A bson_t. + * @key: The key to lookup. + * + * Checks to see if @bson contains a field named @key. + * + * This function is case-sensitive. + * + * Returns: true if @key exists in @bson; otherwise false. + */ +BSON_EXPORT (bool) +bson_has_field (const bson_t *bson, const char *key); + + +/** + * bson_compare: + * @bson: A bson_t. + * @other: A bson_t. + * + * Compares @bson to @other in a qsort() style comparison. + * See qsort() for information on how this function works. + * + * Returns: Less than zero, zero, or greater than zero. + */ +BSON_EXPORT (int) +bson_compare (const bson_t *bson, const bson_t *other); + +/* + * bson_compare: + * @bson: A bson_t. + * @other: A bson_t. + * + * Checks to see if @bson and @other are equal. + * + * Returns: true if equal; otherwise false. + */ +BSON_EXPORT (bool) +bson_equal (const bson_t *bson, const bson_t *other); + + +/** + * bson_validate: + * @bson: A bson_t. + * @offset: A location for the error offset. + * + * Validates a BSON document by walking through the document and inspecting + * the fields for valid content. + * + * Returns: true if @bson is valid; otherwise false and @offset is set. + */ +BSON_EXPORT (bool) +bson_validate (const bson_t *bson, bson_validate_flags_t flags, size_t *offset); + + +/** + * bson_validate_with_error: + * @bson: A bson_t. + * @error: A location for the error info. + * + * Validates a BSON document by walking through the document and inspecting + * the fields for valid content. + * + * Returns: true if @bson is valid; otherwise false and @error is filled out. + */ +BSON_EXPORT (bool) +bson_validate_with_error (const bson_t *bson, + bson_validate_flags_t flags, + bson_error_t *error); + + +/** + * bson_as_canonical_extended_json: + * @bson: A bson_t. + * @length: A location for the string length, or NULL. + * + * Creates a new string containing @bson in canonical extended JSON format, + * conforming to the MongoDB Extended JSON Spec: + * + * github.com/mongodb/specifications/blob/master/source/extended-json.rst + * + * The caller is responsible for freeing the resulting string. If @length is + * non-NULL, then the length of the resulting string will be placed in @length. + * + * See http://docs.mongodb.org/manual/reference/mongodb-extended-json/ for + * more information on extended JSON. + * + * Returns: A newly allocated string that should be freed with bson_free(). + */ +BSON_EXPORT (char *) +bson_as_canonical_extended_json (const bson_t *bson, size_t *length); + + +/** + * bson_as_json: + * @bson: A bson_t. + * @length: A location for the string length, or NULL. + * + * Creates a new string containing @bson in libbson's legacy JSON format. + * Superseded by bson_as_canonical_extended_json and + * bson_as_relaxed_extended_json. The caller is + * responsible for freeing the resulting string. If @length is non-NULL, then + * the length of the resulting string will be placed in @length. + * + * Returns: A newly allocated string that should be freed with bson_free(). + */ +BSON_EXPORT (char *) +bson_as_json (const bson_t *bson, size_t *length); + + +/** + * bson_as_relaxed_extended_json: + * @bson: A bson_t. + * @length: A location for the string length, or NULL. + * + * Creates a new string containing @bson in relaxed extended JSON format, + * conforming to the MongoDB Extended JSON Spec: + * + * github.com/mongodb/specifications/blob/master/source/extended-json.rst + * + * The caller is responsible for freeing the resulting string. If @length is + * non-NULL, then the length of the resulting string will be placed in @length. + * + * See http://docs.mongodb.org/manual/reference/mongodb-extended-json/ for + * more information on extended JSON. + * + * Returns: A newly allocated string that should be freed with bson_free(). + */ +BSON_EXPORT (char *) +bson_as_relaxed_extended_json (const bson_t *bson, size_t *length); + + +/* like bson_as_json() but for outermost arrays. */ +BSON_EXPORT (char *) +bson_array_as_json (const bson_t *bson, size_t *length); + + +BSON_EXPORT (bool) +bson_append_value (bson_t *bson, + const char *key, + int key_length, + const bson_value_t *value); + + +/** + * bson_append_array: + * @bson: A bson_t. + * @key: The key for the field. + * @array: A bson_t containing the array. + * + * Appends a BSON array to @bson. BSON arrays are like documents where the + * key is the string version of the index. For example, the first item of the + * array would have the key "0". The second item would have the index "1". + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_array (bson_t *bson, + const char *key, + int key_length, + const bson_t *array); + + +/** + * bson_append_binary: + * @bson: A bson_t to append. + * @key: The key for the field. + * @subtype: The bson_subtype_t of the binary. + * @binary: The binary buffer to append. + * @length: The length of @binary. + * + * Appends a binary buffer to the BSON document. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_binary (bson_t *bson, + const char *key, + int key_length, + bson_subtype_t subtype, + const uint8_t *binary, + uint32_t length); + + +/** + * bson_append_bool: + * @bson: A bson_t. + * @key: The key for the field. + * @value: The boolean value. + * + * Appends a new field to @bson of type BSON_TYPE_BOOL. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_bool (bson_t *bson, const char *key, int key_length, bool value); + + +/** + * bson_append_code: + * @bson: A bson_t. + * @key: The key for the document. + * @javascript: JavaScript code to be executed. + * + * Appends a field of type BSON_TYPE_CODE to the BSON document. @javascript + * should contain a script in javascript to be executed. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_code (bson_t *bson, + const char *key, + int key_length, + const char *javascript); + + +/** + * bson_append_code_with_scope: + * @bson: A bson_t. + * @key: The key for the document. + * @javascript: JavaScript code to be executed. + * @scope: A bson_t containing the scope for @javascript. + * + * Appends a field of type BSON_TYPE_CODEWSCOPE to the BSON document. + * @javascript should contain a script in javascript to be executed. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_code_with_scope (bson_t *bson, + const char *key, + int key_length, + const char *javascript, + const bson_t *scope); + + +/** + * bson_append_dbpointer: + * @bson: A bson_t. + * @key: The key for the field. + * @collection: The collection name. + * @oid: The oid to the reference. + * + * Appends a new field of type BSON_TYPE_DBPOINTER. This datum type is + * deprecated in the BSON spec and should not be used in new code. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_dbpointer (bson_t *bson, + const char *key, + int key_length, + const char *collection, + const bson_oid_t *oid); + + +/** + * bson_append_double: + * @bson: A bson_t. + * @key: The key for the field. + * + * Appends a new field to @bson of the type BSON_TYPE_DOUBLE. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_double (bson_t *bson, + const char *key, + int key_length, + double value); + + +/** + * bson_append_document: + * @bson: A bson_t. + * @key: The key for the field. + * @value: A bson_t containing the subdocument. + * + * Appends a new field to @bson of the type BSON_TYPE_DOCUMENT. + * The documents contents will be copied into @bson. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_document (bson_t *bson, + const char *key, + int key_length, + const bson_t *value); + + +/** + * bson_append_document_begin: + * @bson: A bson_t. + * @key: The key for the field. + * @key_length: The length of @key in bytes not including NUL or -1 + * if @key_length is NUL terminated. + * @child: A location to an uninitialized bson_t. + * + * Appends a new field named @key to @bson. The field is, however, + * incomplete. @child will be initialized so that you may add fields to the + * child document. Child will use a memory buffer owned by @bson and + * therefore grow the parent buffer as additional space is used. This allows + * a single malloc'd buffer to be used when building documents which can help + * reduce memory fragmentation. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_document_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); + + +/** + * bson_append_document_end: + * @bson: A bson_t. + * @child: A bson_t supplied to bson_append_document_begin(). + * + * Finishes the appending of a document to a @bson. @child is considered + * disposed after this call and should not be used any further. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_document_end (bson_t *bson, bson_t *child); + + +/** + * bson_append_array_begin: + * @bson: A bson_t. + * @key: The key for the field. + * @key_length: The length of @key in bytes not including NUL or -1 + * if @key_length is NUL terminated. + * @child: A location to an uninitialized bson_t. + * + * Appends a new field named @key to @bson. The field is, however, + * incomplete. @child will be initialized so that you may add fields to the + * child array. Child will use a memory buffer owned by @bson and + * therefore grow the parent buffer as additional space is used. This allows + * a single malloc'd buffer to be used when building arrays which can help + * reduce memory fragmentation. + * + * The type of @child will be BSON_TYPE_ARRAY and therefore the keys inside + * of it MUST be "0", "1", etc. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_array_begin (bson_t *bson, + const char *key, + int key_length, + bson_t *child); + + +/** + * bson_append_array_end: + * @bson: A bson_t. + * @child: A bson_t supplied to bson_append_array_begin(). + * + * Finishes the appending of a array to a @bson. @child is considered + * disposed after this call and should not be used any further. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_array_end (bson_t *bson, bson_t *child); + + +/** + * bson_append_int32: + * @bson: A bson_t. + * @key: The key for the field. + * @value: The int32_t 32-bit integer value. + * + * Appends a new field of type BSON_TYPE_INT32 to @bson. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_int32 (bson_t *bson, + const char *key, + int key_length, + int32_t value); + + +/** + * bson_append_int64: + * @bson: A bson_t. + * @key: The key for the field. + * @value: The int64_t 64-bit integer value. + * + * Appends a new field of type BSON_TYPE_INT64 to @bson. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_int64 (bson_t *bson, + const char *key, + int key_length, + int64_t value); + + +/** + * bson_append_decimal128: + * @bson: A bson_t. + * @key: The key for the field. + * @value: The bson_decimal128_t decimal128 value. + * + * Appends a new field of type BSON_TYPE_DECIMAL128 to @bson. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_decimal128 (bson_t *bson, + const char *key, + int key_length, + const bson_decimal128_t *value); + + +/** + * bson_append_iter: + * @bson: A bson_t to append to. + * @key: The key name or %NULL to take current key from @iter. + * @key_length: The key length or -1 to use strlen(). + * @iter: The iter located on the position of the element to append. + * + * Appends a new field to @bson that is equivalent to the field currently + * pointed to by @iter. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_iter (bson_t *bson, + const char *key, + int key_length, + const bson_iter_t *iter); + + +/** + * bson_append_minkey: + * @bson: A bson_t. + * @key: The key for the field. + * + * Appends a new field of type BSON_TYPE_MINKEY to @bson. This is a special + * type that compares lower than all other possible BSON element values. + * + * See http://bsonspec.org for more information on this type. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_minkey (bson_t *bson, const char *key, int key_length); + + +/** + * bson_append_maxkey: + * @bson: A bson_t. + * @key: The key for the field. + * + * Appends a new field of type BSON_TYPE_MAXKEY to @bson. This is a special + * type that compares higher than all other possible BSON element values. + * + * See http://bsonspec.org for more information on this type. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_maxkey (bson_t *bson, const char *key, int key_length); + + +/** + * bson_append_null: + * @bson: A bson_t. + * @key: The key for the field. + * + * Appends a new field to @bson with NULL for the value. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_null (bson_t *bson, const char *key, int key_length); + + +/** + * bson_append_oid: + * @bson: A bson_t. + * @key: The key for the field. + * @oid: bson_oid_t. + * + * Appends a new field to the @bson of type BSON_TYPE_OID using the contents of + * @oid. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_oid (bson_t *bson, + const char *key, + int key_length, + const bson_oid_t *oid); + + +/** + * bson_append_regex: + * @bson: A bson_t. + * @key: The key of the field. + * @regex: The regex to append to the bson. + * @options: Options for @regex. + * + * Appends a new field to @bson of type BSON_TYPE_REGEX. @regex should + * be the regex string. @options should contain the options for the regex. + * + * Valid options for @options are: + * + * 'i' for case-insensitive. + * 'm' for multiple matching. + * 'x' for verbose mode. + * 'l' to make \w and \W locale dependent. + * 's' for dotall mode ('.' matches everything) + * 'u' to make \w and \W match unicode. + * + * For more detailed information about BSON regex elements, see bsonspec.org. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_regex (bson_t *bson, + const char *key, + int key_length, + const char *regex, + const char *options); + + +/** + * bson_append_regex: + * @bson: A bson_t. + * @key: The key of the field. + * @key_length: The length of the key string. + * @regex: The regex to append to the bson. + * @regex_length: The length of the regex string. + * @options: Options for @regex. + * + * Appends a new field to @bson of type BSON_TYPE_REGEX. @regex should + * be the regex string. @options should contain the options for the regex. + * + * Valid options for @options are: + * + * 'i' for case-insensitive. + * 'm' for multiple matching. + * 'x' for verbose mode. + * 'l' to make \w and \W locale dependent. + * 's' for dotall mode ('.' matches everything) + * 'u' to make \w and \W match unicode. + * + * For more detailed information about BSON regex elements, see bsonspec.org. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_regex_w_len (bson_t *bson, const char *key, int key_length, + const char *regex, int regex_length, + const char *options); + + +/** + * bson_append_utf8: + * @bson: A bson_t. + * @key: The key for the field. + * @value: A UTF-8 encoded string. + * @length: The length of @value or -1 if it is NUL terminated. + * + * Appends a new field to @bson using @key as the key and @value as the UTF-8 + * encoded value. + * + * It is the callers responsibility to ensure @value is valid UTF-8. You can + * use bson_utf8_validate() to perform this check. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_utf8 (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); + + +/** + * bson_append_symbol: + * @bson: A bson_t. + * @key: The key for the field. + * @value: The symbol as a string. + * @length: The length of @value or -1 if NUL-terminated. + * + * Appends a new field to @bson of type BSON_TYPE_SYMBOL. This BSON type is + * deprecated and should not be used in new code. + * + * See http://bsonspec.org for more information on this type. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_symbol (bson_t *bson, + const char *key, + int key_length, + const char *value, + int length); + + +/** + * bson_append_time_t: + * @bson: A bson_t. + * @key: The key for the field. + * @value: A time_t. + * + * Appends a BSON_TYPE_DATE_TIME field to @bson using the time_t @value for the + * number of seconds since UNIX epoch in UTC. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_time_t (bson_t *bson, + const char *key, + int key_length, + time_t value); + + +/** + * bson_append_timeval: + * @bson: A bson_t. + * @key: The key for the field. + * @value: A struct timeval containing the date and time. + * + * Appends a BSON_TYPE_DATE_TIME field to @bson using the struct timeval + * provided. The time is persisted in milliseconds since the UNIX epoch in UTC. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_timeval (bson_t *bson, + const char *key, + int key_length, + struct timeval *value); + + +/** + * bson_append_date_time: + * @bson: A bson_t. + * @key: The key for the field. + * @key_length: The length of @key in bytes or -1 if \0 terminated. + * @value: The number of milliseconds elapsed since UNIX epoch. + * + * Appends a new field to @bson of type BSON_TYPE_DATE_TIME. + * + * Returns: true if successful; otherwise false. + */ +BSON_EXPORT (bool) +bson_append_date_time (bson_t *bson, + const char *key, + int key_length, + int64_t value); + + +/** + * bson_append_now_utc: + * @bson: A bson_t. + * @key: The key for the field. + * @key_length: The length of @key or -1 if it is NULL terminated. + * + * Appends a BSON_TYPE_DATE_TIME field to @bson using the current time in UTC + * as the field value. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_now_utc (bson_t *bson, const char *key, int key_length); + +/** + * bson_append_timestamp: + * @bson: A bson_t. + * @key: The key for the field. + * @timestamp: 4 byte timestamp. + * @increment: 4 byte increment for timestamp. + * + * Appends a field of type BSON_TYPE_TIMESTAMP to @bson. This is a special type + * used by MongoDB replication and sharding. If you need generic time and date + * fields use bson_append_time_t() or bson_append_timeval(). + * + * Setting @increment and @timestamp to zero has special semantics. See + * http://bsonspec.org for more information on this field type. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_timestamp (bson_t *bson, + const char *key, + int key_length, + uint32_t timestamp, + uint32_t increment); + + +/** + * bson_append_undefined: + * @bson: A bson_t. + * @key: The key for the field. + * + * Appends a field of type BSON_TYPE_UNDEFINED. This type is deprecated in the + * spec and should not be used for new code. However, it is provided for those + * needing to interact with legacy systems. + * + * Returns: true if successful; false if append would overflow max size. + */ +BSON_EXPORT (bool) +bson_append_undefined (bson_t *bson, const char *key, int key_length); + + +BSON_EXPORT (bool) +bson_concat (bson_t *dst, const bson_t *src); + + +BSON_END_DECLS + + +#endif /* BSON_H */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/forwarding/bson.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/forwarding/bson.h new file mode 100644 index 0000000..cfe6d06 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/forwarding/bson.h @@ -0,0 +1,18 @@ +/* + * Copyright 2018-present MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Including bson.h is superseded. Use bson/bson.h instead. */ +#include "bson/bson.h" \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/modules/module.modulemap.in b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/modules/module.modulemap.in new file mode 100644 index 0000000..7c087d2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/bson/modules/module.modulemap.in @@ -0,0 +1,5 @@ +framework module bson [system] { + umbrella header "bson.h" + + export * +} \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/CMakeLists.txt new file mode 100644 index 0000000..ffb18a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/CMakeLists.txt @@ -0,0 +1,13 @@ +set (src_libbson_src_jsonsl_DIST_hs + jsonsl.h +) + +set (src_libbson_src_jsonsl_DIST_cs + jsonsl.c +) + +set_dist_list (src_libbson_src_jsonsl_DIST + CMakeLists.txt + ${src_libbson_src_jsonsl_DIST_hs} + ${src_libbson_src_jsonsl_DIST_cs} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.c new file mode 100644 index 0000000..ad14414 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.c @@ -0,0 +1,1668 @@ +/* Copyright (C) 2012-2015 Mark Nunberg. + * + * See included LICENSE file for license details. + */ + +#include "jsonsl.h" +#include "bson/bson-memory.h" + +#include +#include + +#ifdef JSONSL_USE_METRICS +#define XMETRICS \ + X(STRINGY_INSIGNIFICANT) \ + X(STRINGY_SLOWPATH) \ + X(ALLOWED_WHITESPACE) \ + X(QUOTE_FASTPATH) \ + X(SPECIAL_FASTPATH) \ + X(SPECIAL_WSPOP) \ + X(SPECIAL_SLOWPATH) \ + X(GENERIC) \ + X(STRUCTURAL_TOKEN) \ + X(SPECIAL_SWITCHFIRST) \ + X(STRINGY_CATCH) \ + X(NUMBER_FASTPATH) \ + X(ESCAPES) \ + X(TOTAL) \ + +struct jsonsl_metrics_st { +#define X(m) \ + unsigned long metric_##m; + XMETRICS +#undef X +}; + +static struct jsonsl_metrics_st GlobalMetrics = { 0 }; +static unsigned long GenericCounter[0x100] = { 0 }; +static unsigned long StringyCatchCounter[0x100] = { 0 }; + +#define INCR_METRIC(m) \ + GlobalMetrics.metric_##m++; + +#define INCR_GENERIC(c) \ + INCR_METRIC(GENERIC); \ + GenericCounter[c]++; \ + +#define INCR_STRINGY_CATCH(c) \ + INCR_METRIC(STRINGY_CATCH); \ + StringyCatchCounter[c]++; + +JSONSL_API +void jsonsl_dump_global_metrics(void) +{ + int ii; + printf("JSONSL Metrics:\n"); +#define X(m) \ + printf("\t%-30s %20lu (%0.2f%%)\n", #m, GlobalMetrics.metric_##m, \ + (float)((float)(GlobalMetrics.metric_##m/(float)GlobalMetrics.metric_TOTAL)) * 100); + XMETRICS +#undef X + printf("Generic Characters:\n"); + for (ii = 0; ii < 0xff; ii++) { + if (GenericCounter[ii]) { + printf("\t[ %c ] %lu\n", ii, GenericCounter[ii]); + } + } + printf("Weird string loop\n"); + for (ii = 0; ii < 0xff; ii++) { + if (StringyCatchCounter[ii]) { + printf("\t[ %c ] %lu\n", ii, StringyCatchCounter[ii]); + } + } +} + +#else +#define INCR_METRIC(m) +#define INCR_GENERIC(c) +#define INCR_STRINGY_CATCH(c) +JSONSL_API +void jsonsl_dump_global_metrics(void) { } +#endif /* JSONSL_USE_METRICS */ + +#define CASE_DIGITS \ +case '1': \ +case '2': \ +case '3': \ +case '4': \ +case '5': \ +case '6': \ +case '7': \ +case '8': \ +case '9': \ +case '0': + +static unsigned extract_special(unsigned); +static int is_special_end(unsigned); +static int is_allowed_whitespace(unsigned); +static int is_allowed_escape(unsigned); +static int is_simple_char(unsigned); +static char get_escape_equiv(unsigned); + +JSONSL_API +jsonsl_t jsonsl_new(int nlevels) +{ + unsigned int ii; + struct jsonsl_st * jsn; + + if (nlevels < 2) { + return NULL; + } + + jsn = (struct jsonsl_st *) + bson_malloc0(sizeof (*jsn) + + ( (nlevels-1) * sizeof (struct jsonsl_state_st) ) + ); + + jsn->levels_max = (unsigned int) nlevels; + jsn->max_callback_level = UINT_MAX; + jsonsl_reset(jsn); + for (ii = 0; ii < jsn->levels_max; ii++) { + jsn->stack[ii].level = ii; + } + return jsn; +} + +JSONSL_API +void jsonsl_reset(jsonsl_t jsn) +{ + jsn->tok_last = 0; + jsn->can_insert = 1; + jsn->pos = 0; + jsn->level = 0; + jsn->stopfl = 0; + jsn->in_escape = 0; + jsn->expecting = 0; +} + +JSONSL_API +void jsonsl_destroy(jsonsl_t jsn) +{ + if (jsn) { + bson_free(jsn); + } +} + + +#define FASTPARSE_EXHAUSTED 1 +#define FASTPARSE_BREAK 0 + +/* + * This function is meant to accelerate string parsing, reducing the main loop's + * check if we are indeed a string. + * + * @param jsn the parser + * @param[in,out] bytes_p A pointer to the current buffer (i.e. current position) + * @param[in,out] nbytes_p A pointer to the current size of the buffer + * @return true if all bytes have been exhausted (and thus the main loop can + * return), false if a special character was examined which requires greater + * examination. + */ +static int +jsonsl__str_fastparse(jsonsl_t jsn, + const jsonsl_uchar_t **bytes_p, size_t *nbytes_p) +{ + const jsonsl_uchar_t *bytes = *bytes_p; + const jsonsl_uchar_t *end; + for (end = bytes + *nbytes_p; bytes != end; bytes++) { + if ( +#ifdef JSONSL_USE_WCHAR + *bytes >= 0x100 || +#endif /* JSONSL_USE_WCHAR */ + (is_simple_char(*bytes))) { + INCR_METRIC(TOTAL); + INCR_METRIC(STRINGY_INSIGNIFICANT); + } else { + /* Once we're done here, re-calculate the position variables */ + jsn->pos += (bytes - *bytes_p); + *nbytes_p -= (bytes - *bytes_p); + *bytes_p = bytes; + return FASTPARSE_BREAK; + } + } + + /* Once we're done here, re-calculate the position variables */ + jsn->pos += (bytes - *bytes_p); + return FASTPARSE_EXHAUSTED; +} + +/* Functions exactly like str_fastparse, except it also accepts a 'state' + * argument, since the number's value is updated in the state. */ +static int +jsonsl__num_fastparse(jsonsl_t jsn, + const jsonsl_uchar_t **bytes_p, size_t *nbytes_p, + struct jsonsl_state_st *state) +{ + int exhausted = 1; + size_t nbytes = *nbytes_p; + const jsonsl_uchar_t *bytes = *bytes_p; + + for (; nbytes; nbytes--, bytes++) { + jsonsl_uchar_t c = *bytes; + if (isdigit(c)) { + INCR_METRIC(TOTAL); + INCR_METRIC(NUMBER_FASTPATH); + state->nelem = (state->nelem * 10) + (c - 0x30); + } else { + exhausted = 0; + break; + } + } + jsn->pos += (*nbytes_p - nbytes); + if (exhausted) { + return FASTPARSE_EXHAUSTED; + } + *nbytes_p = nbytes; + *bytes_p = bytes; + return FASTPARSE_BREAK; +} + +JSONSL_API +void +jsonsl_feed(jsonsl_t jsn, const jsonsl_char_t *bytes, size_t nbytes) +{ + +#define INVOKE_ERROR(eb) \ + if (jsn->error_callback(jsn, JSONSL_ERROR_##eb, state, (char*)c)) { \ + goto GT_AGAIN; \ + } \ + return; + +#define STACK_PUSH \ + if (jsn->level >= (levels_max-1)) { \ + jsn->error_callback(jsn, JSONSL_ERROR_LEVELS_EXCEEDED, state, (char*)c); \ + return; \ + } \ + state = jsn->stack + (++jsn->level); \ + state->ignore_callback = jsn->stack[jsn->level-1].ignore_callback; \ + state->pos_begin = jsn->pos; + +#define STACK_POP_NOPOS \ + state->pos_cur = jsn->pos; \ + state = jsn->stack + (--jsn->level); + + +#define STACK_POP \ + STACK_POP_NOPOS; \ + state->pos_cur = jsn->pos; + +#define CALLBACK_AND_POP_NOPOS(T) \ + state->pos_cur = jsn->pos; \ + DO_CALLBACK(T, POP); \ + state->nescapes = 0; \ + state = jsn->stack + (--jsn->level); + +#define CALLBACK_AND_POP(T) \ + CALLBACK_AND_POP_NOPOS(T); \ + state->pos_cur = jsn->pos; + +#define SPECIAL_POP \ + CALLBACK_AND_POP(SPECIAL); \ + jsn->expecting = 0; \ + jsn->tok_last = 0; \ + +#define CUR_CHAR (*(jsonsl_uchar_t*)c) + +#define DO_CALLBACK(T, action) \ + if (jsn->call_##T && \ + jsn->max_callback_level > state->level && \ + state->ignore_callback == 0) { \ + \ + if (jsn->action_callback_##action) { \ + jsn->action_callback_##action(jsn, JSONSL_ACTION_##action, state, (jsonsl_char_t*)c); \ + } else if (jsn->action_callback) { \ + jsn->action_callback(jsn, JSONSL_ACTION_##action, state, (jsonsl_char_t*)c); \ + } \ + if (jsn->stopfl) { return; } \ + } + + /** + * Verifies that we are able to insert the (non-string) item into a hash. + */ +#define ENSURE_HVAL \ + if (state->nelem % 2 == 0 && state->type == JSONSL_T_OBJECT) { \ + INVOKE_ERROR(HKEY_EXPECTED); \ + } + +#define VERIFY_SPECIAL(lit) \ + if (CUR_CHAR != (lit)[jsn->pos - state->pos_begin]) { \ + INVOKE_ERROR(SPECIAL_EXPECTED); \ + } + +#define VERIFY_SPECIAL_CI(lit) \ + if (tolower(CUR_CHAR) != (lit)[jsn->pos - state->pos_begin]) { \ + INVOKE_ERROR(SPECIAL_EXPECTED); \ + } + +#define STATE_SPECIAL_LENGTH \ + (state)->nescapes + +#define IS_NORMAL_NUMBER \ + ((state)->special_flags == JSONSL_SPECIALf_UNSIGNED || \ + (state)->special_flags == JSONSL_SPECIALf_SIGNED) + +#define STATE_NUM_LAST jsn->tok_last + +#define CONTINUE_NEXT_CHAR() continue + + const jsonsl_uchar_t *c = (jsonsl_uchar_t*)bytes; + size_t levels_max = jsn->levels_max; + struct jsonsl_state_st *state = jsn->stack + jsn->level; + jsn->base = bytes; + + for (; nbytes; nbytes--, jsn->pos++, c++) { + unsigned state_type; + INCR_METRIC(TOTAL); + + GT_AGAIN: + state_type = state->type; + /* Most common type is typically a string: */ + if (state_type & JSONSL_Tf_STRINGY) { + /* Special escape handling for some stuff */ + if (jsn->in_escape) { + jsn->in_escape = 0; + if (!is_allowed_escape(CUR_CHAR)) { + INVOKE_ERROR(ESCAPE_INVALID); + } else if (CUR_CHAR == 'u') { + DO_CALLBACK(UESCAPE, UESCAPE); + if (jsn->return_UESCAPE) { + return; + } + } + CONTINUE_NEXT_CHAR(); + } + + if (jsonsl__str_fastparse(jsn, &c, &nbytes) == + FASTPARSE_EXHAUSTED) { + /* No need to readjust variables as we've exhausted the iterator */ + return; + } else { + if (CUR_CHAR == '"') { + goto GT_QUOTE; + } else if (CUR_CHAR == '\\') { + goto GT_ESCAPE; + } else { + INVOKE_ERROR(WEIRD_WHITESPACE); + } + } + INCR_METRIC(STRINGY_SLOWPATH); + + } else if (state_type == JSONSL_T_SPECIAL) { + /* Fast track for signed/unsigned */ + if (IS_NORMAL_NUMBER) { + if (jsonsl__num_fastparse(jsn, &c, &nbytes, state) == + FASTPARSE_EXHAUSTED) { + return; + } else { + goto GT_SPECIAL_NUMERIC; + } + } else if (state->special_flags == JSONSL_SPECIALf_DASH) { +#ifdef JSONSL_PARSE_NAN + if (CUR_CHAR == 'I' || CUR_CHAR == 'i') { + /* parsing -Infinity? */ + state->special_flags = JSONSL_SPECIALf_NEG_INF; + CONTINUE_NEXT_CHAR(); + } +#endif + + if (!isdigit(CUR_CHAR)) { + INVOKE_ERROR(INVALID_NUMBER); + } + + if (CUR_CHAR == '0') { + state->special_flags = JSONSL_SPECIALf_ZERO|JSONSL_SPECIALf_SIGNED; + } else if (isdigit(CUR_CHAR)) { + state->special_flags = JSONSL_SPECIALf_SIGNED; + state->nelem = CUR_CHAR - 0x30; + } else { + INVOKE_ERROR(INVALID_NUMBER); + } + CONTINUE_NEXT_CHAR(); + + } else if (state->special_flags == JSONSL_SPECIALf_ZERO) { + if (isdigit(CUR_CHAR)) { + /* Following a zero! */ + INVOKE_ERROR(INVALID_NUMBER); + } + /* Unset the 'zero' flag: */ + if (state->special_flags & JSONSL_SPECIALf_SIGNED) { + state->special_flags = JSONSL_SPECIALf_SIGNED; + } else { + state->special_flags = JSONSL_SPECIALf_UNSIGNED; + } + goto GT_SPECIAL_NUMERIC; + } + + if ((state->special_flags & JSONSL_SPECIALf_NUMERIC) && + !(state->special_flags & JSONSL_SPECIALf_INF)) { + GT_SPECIAL_NUMERIC: + switch (CUR_CHAR) { + CASE_DIGITS + STATE_NUM_LAST = '1'; + CONTINUE_NEXT_CHAR(); + + case '.': + if (state->special_flags & JSONSL_SPECIALf_FLOAT) { + INVOKE_ERROR(INVALID_NUMBER); + } + state->special_flags |= JSONSL_SPECIALf_FLOAT; + STATE_NUM_LAST = '.'; + CONTINUE_NEXT_CHAR(); + + case 'e': + case 'E': + if (state->special_flags & JSONSL_SPECIALf_EXPONENT) { + INVOKE_ERROR(INVALID_NUMBER); + } + state->special_flags |= JSONSL_SPECIALf_EXPONENT; + STATE_NUM_LAST = 'e'; + CONTINUE_NEXT_CHAR(); + + case '-': + case '+': + if (STATE_NUM_LAST != 'e') { + INVOKE_ERROR(INVALID_NUMBER); + } + STATE_NUM_LAST = '-'; + CONTINUE_NEXT_CHAR(); + + default: + if (is_special_end(CUR_CHAR)) { + goto GT_SPECIAL_POP; + } + INVOKE_ERROR(INVALID_NUMBER); + break; + } + } + /* else if (!NUMERIC) */ + if (!is_special_end(CUR_CHAR)) { + STATE_SPECIAL_LENGTH++; + + /* Verify TRUE, FALSE, NULL */ + if (state->special_flags == JSONSL_SPECIALf_TRUE) { + VERIFY_SPECIAL("true"); + } else if (state->special_flags == JSONSL_SPECIALf_FALSE) { + VERIFY_SPECIAL("false"); + } else if (state->special_flags == JSONSL_SPECIALf_NULL) { + VERIFY_SPECIAL("null"); +#ifdef JSONSL_PARSE_NAN + } else if (state->special_flags == JSONSL_SPECIALf_POS_INF) { + VERIFY_SPECIAL_CI("infinity"); + } else if (state->special_flags == JSONSL_SPECIALf_NEG_INF) { + VERIFY_SPECIAL_CI("-infinity"); + } else if (state->special_flags == JSONSL_SPECIALf_NAN) { + VERIFY_SPECIAL_CI("nan"); + } else if (state->special_flags & JSONSL_SPECIALf_NULL || + state->special_flags & JSONSL_SPECIALf_NAN) { + /* previous char was "n", are we parsing null or nan? */ + if (CUR_CHAR != 'u') { + state->special_flags &= ~JSONSL_SPECIALf_NULL; + } + + if (tolower(CUR_CHAR) != 'a') { + state->special_flags &= ~JSONSL_SPECIALf_NAN; + } +#endif + } + INCR_METRIC(SPECIAL_FASTPATH); + CONTINUE_NEXT_CHAR(); + } + + GT_SPECIAL_POP: + jsn->can_insert = 0; + if (IS_NORMAL_NUMBER) { + /* Nothing */ + } else if (state->special_flags == JSONSL_SPECIALf_ZERO || + state->special_flags == (JSONSL_SPECIALf_ZERO|JSONSL_SPECIALf_SIGNED)) { + /* 0 is unsigned! */ + state->special_flags = JSONSL_SPECIALf_UNSIGNED; + } else if (state->special_flags == JSONSL_SPECIALf_DASH) { + /* Still in dash! */ + INVOKE_ERROR(INVALID_NUMBER); + } else if (state->special_flags & JSONSL_SPECIALf_INF) { + if (STATE_SPECIAL_LENGTH != 8) { + INVOKE_ERROR(SPECIAL_INCOMPLETE); + } + state->nelem = 1; + } else if (state->special_flags & JSONSL_SPECIALf_NUMERIC) { + /* Check that we're not at the end of a token */ + if (STATE_NUM_LAST != '1') { + INVOKE_ERROR(INVALID_NUMBER); + } + } else if (state->special_flags == JSONSL_SPECIALf_TRUE) { + if (STATE_SPECIAL_LENGTH != 4) { + INVOKE_ERROR(SPECIAL_INCOMPLETE); + } + state->nelem = 1; + } else if (state->special_flags == JSONSL_SPECIALf_FALSE) { + if (STATE_SPECIAL_LENGTH != 5) { + INVOKE_ERROR(SPECIAL_INCOMPLETE); + } + } else if (state->special_flags == JSONSL_SPECIALf_NULL) { + if (STATE_SPECIAL_LENGTH != 4) { + INVOKE_ERROR(SPECIAL_INCOMPLETE); + } + } + SPECIAL_POP; + jsn->expecting = ','; + if (is_allowed_whitespace(CUR_CHAR)) { + CONTINUE_NEXT_CHAR(); + } + /** + * This works because we have a non-whitespace token + * which is not a special token. If this is a structural + * character then it will be gracefully handled by the + * switch statement. Otherwise it will default to the 'special' + * state again, + */ + goto GT_STRUCTURAL_TOKEN; + } else if (is_allowed_whitespace(CUR_CHAR)) { + INCR_METRIC(ALLOWED_WHITESPACE); + /* So we're not special. Harmless insignificant whitespace + * passthrough + */ + CONTINUE_NEXT_CHAR(); + } else if (extract_special(CUR_CHAR)) { + /* not a string, whitespace, or structural token. must be special */ + goto GT_SPECIAL_BEGIN; + } + + INCR_GENERIC(CUR_CHAR); + + if (CUR_CHAR == '"') { + GT_QUOTE: + jsn->can_insert = 0; + switch (state_type) { + + /* the end of a string or hash key */ + case JSONSL_T_STRING: + CALLBACK_AND_POP(STRING); + CONTINUE_NEXT_CHAR(); + case JSONSL_T_HKEY: + CALLBACK_AND_POP(HKEY); + CONTINUE_NEXT_CHAR(); + + case JSONSL_T_OBJECT: + state->nelem++; + if ( (state->nelem-1) % 2 ) { + /* Odd, this must be a hash value */ + if (jsn->tok_last != ':') { + INVOKE_ERROR(MISSING_TOKEN); + } + jsn->expecting = ','; /* Can't figure out what to expect next */ + jsn->tok_last = 0; + + STACK_PUSH; + state->type = JSONSL_T_STRING; + DO_CALLBACK(STRING, PUSH); + + } else { + /* hash key */ + if (jsn->expecting != '"') { + INVOKE_ERROR(STRAY_TOKEN); + } + jsn->tok_last = 0; + jsn->expecting = ':'; + + STACK_PUSH; + state->type = JSONSL_T_HKEY; + DO_CALLBACK(HKEY, PUSH); + } + CONTINUE_NEXT_CHAR(); + + case JSONSL_T_LIST: + state->nelem++; + STACK_PUSH; + state->type = JSONSL_T_STRING; + jsn->expecting = ','; + jsn->tok_last = 0; + DO_CALLBACK(STRING, PUSH); + CONTINUE_NEXT_CHAR(); + + case JSONSL_T_SPECIAL: + INVOKE_ERROR(STRAY_TOKEN); + break; + + default: + INVOKE_ERROR(STRING_OUTSIDE_CONTAINER); + break; + } /* switch(state->type) */ + } else if (CUR_CHAR == '\\') { + GT_ESCAPE: + INCR_METRIC(ESCAPES); + /* Escape */ + if ( (state->type & JSONSL_Tf_STRINGY) == 0 ) { + INVOKE_ERROR(ESCAPE_OUTSIDE_STRING); + } + state->nescapes++; + jsn->in_escape = 1; + CONTINUE_NEXT_CHAR(); + } /* " or \ */ + + GT_STRUCTURAL_TOKEN: + switch (CUR_CHAR) { + case ':': + INCR_METRIC(STRUCTURAL_TOKEN); + if (jsn->expecting != CUR_CHAR) { + INVOKE_ERROR(STRAY_TOKEN); + } + jsn->tok_last = ':'; + jsn->can_insert = 1; + jsn->expecting = '"'; + CONTINUE_NEXT_CHAR(); + + case ',': + INCR_METRIC(STRUCTURAL_TOKEN); + /** + * The comma is one of the more generic tokens. + * In the context of an OBJECT, the can_insert flag + * should never be set, and no other action is + * necessary. + */ + if (jsn->expecting != CUR_CHAR) { + /* make this branch execute only when we haven't manually + * just placed the ',' in the expecting register. + */ + INVOKE_ERROR(STRAY_TOKEN); + } + + if (state->type == JSONSL_T_OBJECT) { + /* end of hash value, expect a string as a hash key */ + jsn->expecting = '"'; + } else { + jsn->can_insert = 1; + } + + jsn->tok_last = ','; + jsn->expecting = '"'; + CONTINUE_NEXT_CHAR(); + + /* new list or object */ + /* hashes are more common */ + case '{': + case '[': + INCR_METRIC(STRUCTURAL_TOKEN); + if (!jsn->can_insert) { + INVOKE_ERROR(CANT_INSERT); + } + + ENSURE_HVAL; + state->nelem++; + + STACK_PUSH; + /* because the constants match the opening delimiters, we can do this: */ + state->type = CUR_CHAR; + state->nelem = 0; + jsn->can_insert = 1; + if (CUR_CHAR == '{') { + /* If we're a hash, we expect a key first, which is quouted */ + jsn->expecting = '"'; + } + if (CUR_CHAR == JSONSL_T_OBJECT) { + DO_CALLBACK(OBJECT, PUSH); + } else { + DO_CALLBACK(LIST, PUSH); + } + jsn->tok_last = 0; + CONTINUE_NEXT_CHAR(); + + /* closing of list or object */ + case '}': + case ']': + INCR_METRIC(STRUCTURAL_TOKEN); + if (jsn->tok_last == ',' && jsn->options.allow_trailing_comma == 0) { + INVOKE_ERROR(TRAILING_COMMA); + } + + jsn->can_insert = 0; + jsn->level--; + jsn->expecting = ','; + jsn->tok_last = 0; + if (CUR_CHAR == ']') { + if (state->type != '[') { + INVOKE_ERROR(BRACKET_MISMATCH); + } + DO_CALLBACK(LIST, POP); + } else { + if (state->type != '{') { + INVOKE_ERROR(BRACKET_MISMATCH); + } else if (state->nelem && state->nelem % 2 != 0) { + INVOKE_ERROR(VALUE_EXPECTED); + } + DO_CALLBACK(OBJECT, POP); + } + state = jsn->stack + jsn->level; + state->pos_cur = jsn->pos; + CONTINUE_NEXT_CHAR(); + + default: + GT_SPECIAL_BEGIN: + /** + * Not a string, not a structural token, and not benign whitespace. + * Technically we should iterate over the character always, but since + * we are not doing full numerical/value decoding anyway (but only hinting), + * we only check upon entry. + */ + if (state->type != JSONSL_T_SPECIAL) { + int special_flags = extract_special(CUR_CHAR); + if (!special_flags) { + /** + * Try to do some heuristics here anyway to figure out what kind of + * error this is. The 'special' case is a fallback scenario anyway. + */ + if (CUR_CHAR == '\0') { + INVOKE_ERROR(FOUND_NULL_BYTE); + } else if (CUR_CHAR < 0x20) { + INVOKE_ERROR(WEIRD_WHITESPACE); + } else { + INVOKE_ERROR(SPECIAL_EXPECTED); + } + } + ENSURE_HVAL; + state->nelem++; + if (!jsn->can_insert) { + INVOKE_ERROR(CANT_INSERT); + } + STACK_PUSH; + state->type = JSONSL_T_SPECIAL; + state->special_flags = special_flags; + STATE_SPECIAL_LENGTH = 1; + + if (special_flags == JSONSL_SPECIALf_UNSIGNED) { + state->nelem = CUR_CHAR - 0x30; + STATE_NUM_LAST = '1'; + } else { + STATE_NUM_LAST = '-'; + state->nelem = 0; + } + DO_CALLBACK(SPECIAL, PUSH); + } + CONTINUE_NEXT_CHAR(); + } + } +} + +JSONSL_API +const char* jsonsl_strerror(jsonsl_error_t err) +{ + if (err == JSONSL_ERROR_SUCCESS) { + return "SUCCESS"; + } +#define X(t) \ + if (err == JSONSL_ERROR_##t) \ + return #t; + JSONSL_XERR; +#undef X + return ""; +} + +JSONSL_API +const char *jsonsl_strtype(jsonsl_type_t type) +{ +#define X(o,c) \ + if (type == JSONSL_T_##o) \ + return #o; + JSONSL_XTYPE +#undef X + return "UNKNOWN TYPE"; + +} + +/* + * + * JPR/JSONPointer functions + * + * + */ +#ifndef JSONSL_NO_JPR +static +jsonsl_jpr_type_t +populate_component(char *in, + struct jsonsl_jpr_component_st *component, + char **next, + jsonsl_error_t *errp) +{ + unsigned long pctval; + char *c = NULL, *outp = NULL, *end = NULL; + size_t input_len; + jsonsl_jpr_type_t ret = JSONSL_PATH_NONE; + + if (*next == NULL || *(*next) == '\0') { + return JSONSL_PATH_NONE; + } + + /* Replace the next / with a NULL */ + *next = strstr(in, "/"); + if (*next != NULL) { + *(*next) = '\0'; /* drop the forward slash */ + input_len = *next - in; + end = *next; + *next += 1; /* next character after the '/' */ + } else { + input_len = strlen(in); + end = in + input_len + 1; + } + + component->pstr = in; + + /* Check for special components of interest */ + if (*in == JSONSL_PATH_WILDCARD_CHAR && input_len == 1) { + /* Lone wildcard */ + ret = JSONSL_PATH_WILDCARD; + goto GT_RET; + } else if (isdigit(*in)) { + /* ASCII Numeric */ + char *endptr; + component->idx = strtoul(in, &endptr, 10); + if (endptr && *endptr == '\0') { + ret = JSONSL_PATH_NUMERIC; + goto GT_RET; + } + } + + /* Default, it's a string */ + ret = JSONSL_PATH_STRING; + for (c = outp = in; c < end; c++, outp++) { + char origc; + if (*c != '%') { + goto GT_ASSIGN; + } + /* + * c = { [+0] = '%', [+1] = 'b', [+2] = 'e', [+3] = '\0' } + */ + + /* Need %XX */ + if (c+2 >= end) { + *errp = JSONSL_ERROR_PERCENT_BADHEX; + return JSONSL_PATH_INVALID; + } + if (! (isxdigit(*(c+1)) && isxdigit(*(c+2))) ) { + *errp = JSONSL_ERROR_PERCENT_BADHEX; + return JSONSL_PATH_INVALID; + } + + /* Temporarily null-terminate the characters */ + origc = *(c+3); + *(c+3) = '\0'; + pctval = strtoul(c+1, NULL, 16); + *(c+3) = origc; + + *outp = (char) pctval; + c += 2; + continue; + + GT_ASSIGN: + *outp = *c; + } + /* Null-terminate the string */ + for (; outp < c; outp++) { + *outp = '\0'; + } + + GT_RET: + component->ptype = ret; + if (ret != JSONSL_PATH_WILDCARD) { + component->len = strlen(component->pstr); + } + return ret; +} + +JSONSL_API +jsonsl_jpr_t +jsonsl_jpr_new(const char *path, jsonsl_error_t *errp) +{ + char *my_copy = NULL; + int count, curidx; + struct jsonsl_jpr_st *ret = NULL; + struct jsonsl_jpr_component_st *components = NULL; + size_t origlen; + jsonsl_error_t errstacked; + +#define JPR_BAIL(err) *errp = err; goto GT_ERROR; + + if (errp == NULL) { + errp = &errstacked; + } + + if (path == NULL || *path != '/') { + JPR_BAIL(JSONSL_ERROR_JPR_NOROOT); + } + + count = 1; + path++; + { + const char *c = path; + for (; *c; c++) { + if (*c == '/') { + count++; + if (*(c+1) == '/') { + JPR_BAIL(JSONSL_ERROR_JPR_DUPSLASH); + } + } + } + } + if(*path) { + count++; + } + + components = (struct jsonsl_jpr_component_st *) + malloc(sizeof(*components) * count); + if (!components) { + JPR_BAIL(JSONSL_ERROR_ENOMEM); + } + + my_copy = (char *)malloc(strlen(path) + 1); + if (!my_copy) { + JPR_BAIL(JSONSL_ERROR_ENOMEM); + } + + strcpy(my_copy, path); + + components[0].ptype = JSONSL_PATH_ROOT; + + if (*my_copy) { + char *cur = my_copy; + int pathret = JSONSL_PATH_STRING; + curidx = 1; + while (curidx < count) { + pathret = populate_component(cur, components + curidx, &cur, errp); + if (pathret > 0) { + curidx++; + } else { + break; + } + } + + if (pathret == JSONSL_PATH_INVALID) { + JPR_BAIL(JSONSL_ERROR_JPR_BADPATH); + } + } else { + curidx = 1; + } + + path--; /*revert path to leading '/' */ + origlen = strlen(path) + 1; + ret = (struct jsonsl_jpr_st *)malloc(sizeof(*ret)); + if (!ret) { + JPR_BAIL(JSONSL_ERROR_ENOMEM); + } + ret->orig = (char *)malloc(origlen); + if (!ret->orig) { + JPR_BAIL(JSONSL_ERROR_ENOMEM); + } + ret->components = components; + ret->ncomponents = curidx; + ret->basestr = my_copy; + ret->norig = origlen-1; + strcpy(ret->orig, path); + + return ret; + + GT_ERROR: + free(my_copy); + free(components); + if (ret) { + free(ret->orig); + } + free(ret); + return NULL; +#undef JPR_BAIL +} + +void jsonsl_jpr_destroy(jsonsl_jpr_t jpr) +{ + free(jpr->components); + free(jpr->basestr); + free(jpr->orig); + free(jpr); +} + +/** + * Call when there is a possibility of a match, either as a final match or + * as a path within a match + * @param jpr The JPR path + * @param component Component corresponding to the current element + * @param prlevel The level of the *parent* + * @param chtype The type of the child + * @return Match status + */ +static jsonsl_jpr_match_t +jsonsl__match_continue(jsonsl_jpr_t jpr, + const struct jsonsl_jpr_component_st *component, + unsigned prlevel, unsigned chtype) +{ + const struct jsonsl_jpr_component_st *next_comp = component + 1; + if (prlevel == jpr->ncomponents - 1) { + /* This is the match. Check the expected type of the match against + * the child */ + if (jpr->match_type == 0 || jpr->match_type == chtype) { + return JSONSL_MATCH_COMPLETE; + } else { + return JSONSL_MATCH_TYPE_MISMATCH; + } + } + if (chtype == JSONSL_T_LIST) { + if (next_comp->ptype == JSONSL_PATH_NUMERIC) { + return JSONSL_MATCH_POSSIBLE; + } else { + return JSONSL_MATCH_TYPE_MISMATCH; + } + } else if (chtype == JSONSL_T_OBJECT) { + if (next_comp->ptype == JSONSL_PATH_NUMERIC) { + return JSONSL_MATCH_TYPE_MISMATCH; + } else { + return JSONSL_MATCH_POSSIBLE; + } + } else { + return JSONSL_MATCH_TYPE_MISMATCH; + } +} + +JSONSL_API +jsonsl_jpr_match_t +jsonsl_path_match(jsonsl_jpr_t jpr, + const struct jsonsl_state_st *parent, + const struct jsonsl_state_st *child, + const char *key, size_t nkey) +{ + const struct jsonsl_jpr_component_st *comp; + if (!parent) { + /* No parent. Return immediately since it's always a match */ + return jsonsl__match_continue(jpr, jpr->components, 0, child->type); + } + + comp = jpr->components + parent->level; + + /* note that we don't need to verify the type of the match, this is + * always done through the previous call to jsonsl__match_continue. + * If we are in a POSSIBLE tree then we can be certain the types (at + * least at this level) are correct */ + if (parent->type == JSONSL_T_OBJECT) { + if (comp->len != nkey || strncmp(key, comp->pstr, nkey) != 0) { + return JSONSL_MATCH_NOMATCH; + } + } else { + if (comp->idx != parent->nelem - 1) { + return JSONSL_MATCH_NOMATCH; + } + } + return jsonsl__match_continue(jpr, comp, parent->level, child->type); +} + +JSONSL_API +jsonsl_jpr_match_t +jsonsl_jpr_match(jsonsl_jpr_t jpr, + unsigned int parent_type, + unsigned int parent_level, + const char *key, + size_t nkey) +{ + /* find our current component. This is the child level */ + int cmpret; + struct jsonsl_jpr_component_st *p_component; + p_component = jpr->components + parent_level; + + if (parent_level >= jpr->ncomponents) { + return JSONSL_MATCH_NOMATCH; + } + + /* Lone query for 'root' element. Always matches */ + if (parent_level == 0) { + if (jpr->ncomponents == 1) { + return JSONSL_MATCH_COMPLETE; + } else { + return JSONSL_MATCH_POSSIBLE; + } + } + + /* Wildcard, always matches */ + if (p_component->ptype == JSONSL_PATH_WILDCARD) { + if (parent_level == jpr->ncomponents-1) { + return JSONSL_MATCH_COMPLETE; + } else { + return JSONSL_MATCH_POSSIBLE; + } + } + + /* Check numeric array index. This gets its special block so we can avoid + * string comparisons */ + if (p_component->ptype == JSONSL_PATH_NUMERIC) { + if (parent_type == JSONSL_T_LIST) { + if (p_component->idx != nkey) { + /* Wrong index */ + return JSONSL_MATCH_NOMATCH; + } else { + if (parent_level == jpr->ncomponents-1) { + /* This is the last element of the path */ + return JSONSL_MATCH_COMPLETE; + } else { + /* Intermediate element */ + return JSONSL_MATCH_POSSIBLE; + } + } + } else if (p_component->is_arridx) { + /* Numeric and an array index (set explicitly by user). But not + * a list for a parent */ + return JSONSL_MATCH_TYPE_MISMATCH; + } + } else if (parent_type == JSONSL_T_LIST) { + return JSONSL_MATCH_TYPE_MISMATCH; + } + + /* Check lengths */ + if (p_component->len != nkey) { + return JSONSL_MATCH_NOMATCH; + } + + /* Check string comparison */ + cmpret = strncmp(p_component->pstr, key, nkey); + if (cmpret == 0) { + if (parent_level == jpr->ncomponents-1) { + return JSONSL_MATCH_COMPLETE; + } else { + return JSONSL_MATCH_POSSIBLE; + } + } + + return JSONSL_MATCH_NOMATCH; +} + +JSONSL_API +void jsonsl_jpr_match_state_init(jsonsl_t jsn, + jsonsl_jpr_t *jprs, + size_t njprs) +{ + size_t ii, *firstjmp; + if (njprs == 0) { + return; + } + jsn->jprs = (jsonsl_jpr_t *)malloc(sizeof(jsonsl_jpr_t) * njprs); + jsn->jpr_count = njprs; + jsn->jpr_root = (size_t*)calloc(1, sizeof(size_t) * njprs * jsn->levels_max); + memcpy(jsn->jprs, jprs, sizeof(jsonsl_jpr_t) * njprs); + /* Set the initial jump table values */ + + firstjmp = jsn->jpr_root; + for (ii = 0; ii < njprs; ii++) { + firstjmp[ii] = ii+1; + } +} + +JSONSL_API +void jsonsl_jpr_match_state_cleanup(jsonsl_t jsn) +{ + if (jsn->jpr_count == 0) { + return; + } + + free(jsn->jpr_root); + free(jsn->jprs); + jsn->jprs = NULL; + jsn->jpr_root = NULL; + jsn->jpr_count = 0; +} + +/** + * This function should be called exactly once on each element... + * This should also be called in recursive order, since we rely + * on the parent having been initialized for a match. + * + * Since the parent is checked for a match as well, we maintain a 'serial' counter. + * Whenever we traverse an element, we expect the serial to be the same as a global + * integer. If they do not match, we re-initialize the context, and set the serial. + * + * This ensures a type of consistency without having a proactive reset by the + * main lexer itself. + * + */ +JSONSL_API +jsonsl_jpr_t jsonsl_jpr_match_state(jsonsl_t jsn, + struct jsonsl_state_st *state, + const char *key, + size_t nkey, + jsonsl_jpr_match_t *out) +{ + struct jsonsl_state_st *parent_state; + jsonsl_jpr_t ret = NULL; + + /* Jump and JPR tables for our own state and the parent state */ + size_t *jmptable, *pjmptable; + size_t jmp_cur, ii, ourjmpidx; + + if (!jsn->jpr_root) { + *out = JSONSL_MATCH_NOMATCH; + return NULL; + } + + pjmptable = jsn->jpr_root + (jsn->jpr_count * (state->level-1)); + jmptable = pjmptable + jsn->jpr_count; + + /* If the parent cannot match, then invalidate it */ + if (*pjmptable == 0) { + *jmptable = 0; + *out = JSONSL_MATCH_NOMATCH; + return NULL; + } + + parent_state = jsn->stack + state->level - 1; + + if (parent_state->type == JSONSL_T_LIST) { + nkey = (size_t) parent_state->nelem; + } + + *jmptable = 0; + ourjmpidx = 0; + memset(jmptable, 0, sizeof(int) * jsn->jpr_count); + + for (ii = 0; ii < jsn->jpr_count; ii++) { + jmp_cur = pjmptable[ii]; + if (jmp_cur) { + jsonsl_jpr_t jpr = jsn->jprs[jmp_cur-1]; + *out = jsonsl_jpr_match(jpr, + parent_state->type, + parent_state->level, + key, nkey); + if (*out == JSONSL_MATCH_COMPLETE) { + ret = jpr; + *jmptable = 0; + return ret; + } else if (*out == JSONSL_MATCH_POSSIBLE) { + jmptable[ourjmpidx] = ii+1; + ourjmpidx++; + } + } else { + break; + } + } + if (!*jmptable) { + *out = JSONSL_MATCH_NOMATCH; + } + return NULL; +} + +JSONSL_API +const char *jsonsl_strmatchtype(jsonsl_jpr_match_t match) +{ +#define X(T,v) \ + if ( match == JSONSL_MATCH_##T ) \ + return #T; + JSONSL_XMATCH +#undef X + return ""; +} + +#endif /* JSONSL_WITH_JPR */ + +static char * +jsonsl__writeutf8(uint32_t pt, char *out) +{ + #define ADD_OUTPUT(c) *out = (char)(c); out++; + + if (pt < 0x80) { + ADD_OUTPUT(pt); + } else if (pt < 0x800) { + ADD_OUTPUT((pt >> 6) | 0xC0); + ADD_OUTPUT((pt & 0x3F) | 0x80); + } else if (pt < 0x10000) { + ADD_OUTPUT((pt >> 12) | 0xE0); + ADD_OUTPUT(((pt >> 6) & 0x3F) | 0x80); + ADD_OUTPUT((pt & 0x3F) | 0x80); + } else { + ADD_OUTPUT((pt >> 18) | 0xF0); + ADD_OUTPUT(((pt >> 12) & 0x3F) | 0x80); + ADD_OUTPUT(((pt >> 6) & 0x3F) | 0x80); + ADD_OUTPUT((pt & 0x3F) | 0x80); + } + return out; + #undef ADD_OUTPUT +} + +/* Thanks snej (https://github.com/mnunberg/jsonsl/issues/9) */ +static int +jsonsl__digit2int(char ch) { + int d = ch - '0'; + if ((unsigned) d < 10) { + return d; + } + d = ch - 'a'; + if ((unsigned) d < 6) { + return d + 10; + } + d = ch - 'A'; + if ((unsigned) d < 6) { + return d + 10; + } + return -1; +} + +/* Assume 's' is at least 4 bytes long */ +static int +jsonsl__get_uescape_16(const char *s) +{ + int ret = 0; + int cur; + + #define GET_DIGIT(off) \ + cur = jsonsl__digit2int(s[off]); \ + if (cur == -1) { return -1; } \ + ret |= (cur << (12 - (off * 4))); + + GET_DIGIT(0); + GET_DIGIT(1); + GET_DIGIT(2); + GET_DIGIT(3); + #undef GET_DIGIT + return ret; +} + +/** + * Utility function to convert escape sequences + */ +JSONSL_API +size_t jsonsl_util_unescape_ex(const char *in, + char *out, + size_t len, + const int toEscape[128], + unsigned *oflags, + jsonsl_error_t *err, + const char **errat) +{ + const unsigned char *c = (const unsigned char*)in; + char *begin_p = out; + unsigned oflags_s; + uint16_t last_codepoint = 0; + + if (!oflags) { + oflags = &oflags_s; + } + *oflags = 0; + + #define UNESCAPE_BAIL(e,offset) \ + *err = JSONSL_ERROR_##e; \ + if (errat) { \ + *errat = (const char*)(c+ (ptrdiff_t)(offset)); \ + } \ + return 0; + + for (; len; len--, c++, out++) { + int uescval; + if (*c != '\\') { + /* Not an escape, so we don't care about this */ + goto GT_ASSIGN; + } + + if (len < 2) { + UNESCAPE_BAIL(ESCAPE_INVALID, 0); + } + if (!is_allowed_escape(c[1])) { + UNESCAPE_BAIL(ESCAPE_INVALID, 1) + } + if ((toEscape && toEscape[(unsigned char)c[1] & 0x7f] == 0 && + c[1] != '\\' && c[1] != '"')) { + /* if we don't want to unescape this string, write the escape sequence to the output */ + *out++ = *c++; + --len; + goto GT_ASSIGN; + } + + if (c[1] != 'u') { + /* simple skip-and-replace using pre-defined maps. + * TODO: should the maps actually reflect the desired + * replacement character in toEscape? + */ + char esctmp = get_escape_equiv(c[1]); + if (esctmp) { + /* Check if there is a corresponding replacement */ + *out = esctmp; + } else { + /* Just gobble up the 'reverse-solidus' */ + *out = c[1]; + } + len--; + c++; + /* do not assign, just continue */ + continue; + } + + /* next == 'u' */ + if (len < 6) { + /* Need at least six characters.. */ + UNESCAPE_BAIL(UESCAPE_TOOSHORT, 2); + } + + uescval = jsonsl__get_uescape_16((const char *)c + 2); + if (uescval == -1) { + UNESCAPE_BAIL(PERCENT_BADHEX, -1); + } + + if (last_codepoint) { + uint16_t w1 = last_codepoint, w2 = (uint16_t)uescval; + uint32_t cp; + + if (uescval < 0xDC00 || uescval > 0xDFFF) { + UNESCAPE_BAIL(INVALID_CODEPOINT, -1); + } + + cp = (w1 & 0x3FF) << 10; + cp |= (w2 & 0x3FF); + cp += 0x10000; + + out = jsonsl__writeutf8(cp, out) - 1; + last_codepoint = 0; + + } else if (uescval < 0xD800 || uescval > 0xDFFF) { + *oflags |= JSONSL_SPECIALf_NONASCII; + out = jsonsl__writeutf8(uescval, out) - 1; + + } else if (uescval < 0xDC00) { + *oflags |= JSONSL_SPECIALf_NONASCII; + last_codepoint = (uint16_t)uescval; + out--; + } else { + UNESCAPE_BAIL(INVALID_CODEPOINT, 2); + } + + /* Post uescape cleanup */ + len -= 5; /* Gobble up 5 chars after 'u' */ + c += 5; + continue; + + /* Only reached by previous branches */ + GT_ASSIGN: + *out = *c; + } + + if (last_codepoint) { + *err = JSONSL_ERROR_INVALID_CODEPOINT; + return 0; + } + + *err = JSONSL_ERROR_SUCCESS; + return out - begin_p; +} + +/** + * Character Table definitions. + * These were all generated via srcutil/genchartables.pl + */ + +/** + * This table contains the beginnings of non-string + * allowable (bareword) values. + */ +static unsigned short Special_Table[0x100] = { + /* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1f */ + /* 0x20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x2c */ + /* 0x2d */ JSONSL_SPECIALf_DASH /* <-> */, /* 0x2d */ + /* 0x2e */ 0,0, /* 0x2f */ + /* 0x30 */ JSONSL_SPECIALf_ZERO /* <0> */, /* 0x30 */ + /* 0x31 */ JSONSL_SPECIALf_UNSIGNED /* <1> */, /* 0x31 */ + /* 0x32 */ JSONSL_SPECIALf_UNSIGNED /* <2> */, /* 0x32 */ + /* 0x33 */ JSONSL_SPECIALf_UNSIGNED /* <3> */, /* 0x33 */ + /* 0x34 */ JSONSL_SPECIALf_UNSIGNED /* <4> */, /* 0x34 */ + /* 0x35 */ JSONSL_SPECIALf_UNSIGNED /* <5> */, /* 0x35 */ + /* 0x36 */ JSONSL_SPECIALf_UNSIGNED /* <6> */, /* 0x36 */ + /* 0x37 */ JSONSL_SPECIALf_UNSIGNED /* <7> */, /* 0x37 */ + /* 0x38 */ JSONSL_SPECIALf_UNSIGNED /* <8> */, /* 0x38 */ + /* 0x39 */ JSONSL_SPECIALf_UNSIGNED /* <9> */, /* 0x39 */ + /* 0x3a */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x48 */ + /* 0x49 */ JSONSL__INF_PROXY /* */, /* 0x49 */ + /* 0x4a */ 0,0,0,0, /* 0x4d */ + /* 0x4e */ JSONSL__NAN_PROXY /* */, /* 0x4e */ + /* 0x4f */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x65 */ + /* 0x66 */ JSONSL_SPECIALf_FALSE /* */, /* 0x66 */ + /* 0x67 */ 0,0, /* 0x68 */ + /* 0x69 */ JSONSL__INF_PROXY /* */, /* 0x69 */ + /* 0x6a */ 0,0,0,0, /* 0x6d */ + /* 0x6e */ JSONSL_SPECIALf_NULL|JSONSL__NAN_PROXY /* */, /* 0x6e */ + /* 0x6f */ 0,0,0,0,0, /* 0x73 */ + /* 0x74 */ JSONSL_SPECIALf_TRUE /* */, /* 0x74 */ + /* 0x75 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x94 */ + /* 0x95 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xb4 */ + /* 0xb5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xd4 */ + /* 0xd5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xf4 */ + /* 0xf5 */ 0,0,0,0,0,0,0,0,0,0, /* 0xfe */ +}; + +/** + * Contains characters which signal the termination of any of the 'special' bareword + * values. + */ +static int Special_Endings[0x100] = { + /* 0x00 */ 0,0,0,0,0,0,0,0,0, /* 0x08 */ + /* 0x09 */ 1 /* */, /* 0x09 */ + /* 0x0a */ 1 /* */, /* 0x0a */ + /* 0x0b */ 0,0, /* 0x0c */ + /* 0x0d */ 1 /* */, /* 0x0d */ + /* 0x0e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1f */ + /* 0x20 */ 1 /* */, /* 0x20 */ + /* 0x21 */ 0, /* 0x21 */ + /* 0x22 */ 1 /* " */, /* 0x22 */ + /* 0x23 */ 0,0,0,0,0,0,0,0,0, /* 0x2b */ + /* 0x2c */ 1 /* , */, /* 0x2c */ + /* 0x2d */ 0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x39 */ + /* 0x3a */ 1 /* : */, /* 0x3a */ + /* 0x3b */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x5a */ + /* 0x5b */ 1 /* [ */, /* 0x5b */ + /* 0x5c */ 1 /* \ */, /* 0x5c */ + /* 0x5d */ 1 /* ] */, /* 0x5d */ + /* 0x5e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x7a */ + /* 0x7b */ 1 /* { */, /* 0x7b */ + /* 0x7c */ 0, /* 0x7c */ + /* 0x7d */ 1 /* } */, /* 0x7d */ + /* 0x7e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x9d */ + /* 0x9e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xbd */ + /* 0xbe */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xdd */ + /* 0xde */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xfd */ + /* 0xfe */ 0 /* 0xfe */ +}; + +/** + * This table contains entries for the allowed whitespace as per RFC 4627 + */ +static int Allowed_Whitespace[0x100] = { + /* 0x00 */ 0,0,0,0,0,0,0,0,0, /* 0x08 */ + /* 0x09 */ 1 /* */, /* 0x09 */ + /* 0x0a */ 1 /* */, /* 0x0a */ + /* 0x0b */ 0,0, /* 0x0c */ + /* 0x0d */ 1 /* */, /* 0x0d */ + /* 0x0e */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1f */ + /* 0x20 */ 1 /* */, /* 0x20 */ + /* 0x21 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x40 */ + /* 0x41 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x60 */ + /* 0x61 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 */ + /* 0x81 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xa0 */ + /* 0xa1 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xc0 */ + /* 0xc1 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xe0 */ + /* 0xe1 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xfe */ +}; + +static const int String_No_Passthrough[0x100] = { + /* 0x00 */ 1 /* */, /* 0x00 */ + /* 0x01 */ 1 /* */, /* 0x01 */ + /* 0x02 */ 1 /* */, /* 0x02 */ + /* 0x03 */ 1 /* */, /* 0x03 */ + /* 0x04 */ 1 /* */, /* 0x04 */ + /* 0x05 */ 1 /* */, /* 0x05 */ + /* 0x06 */ 1 /* */, /* 0x06 */ + /* 0x07 */ 1 /* */, /* 0x07 */ + /* 0x08 */ 1 /* */, /* 0x08 */ + /* 0x09 */ 1 /* */, /* 0x09 */ + /* 0x0a */ 1 /* */, /* 0x0a */ + /* 0x0b */ 1 /* */, /* 0x0b */ + /* 0x0c */ 1 /* */, /* 0x0c */ + /* 0x0d */ 1 /* */, /* 0x0d */ + /* 0x0e */ 1 /* */, /* 0x0e */ + /* 0x0f */ 1 /* */, /* 0x0f */ + /* 0x10 */ 1 /* */, /* 0x10 */ + /* 0x11 */ 1 /* */, /* 0x11 */ + /* 0x12 */ 1 /* */, /* 0x12 */ + /* 0x13 */ 1 /* */, /* 0x13 */ + /* 0x14 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x21 */ + /* 0x22 */ 1 /* <"> */, /* 0x22 */ + /* 0x23 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x42 */ + /* 0x43 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x5b */ + /* 0x5c */ 1 /* <\> */, /* 0x5c */ + /* 0x5d */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x7c */ + /* 0x7d */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x9c */ + /* 0x9d */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xbc */ + /* 0xbd */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xdc */ + /* 0xdd */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xfc */ + /* 0xfd */ 0,0, /* 0xfe */ +}; + +/** + * Allowable two-character 'common' escapes: + */ +static int Allowed_Escapes[0x100] = { + /* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1f */ + /* 0x20 */ 0,0, /* 0x21 */ + /* 0x22 */ 1 /* <"> */, /* 0x22 */ + /* 0x23 */ 0,0,0,0,0,0,0,0,0,0,0,0, /* 0x2e */ + /* 0x2f */ 1 /* */, /* 0x2f */ + /* 0x30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x4f */ + /* 0x50 */ 0,0,0,0,0,0,0,0,0,0,0,0, /* 0x5b */ + /* 0x5c */ 1 /* <\> */, /* 0x5c */ + /* 0x5d */ 0,0,0,0,0, /* 0x61 */ + /* 0x62 */ 1 /* */, /* 0x62 */ + /* 0x63 */ 0,0,0, /* 0x65 */ + /* 0x66 */ 1 /* */, /* 0x66 */ + /* 0x67 */ 0,0,0,0,0,0,0, /* 0x6d */ + /* 0x6e */ 1 /* */, /* 0x6e */ + /* 0x6f */ 0,0,0, /* 0x71 */ + /* 0x72 */ 1 /* */, /* 0x72 */ + /* 0x73 */ 0, /* 0x73 */ + /* 0x74 */ 1 /* */, /* 0x74 */ + /* 0x75 */ 1 /* */, /* 0x75 */ + /* 0x76 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x95 */ + /* 0x96 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xb5 */ + /* 0xb6 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xd5 */ + /* 0xd6 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xf5 */ + /* 0xf6 */ 0,0,0,0,0,0,0,0,0, /* 0xfe */ +}; + +/** + * This table contains the _values_ for a given (single) escaped character. + */ +static unsigned char Escape_Equivs[0x100] = { + /* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1f */ + /* 0x20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x3f */ + /* 0x40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x5f */ + /* 0x60 */ 0,0, /* 0x61 */ + /* 0x62 */ 8 /* */, /* 0x62 */ + /* 0x63 */ 0,0,0, /* 0x65 */ + /* 0x66 */ 12 /* */, /* 0x66 */ + /* 0x67 */ 0,0,0,0,0,0,0, /* 0x6d */ + /* 0x6e */ 10 /* */, /* 0x6e */ + /* 0x6f */ 0,0,0, /* 0x71 */ + /* 0x72 */ 13 /* */, /* 0x72 */ + /* 0x73 */ 0, /* 0x73 */ + /* 0x74 */ 9 /* */, /* 0x74 */ + /* 0x75 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x94 */ + /* 0x95 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xb4 */ + /* 0xb5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xd4 */ + /* 0xd5 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xf4 */ + /* 0xf5 */ 0,0,0,0,0,0,0,0,0,0 /* 0xfe */ +}; + +/* Definitions of above-declared static functions */ +static char get_escape_equiv(unsigned c) { + return Escape_Equivs[c & 0xff]; +} +static unsigned extract_special(unsigned c) { + return Special_Table[c & 0xff]; +} +static int is_special_end(unsigned c) { + return Special_Endings[c & 0xff]; +} +static int is_allowed_whitespace(unsigned c) { + return c == ' ' || Allowed_Whitespace[c & 0xff]; +} +static int is_allowed_escape(unsigned c) { + return Allowed_Escapes[c & 0xff]; +} +static int is_simple_char(unsigned c) { + return !String_No_Passthrough[c & 0xff]; +} + +/* Clean up all our macros! */ +#undef INCR_METRIC +#undef INCR_GENERIC +#undef INCR_STRINGY_CATCH +#undef CASE_DIGITS +#undef INVOKE_ERROR +#undef STACK_PUSH +#undef STACK_POP_NOPOS +#undef STACK_POP +#undef CALLBACK_AND_POP_NOPOS +#undef CALLBACK_AND_POP +#undef SPECIAL_POP +#undef CUR_CHAR +#undef DO_CALLBACK +#undef ENSURE_HVAL +#undef VERIFY_SPECIAL +#undef STATE_SPECIAL_LENGTH +#undef IS_NORMAL_NUMBER +#undef STATE_NUM_LAST +#undef FASTPARSE_EXHAUSTED +#undef FASTPARSE_BREAK diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.h new file mode 100644 index 0000000..e31a709 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/jsonsl/jsonsl.h @@ -0,0 +1,1004 @@ +/** + * JSON Simple/Stacked/Stateful Lexer. + * - Does not buffer data + * - Maintains state + * - Callback oriented + * - Lightweight and fast. One source file and one header file + * + * Copyright (C) 2012-2015 Mark Nunberg + * See included LICENSE file for license details. + */ + +#ifndef JSONSL_H_ +#define JSONSL_H_ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef JSONSL_USE_WCHAR +typedef jsonsl_char_t wchar_t; +typedef jsonsl_uchar_t unsigned wchar_t; +#else +typedef char jsonsl_char_t; +typedef unsigned char jsonsl_uchar_t; +#endif /* JSONSL_USE_WCHAR */ + +#ifdef JSONSL_PARSE_NAN +#define JSONSL__NAN_PROXY JSONSL_SPECIALf_NAN +#define JSONSL__INF_PROXY JSONSL_SPECIALf_INF +#else +#define JSONSL__NAN_PROXY 0 +#define JSONSL__INF_PROXY 0 +#endif + +/* Stolen from http-parser.h, and possibly others */ +#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600) +typedef __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#if !defined(_MSC_VER) || _MSC_VER<1400 +typedef unsigned int size_t; +typedef int ssize_t; +#endif +#else +#include +#endif + + +#if (!defined(JSONSL_STATE_GENERIC)) && (!defined(JSONSL_STATE_USER_FIELDS)) +#define JSONSL_STATE_GENERIC +#endif /* !defined JSONSL_STATE_GENERIC */ + +#ifdef JSONSL_STATE_GENERIC +#define JSONSL_STATE_USER_FIELDS +#endif /* JSONSL_STATE_GENERIC */ + +/* Additional fields for component object */ +#ifndef JSONSL_JPR_COMPONENT_USER_FIELDS +#define JSONSL_JPR_COMPONENT_USER_FIELDS +#endif + +#ifndef JSONSL_API +/** + * We require a /DJSONSL_DLL so that users already using this as a static + * or embedded library don't get confused + */ +#if defined(_WIN32) && defined(JSONSL_DLL) +#define JSONSL_API __declspec(dllexport) +#else +#define JSONSL_API +#endif /* _WIN32 */ + +#endif /* !JSONSL_API */ + +#ifndef JSONSL_INLINE +#if defined(_MSC_VER) + #define JSONSL_INLINE __inline + #elif defined(__GNUC__) + #define JSONSL_INLINE __inline__ + #else + #define JSONSL_INLINE inline + #endif /* _MSC_VER or __GNUC__ */ +#endif /* JSONSL_INLINE */ + +#define JSONSL_MAX_LEVELS 512 + +struct jsonsl_st; +typedef struct jsonsl_st *jsonsl_t; + +typedef struct jsonsl_jpr_st* jsonsl_jpr_t; + +/** + * This flag is true when AND'd against a type whose value + * must be in "quoutes" i.e. T_HKEY and T_STRING + */ +#define JSONSL_Tf_STRINGY 0xffff00 + +/** + * Constant representing the special JSON types. + * The values are special and aid in speed (the OBJECT and LIST + * values are the char literals of their openings). + * + * Their actual value is a character which attempts to resemble + * some mnemonic reference to the actual type. + * + * If new types are added, they must fit into the ASCII printable + * range (so they should be AND'd with 0x7f and yield something + * meaningful) + */ +#define JSONSL_XTYPE \ + X(STRING, '"'|JSONSL_Tf_STRINGY) \ + X(HKEY, '#'|JSONSL_Tf_STRINGY) \ + X(OBJECT, '{') \ + X(LIST, '[') \ + X(SPECIAL, '^') \ + X(UESCAPE, 'u') +typedef enum { +#define X(o, c) \ + JSONSL_T_##o = c, + JSONSL_XTYPE + JSONSL_T_UNKNOWN = '?', + /* Abstract 'root' object */ + JSONSL_T_ROOT = 0 +#undef X +} jsonsl_type_t; + +/** + * Subtypes for T_SPECIAL. We define them as flags + * because more than one type can be applied to a + * given object. + */ + +#define JSONSL_XSPECIAL \ + X(NONE, 0) \ + X(SIGNED, 1<<0) \ + X(UNSIGNED, 1<<1) \ + X(TRUE, 1<<2) \ + X(FALSE, 1<<3) \ + X(NULL, 1<<4) \ + X(FLOAT, 1<<5) \ + X(EXPONENT, 1<<6) \ + X(NONASCII, 1<<7) \ + X(NAN, 1<<8) \ + X(INF, 1<<9) +typedef enum { +#define X(o,b) \ + JSONSL_SPECIALf_##o = b, + JSONSL_XSPECIAL +#undef X + /* Handy flags for checking */ + + JSONSL_SPECIALf_UNKNOWN = 1 << 10, + + /** @private Private */ + JSONSL_SPECIALf_ZERO = 1 << 11 | JSONSL_SPECIALf_UNSIGNED, + /** @private */ + JSONSL_SPECIALf_DASH = 1 << 12, + /** @private */ + JSONSL_SPECIALf_POS_INF = (JSONSL_SPECIALf_INF), + JSONSL_SPECIALf_NEG_INF = (JSONSL_SPECIALf_INF|JSONSL_SPECIALf_SIGNED), + + /** Type is numeric */ + JSONSL_SPECIALf_NUMERIC = (JSONSL_SPECIALf_SIGNED| JSONSL_SPECIALf_UNSIGNED), + + /** Type is a boolean */ + JSONSL_SPECIALf_BOOLEAN = (JSONSL_SPECIALf_TRUE|JSONSL_SPECIALf_FALSE), + + /** Type is an "extended", not integral type (but numeric) */ + JSONSL_SPECIALf_NUMNOINT = + (JSONSL_SPECIALf_FLOAT|JSONSL_SPECIALf_EXPONENT|JSONSL_SPECIALf_NAN + |JSONSL_SPECIALf_INF) +} jsonsl_special_t; + + +/** + * These are the various types of stack (or other) events + * which will trigger a callback. + * Like the type constants, this are also mnemonic + */ +#define JSONSL_XACTION \ + X(PUSH, '+') \ + X(POP, '-') \ + X(UESCAPE, 'U') \ + X(ERROR, '!') +typedef enum { +#define X(a,c) \ + JSONSL_ACTION_##a = c, + JSONSL_XACTION + JSONSL_ACTION_UNKNOWN = '?' +#undef X +} jsonsl_action_t; + + +/** + * Various errors which may be thrown while parsing JSON + */ +#define JSONSL_XERR \ +/* Trailing garbage characters */ \ + X(GARBAGE_TRAILING) \ +/* We were expecting a 'special' (numeric, true, false, null) */ \ + X(SPECIAL_EXPECTED) \ +/* The 'special' value was incomplete */ \ + X(SPECIAL_INCOMPLETE) \ +/* Found a stray token */ \ + X(STRAY_TOKEN) \ +/* We were expecting a token before this one */ \ + X(MISSING_TOKEN) \ +/* Cannot insert because the container is not ready */ \ + X(CANT_INSERT) \ +/* Found a '\' outside a string */ \ + X(ESCAPE_OUTSIDE_STRING) \ +/* Found a ':' outside of a hash */ \ + X(KEY_OUTSIDE_OBJECT) \ +/* found a string outside of a container */ \ + X(STRING_OUTSIDE_CONTAINER) \ +/* Found a null byte in middle of string */ \ + X(FOUND_NULL_BYTE) \ +/* Current level exceeds limit specified in constructor */ \ + X(LEVELS_EXCEEDED) \ +/* Got a } as a result of an opening [ or vice versa */ \ + X(BRACKET_MISMATCH) \ +/* We expected a key, but got something else instead */ \ + X(HKEY_EXPECTED) \ +/* We got an illegal control character (bad whitespace or something) */ \ + X(WEIRD_WHITESPACE) \ +/* Found a \u-escape, but there were less than 4 following hex digits */ \ + X(UESCAPE_TOOSHORT) \ +/* Invalid two-character escape */ \ + X(ESCAPE_INVALID) \ +/* Trailing comma */ \ + X(TRAILING_COMMA) \ +/* An invalid number was passed in a numeric field */ \ + X(INVALID_NUMBER) \ +/* Value is missing for object */ \ + X(VALUE_EXPECTED) \ +/* The following are for JPR Stuff */ \ + \ +/* Found a literal '%' but it was only followed by a single valid hex digit */ \ + X(PERCENT_BADHEX) \ +/* jsonpointer URI is malformed '/' */ \ + X(JPR_BADPATH) \ +/* Duplicate slash */ \ + X(JPR_DUPSLASH) \ +/* No leading root */ \ + X(JPR_NOROOT) \ +/* Allocation failure */ \ + X(ENOMEM) \ +/* Invalid unicode codepoint detected (in case of escapes) */ \ + X(INVALID_CODEPOINT) + +typedef enum { + JSONSL_ERROR_SUCCESS = 0, +#define X(e) \ + JSONSL_ERROR_##e, + JSONSL_XERR +#undef X + JSONSL_ERROR_GENERIC +} jsonsl_error_t; + + +/** + * A state is a single level of the stack. + * Non-private data (i.e. the 'data' field, see the STATE_GENERIC section) + * will remain in tact until the item is popped. + * + * As a result, it means a parent state object may be accessed from a child + * object, (the parents fields will all be valid). This allows a user to create + * an ad-hoc hierarchy on top of the JSON one. + * + */ +struct jsonsl_state_st { + /** + * The JSON object type + */ + unsigned type; + + /** If this element is special, then its extended type is here */ + unsigned special_flags; + + /** + * The position (in terms of number of bytes since the first call to + * jsonsl_feed()) at which the state was first pushed. This includes + * opening tokens, if applicable. + * + * @note For strings (i.e. type & JSONSL_Tf_STRINGY is nonzero) this will + * be the position of the first quote. + * + * @see jsonsl_st::pos which contains the _current_ position and can be + * used during a POP callback to get the length of the element. + */ + size_t pos_begin; + + /**FIXME: This is redundant as the same information can be derived from + * jsonsl_st::pos at pop-time */ + size_t pos_cur; + + /** + * Level of recursion into nesting. This is mainly a convenience + * variable, as this can technically be deduced from the lexer's + * level parameter (though the logic is not that simple) + */ + unsigned int level; + + + /** + * how many elements in the object/list. + * For objects (hashes), an element is either + * a key or a value. Thus for one complete pair, + * nelem will be 2. + * + * For special types, this will hold the sum of the digits. + * This only holds true for values which are simple signed/unsigned + * numbers. Otherwise a special flag is set, and extra handling is not + * performed. + */ + uint64_t nelem; + + + + /*TODO: merge this and special_flags into a union */ + + + /** + * Useful for an opening nest, this will prevent a callback from being + * invoked on this item or any of its children + */ + int ignore_callback; + + /** + * Counter which is incremented each time an escape ('\') is encountered. + * This is used internally for non-string types and should only be + * inspected by the user if the state actually represents a string + * type. + */ + unsigned int nescapes; + + /** + * Put anything you want here. if JSONSL_STATE_USER_FIELDS is here, then + * the macro expansion happens here. + * + * You can use these fields to store hierarchical or 'tagging' information + * for specific objects. + * + * See the documentation above for the lifetime of the state object (i.e. + * if the private data points to allocated memory, it should be freed + * when the object is popped, as the state object will be re-used) + */ +#ifndef JSONSL_STATE_GENERIC + JSONSL_STATE_USER_FIELDS +#else + + /** + * Otherwise, this is a simple void * pointer for anything you want + */ + void *data; +#endif /* JSONSL_STATE_USER_FIELDS */ +}; + +/**Gets the number of elements in the list. + * @param st The state. Must be of type JSONSL_T_LIST + * @return number of elements in the list + */ +#define JSONSL_LIST_SIZE(st) ((st)->nelem) + +/**Gets the number of key-value pairs in an object + * @param st The state. Must be of type JSONSL_T_OBJECT + * @return the number of key-value pairs in the object + */ +#define JSONSL_OBJECT_SIZE(st) ((st)->nelem / 2) + +/**Gets the numeric value. + * @param st The state. Must be of type JSONSL_T_SPECIAL and + * special_flags must have the JSONSL_SPECIALf_NUMERIC flag + * set. + * @return the numeric value of the state. + */ +#define JSONSL_NUMERIC_VALUE(st) ((st)->nelem) + +/* + * So now we need some special structure for keeping the + * JPR info in sync. Preferably all in a single block + * of memory (there's no need for separate allocations. + * So we will define a 'table' with the following layout + * + * Level nPosbl JPR1_last JPR2_last JPR3_last + * + * 0 1 NOMATCH POSSIBLE POSSIBLE + * 1 0 NOMATCH NOMATCH COMPLETE + * [ table ends here because no further path is possible] + * + * Where the JPR..n corresponds to the number of JPRs + * requested, and nPosble is a quick flag to determine + * + * the number of possibilities. In the future this might + * be made into a proper 'jump' table, + * + * Since we always mark JPRs from the higher levels descending + * into the lower ones, a prospective child match would first + * look at the parent table to check the possibilities, and then + * see which ones were possible.. + * + * Thus, the size of this blob would be (and these are all ints here) + * nLevels * nJPR * 2. + * + * the 'Width' of the table would be nJPR*2, and the 'height' would be + * nlevels + */ + +/** + * This is called when a stack change ocurs. + * + * @param jsn The lexer + * @param action The type of action, this can be PUSH or POP + * @param state A pointer to the stack currently affected by the action + * @param at A pointer to the position of the input buffer which triggered + * this action. + */ +typedef void (*jsonsl_stack_callback)( + jsonsl_t jsn, + jsonsl_action_t action, + struct jsonsl_state_st* state, + const jsonsl_char_t *at); + + +/** + * This is called when an error is encountered. + * Sometimes it's possible to 'erase' characters (by replacing them + * with whitespace). If you think you have corrected the error, you + * can return a true value, in which case the parser will backtrack + * and try again. + * + * @param jsn The lexer + * @param error The error which was thrown + * @param state the current state + * @param a pointer to the position of the input buffer which triggered + * the error. Note that this is not const, this is because you have the + * possibility of modifying the character in an attempt to correct the + * error + * + * @return zero to bail, nonzero to try again (this only makes sense if + * the input buffer has been modified by this callback) + */ +typedef int (*jsonsl_error_callback)( + jsonsl_t jsn, + jsonsl_error_t error, + struct jsonsl_state_st* state, + jsonsl_char_t *at); + +struct jsonsl_st { + /** Public, read-only */ + + /** This is the current level of the stack */ + unsigned int level; + + /** Flag set to indicate we should stop processing */ + unsigned int stopfl; + + /** + * This is the current position, relative to the beginning + * of the stream. + */ + size_t pos; + + /** This is the 'bytes' variable passed to feed() */ + const jsonsl_char_t *base; + + /** Callback invoked for PUSH actions */ + jsonsl_stack_callback action_callback_PUSH; + + /** Callback invoked for POP actions */ + jsonsl_stack_callback action_callback_POP; + + /** Default callback for any action, if neither PUSH or POP callbacks are defined */ + jsonsl_stack_callback action_callback; + + /** + * Do not invoke callbacks for objects deeper than this level. + * NOTE: This field establishes the lower bound for ignored callbacks, + * and is thus misnamed. `min_ignore_level` would actually make more + * sense, but we don't want to break API. + */ + unsigned int max_callback_level; + + /** The error callback. Invoked when an error happens. Should not be NULL */ + jsonsl_error_callback error_callback; + + /* these are boolean flags you can modify. You will be called + * about notification for each of these types if the corresponding + * variable is true. + */ + + /** + * @name Callback Booleans. + * These determine whether a callback is to be invoked for certain types of objects + * @{*/ + + /** Boolean flag to enable or disable the invokcation for events on this type*/ + int call_SPECIAL; + int call_OBJECT; + int call_LIST; + int call_STRING; + int call_HKEY; + /*@}*/ + + /** + * @name u-Escape handling + * Special handling for the \\u-f00d type sequences. These are meant + * to be translated back into the corresponding octet(s). + * A special callback (if set) is invoked with *at=='u'. An application + * may wish to temporarily suspend parsing and handle the 'u-' sequence + * internally (or not). + */ + + /*@{*/ + + /** Callback to be invoked for a u-escape */ + jsonsl_stack_callback action_callback_UESCAPE; + + /** Boolean flag, whether to invoke the callback */ + int call_UESCAPE; + + /** Boolean flag, whether we should return after encountering a u-escape: + * the callback is invoked and then we return if this is true + */ + int return_UESCAPE; + /*@}*/ + + struct { + int allow_trailing_comma; + } options; + + /** Put anything here */ + void *data; + + /*@{*/ + /** Private */ + int in_escape; + char expecting; + char tok_last; + int can_insert; + unsigned int levels_max; + +#ifndef JSONSL_NO_JPR + size_t jpr_count; + jsonsl_jpr_t *jprs; + + /* Root pointer for JPR matching information */ + size_t *jpr_root; +#endif /* JSONSL_NO_JPR */ + /*@}*/ + + /** + * This is the stack. Its upper bound is levels_max, or the + * nlevels argument passed to jsonsl_new. If you modify this structure, + * make sure that this member is last. + */ + struct jsonsl_state_st stack[1]; +}; + + +/** + * Creates a new lexer object, with capacity for recursion up to nlevels + * + * @param nlevels maximum recursion depth + */ +JSONSL_API +jsonsl_t jsonsl_new(int nlevels); + +/** + * Feeds data into the lexer. + * + * @param jsn the lexer object + * @param bytes new data to be fed + * @param nbytes size of new data + */ +JSONSL_API +void jsonsl_feed(jsonsl_t jsn, const jsonsl_char_t *bytes, size_t nbytes); + +/** + * Resets the internal parser state. This does not free the parser + * but does clean it internally, so that the next time feed() is called, + * it will be treated as a new stream + * + * @param jsn the lexer + */ +JSONSL_API +void jsonsl_reset(jsonsl_t jsn); + +/** + * Frees the lexer, cleaning any allocated memory taken + * + * @param jsn the lexer + */ +JSONSL_API +void jsonsl_destroy(jsonsl_t jsn); + +/** + * Gets the 'parent' element, given the current one + * + * @param jsn the lexer + * @param cur the current nest, which should be a struct jsonsl_nest_st + */ +static JSONSL_INLINE +struct jsonsl_state_st *jsonsl_last_state(const jsonsl_t jsn, + const struct jsonsl_state_st *state) +{ + /* Don't complain about overriding array bounds */ + if (state->level > 1) { + return jsn->stack + state->level - 1; + } else { + return NULL; + } +} + +/** + * Gets the state of the last fully consumed child of this parent. This is + * only valid in the parent's POP callback. + * + * @param the lexer + * @return A pointer to the child. + */ +static JSONSL_INLINE +struct jsonsl_state_st *jsonsl_last_child(const jsonsl_t jsn, + const struct jsonsl_state_st *parent) +{ + return jsn->stack + (parent->level + 1); +} + +/**Call to instruct the parser to stop parsing and return. This is valid + * only from within a callback */ +static JSONSL_INLINE +void jsonsl_stop(jsonsl_t jsn) +{ + jsn->stopfl = 1; +} + +/** + * This enables receiving callbacks on all events. Doesn't do + * anything special but helps avoid some boilerplate. + * This does not touch the UESCAPE callbacks or flags. + */ +static JSONSL_INLINE +void jsonsl_enable_all_callbacks(jsonsl_t jsn) +{ + jsn->call_HKEY = 1; + jsn->call_STRING = 1; + jsn->call_OBJECT = 1; + jsn->call_SPECIAL = 1; + jsn->call_LIST = 1; +} + +/** + * A macro which returns true if the current state object can + * have children. This means a list type or an object type. + */ +#define JSONSL_STATE_IS_CONTAINER(state) \ + (state->type == JSONSL_T_OBJECT || state->type == JSONSL_T_LIST) + +/** + * These two functions, dump a string representation + * of the error or type, respectively. They will never + * return NULL + */ +JSONSL_API +const char* jsonsl_strerror(jsonsl_error_t err); +JSONSL_API +const char* jsonsl_strtype(jsonsl_type_t jt); + +/** + * Dumps global metrics to the screen. This is a noop unless + * jsonsl was compiled with JSONSL_USE_METRICS + */ +JSONSL_API +void jsonsl_dump_global_metrics(void); + +/* This macro just here for editors to do code folding */ +#ifndef JSONSL_NO_JPR + +/** + * @name JSON Pointer API + * + * JSONPointer API. This isn't really related to the lexer (at least not yet) + * JSONPointer provides an extremely simple specification for providing + * locations within JSON objects. We will extend it a bit and allow for + * providing 'wildcard' characters by which to be able to 'query' the stream. + * + * See http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-00 + * + * Currently I'm implementing the 'single query' API which can only use a single + * query component. In the future I will integrate my yet-to-be-published + * Boyer-Moore-esque prefix searching implementation, in order to allow + * multiple paths to be merged into one for quick and efficient searching. + * + * + * JPR (as we'll refer to it within the source) can be used by splitting + * the components into multiple sections, and incrementally 'track' each + * component. When JSONSL delivers a 'pop' callback for a string, or a 'push' + * callback for an object, we will check to see whether the index matching + * the component corresponding to the current level contains a match + * for our path. + * + * In order to do this properly, a structure must be maintained within the + * parent indicating whether its children are possible matches. This flag + * will be 'inherited' by call children which may conform to the match + * specification, and discarded by all which do not (thereby eliminating + * their children from inheriting it). + * + * A successful match is a complete one. One can provide multiple paths with + * multiple levels of matches e.g. + * /foo/bar/baz/^/blah + * + * @{ + */ + +/** The wildcard character */ +#ifndef JSONSL_PATH_WILDCARD_CHAR +#define JSONSL_PATH_WILDCARD_CHAR '^' +#endif /* WILDCARD_CHAR */ + +#define JSONSL_XMATCH \ + X(COMPLETE,1) \ + X(POSSIBLE,0) \ + X(NOMATCH,-1) \ + X(TYPE_MISMATCH, -2) + +typedef enum { + +#define X(T,v) \ + JSONSL_MATCH_##T = v, + JSONSL_XMATCH + +#undef X + JSONSL_MATCH_UNKNOWN +} jsonsl_jpr_match_t; + +typedef enum { + JSONSL_PATH_STRING = 1, + JSONSL_PATH_WILDCARD, + JSONSL_PATH_NUMERIC, + JSONSL_PATH_ROOT, + + /* Special */ + JSONSL_PATH_INVALID = -1, + JSONSL_PATH_NONE = 0 +} jsonsl_jpr_type_t; + +struct jsonsl_jpr_component_st { + /** The string the component points to */ + char *pstr; + /** if this is a numeric type, the number is 'cached' here */ + unsigned long idx; + /** The length of the string */ + size_t len; + /** The type of component (NUMERIC or STRING) */ + jsonsl_jpr_type_t ptype; + + /** Set this to true to enforce type checking between dict keys and array + * indices. jsonsl_jpr_match() will return TYPE_MISMATCH if it detects + * that an array index is actually a child of a dictionary. */ + short is_arridx; + + /* Extra fields (for more advanced searches. Default is empty) */ + JSONSL_JPR_COMPONENT_USER_FIELDS +}; + +struct jsonsl_jpr_st { + /** Path components */ + struct jsonsl_jpr_component_st *components; + size_t ncomponents; + + /**Type of the match to be expected. If nonzero, will be compared against + * the actual type */ + unsigned match_type; + + /** Base of allocated string for components */ + char *basestr; + + /** The original match string. Useful for returning to the user */ + char *orig; + size_t norig; +}; + +/** + * Create a new JPR object. + * + * @param path the JSONPointer path specification. + * @param errp a pointer to a jsonsl_error_t. If this function returns NULL, + * then more details will be in this variable. + * + * @return a new jsonsl_jpr_t object, or NULL on error. + */ +JSONSL_API +jsonsl_jpr_t jsonsl_jpr_new(const char *path, jsonsl_error_t *errp); + +/** + * Destroy a JPR object + */ +JSONSL_API +void jsonsl_jpr_destroy(jsonsl_jpr_t jpr); + +/** + * Match a JSON object against a type and specific level + * + * @param jpr the JPR object + * @param parent_type the type of the parent (should be T_LIST or T_OBJECT) + * @param parent_level the level of the parent + * @param key the 'key' of the child. If the parent is an array, this should be + * empty. + * @param nkey - the length of the key. If the parent is an array (T_LIST), then + * this should be the current index. + * + * NOTE: The key of the child means any kind of associative data related to the + * element. Thus: <<< { "foo" : [ >>, + * the opening array's key is "foo". + * + * @return a status constant. This indicates whether a match was excluded, possible, + * or successful. + */ +JSONSL_API +jsonsl_jpr_match_t jsonsl_jpr_match(jsonsl_jpr_t jpr, + unsigned int parent_type, + unsigned int parent_level, + const char *key, size_t nkey); + +/** + * Alternate matching algorithm. This matching algorithm does not use + * JSONPointer but relies on a more structured searching mechanism. It + * assumes that there is a clear distinction between array indices and + * object keys. In this case, the jsonsl_path_component_st::ptype should + * be set to @ref JSONSL_PATH_NUMERIC for an array index (the + * jsonsl_path_comonent_st::is_arridx field will be removed in a future + * version). + * + * @param jpr The path + * @param parent The parent structure. Can be NULL if this is the root object + * @param child The child structure. Should not be NULL + * @param key Object key, if an object + * @param nkey Length of object key + * @return Status constant if successful + * + * @note + * For successful matching, both the key and the path itself should be normalized + * to contain 'proper' utf8 sequences rather than utf16 '\uXXXX' escapes. This + * should currently be done in the application. Another version of this function + * may use a temporary buffer in such circumstances (allocated by the application). + * + * Since this function also checks the state of the child, it should only + * be called on PUSH callbacks, and not POP callbacks + */ +JSONSL_API +jsonsl_jpr_match_t +jsonsl_path_match(jsonsl_jpr_t jpr, + const struct jsonsl_state_st *parent, + const struct jsonsl_state_st *child, + const char *key, size_t nkey); + + +/** + * Associate a set of JPR objects with a lexer instance. + * This should be called before the lexer has been fed any data (and + * behavior is undefined if you don't adhere to this). + * + * After using this function, you may subsequently call match_state() on + * given states (presumably from within the callbacks). + * + * Note that currently the first JPR is the quickest and comes + * pre-allocated with the state structure. Further JPR objects + * are chained. + * + * @param jsn The lexer + * @param jprs An array of jsonsl_jpr_t objects + * @param njprs How many elements in the jprs array. + */ +JSONSL_API +void jsonsl_jpr_match_state_init(jsonsl_t jsn, + jsonsl_jpr_t *jprs, + size_t njprs); + +/** + * This follows the same semantics as the normal match, + * except we infer parent and type information from the relevant state objects. + * The match status (for all possible JPR objects) is set in the *out parameter. + * + * If a match has succeeded, then its JPR object will be returned. In all other + * instances, NULL is returned; + * + * @param jpr The jsonsl_jpr_t handle + * @param state The jsonsl_state_st which is a candidate + * @param key The hash key (if applicable, can be NULL if parent is list) + * @param nkey Length of hash key (if applicable, can be zero if parent is list) + * @param out A pointer to a jsonsl_jpr_match_t. This will be populated with + * the match result + * + * @return If a match was completed in full, then the JPR object containing + * the matching path will be returned. Otherwise, the return is NULL (note, this + * does not mean matching has failed, it can still be part of the match: check + * the out parameter). + */ +JSONSL_API +jsonsl_jpr_t jsonsl_jpr_match_state(jsonsl_t jsn, + struct jsonsl_state_st *state, + const char *key, + size_t nkey, + jsonsl_jpr_match_t *out); + + +/** + * Cleanup any memory allocated and any states set by + * match_state_init() and match_state() + * @param jsn The lexer + */ +JSONSL_API +void jsonsl_jpr_match_state_cleanup(jsonsl_t jsn); + +/** + * Return a string representation of the match result returned by match() + */ +JSONSL_API +const char *jsonsl_strmatchtype(jsonsl_jpr_match_t match); + +/* @}*/ + +/** + * Utility function to convert escape sequences into their original form. + * + * The decoders I've sampled do not seem to specify a standard behavior of what + * to escape/unescape. + * + * RFC 4627 Mandates only that the quoute, backslash, and ASCII control + * characters (0x00-0x1f) be escaped. It is often common for applications + * to escape a '/' - however this may also be desired behavior. the JSON + * spec is not clear on this, and therefore jsonsl leaves it up to you. + * + * Additionally, sometimes you may wish to _normalize_ JSON. This is specifically + * true when dealing with 'u-escapes' which can be expressed perfectly fine + * as utf8. One use case for normalization is JPR string comparison, in which + * case two effectively equivalent strings may not match because one is using + * u-escapes and the other proper utf8. To normalize u-escapes only, pass in + * an empty `toEscape` table, enabling only the `u` index. + * + * @param in The input string. + * @param out An allocated output (should be the same size as in) + * @param len the size of the buffer + * @param toEscape - A sparse array of characters to unescape. Characters + * which are not present in this array, e.g. toEscape['c'] == 0 will be + * ignored and passed to the output in their original form. + * @param oflags If not null, and a \uXXXX escape expands to a non-ascii byte, + * then this variable will have the SPECIALf_NONASCII flag on. + * + * @param err A pointer to an error variable. If an error ocurrs, it will be + * set in this variable + * @param errat If not null and an error occurs, this will be set to point + * to the position within the string at which the offending character was + * encountered. + * + * @return The effective size of the output buffer. + * + * @note + * This function now encodes the UTF8 equivalents of utf16 escapes (i.e. + * 'u-escapes'). Previously this would encode the escapes as utf16 literals, + * which while still correct in some sense was confusing for many (especially + * considering that the inputs were variations of char). + * + * @note + * The output buffer will never be larger than the input buffer, since + * standard escape sequences (i.e. '\t') occupy two bytes in the source + * but only one byte (when unescaped) in the output. Likewise u-escapes + * (i.e. \uXXXX) will occupy six bytes in the source, but at the most + * two bytes when escaped. + */ +JSONSL_API +size_t jsonsl_util_unescape_ex(const char *in, + char *out, + size_t len, + const int toEscape[128], + unsigned *oflags, + jsonsl_error_t *err, + const char **errat); + +/** + * Convenience macro to avoid passing too many parameters + */ +#define jsonsl_util_unescape(in, out, len, toEscape, err) \ + jsonsl_util_unescape_ex(in, out, len, toEscape, NULL, err, NULL) + +#endif /* JSONSL_NO_JPR */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* JSONSL_H_ */ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-1.0.pc.in b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-1.0.pc.in new file mode 100644 index 0000000..b65abbc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-1.0.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +includedir=${exec_prefix}/include + +Name: libbson +Description: The libbson BSON serialization library. +Version: @VERSION@ +Libs: -L${libdir} -lbson-@BSON_API_VERSION@ +Cflags: -I${includedir}/libbson-@BSON_API_VERSION@ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-static-1.0.pc.in b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-static-1.0.pc.in new file mode 100644 index 0000000..6ee58d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/src/libbson-static-1.0.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +includedir=${exec_prefix}/include + +Name: libbson static archive +Description: The libbson BSON serialization library. +Version: @VERSION@ +Libs: -L${libdir} -lbson-static-@BSON_API_VERSION@ @LIBBSON_LIBRARIES@ +Cflags: -I${includedir}/libbson-@BSON_API_VERSION@ -DBSON_STATIC diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/CMakeLists.txt new file mode 100644 index 0000000..db9e4e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/CMakeLists.txt @@ -0,0 +1,12 @@ +file (GLOB_RECURSE src_libbson_tests_DIST_cs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c) +file (GLOB_RECURSE src_libbson_tests_DIST_hs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) +file (GLOB_RECURSE src_libbson_tests_DIST_bsons RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.bson) +file (GLOB_RECURSE src_libbson_tests_DIST_jsons RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.json) + +set_dist_list (src_libbson_tests_DIST + CMakeLists.txt + ${src_libbson_tests_DIST_cs} + ${src_libbson_tests_DIST_hs} + ${src_libbson_tests_DIST_bsons} + ${src_libbson_tests_DIST_jsons} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/binary_deprecated.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/binary_deprecated.bson new file mode 100644 index 0000000..efac921 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/binary_deprecated.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/cdriver2269.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/cdriver2269.bson new file mode 100644 index 0000000..e302f87 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/cdriver2269.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/code_w_empty_scope.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/code_w_empty_scope.bson new file mode 100644 index 0000000..7cb594c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/code_w_empty_scope.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/codewscope.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/codewscope.bson new file mode 100644 index 0000000..cb20ed0 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/codewscope.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dollarquery.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dollarquery.bson new file mode 100644 index 0000000..62cbe1e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dollarquery.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotkey.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotkey.bson new file mode 100644 index 0000000..4bba21c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotkey.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotquery.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotquery.bson new file mode 100644 index 0000000..93fdc75 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/dotquery.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/empty_key.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/empty_key.bson new file mode 100644 index 0000000..2bb6762 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/empty_key.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/eurokey.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/eurokey.bson new file mode 100644 index 0000000..a51516b Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/eurokey.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow1.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow1.bson new file mode 100644 index 0000000..99a940c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow1.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow2.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow2.bson new file mode 100644 index 0000000..71f1f71 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow2.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow3.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow3.bson new file mode 100644 index 0000000..cd0f7f2 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow3.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow4.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow4.bson new file mode 100644 index 0000000..c3e853e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/overflow4.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/readergrow.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/readergrow.bson new file mode 100644 index 0000000..2542b7f Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/readergrow.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stackoverflow.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stackoverflow.bson new file mode 100644 index 0000000..7316c04 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stackoverflow.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream.bson new file mode 100644 index 0000000..69668e2 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream_corrupt.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream_corrupt.bson new file mode 100644 index 0000000..e494669 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/stream_corrupt.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test1.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test1.bson new file mode 100644 index 0000000..38942ab Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test1.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test10.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test10.bson new file mode 100644 index 0000000..c014085 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test10.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test11.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test11.bson new file mode 100644 index 0000000..fdfed2e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test11.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test12.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test12.bson new file mode 100644 index 0000000..8e303c1 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test12.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test13.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test13.bson new file mode 100644 index 0000000..74f6b99 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test13.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test14.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test14.bson new file mode 100644 index 0000000..f7daf3e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test14.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test15.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test15.bson new file mode 100644 index 0000000..379eced Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test15.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test16.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test16.bson new file mode 100644 index 0000000..a1d263c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test16.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test17.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test17.bson new file mode 100644 index 0000000..89eef41 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test17.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test18.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test18.bson new file mode 100644 index 0000000..4ef3e53 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test18.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test19.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test19.bson new file mode 100644 index 0000000..3f0974b Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test19.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test2.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test2.bson new file mode 100644 index 0000000..ca51f05 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test2.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test20.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test20.bson new file mode 100644 index 0000000..5caced6 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test20.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test21.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test21.bson new file mode 100644 index 0000000..f19530e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test21.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test22.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test22.bson new file mode 100644 index 0000000..e8022e0 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test22.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test23.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test23.bson new file mode 100644 index 0000000..43656d9 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test23.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test24.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test24.bson new file mode 100644 index 0000000..efadae0 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test24.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test25.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test25.bson new file mode 100644 index 0000000..8965c8e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test25.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test26.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test26.bson new file mode 100644 index 0000000..64a2ea0 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test26.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test27.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test27.bson new file mode 100644 index 0000000..8133e35 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test27.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test28.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test28.bson new file mode 100644 index 0000000..4356b12 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test28.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test29.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test29.bson new file mode 100644 index 0000000..191eb8f Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test29.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test3.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test3.bson new file mode 100644 index 0000000..d9ae1a9 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test3.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test30.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test30.bson new file mode 100644 index 0000000..191eb8f Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test30.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test31.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test31.bson new file mode 100644 index 0000000..24c2052 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test31.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test32.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test32.bson new file mode 100644 index 0000000..4a6f55c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test32.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test33.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test33.bson new file mode 100644 index 0000000..c8fc61d Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test33.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test34.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test34.bson new file mode 100644 index 0000000..c7f3890 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test34.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test35.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test35.bson new file mode 100644 index 0000000..d3fcec1 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test35.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test36.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test36.bson new file mode 100644 index 0000000..bcb5268 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test36.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test37.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test37.bson new file mode 100644 index 0000000..1b103c8 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test37.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test38.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test38.bson new file mode 100644 index 0000000..4a18b47 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test38.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test39.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test39.bson new file mode 100644 index 0000000..c255156 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test39.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test4.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test4.bson new file mode 100644 index 0000000..db626b3 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test4.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test40.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test40.bson new file mode 100644 index 0000000..8843698 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test40.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test41.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test41.bson new file mode 100644 index 0000000..c6a6c66 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test41.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test42.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test42.bson new file mode 100644 index 0000000..0717425 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test42.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test43.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test43.bson new file mode 100644 index 0000000..8b762fa Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test43.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test44.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test44.bson new file mode 100644 index 0000000..8a5ccf1 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test44.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test45.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test45.bson new file mode 100644 index 0000000..e845a1f Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test45.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test46.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test46.bson new file mode 100644 index 0000000..f939b23 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test46.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test47.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test47.bson new file mode 100644 index 0000000..5200aee Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test47.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test48.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test48.bson new file mode 100644 index 0000000..29d72f4 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test48.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test49.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test49.bson new file mode 100644 index 0000000..bb10d6a Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test49.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test5.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test5.bson new file mode 100644 index 0000000..ae5b828 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test5.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test50.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test50.bson new file mode 100644 index 0000000..01a780a Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test50.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test51.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test51.bson new file mode 100644 index 0000000..7db1d9c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test51.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test52.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test52.bson new file mode 100644 index 0000000..d777df8 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test52.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test53.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test53.bson new file mode 100644 index 0000000..f735154 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test53.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test54.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test54.bson new file mode 100644 index 0000000..0a567ce Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test54.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test55.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test55.bson new file mode 100644 index 0000000..0c0d33f Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test55.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test56.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test56.bson new file mode 100644 index 0000000..7f49315 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test56.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test57.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test57.bson new file mode 100644 index 0000000..b699c20 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test57.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test58.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test58.bson new file mode 100644 index 0000000..671db10 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test58.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test59.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test59.bson new file mode 100644 index 0000000..5fd8be0 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test59.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test6.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test6.bson new file mode 100644 index 0000000..3750cb1 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test6.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test7.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test7.bson new file mode 100644 index 0000000..e103982 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test7.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test8.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test8.bson new file mode 100644 index 0000000..7ce525d Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test8.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test9.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test9.bson new file mode 100644 index 0000000..81c3de8 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/test9.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/trailingnull.bson b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/trailingnull.bson new file mode 100644 index 0000000..9f1c9c4 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/binary/trailingnull.bson differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.c new file mode 100644 index 0000000..0e34cf0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.c @@ -0,0 +1,185 @@ +/* + * Copyright 2016 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "corpus-test.h" + + +#ifdef _MSC_VER +#define SSCANF sscanf_s +#else +#define SSCANF sscanf +#endif + +void +corpus_test_print_description (const char *description) +{ + if (test_suite_debug_output ()) { + printf (" - %s\n", description); + fflush (stdout); + } +} + +uint8_t * +corpus_test_unhexlify (bson_iter_t *iter, uint32_t *bson_str_len) +{ + const char *hex_str; + uint8_t *data = NULL; + unsigned int byte; + uint32_t tmp; + int x = 0; + int i = 0; + + ASSERT (BSON_ITER_HOLDS_UTF8 (iter)); + hex_str = bson_iter_utf8 (iter, &tmp); + *bson_str_len = tmp / 2; + data = bson_malloc (*bson_str_len); + while (SSCANF (&hex_str[i], "%2x", &byte) == 1) { + data[x++] = (uint8_t) byte; + i += 2; + } + + return data; +} + + +void +corpus_test (bson_t *scenario, + test_bson_valid_cb valid, + test_bson_decode_error_cb decode_error, + test_bson_parse_error_cb parse_error) +{ + bson_iter_t iter; + bson_iter_t inner_iter; + const char *scenario_description = NULL; + bson_type_t bson_type; + + BSON_ASSERT (scenario); + + BSON_ASSERT (bson_iter_init_find (&iter, scenario, "description")); + scenario_description = bson_iter_utf8 (&iter, NULL); + + BSON_ASSERT (bson_iter_init_find (&iter, scenario, "bson_type")); + /* like "0x0C */ + if (sscanf (bson_iter_utf8 (&iter, NULL), "%i", (int *) &bson_type) != 1) { + fprintf ( + stderr, "Couldn't parse bson_type %s\n", bson_iter_utf8 (&iter, NULL)); + abort (); + } + + /* test valid BSON and Extended JSON */ + if (bson_iter_init_find (&iter, scenario, "valid")) { + BSON_ASSERT (bson_iter_recurse (&iter, &inner_iter)); + while (bson_iter_next (&inner_iter)) { + bson_iter_t test_iter; + test_bson_valid_type_t test = {scenario_description, bson_type, NULL}; + + BSON_ASSERT (bson_iter_recurse (&inner_iter, &test_iter)); + while (bson_iter_next (&test_iter)) { + const char *key = bson_iter_key (&test_iter); + + if (!strcmp (key, "description")) { + test.test_description = bson_iter_utf8 (&test_iter, NULL); + corpus_test_print_description (test.test_description); + } + + if (!strcmp (key, "canonical_bson")) { + test.cB = corpus_test_unhexlify (&test_iter, &test.cB_len); + } + + if (!strcmp (key, "degenerate_bson")) { + test.dB = corpus_test_unhexlify (&test_iter, &test.dB_len); + } + + if (!strcmp (key, "canonical_extjson")) { + test.cE = bson_iter_utf8 (&test_iter, NULL); + } + + if (!strcmp (key, "degenerate_extjson")) { + test.dE = bson_iter_utf8 (&test_iter, NULL); + } + + if (!strcmp (key, "relaxed_extjson")) { + test.rE = bson_iter_utf8 (&test_iter, NULL); + } + + if (!strcmp (key, "lossy")) { + test.lossy = bson_iter_bool (&test_iter); + } + } + + /* execute the test callback */ + valid (&test); + + bson_free (test.cB); + bson_free (test.dB); + } + } + + /* test decoding errors (i.e. invalid BSON) */ + if (bson_iter_init_find (&iter, scenario, "decodeErrors")) { + BSON_ASSERT (bson_iter_recurse (&iter, &inner_iter)); + while (bson_iter_next (&inner_iter)) { + bson_iter_t test_iter; + test_bson_decode_error_type_t test = { + scenario_description, bson_type, NULL}; + + BSON_ASSERT (bson_iter_recurse (&inner_iter, &test_iter)); + while (bson_iter_next (&test_iter)) { + if (!strcmp (bson_iter_key (&test_iter), "description")) { + test.test_description = bson_iter_utf8 (&test_iter, NULL); + corpus_test_print_description (test.test_description); + } + + if (!strcmp (bson_iter_key (&test_iter), "bson")) { + test.bson = corpus_test_unhexlify (&test_iter, &test.bson_len); + } + } + + /* execute the test callback */ + decode_error (&test); + + bson_free (test.bson); + } + } + + /* test parsing errors (e.g. invalid JSON or Decimal128 strings) */ + if (bson_iter_init_find (&iter, scenario, "parseErrors")) { + BSON_ASSERT (bson_iter_recurse (&iter, &inner_iter)); + while (bson_iter_next (&inner_iter)) { + bson_iter_t test_iter; + test_bson_parse_error_type_t test = { + scenario_description, bson_type, NULL}; + + BSON_ASSERT (bson_iter_recurse (&inner_iter, &test_iter)); + while (bson_iter_next (&test_iter)) { + if (!strcmp (bson_iter_key (&test_iter), "description")) { + test.test_description = bson_iter_utf8 (&test_iter, NULL); + corpus_test_print_description (test.test_description); + } + + if (!strcmp (bson_iter_key (&test_iter), "string")) { + test.str = bson_iter_utf8 (&test_iter, &test.str_len); + } + } + + /* execute the test callback */ + parse_error (&test); + } + } +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.h b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.h new file mode 100644 index 0000000..1474b2f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/corpus-test.h @@ -0,0 +1,83 @@ +/* + * Copyright 2017 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CORPUS_TEST_H +#define CORPUS_TEST_H + +#include "TestSuite.h" + +#include + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-validity +*/ +typedef struct _test_bson_valid_type_t { + const char *scenario_description; + bson_type_t bson_type; + const char *test_description; + uint8_t *cB; /* "canonical_bson" */ + uint32_t cB_len; + uint8_t *dB; /* "degenerate_bson" */ + uint32_t dB_len; + const char *cE; /* "canonical_extjson" */ + const char *rE; /* "relaxed_extjson" */ + const char *dE; /* "degenerate_extjson" */ + bool lossy; +} test_bson_valid_type_t; + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-decode-errors + */ +typedef struct _test_bson_decode_error_type_t { + const char *scenario_description; + bson_type_t bson_type; + const char *test_description; + uint8_t *bson; + uint32_t bson_len; +} test_bson_decode_error_type_t; + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-parsing-errors + */ +typedef struct _test_bson_parse_error_type_t { + const char *scenario_description; + bson_type_t bson_type; + const char *test_description; + const char *str; + uint32_t str_len; +} test_bson_parse_error_type_t; + +typedef void (*test_bson_valid_cb) (test_bson_valid_type_t *test); +typedef void (*test_bson_decode_error_cb) (test_bson_decode_error_type_t *test); +typedef void (*test_bson_parse_error_cb) (test_bson_parse_error_type_t *test); + +void +corpus_test_print_description (const char *description); +uint8_t * +corpus_test_unhexlify (bson_iter_t *iter, uint32_t *bson_str_len); +void +corpus_test (bson_t *scenario, + test_bson_valid_cb valid, + test_bson_decode_error_cb decode_error, + test_bson_parse_error_cb parse_error); + +#endif diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/array.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/array.json new file mode 100644 index 0000000..1c654cf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/array.json @@ -0,0 +1,43 @@ +{ + "description": "Array", + "bson_type": "0x04", + "test_key": "a", + "valid": [ + { + "description": "Empty", + "canonical_bson": "0D000000046100050000000000", + "canonical_extjson": "{\"a\" : []}" + }, + { + "description": "Single Element Array", + "canonical_bson": "140000000461000C0000001030000A0000000000", + "canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}" + }, + { + "description": "Single Element Array with index set incorrectly", + "degenerate_bson": "130000000461000B00000010000A0000000000", + "canonical_bson": "140000000461000C0000001030000A0000000000", + "canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}" + }, + { + "description": "Single Element Array with index set incorrectly", + "degenerate_bson": "150000000461000D000000106162000A0000000000", + "canonical_bson": "140000000461000C0000001030000A0000000000", + "canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}" + } + ], + "decodeErrors": [ + { + "description": "Array length too long: eats outer terminator", + "bson": "140000000461000D0000001030000A0000000000" + }, + { + "description": "Array length too short: leaks terminator", + "bson": "140000000461000B0000001030000A0000000000" + }, + { + "description": "Invalid Array: bad string length in field", + "bson": "1A00000004666F6F00100000000230000500000062617A000000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/binary.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/binary.json new file mode 100644 index 0000000..90a15c1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/binary.json @@ -0,0 +1,85 @@ +{ + "description": "Binary type", + "bson_type": "0x05", + "test_key": "x", + "valid": [ + { + "description": "subtype 0x00 (Zero-length)", + "canonical_bson": "0D000000057800000000000000", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}" + }, + { + "description": "subtype 0x00 (Zero-length, keys reversed)", + "canonical_bson": "0D000000057800000000000000", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}", + "degenerate_extjson": "{\"x\" : { \"$binary\" : {\"subType\" : \"00\", \"base64\" : \"\"}}}" + }, + { + "description": "subtype 0x00", + "canonical_bson": "0F0000000578000200000000FFFF00", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"00\"}}}" + }, + { + "description": "subtype 0x01", + "canonical_bson": "0F0000000578000200000001FFFF00", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"01\"}}}" + }, + { + "description": "subtype 0x02", + "canonical_bson": "13000000057800060000000202000000FFFF00", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"02\"}}}" + }, + { + "description": "subtype 0x03", + "canonical_bson": "1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"03\"}}}" + }, + { + "description": "subtype 0x04", + "canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}" + }, + { + "description": "subtype 0x05", + "canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"05\"}}}" + }, + { + "description": "subtype 0x80", + "canonical_bson": "0F0000000578000200000080FFFF00", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"80\"}}}" + }, + { + "description": "$type query operator (conflicts with legacy $binary form with $type field)", + "canonical_bson": "1F000000037800170000000224747970650007000000737472696E67000000", + "canonical_extjson": "{\"x\" : { \"$type\" : \"string\"}}" + }, + { + "description": "$type query operator (conflicts with legacy $binary form with $type field)", + "canonical_bson": "180000000378001000000010247479706500020000000000", + "canonical_extjson": "{\"x\" : { \"$type\" : {\"$numberInt\": \"2\"}}}" + } + ], + "decodeErrors": [ + { + "description": "Length longer than document", + "bson": "1D000000057800FF0000000573FFD26444B34C6990E8E7D1DFC035D400" + }, + { + "description": "Negative length", + "bson": "0D000000057800FFFFFFFF0000" + }, + { + "description": "subtype 0x02 length too long ", + "bson": "13000000057800060000000203000000FFFF00" + }, + { + "description": "subtype 0x02 length too short", + "bson": "13000000057800060000000201000000FFFF00" + }, + { + "description": "subtype 0x02 length negative one", + "bson": "130000000578000600000002FFFFFFFFFFFF00" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/boolean.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/boolean.json new file mode 100644 index 0000000..84c2822 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/boolean.json @@ -0,0 +1,27 @@ +{ + "description": "Boolean", + "bson_type": "0x08", + "test_key": "b", + "valid": [ + { + "description": "True", + "canonical_bson": "090000000862000100", + "canonical_extjson": "{\"b\" : true}" + }, + { + "description": "False", + "canonical_bson": "090000000862000000", + "canonical_extjson": "{\"b\" : false}" + } + ], + "decodeErrors": [ + { + "description": "Invalid boolean value of 2", + "bson": "090000000862000200" + }, + { + "description": "Invalid boolean value of -1", + "bson": "09000000086200FF00" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code.json new file mode 100644 index 0000000..3ae3472 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code.json @@ -0,0 +1,67 @@ +{ + "description": "Javascript Code", + "bson_type": "0x0D", + "test_key": "a", + "valid": [ + { + "description": "Empty string", + "canonical_bson": "0D0000000D6100010000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"\"}}" + }, + { + "description": "Single character", + "canonical_bson": "0E0000000D610002000000620000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"b\"}}" + }, + { + "description": "Multi-character", + "canonical_bson": "190000000D61000D0000006162616261626162616261620000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"abababababab\"}}" + }, + { + "description": "two-byte UTF-8 (\u00e9)", + "canonical_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000", + "canonical_extjson": "{\"a\" : \"éééééé\"}" + }, + { + "description": "three-byte UTF-8 (\u2606)", + "canonical_bson": "190000000261000D000000E29886E29886E29886E298860000", + "canonical_extjson": "{\"a\" : \"☆☆☆☆\"}" + }, + { + "description": "Embedded nulls", + "canonical_bson": "190000000261000D0000006162006261620062616261620000", + "canonical_extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}" + } + ], + "decodeErrors": [ + { + "description": "bad code string length: 0 (but no 0x00 either)", + "bson": "0C0000000261000000000000" + }, + { + "description": "bad code string length: -1", + "bson": "0C000000026100FFFFFFFF00" + }, + { + "description": "bad code string length: eats terminator", + "bson": "10000000026100050000006200620000" + }, + { + "description": "bad code string length: longer than rest of document", + "bson": "120000000200FFFFFF00666F6F6261720000" + }, + { + "description": "code string is not null-terminated", + "bson": "1000000002610004000000616263FF00" + }, + { + "description": "empty code string, but extra null", + "bson": "0E00000002610001000000000000" + }, + { + "description": "invalid UTF-8", + "bson": "0E00000002610002000000E90000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code_w_scope.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code_w_scope.json new file mode 100644 index 0000000..5f5fb57 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/code_w_scope.json @@ -0,0 +1,78 @@ +{ + "description": "Javascript Code with Scope", + "bson_type": "0x0F", + "test_key": "a", + "valid": [ + { + "description": "Empty code string, empty scope", + "canonical_bson": "160000000F61000E0000000100000000050000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {}}}" + }, + { + "description": "Non-empty code string, empty scope", + "canonical_bson": "1A0000000F610012000000050000006162636400050000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {}}}" + }, + { + "description": "Empty code string, non-empty scope", + "canonical_bson": "1D0000000F61001500000001000000000C000000107800010000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}" + }, + { + "description": "Non-empty code string and non-empty scope", + "canonical_bson": "210000000F6100190000000500000061626364000C000000107800010000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"abcd\", \"$scope\" : {\"x\" : {\"$numberInt\": \"1\"}}}}" + }, + { + "description": "Unicode and embedded null in code string, empty scope", + "canonical_bson": "1A0000000F61001200000005000000C3A9006400050000000000", + "canonical_extjson": "{\"a\" : {\"$code\" : \"é\\u0000d\", \"$scope\" : {}}}" + } + ], + "decodeErrors": [ + { + "description": "field length zero", + "bson": "280000000F6100000000000500000061626364001300000010780001000000107900010000000000" + }, + { + "description": "field length negative", + "bson": "280000000F6100FFFFFFFF0500000061626364001300000010780001000000107900010000000000" + }, + { + "description": "field length too short (less than minimum size)", + "bson": "160000000F61000D0000000100000000050000000000" + }, + { + "description": "field length too short (truncates scope)", + "bson": "280000000F61001F0000000500000061626364001300000010780001000000107900010000000000" + }, + { + "description": "field length too long (clips outer doc)", + "bson": "280000000F6100210000000500000061626364001300000010780001000000107900010000000000" + }, + { + "description": "field length too long (longer than outer doc)", + "bson": "280000000F6100FF0000000500000061626364001300000010780001000000107900010000000000" + }, + { + "description": "bad code string: length too short", + "bson": "280000000F6100200000000400000061626364001300000010780001000000107900010000000000" + }, + { + "description": "bad code string: length too long (clips scope)", + "bson": "280000000F6100200000000600000061626364001300000010780001000000107900010000000000" + }, + { + "description": "bad code string: negative length", + "bson": "280000000F610020000000FFFFFFFF61626364001300000010780001000000107900010000000000" + }, + { + "description": "bad code string: length longer than field", + "bson": "280000000F610020000000FF00000061626364001300000010780001000000107900010000000000" + }, + { + "description": "bad scope doc (field has bad string length)", + "bson": "1C0000000F001500000001000000000C000000020000000000000000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/datetime.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/datetime.json new file mode 100644 index 0000000..60506ce --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/datetime.json @@ -0,0 +1,36 @@ +{ + "description": "DateTime", + "bson_type": "0x09", + "test_key": "a", + "valid": [ + { + "description": "epoch", + "canonical_bson": "10000000096100000000000000000000", + "relaxed_extjson": "{\"a\" : {\"$date\" : \"1970-01-01T00:00:00Z\"}}", + "canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"0\"}}}" + }, + { + "description": "positive ms", + "canonical_bson": "10000000096100C5D8D6CC3B01000000", + "relaxed_extjson": "{\"a\" : {\"$date\" : \"2012-12-24T12:15:30.501Z\"}}", + "canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330501\"}}}" + }, + { + "description": "negative", + "canonical_bson": "10000000096100C33CE7B9BDFFFFFF00", + "relaxed_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"-284643869501\"}}}", + "canonical_extjson": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"-284643869501\"}}}" + }, + { + "description" : "Y10K", + "canonical_bson" : "1000000009610000DC1FD277E6000000", + "canonical_extjson" : "{\"a\":{\"$date\":{\"$numberLong\":\"253402300800000\"}}}" + } + ], + "decodeErrors": [ + { + "description": "datetime field truncated", + "bson": "0C0000000961001234567800" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbpointer.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbpointer.json new file mode 100644 index 0000000..377e556 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbpointer.json @@ -0,0 +1,56 @@ +{ + "description": "DBPointer type (deprecated)", + "bson_type": "0x0C", + "deprecated": true, + "test_key": "a", + "valid": [ + { + "description": "DBpointer", + "canonical_bson": "1A0000000C610002000000620056E1FC72E0C917E9C471416100", + "canonical_extjson": "{\"a\": {\"$dbPointer\": {\"$ref\": \"b\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}}", + "converted_bson": "2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000", + "converted_extjson": "{\"a\": {\"$ref\": \"b\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}" + }, + { + "description": "DBpointer with opposite key order", + "canonical_bson": "1A0000000C610002000000620056E1FC72E0C917E9C471416100", + "canonical_extjson": "{\"a\": {\"$dbPointer\": {\"$ref\": \"b\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}}", + "degenerate_extjson": "{\"a\": {\"$dbPointer\": {\"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}, \"$ref\": \"b\"}}}", + "converted_bson": "2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000", + "converted_extjson": "{\"a\": {\"$ref\": \"b\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}" + }, + { + "description": "With two-byte UTF-8", + "canonical_bson": "1B0000000C610003000000C3A90056E1FC72E0C917E9C471416100", + "canonical_extjson": "{\"a\": {\"$dbPointer\": {\"$ref\": \"é\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}}", + "converted_bson": "2B0000000361002300000002247265660003000000C3A900072469640056E1FC72E0C917E9C47141610000", + "converted_extjson": "{\"a\": {\"$ref\": \"é\", \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}}}" + } + ], + "decodeErrors": [ + { + "description": "String with negative length", + "bson": "1A0000000C6100FFFFFFFF620056E1FC72E0C917E9C471416100" + }, + { + "description": "String with zero length", + "bson": "1A0000000C610000000000620056E1FC72E0C917E9C471416100" + }, + { + "description": "String not null terminated", + "bson": "1A0000000C610002000000626256E1FC72E0C917E9C471416100" + }, + { + "description": "short OID (less than minimum length for field)", + "bson": "160000000C61000300000061620056E1FC72E0C91700" + }, + { + "description": "short OID (greater than minimum, but truncated)", + "bson": "1A0000000C61000300000061620056E1FC72E0C917E9C4716100" + }, + { + "description": "String with bad UTF-8", + "bson": "1A0000000C610002000000E90056E1FC72E0C917E9C471416100" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbref.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbref.json new file mode 100644 index 0000000..1fe12c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/dbref.json @@ -0,0 +1,31 @@ +{ + "description": "DBRef", + "bson_type": "0x03", + "valid": [ + { + "description": "DBRef", + "canonical_bson": "37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000", + "canonical_extjson": "{\"dbref\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}}}" + }, + { + "description": "DBRef with database", + "canonical_bson": "4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000", + "canonical_extjson": "{\"dbref\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}, \"$db\": \"db\"}}" + }, + { + "description": "DBRef with database and additional fields", + "canonical_bson": "48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000", + "canonical_extjson": "{\"dbref\": {\"$ref\": \"collection\", \"$id\": {\"$numberInt\": \"42\"}, \"$db\": \"db\", \"foo\": \"bar\"}}" + }, + { + "description": "DBRef with additional fields", + "canonical_bson": "4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000", + "canonical_extjson": "{\"dbref\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}, \"foo\": \"bar\"}}" + }, + { + "description": "Document with key names similar to those of a DBRef", + "canonical_bson": "3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000", + "canonical_extjson": "{\"$ref\": \"not-a-dbref\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}, \"$banana\": \"peel\"}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-1.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-1.json new file mode 100644 index 0000000..7eefec6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-1.json @@ -0,0 +1,317 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "Special - Canonical NaN", + "canonical_bson": "180000001364000000000000000000000000000000007C00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}" + }, + { + "description": "Special - Negative NaN", + "canonical_bson": "18000000136400000000000000000000000000000000FC00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}", + "lossy": true + }, + { + "description": "Special - Negative NaN", + "canonical_bson": "18000000136400000000000000000000000000000000FC00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-NaN\"}}", + "lossy": true + }, + { + "description": "Special - Canonical SNaN", + "canonical_bson": "180000001364000000000000000000000000000000007E00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}", + "lossy": true + }, + { + "description": "Special - Negative SNaN", + "canonical_bson": "18000000136400000000000000000000000000000000FE00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}", + "lossy": true + }, + { + "description": "Special - NaN with a payload", + "canonical_bson": "180000001364001200000000000000000000000000007E00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}", + "lossy": true + }, + { + "description": "Special - Canonical Positive Infinity", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Special - Canonical Negative Infinity", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Special - Invalid representation treated as 0", + "canonical_bson": "180000001364000000000000000000000000000000106C00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}", + "lossy": true + }, + { + "description": "Special - Invalid representation treated as -0", + "canonical_bson": "18000000136400DCBA9876543210DEADBEEF00000010EC00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}", + "lossy": true + }, + { + "description": "Special - Invalid representation treated as 0E3", + "canonical_bson": "18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF116C00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}", + "lossy": true + }, + { + "description": "Regular - Adjusted Exponent Limit", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CF22F00", + "canonical_extjson": "{\"d\": { \"$numberDecimal\": \"0.000001234567890123456789012345678901234\" }}" + }, + { + "description": "Regular - Smallest", + "canonical_bson": "18000000136400D204000000000000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001234\"}}" + }, + { + "description": "Regular - Smallest with Trailing Zeros", + "canonical_bson": "1800000013640040EF5A07000000000000000000002A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00123400000\"}}" + }, + { + "description": "Regular - 0.1", + "canonical_bson": "1800000013640001000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1\"}}" + }, + { + "description": "Regular - 0.1234567890123456789012345678901234", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFC2F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1234567890123456789012345678901234\"}}" + }, + { + "description": "Regular - 0", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "Regular - -0", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "Regular - -0.0", + "canonical_bson": "1800000013640000000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}" + }, + { + "description": "Regular - 2", + "canonical_bson": "180000001364000200000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2\"}}" + }, + { + "description": "Regular - 2.000", + "canonical_bson": "18000000136400D0070000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2.000\"}}" + }, + { + "description": "Regular - Largest", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}" + }, + { + "description": "Scientific - Tiniest", + "canonical_bson": "18000000136400FFFFFFFF638E8D37C087ADBE09ED010000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E-6143\"}}" + }, + { + "description": "Scientific - Tiny", + "canonical_bson": "180000001364000100000000000000000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}" + }, + { + "description": "Scientific - Negative Tiny", + "canonical_bson": "180000001364000100000000000000000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}" + }, + { + "description": "Scientific - Adjusted Exponent Limit", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CF02F00", + "canonical_extjson": "{\"d\": { \"$numberDecimal\": \"1.234567890123456789012345678901234E-7\" }}" + }, + { + "description": "Scientific - Fractional", + "canonical_bson": "1800000013640064000000000000000000000000002CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00E-8\"}}" + }, + { + "description": "Scientific - 0 with Exponent", + "canonical_bson": "180000001364000000000000000000000000000000205F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6000\"}}" + }, + { + "description": "Scientific - 0 with Negative Exponent", + "canonical_bson": "1800000013640000000000000000000000000000007A2B00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-611\"}}" + }, + { + "description": "Scientific - No Decimal with Signed Exponent", + "canonical_bson": "180000001364000100000000000000000000000000463000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}" + }, + { + "description": "Scientific - Trailing Zero", + "canonical_bson": "180000001364001A04000000000000000000000000423000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.050E+4\"}}" + }, + { + "description": "Scientific - With Decimal", + "canonical_bson": "180000001364006900000000000000000000000000423000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.05E+3\"}}" + }, + { + "description": "Scientific - Full", + "canonical_bson": "18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5192296858534827628530496329220095\"}}" + }, + { + "description": "Scientific - Large", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "Scientific - Largest", + "canonical_bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E+6144\"}}" + }, + { + "description": "Non-Canonical Parsing - Exponent Normalization", + "canonical_bson": "1800000013640064000000000000000000000000002CB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-100E-10\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00E-8\"}}" + }, + { + "description": "Non-Canonical Parsing - Unsigned Positive Exponent", + "canonical_bson": "180000001364000100000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}" + }, + { + "description": "Non-Canonical Parsing - Lowercase Exponent Identifier", + "canonical_bson": "180000001364000100000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}" + }, + { + "description": "Non-Canonical Parsing - Long Significand with Exponent", + "canonical_bson": "1800000013640079D9E0F9763ADA429D0200000000583000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12345689012345789012345E+12\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.2345689012345789012345E+34\"}}" + }, + { + "description": "Non-Canonical Parsing - Positive Sign", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+1234567890123456789012345678901234\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}" + }, + { + "description": "Non-Canonical Parsing - Long Decimal String", + "canonical_bson": "180000001364000100000000000000000000000000722800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \".000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-999\"}}" + }, + { + "description": "Non-Canonical Parsing - nan", + "canonical_bson": "180000001364000000000000000000000000000000007C00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"nan\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}" + }, + { + "description": "Non-Canonical Parsing - nAn", + "canonical_bson": "180000001364000000000000000000000000000000007C00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"nAn\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}" + }, + { + "description": "Non-Canonical Parsing - +infinity", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+infinity\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - infinity", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"infinity\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - infiniTY", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"infiniTY\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - inf", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"inf\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - inF", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"inF\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - -infinity", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-infinity\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - -infiniTy", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-infiniTy\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - -Inf", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - -inf", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-inf\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Non-Canonical Parsing - -inF", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-inF\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "Rounded Subnormal number", + "canonical_bson": "180000001364000100000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10E-6177\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}" + }, + { + "description": "Clamped", + "canonical_bson": "180000001364000a00000000000000000000000000fe5f00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E6112\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}" + }, + { + "description": "Exact rounding", + "canonical_bson": "18000000136400000000000a5bc138938d44c64d31cc3700", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+999\"}}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-2.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-2.json new file mode 100644 index 0000000..316d3b0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-2.json @@ -0,0 +1,793 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "[decq021] Normality", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C40B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1234567890123456789012345678901234\"}}" + }, + { + "description": "[decq823] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400010000800000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483649\"}}" + }, + { + "description": "[decq822] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400000000800000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483648\"}}" + }, + { + "description": "[decq821] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FFFFFF7F0000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483647\"}}" + }, + { + "description": "[decq820] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FEFFFF7F0000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483646\"}}" + }, + { + "description": "[decq152] fold-downs (more below)", + "canonical_bson": "18000000136400393000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-12345\"}}" + }, + { + "description": "[decq154] fold-downs (more below)", + "canonical_bson": "18000000136400D20400000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1234\"}}" + }, + { + "description": "[decq006] derivative canonical plain strings", + "canonical_bson": "18000000136400EE0200000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-750\"}}" + }, + { + "description": "[decq164] fold-downs (more below)", + "canonical_bson": "1800000013640039300000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-123.45\"}}" + }, + { + "description": "[decq156] fold-downs (more below)", + "canonical_bson": "180000001364007B0000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-123\"}}" + }, + { + "description": "[decq008] derivative canonical plain strings", + "canonical_bson": "18000000136400EE020000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-75.0\"}}" + }, + { + "description": "[decq158] fold-downs (more below)", + "canonical_bson": "180000001364000C0000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-12\"}}" + }, + { + "description": "[decq122] Nmax and similar", + "canonical_bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFFDF00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.999999999999999999999999999999999E+6144\"}}" + }, + { + "description": "[decq002] (mostly derived from the Strawman 4 document and examples)", + "canonical_bson": "18000000136400EE020000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50\"}}" + }, + { + "description": "[decq004] derivative canonical plain strings", + "canonical_bson": "18000000136400EE0200000000000000000000000042B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50E+3\"}}" + }, + { + "description": "[decq018] derivative canonical plain strings", + "canonical_bson": "18000000136400EE020000000000000000000000002EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50E-7\"}}" + }, + { + "description": "[decq125] Nmax and similar", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFEDF00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.234567890123456789012345678901234E+6144\"}}" + }, + { + "description": "[decq131] fold-downs (more below)", + "canonical_bson": "18000000136400000000807F1BCF85B27059C8A43CFEDF00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.230000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq162] fold-downs (more below)", + "canonical_bson": "180000001364007B000000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.23\"}}" + }, + { + "description": "[decq176] Nmin and below", + "canonical_bson": "18000000136400010000000A5BC138938D44C64D31008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000001E-6143\"}}" + }, + { + "description": "[decq174] Nmin and below", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E-6143\"}}" + }, + { + "description": "[decq133] fold-downs (more below)", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FEDF00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq160] fold-downs (more below)", + "canonical_bson": "18000000136400010000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1\"}}" + }, + { + "description": "[decq172] Nmin and below", + "canonical_bson": "180000001364000100000000000000000000000000428000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6143\"}}" + }, + { + "description": "[decq010] derivative canonical plain strings", + "canonical_bson": "18000000136400EE020000000000000000000000003AB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.750\"}}" + }, + { + "description": "[decq012] derivative canonical plain strings", + "canonical_bson": "18000000136400EE0200000000000000000000000038B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0750\"}}" + }, + { + "description": "[decq014] derivative canonical plain strings", + "canonical_bson": "18000000136400EE0200000000000000000000000034B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000750\"}}" + }, + { + "description": "[decq016] derivative canonical plain strings", + "canonical_bson": "18000000136400EE0200000000000000000000000030B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000750\"}}" + }, + { + "description": "[decq404] zeros", + "canonical_bson": "180000001364000000000000000000000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}" + }, + { + "description": "[decq424] negative zeros", + "canonical_bson": "180000001364000000000000000000000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}" + }, + { + "description": "[decq407] zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[decq427] negative zeros", + "canonical_bson": "1800000013640000000000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}" + }, + { + "description": "[decq409] zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[decq428] negative zeros", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "[decq700] Selected DPD codes", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[decq406] zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[decq426] negative zeros", + "canonical_bson": "1800000013640000000000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}" + }, + { + "description": "[decq410] zeros", + "canonical_bson": "180000001364000000000000000000000000000000463000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}" + }, + { + "description": "[decq431] negative zeros", + "canonical_bson": "18000000136400000000000000000000000000000046B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+3\"}}" + }, + { + "description": "[decq419] clamped zeros...", + "canonical_bson": "180000001364000000000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}" + }, + { + "description": "[decq432] negative zeros", + "canonical_bson": "180000001364000000000000000000000000000000FEDF00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}" + }, + { + "description": "[decq405] zeros", + "canonical_bson": "180000001364000000000000000000000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}" + }, + { + "description": "[decq425] negative zeros", + "canonical_bson": "180000001364000000000000000000000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}" + }, + { + "description": "[decq508] Specials", + "canonical_bson": "180000001364000000000000000000000000000000007800", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}" + }, + { + "description": "[decq528] Specials", + "canonical_bson": "18000000136400000000000000000000000000000000F800", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}" + }, + { + "description": "[decq541] Specials", + "canonical_bson": "180000001364000000000000000000000000000000007C00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}" + }, + { + "description": "[decq074] Nmin and below", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E-6143\"}}" + }, + { + "description": "[decq602] fold-down full sequence", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq604] fold-down full sequence", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E+6143\"}}" + }, + { + "description": "[decq606] fold-down full sequence", + "canonical_bson": "1800000013640000000080264B91C02220BE377E00FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000000E+6142\"}}" + }, + { + "description": "[decq608] fold-down full sequence", + "canonical_bson": "1800000013640000000040EAED7446D09C2C9F0C00FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000E+6141\"}}" + }, + { + "description": "[decq610] fold-down full sequence", + "canonical_bson": "18000000136400000000A0CA17726DAE0F1E430100FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000E+6140\"}}" + }, + { + "description": "[decq612] fold-down full sequence", + "canonical_bson": "18000000136400000000106102253E5ECE4F200000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000E+6139\"}}" + }, + { + "description": "[decq614] fold-down full sequence", + "canonical_bson": "18000000136400000000E83C80D09F3C2E3B030000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000E+6138\"}}" + }, + { + "description": "[decq616] fold-down full sequence", + "canonical_bson": "18000000136400000000E4D20CC8DCD2B752000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000E+6137\"}}" + }, + { + "description": "[decq618] fold-down full sequence", + "canonical_bson": "180000001364000000004A48011416954508000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000E+6136\"}}" + }, + { + "description": "[decq620] fold-down full sequence", + "canonical_bson": "18000000136400000000A1EDCCCE1BC2D300000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000E+6135\"}}" + }, + { + "description": "[decq622] fold-down full sequence", + "canonical_bson": "18000000136400000080F64AE1C7022D1500000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000E+6134\"}}" + }, + { + "description": "[decq624] fold-down full sequence", + "canonical_bson": "18000000136400000040B2BAC9E0191E0200000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000E+6133\"}}" + }, + { + "description": "[decq626] fold-down full sequence", + "canonical_bson": "180000001364000000A0DEC5ADC935360000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000E+6132\"}}" + }, + { + "description": "[decq628] fold-down full sequence", + "canonical_bson": "18000000136400000010632D5EC76B050000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000E+6131\"}}" + }, + { + "description": "[decq630] fold-down full sequence", + "canonical_bson": "180000001364000000E8890423C78A000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000E+6130\"}}" + }, + { + "description": "[decq632] fold-down full sequence", + "canonical_bson": "18000000136400000064A7B3B6E00D000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000E+6129\"}}" + }, + { + "description": "[decq634] fold-down full sequence", + "canonical_bson": "1800000013640000008A5D78456301000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000E+6128\"}}" + }, + { + "description": "[decq636] fold-down full sequence", + "canonical_bson": "180000001364000000C16FF2862300000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000E+6127\"}}" + }, + { + "description": "[decq638] fold-down full sequence", + "canonical_bson": "180000001364000080C6A47E8D0300000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000E+6126\"}}" + }, + { + "description": "[decq640] fold-down full sequence", + "canonical_bson": "1800000013640000407A10F35A0000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000E+6125\"}}" + }, + { + "description": "[decq642] fold-down full sequence", + "canonical_bson": "1800000013640000A0724E18090000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000E+6124\"}}" + }, + { + "description": "[decq644] fold-down full sequence", + "canonical_bson": "180000001364000010A5D4E8000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000E+6123\"}}" + }, + { + "description": "[decq646] fold-down full sequence", + "canonical_bson": "1800000013640000E8764817000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000E+6122\"}}" + }, + { + "description": "[decq648] fold-down full sequence", + "canonical_bson": "1800000013640000E40B5402000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000E+6121\"}}" + }, + { + "description": "[decq650] fold-down full sequence", + "canonical_bson": "1800000013640000CA9A3B00000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000E+6120\"}}" + }, + { + "description": "[decq652] fold-down full sequence", + "canonical_bson": "1800000013640000E1F50500000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000E+6119\"}}" + }, + { + "description": "[decq654] fold-down full sequence", + "canonical_bson": "180000001364008096980000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000E+6118\"}}" + }, + { + "description": "[decq656] fold-down full sequence", + "canonical_bson": "1800000013640040420F0000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000E+6117\"}}" + }, + { + "description": "[decq658] fold-down full sequence", + "canonical_bson": "18000000136400A086010000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000E+6116\"}}" + }, + { + "description": "[decq660] fold-down full sequence", + "canonical_bson": "180000001364001027000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000E+6115\"}}" + }, + { + "description": "[decq662] fold-down full sequence", + "canonical_bson": "18000000136400E803000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000E+6114\"}}" + }, + { + "description": "[decq664] fold-down full sequence", + "canonical_bson": "180000001364006400000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+6113\"}}" + }, + { + "description": "[decq666] fold-down full sequence", + "canonical_bson": "180000001364000A00000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}" + }, + { + "description": "[decq060] fold-downs (more below)", + "canonical_bson": "180000001364000100000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1\"}}" + }, + { + "description": "[decq670] fold-down full sequence", + "canonical_bson": "180000001364000100000000000000000000000000FC5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6110\"}}" + }, + { + "description": "[decq668] fold-down full sequence", + "canonical_bson": "180000001364000100000000000000000000000000FE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6111\"}}" + }, + { + "description": "[decq072] Nmin and below", + "canonical_bson": "180000001364000100000000000000000000000000420000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6143\"}}" + }, + { + "description": "[decq076] Nmin and below", + "canonical_bson": "18000000136400010000000A5BC138938D44C64D31000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000001E-6143\"}}" + }, + { + "description": "[decq036] fold-downs (more below)", + "canonical_bson": "18000000136400000000807F1BCF85B27059C8A43CFE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.230000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq062] fold-downs (more below)", + "canonical_bson": "180000001364007B000000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23\"}}" + }, + { + "description": "[decq034] Nmax and similar", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFE5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.234567890123456789012345678901234E+6144\"}}" + }, + { + "description": "[decq441] exponent lengths", + "canonical_bson": "180000001364000700000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7\"}}" + }, + { + "description": "[decq449] exponent lengths", + "canonical_bson": "1800000013640007000000000000000000000000001E5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+5999\"}}" + }, + { + "description": "[decq447] exponent lengths", + "canonical_bson": "1800000013640007000000000000000000000000000E3800", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+999\"}}" + }, + { + "description": "[decq445] exponent lengths", + "canonical_bson": "180000001364000700000000000000000000000000063100", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+99\"}}" + }, + { + "description": "[decq443] exponent lengths", + "canonical_bson": "180000001364000700000000000000000000000000523000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+9\"}}" + }, + { + "description": "[decq842] VG testcase", + "canonical_bson": "180000001364000000FED83F4E7C9FE4E269E38A5BCD1700", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7.049000000000010795488000000000000E-3097\"}}" + }, + { + "description": "[decq841] VG testcase", + "canonical_bson": "180000001364000000203B9DB5056F000000000000002400", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"8.000000000000000000E-1550\"}}" + }, + { + "description": "[decq840] VG testcase", + "canonical_bson": "180000001364003C17258419D710C42F0000000000002400", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"8.81125000000001349436E-1548\"}}" + }, + { + "description": "[decq701] Selected DPD codes", + "canonical_bson": "180000001364000900000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9\"}}" + }, + { + "description": "[decq032] Nmax and similar", + "canonical_bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E+6144\"}}" + }, + { + "description": "[decq702] Selected DPD codes", + "canonical_bson": "180000001364000A00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}" + }, + { + "description": "[decq057] fold-downs (more below)", + "canonical_bson": "180000001364000C00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12\"}}" + }, + { + "description": "[decq703] Selected DPD codes", + "canonical_bson": "180000001364001300000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"19\"}}" + }, + { + "description": "[decq704] Selected DPD codes", + "canonical_bson": "180000001364001400000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"20\"}}" + }, + { + "description": "[decq705] Selected DPD codes", + "canonical_bson": "180000001364001D00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"29\"}}" + }, + { + "description": "[decq706] Selected DPD codes", + "canonical_bson": "180000001364001E00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"30\"}}" + }, + { + "description": "[decq707] Selected DPD codes", + "canonical_bson": "180000001364002700000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"39\"}}" + }, + { + "description": "[decq708] Selected DPD codes", + "canonical_bson": "180000001364002800000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"40\"}}" + }, + { + "description": "[decq709] Selected DPD codes", + "canonical_bson": "180000001364003100000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"49\"}}" + }, + { + "description": "[decq710] Selected DPD codes", + "canonical_bson": "180000001364003200000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"50\"}}" + }, + { + "description": "[decq711] Selected DPD codes", + "canonical_bson": "180000001364003B00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"59\"}}" + }, + { + "description": "[decq712] Selected DPD codes", + "canonical_bson": "180000001364003C00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"60\"}}" + }, + { + "description": "[decq713] Selected DPD codes", + "canonical_bson": "180000001364004500000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"69\"}}" + }, + { + "description": "[decq714] Selected DPD codes", + "canonical_bson": "180000001364004600000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"70\"}}" + }, + { + "description": "[decq715] Selected DPD codes", + "canonical_bson": "180000001364004700000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"71\"}}" + }, + { + "description": "[decq716] Selected DPD codes", + "canonical_bson": "180000001364004800000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"72\"}}" + }, + { + "description": "[decq717] Selected DPD codes", + "canonical_bson": "180000001364004900000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"73\"}}" + }, + { + "description": "[decq718] Selected DPD codes", + "canonical_bson": "180000001364004A00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"74\"}}" + }, + { + "description": "[decq719] Selected DPD codes", + "canonical_bson": "180000001364004B00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"75\"}}" + }, + { + "description": "[decq720] Selected DPD codes", + "canonical_bson": "180000001364004C00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"76\"}}" + }, + { + "description": "[decq721] Selected DPD codes", + "canonical_bson": "180000001364004D00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"77\"}}" + }, + { + "description": "[decq722] Selected DPD codes", + "canonical_bson": "180000001364004E00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"78\"}}" + }, + { + "description": "[decq723] Selected DPD codes", + "canonical_bson": "180000001364004F00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"79\"}}" + }, + { + "description": "[decq056] fold-downs (more below)", + "canonical_bson": "180000001364007B00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"123\"}}" + }, + { + "description": "[decq064] fold-downs (more below)", + "canonical_bson": "1800000013640039300000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"123.45\"}}" + }, + { + "description": "[decq732] Selected DPD codes", + "canonical_bson": "180000001364000802000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"520\"}}" + }, + { + "description": "[decq733] Selected DPD codes", + "canonical_bson": "180000001364000902000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"521\"}}" + }, + { + "description": "[decq740] DPD: one of each of the huffman groups", + "canonical_bson": "180000001364000903000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"777\"}}" + }, + { + "description": "[decq741] DPD: one of each of the huffman groups", + "canonical_bson": "180000001364000A03000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"778\"}}" + }, + { + "description": "[decq742] DPD: one of each of the huffman groups", + "canonical_bson": "180000001364001303000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"787\"}}" + }, + { + "description": "[decq746] DPD: one of each of the huffman groups", + "canonical_bson": "180000001364001F03000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"799\"}}" + }, + { + "description": "[decq743] DPD: one of each of the huffman groups", + "canonical_bson": "180000001364006D03000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"877\"}}" + }, + { + "description": "[decq753] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "180000001364007803000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"888\"}}" + }, + { + "description": "[decq754] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "180000001364007903000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"889\"}}" + }, + { + "description": "[decq760] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "180000001364008203000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"898\"}}" + }, + { + "description": "[decq764] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "180000001364008303000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"899\"}}" + }, + { + "description": "[decq745] DPD: one of each of the huffman groups", + "canonical_bson": "18000000136400D303000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"979\"}}" + }, + { + "description": "[decq770] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "18000000136400DC03000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"988\"}}" + }, + { + "description": "[decq774] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "18000000136400DD03000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"989\"}}" + }, + { + "description": "[decq730] Selected DPD codes", + "canonical_bson": "18000000136400E203000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"994\"}}" + }, + { + "description": "[decq731] Selected DPD codes", + "canonical_bson": "18000000136400E303000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"995\"}}" + }, + { + "description": "[decq744] DPD: one of each of the huffman groups", + "canonical_bson": "18000000136400E503000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"997\"}}" + }, + { + "description": "[decq780] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "18000000136400E603000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"998\"}}" + }, + { + "description": "[decq787] DPD all-highs cases (includes the 24 redundant codes)", + "canonical_bson": "18000000136400E703000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"999\"}}" + }, + { + "description": "[decq053] fold-downs (more below)", + "canonical_bson": "18000000136400D204000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1234\"}}" + }, + { + "description": "[decq052] fold-downs (more below)", + "canonical_bson": "180000001364003930000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12345\"}}" + }, + { + "description": "[decq792] Miscellaneous (testers' queries, etc.)", + "canonical_bson": "180000001364003075000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"30000\"}}" + }, + { + "description": "[decq793] Miscellaneous (testers' queries, etc.)", + "canonical_bson": "1800000013640090940D0000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"890000\"}}" + }, + { + "description": "[decq824] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FEFFFF7F00000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483646\"}}" + }, + { + "description": "[decq825] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FFFFFF7F00000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483647\"}}" + }, + { + "description": "[decq826] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "180000001364000000008000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483648\"}}" + }, + { + "description": "[decq827] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "180000001364000100008000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483649\"}}" + }, + { + "description": "[decq828] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FEFFFFFF00000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967294\"}}" + }, + { + "description": "[decq829] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "18000000136400FFFFFFFF00000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967295\"}}" + }, + { + "description": "[decq830] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "180000001364000000000001000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967296\"}}" + }, + { + "description": "[decq831] values around [u]int32 edges (zeros done earlier)", + "canonical_bson": "180000001364000100000001000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967297\"}}" + }, + { + "description": "[decq022] Normality", + "canonical_bson": "18000000136400C7711CC7B548F377DC80A131C836403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1111111111111111111111111111111111\"}}" + }, + { + "description": "[decq020] Normality", + "canonical_bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}" + }, + { + "description": "[decq550] Specials", + "canonical_bson": "18000000136400FFFFFFFF638E8D37C087ADBE09ED413000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9999999999999999999999999999999999\"}}" + } + ] +} + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-3.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-3.json new file mode 100644 index 0000000..9b01534 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-3.json @@ -0,0 +1,1771 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "[basx066] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE0000000000000000000038B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-00345678.5432\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}" + }, + { + "description": "[basx065] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE0000000000000000000038B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0345678.5432\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}" + }, + { + "description": "[basx064] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE0000000000000000000038B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}" + }, + { + "description": "[basx041] strings without E cannot generate E in result", + "canonical_bson": "180000001364004C0000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-76\"}}" + }, + { + "description": "[basx027] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000F270000000000000000000000003AB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.999\"}}" + }, + { + "description": "[basx026] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364009F230000000000000000000000003AB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.119\"}}" + }, + { + "description": "[basx025] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364008F030000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.11\"}}" + }, + { + "description": "[basx024] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364005B000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.1\"}}" + }, + { + "description": "[dqbsr531] negatives (Rounded)", + "canonical_bson": "1800000013640099761CC7B548F377DC80A131C836FEAF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.1111111111111111111111111111123450\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.111111111111111111111111111112345\"}}" + }, + { + "description": "[basx022] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000A000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0\"}}" + }, + { + "description": "[basx021] conform to rules and exponent will be in permitted range).", + "canonical_bson": "18000000136400010000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1\"}}" + }, + { + "description": "[basx601] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}" + }, + { + "description": "[basx622] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002EB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-9\"}}" + }, + { + "description": "[basx602] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}" + }, + { + "description": "[basx621] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000030B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-8\"}}" + }, + { + "description": "[basx603] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}" + }, + { + "description": "[basx620] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000032B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-7\"}}" + }, + { + "description": "[basx604] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}" + }, + { + "description": "[basx619] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000034B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000\"}}" + }, + { + "description": "[basx605] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000363000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}" + }, + { + "description": "[basx618] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000036B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}" + }, + { + "description": "[basx680] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"000000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx606] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000383000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}" + }, + { + "description": "[basx617] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000038B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}" + }, + { + "description": "[basx681] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"00000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx686] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+00000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx687] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-00000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "[basx019] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640000000000000000000000000000003CB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-00.00\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}" + }, + { + "description": "[basx607] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}" + }, + { + "description": "[basx616] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003AB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}" + }, + { + "description": "[basx682] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx155] Numbers with E", + "canonical_bson": "1800000013640000000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000e+0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}" + }, + { + "description": "[basx130] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}" + }, + { + "description": "[basx290] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000038B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}" + }, + { + "description": "[basx131] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}" + }, + { + "description": "[basx291] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000036B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}" + }, + { + "description": "[basx132] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}" + }, + { + "description": "[basx292] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000034B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000\"}}" + }, + { + "description": "[basx133] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}" + }, + { + "description": "[basx293] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000032B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-7\"}}" + }, + { + "description": "[basx608] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[basx615] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003CB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}" + }, + { + "description": "[basx683] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"000.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx630] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[basx670] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[basx631] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}" + }, + { + "description": "[basx671] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}" + }, + { + "description": "[basx134] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}" + }, + { + "description": "[basx294] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000038B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}" + }, + { + "description": "[basx632] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx672] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}" + }, + { + "description": "[basx135] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}" + }, + { + "description": "[basx295] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000036B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}" + }, + { + "description": "[basx633] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}" + }, + { + "description": "[basx673] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}" + }, + { + "description": "[basx136] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}" + }, + { + "description": "[basx674] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}" + }, + { + "description": "[basx634] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}" + }, + { + "description": "[basx137] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}" + }, + { + "description": "[basx635] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}" + }, + { + "description": "[basx675] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}" + }, + { + "description": "[basx636] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}" + }, + { + "description": "[basx676] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}" + }, + { + "description": "[basx637] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}" + }, + { + "description": "[basx677] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}" + }, + { + "description": "[basx638] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}" + }, + { + "description": "[basx678] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-10\"}}" + }, + { + "description": "[basx149] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"000E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx639] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}" + }, + { + "description": "[basx679] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-11\"}}" + }, + { + "description": "[basx063] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE00000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+00345678.5432\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}" + }, + { + "description": "[basx018] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640000000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}" + }, + { + "description": "[basx609] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}" + }, + { + "description": "[basx614] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}" + }, + { + "description": "[basx684] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"00.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx640] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}" + }, + { + "description": "[basx660] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}" + }, + { + "description": "[basx641] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx661] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}" + }, + { + "description": "[basx296] some more negative zeros [systematic tests below]", + "canonical_bson": "1800000013640000000000000000000000000000003AB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}" + }, + { + "description": "[basx642] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}" + }, + { + "description": "[basx662] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}" + }, + { + "description": "[basx297] some more negative zeros [systematic tests below]", + "canonical_bson": "18000000136400000000000000000000000000000038B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}" + }, + { + "description": "[basx643] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}" + }, + { + "description": "[basx663] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}" + }, + { + "description": "[basx644] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}" + }, + { + "description": "[basx664] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}" + }, + { + "description": "[basx645] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}" + }, + { + "description": "[basx665] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}" + }, + { + "description": "[basx646] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}" + }, + { + "description": "[basx666] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}" + }, + { + "description": "[basx647] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}" + }, + { + "description": "[basx667] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}" + }, + { + "description": "[basx648] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}" + }, + { + "description": "[basx668] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}" + }, + { + "description": "[basx160] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"00E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx161] Numbers with E", + "canonical_bson": "1800000013640000000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"00E-9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}" + }, + { + "description": "[basx649] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000503000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8\"}}" + }, + { + "description": "[basx669] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000002C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-10\"}}" + }, + { + "description": "[basx062] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE00000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+0345678.5432\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}" + }, + { + "description": "[basx001] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx017] conform to rules and exponent will be in permitted range).", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "[basx611] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx613] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "[basx685] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx688] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+0.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx689] Zeros", + "canonical_bson": "18000000136400000000000000000000000000000040B000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}" + }, + { + "description": "[basx650] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}" + }, + { + "description": "[basx651] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000423000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}" + }, + { + "description": "[basx298] some more negative zeros [systematic tests below]", + "canonical_bson": "1800000013640000000000000000000000000000003CB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}" + }, + { + "description": "[basx652] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000443000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}" + }, + { + "description": "[basx299] some more negative zeros [systematic tests below]", + "canonical_bson": "1800000013640000000000000000000000000000003AB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}" + }, + { + "description": "[basx653] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000463000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}" + }, + { + "description": "[basx654] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000483000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}" + }, + { + "description": "[basx655] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}" + }, + { + "description": "[basx656] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}" + }, + { + "description": "[basx657] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000004E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}" + }, + { + "description": "[basx658] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000503000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8\"}}" + }, + { + "description": "[basx138] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+0E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx139] Numbers with E", + "canonical_bson": "18000000136400000000000000000000000000000052B000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+9\"}}" + }, + { + "description": "[basx144] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx154] Numbers with E", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx659] Zeros", + "canonical_bson": "180000001364000000000000000000000000000000523000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}" + }, + { + "description": "[basx042] strings without E cannot generate E in result", + "canonical_bson": "18000000136400FC040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+12.76\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}" + }, + { + "description": "[basx143] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+1E+009\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx061] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE00000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+345678.5432\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}" + }, + { + "description": "[basx036] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640015CD5B0700000000000000000000203000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000000123456789\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23456789E-8\"}}" + }, + { + "description": "[basx035] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640015CD5B0700000000000000000000223000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000123456789\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23456789E-7\"}}" + }, + { + "description": "[basx034] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640015CD5B0700000000000000000000243000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000123456789\"}}" + }, + { + "description": "[basx053] strings without E cannot generate E in result", + "canonical_bson": "180000001364003200000000000000000000000000323000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000050\"}}" + }, + { + "description": "[basx033] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640015CD5B0700000000000000000000263000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000123456789\"}}" + }, + { + "description": "[basx016] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000C000000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.012\"}}" + }, + { + "description": "[basx015] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364007B000000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123\"}}" + }, + { + "description": "[basx037] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640078DF0D8648700000000000000000223000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123456789012344\"}}" + }, + { + "description": "[basx038] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640079DF0D8648700000000000000000223000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123456789012345\"}}" + }, + { + "description": "[basx250] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx257] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx256] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}" + }, + { + "description": "[basx258] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx251] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000103000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-21\"}}" + }, + { + "description": "[basx263] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000603000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+19\"}}" + }, + { + "description": "[basx255] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}" + }, + { + "description": "[basx259] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx254] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0001265\"}}" + }, + { + "description": "[basx260] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx253] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00001265\"}}" + }, + { + "description": "[basx261] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx252] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000283000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-9\"}}" + }, + { + "description": "[basx262] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+7\"}}" + }, + { + "description": "[basx159] Numbers with E", + "canonical_bson": "1800000013640049000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.73e-7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7.3E-8\"}}" + }, + { + "description": "[basx004] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640064000000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00\"}}" + }, + { + "description": "[basx003] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000A000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0\"}}" + }, + { + "description": "[basx002] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000100000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1\"}}" + }, + { + "description": "[basx148] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+009\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx153] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E009\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx141] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+09\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx146] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+09\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx151] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1e09\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx142] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000F43000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}" + }, + { + "description": "[basx147] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000F43000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+90\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}" + }, + { + "description": "[basx152] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000F43000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E90\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}" + }, + { + "description": "[basx140] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx150] Numbers with E", + "canonical_bson": "180000001364000100000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}" + }, + { + "description": "[basx014] conform to rules and exponent will be in permitted range).", + "canonical_bson": "18000000136400D2040000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.234\"}}" + }, + { + "description": "[basx170] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx177] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx176] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx178] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx171] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000123000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-20\"}}" + }, + { + "description": "[basx183] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000623000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+20\"}}" + }, + { + "description": "[basx175] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}" + }, + { + "description": "[basx179] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx174] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}" + }, + { + "description": "[basx180] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx173] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0001265\"}}" + }, + { + "description": "[basx181] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000423000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}" + }, + { + "description": "[basx172] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000002A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-8\"}}" + }, + { + "description": "[basx182] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000004A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+8\"}}" + }, + { + "description": "[basx157] Numbers with E", + "canonical_bson": "180000001364000400000000000000000000000000523000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4E+9\"}}" + }, + { + "description": "[basx067] examples", + "canonical_bson": "180000001364000500000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000005\"}}" + }, + { + "description": "[basx069] examples", + "canonical_bson": "180000001364000500000000000000000000000000323000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-7\"}}" + }, + { + "description": "[basx385] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7\"}}" + }, + { + "description": "[basx365] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000543000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E10\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+10\"}}" + }, + { + "description": "[basx405] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000002C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-10\"}}" + }, + { + "description": "[basx363] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000563000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E11\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+11\"}}" + }, + { + "description": "[basx407] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000002A3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-11\"}}" + }, + { + "description": "[basx361] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000583000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E12\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+12\"}}" + }, + { + "description": "[basx409] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000283000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-12\"}}" + }, + { + "description": "[basx411] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000263000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-13\"}}" + }, + { + "description": "[basx383] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+1\"}}" + }, + { + "description": "[basx387] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.7\"}}" + }, + { + "description": "[basx381] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+2\"}}" + }, + { + "description": "[basx389] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.07\"}}" + }, + { + "description": "[basx379] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+3\"}}" + }, + { + "description": "[basx391] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.007\"}}" + }, + { + "description": "[basx377] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+4\"}}" + }, + { + "description": "[basx393] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0007\"}}" + }, + { + "description": "[basx375] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000004A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+5\"}}" + }, + { + "description": "[basx395] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00007\"}}" + }, + { + "description": "[basx373] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000004C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+6\"}}" + }, + { + "description": "[basx397] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000007\"}}" + }, + { + "description": "[basx371] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000004E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+7\"}}" + }, + { + "description": "[basx399] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000323000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-7\"}}" + }, + { + "description": "[basx369] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000503000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+8\"}}" + }, + { + "description": "[basx401] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000303000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-8\"}}" + }, + { + "description": "[basx367] Engineering notation tests", + "canonical_bson": "180000001364000700000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+9\"}}" + }, + { + "description": "[basx403] Engineering notation tests", + "canonical_bson": "1800000013640007000000000000000000000000002E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-9\"}}" + }, + { + "description": "[basx007] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640064000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.0\"}}" + }, + { + "description": "[basx005] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364000A00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}" + }, + { + "description": "[basx165] Numbers with E", + "canonical_bson": "180000001364000A00000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+009\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}" + }, + { + "description": "[basx163] Numbers with E", + "canonical_bson": "180000001364000A00000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+09\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}" + }, + { + "description": "[basx325] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}" + }, + { + "description": "[basx305] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000543000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e10\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+11\"}}" + }, + { + "description": "[basx345] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000002C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-10\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-9\"}}" + }, + { + "description": "[basx303] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000563000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e11\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+12\"}}" + }, + { + "description": "[basx347] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000002A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-11\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-10\"}}" + }, + { + "description": "[basx301] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000583000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e12\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+13\"}}" + }, + { + "description": "[basx349] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000283000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-12\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-11\"}}" + }, + { + "description": "[basx351] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000263000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-13\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-12\"}}" + }, + { + "description": "[basx323] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+2\"}}" + }, + { + "description": "[basx327] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0\"}}" + }, + { + "description": "[basx321] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+3\"}}" + }, + { + "description": "[basx329] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.10\"}}" + }, + { + "description": "[basx319] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+4\"}}" + }, + { + "description": "[basx331] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.010\"}}" + }, + { + "description": "[basx317] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+5\"}}" + }, + { + "description": "[basx333] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0010\"}}" + }, + { + "description": "[basx315] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000004A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6\"}}" + }, + { + "description": "[basx335] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00010\"}}" + }, + { + "description": "[basx313] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000004C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+7\"}}" + }, + { + "description": "[basx337] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-6\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000010\"}}" + }, + { + "description": "[basx311] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000004E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+8\"}}" + }, + { + "description": "[basx339] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000010\"}}" + }, + { + "description": "[basx309] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000503000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+9\"}}" + }, + { + "description": "[basx341] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-7\"}}" + }, + { + "description": "[basx164] Numbers with E", + "canonical_bson": "180000001364000A00000000000000000000000000F43000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e+90\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+91\"}}" + }, + { + "description": "[basx162] Numbers with E", + "canonical_bson": "180000001364000A00000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}" + }, + { + "description": "[basx307] Engineering notation tests", + "canonical_bson": "180000001364000A00000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}" + }, + { + "description": "[basx343] Engineering notation tests", + "canonical_bson": "180000001364000A000000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-8\"}}" + }, + { + "description": "[basx008] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640065000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.1\"}}" + }, + { + "description": "[basx009] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640068000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.4\"}}" + }, + { + "description": "[basx010] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640069000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.5\"}}" + }, + { + "description": "[basx011] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364006A000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.6\"}}" + }, + { + "description": "[basx012] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364006D000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10.9\"}}" + }, + { + "description": "[basx013] conform to rules and exponent will be in permitted range).", + "canonical_bson": "180000001364006E000000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"11.0\"}}" + }, + { + "description": "[basx040] strings without E cannot generate E in result", + "canonical_bson": "180000001364000C00000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12\"}}" + }, + { + "description": "[basx190] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx197] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx196] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx198] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx191] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000143000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-19\"}}" + }, + { + "description": "[basx203] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000643000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+21\"}}" + }, + { + "description": "[basx195] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx199] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx194] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}" + }, + { + "description": "[basx200] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}" + }, + { + "description": "[basx193] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000343000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}" + }, + { + "description": "[basx201] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}" + }, + { + "description": "[basx192] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000002C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-7\"}}" + }, + { + "description": "[basx202] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000004C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+9\"}}" + }, + { + "description": "[basx044] strings without E cannot generate E in result", + "canonical_bson": "18000000136400FC040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"012.76\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}" + }, + { + "description": "[basx042] strings without E cannot generate E in result", + "canonical_bson": "18000000136400FC040000000000000000000000003C3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}" + }, + { + "description": "[basx046] strings without E cannot generate E in result", + "canonical_bson": "180000001364001100000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"17.\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"17\"}}" + }, + { + "description": "[basx049] strings without E cannot generate E in result", + "canonical_bson": "180000001364002C00000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0044\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"44\"}}" + }, + { + "description": "[basx048] strings without E cannot generate E in result", + "canonical_bson": "180000001364002C00000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"044\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"44\"}}" + }, + { + "description": "[basx158] Numbers with E", + "canonical_bson": "180000001364002C00000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"44E+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4.4E+10\"}}" + }, + { + "description": "[basx068] examples", + "canonical_bson": "180000001364003200000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"50E-7\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000050\"}}" + }, + { + "description": "[basx169] Numbers with E", + "canonical_bson": "180000001364006400000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+009\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}" + }, + { + "description": "[basx167] Numbers with E", + "canonical_bson": "180000001364006400000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+09\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}" + }, + { + "description": "[basx168] Numbers with E", + "canonical_bson": "180000001364006400000000000000000000000000F43000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"100E+90\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+92\"}}" + }, + { + "description": "[basx166] Numbers with E", + "canonical_bson": "180000001364006400000000000000000000000000523000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+9\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}" + }, + { + "description": "[basx210] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx217] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx216] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx218] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx211] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000163000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-18\"}}" + }, + { + "description": "[basx223] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000663000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+22\"}}" + }, + { + "description": "[basx215] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx219] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}" + }, + { + "description": "[basx214] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx220] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}" + }, + { + "description": "[basx213] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}" + }, + { + "description": "[basx221] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+6\"}}" + }, + { + "description": "[basx212] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000002E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000001265\"}}" + }, + { + "description": "[basx222] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000004E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+10\"}}" + }, + { + "description": "[basx006] conform to rules and exponent will be in permitted range).", + "canonical_bson": "18000000136400E803000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1000\"}}" + }, + { + "description": "[basx230] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx237] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000403000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}" + }, + { + "description": "[basx236] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}" + }, + { + "description": "[basx238] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000423000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+1\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}" + }, + { + "description": "[basx231] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000183000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-17\"}}" + }, + { + "description": "[basx243] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000683000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+20\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+23\"}}" + }, + { + "description": "[basx235] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}" + }, + { + "description": "[basx239] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000443000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+2\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}" + }, + { + "description": "[basx234] Numbers with E", + "canonical_bson": "18000000136400F1040000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}" + }, + { + "description": "[basx240] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000463000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+3\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+6\"}}" + }, + { + "description": "[basx233] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000383000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}" + }, + { + "description": "[basx241] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000483000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+4\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+7\"}}" + }, + { + "description": "[basx232] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00001265\"}}" + }, + { + "description": "[basx242] Numbers with E", + "canonical_bson": "18000000136400F104000000000000000000000000503000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+8\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+11\"}}" + }, + { + "description": "[basx060] strings without E cannot generate E in result", + "canonical_bson": "18000000136400185C0ACE00000000000000000000383000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}" + }, + { + "description": "[basx059] strings without E cannot generate E in result", + "canonical_bson": "18000000136400F198670C08000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0345678.54321\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.54321\"}}" + }, + { + "description": "[basx058] strings without E cannot generate E in result", + "canonical_bson": "180000001364006AF90B7C50000000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.543210\"}}" + }, + { + "description": "[basx057] strings without E cannot generate E in result", + "canonical_bson": "180000001364006A19562522020000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"2345678.543210\"}}" + }, + { + "description": "[basx056] strings without E cannot generate E in result", + "canonical_bson": "180000001364006AB9C8733A0B0000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12345678.543210\"}}" + }, + { + "description": "[basx031] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640040AF0D8648700000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789.000000\"}}" + }, + { + "description": "[basx030] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640080910F8648700000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789.123456\"}}" + }, + { + "description": "[basx032] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640080910F8648700000000000000000403000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789123456\"}}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-4.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-4.json new file mode 100644 index 0000000..0957019 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-4.json @@ -0,0 +1,165 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "[basx023] conform to rules and exponent will be in permitted range).", + "canonical_bson": "1800000013640001000000000000000000000000003EB000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.1\"}}" + }, + + { + "description": "[basx045] strings without E cannot generate E in result", + "canonical_bson": "1800000013640003000000000000000000000000003A3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+0.003\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.003\"}}" + }, + { + "description": "[basx610] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \".0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}" + }, + { + "description": "[basx612] Zeros", + "canonical_bson": "1800000013640000000000000000000000000000003EB000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-.0\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}" + }, + { + "description": "[basx043] strings without E cannot generate E in result", + "canonical_bson": "18000000136400FC040000000000000000000000003C3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"+12.76\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}" + }, + { + "description": "[basx055] strings without E cannot generate E in result", + "canonical_bson": "180000001364000500000000000000000000000000303000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000005\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-8\"}}" + }, + { + "description": "[basx054] strings without E cannot generate E in result", + "canonical_bson": "180000001364000500000000000000000000000000323000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000005\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-7\"}}" + }, + { + "description": "[basx052] strings without E cannot generate E in result", + "canonical_bson": "180000001364000500000000000000000000000000343000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000005\"}}" + }, + { + "description": "[basx051] strings without E cannot generate E in result", + "canonical_bson": "180000001364000500000000000000000000000000363000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"00.00005\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00005\"}}" + }, + { + "description": "[basx050] strings without E cannot generate E in result", + "canonical_bson": "180000001364000500000000000000000000000000383000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0005\"}}" + }, + { + "description": "[basx047] strings without E cannot generate E in result", + "canonical_bson": "1800000013640005000000000000000000000000003E3000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \".5\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.5\"}}" + }, + { + "description": "[dqbsr431] check rounding modes heeded (Rounded)", + "canonical_bson": "1800000013640099761CC7B548F377DC80A131C836FE2F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.1111111111111111111111111111123450\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.111111111111111111111111111112345\"}}" + }, + { + "description": "OK2", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FC2F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \".100000000000000000000000000000000000000000000000000000000000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1000000000000000000000000000000000\"}}" + } + ], + "parseErrors": [ + { + "description": "[basx564] Near-specials (Conversion_syntax)", + "string": "Infi" + }, + { + "description": "[basx565] Near-specials (Conversion_syntax)", + "string": "Infin" + }, + { + "description": "[basx566] Near-specials (Conversion_syntax)", + "string": "Infini" + }, + { + "description": "[basx567] Near-specials (Conversion_syntax)", + "string": "Infinit" + }, + { + "description": "[basx568] Near-specials (Conversion_syntax)", + "string": "-Infinit" + }, + { + "description": "[basx590] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": ".Infinity" + }, + { + "description": "[basx562] Near-specials (Conversion_syntax)", + "string": "NaNq" + }, + { + "description": "[basx563] Near-specials (Conversion_syntax)", + "string": "NaNs" + }, + { + "description": "[dqbas939] overflow results at different rounding modes (Overflow & Inexact & Rounded)", + "string": "-7e10000" + }, + { + "description": "[dqbsr534] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234650" + }, + { + "description": "[dqbsr535] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234551" + }, + { + "description": "[dqbsr533] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234550" + }, + { + "description": "[dqbsr532] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234549" + }, + { + "description": "[dqbsr432] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234549" + }, + { + "description": "[dqbsr433] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234550" + }, + { + "description": "[dqbsr435] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234551" + }, + { + "description": "[dqbsr434] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234650" + }, + { + "description": "[dqbas938] overflow results at different rounding modes (Overflow & Inexact & Rounded)", + "string": "7e10000" + }, + { + "description": "Inexact rounding#1", + "string": "100000000000000000000000000000000000000000000000000000000001" + }, + { + "description": "Inexact rounding#2", + "string": "1E-6177" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-5.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-5.json new file mode 100644 index 0000000..e976eae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-5.json @@ -0,0 +1,402 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "[decq035] fold-downs (more below) (Clamped)", + "canonical_bson": "18000000136400000000807F1BCF85B27059C8A43CFE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.230000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq037] fold-downs (more below) (Clamped)", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq077] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.100000000000000000000000000000000E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E-6144\"}}" + }, + { + "description": "[decq078] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E-6144\"}}" + }, + { + "description": "[decq079] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000A00000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000000000000000000000000010E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-6175\"}}" + }, + { + "description": "[decq080] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000A00000000000000000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-6175\"}}" + }, + { + "description": "[decq081] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000020000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000000000000000000000000000001E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6175\"}}" + }, + { + "description": "[decq082] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000020000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6175\"}}" + }, + { + "description": "[decq083] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000000000000000000000000001E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}" + }, + { + "description": "[decq084] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}" + }, + { + "description": "[decq090] underflows cannot be tested for simple copies, check edge cases (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1e-6176\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}" + }, + { + "description": "[decq100] underflows cannot be tested for simple copies, check edge cases (Subnormal)", + "canonical_bson": "18000000136400FFFFFFFF095BC138938D44C64D31000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"999999999999999999999999999999999e-6176\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9.99999999999999999999999999999999E-6144\"}}" + }, + { + "description": "[decq130] fold-downs (more below) (Clamped)", + "canonical_bson": "18000000136400000000807F1BCF85B27059C8A43CFEDF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.23E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.230000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq132] fold-downs (more below) (Clamped)", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FEDF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq177] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.100000000000000000000000000000000E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00000000000000000000000000000000E-6144\"}}" + }, + { + "description": "[decq178] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00000000000000000000000000000000E-6144\"}}" + }, + { + "description": "[decq179] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000A00000000000000000000000000008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000000000000000000000000010E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0E-6175\"}}" + }, + { + "description": "[decq180] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000A00000000000000000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0E-6175\"}}" + }, + { + "description": "[decq181] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000028000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000000000000000000000000000001E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6175\"}}" + }, + { + "description": "[decq182] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000028000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6175\"}}" + }, + { + "description": "[decq183] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000000000000000000000000001E-6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}" + }, + { + "description": "[decq184] Nmin and below (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}" + }, + { + "description": "[decq190] underflow edge cases (Subnormal)", + "canonical_bson": "180000001364000100000000000000000000000000008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1e-6176\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}" + }, + { + "description": "[decq200] underflow edge cases (Subnormal)", + "canonical_bson": "18000000136400FFFFFFFF095BC138938D44C64D31008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-999999999999999999999999999999999e-6176\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.99999999999999999999999999999999E-6144\"}}" + }, + { + "description": "[decq400] zeros (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}" + }, + { + "description": "[decq401] zeros (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000000000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6177\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}" + }, + { + "description": "[decq414] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6112\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}" + }, + { + "description": "[decq416] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}" + }, + { + "description": "[decq418] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}" + }, + { + "description": "[decq420] negative zeros (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-8000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}" + }, + { + "description": "[decq421] negative zeros (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000008000", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6177\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}" + }, + { + "description": "[decq434] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FEDF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6112\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}" + }, + { + "description": "[decq436] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FEDF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}" + }, + { + "description": "[decq438] clamped zeros... (Clamped)", + "canonical_bson": "180000001364000000000000000000000000000000FEDF00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+8000\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}" + }, + { + "description": "[decq601] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000000A5BC138938D44C64D31FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6144\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}" + }, + { + "description": "[decq603] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000000000081EFAC855B416D2DEE04FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6143\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E+6143\"}}" + }, + { + "description": "[decq605] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000000080264B91C02220BE377E00FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6142\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000000E+6142\"}}" + }, + { + "description": "[decq607] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000000040EAED7446D09C2C9F0C00FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6141\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000E+6141\"}}" + }, + { + "description": "[decq609] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000A0CA17726DAE0F1E430100FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6140\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000E+6140\"}}" + }, + { + "description": "[decq611] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000106102253E5ECE4F200000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6139\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000E+6139\"}}" + }, + { + "description": "[decq613] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000E83C80D09F3C2E3B030000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6138\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000E+6138\"}}" + }, + { + "description": "[decq615] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000E4D20CC8DCD2B752000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6137\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000E+6137\"}}" + }, + { + "description": "[decq617] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000000004A48011416954508000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6136\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000E+6136\"}}" + }, + { + "description": "[decq619] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000000A1EDCCCE1BC2D300000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6135\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000E+6135\"}}" + }, + { + "description": "[decq621] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000080F64AE1C7022D1500000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6134\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000E+6134\"}}" + }, + { + "description": "[decq623] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000040B2BAC9E0191E0200000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6133\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000E+6133\"}}" + }, + { + "description": "[decq625] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000000A0DEC5ADC935360000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6132\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000E+6132\"}}" + }, + { + "description": "[decq627] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000010632D5EC76B050000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6131\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000E+6131\"}}" + }, + { + "description": "[decq629] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000000E8890423C78A000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6130\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000E+6130\"}}" + }, + { + "description": "[decq631] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400000064A7B3B6E00D000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6129\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000E+6129\"}}" + }, + { + "description": "[decq633] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000008A5D78456301000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6128\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000E+6128\"}}" + }, + { + "description": "[decq635] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000000C16FF2862300000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6127\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000E+6127\"}}" + }, + { + "description": "[decq637] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000080C6A47E8D0300000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6126\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000E+6126\"}}" + }, + { + "description": "[decq639] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000407A10F35A0000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6125\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000E+6125\"}}" + }, + { + "description": "[decq641] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000A0724E18090000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6124\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000E+6124\"}}" + }, + { + "description": "[decq643] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000010A5D4E8000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6123\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000E+6123\"}}" + }, + { + "description": "[decq645] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000E8764817000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6122\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000E+6122\"}}" + }, + { + "description": "[decq647] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000E40B5402000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6121\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000E+6121\"}}" + }, + { + "description": "[decq649] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000CA9A3B00000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6120\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000E+6120\"}}" + }, + { + "description": "[decq651] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640000E1F50500000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6119\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000E+6119\"}}" + }, + { + "description": "[decq653] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364008096980000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6118\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000E+6118\"}}" + }, + { + "description": "[decq655] fold-down full sequence (Clamped)", + "canonical_bson": "1800000013640040420F0000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6117\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000E+6117\"}}" + }, + { + "description": "[decq657] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400A086010000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6116\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000E+6116\"}}" + }, + { + "description": "[decq659] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364001027000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6115\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000E+6115\"}}" + }, + { + "description": "[decq661] fold-down full sequence (Clamped)", + "canonical_bson": "18000000136400E803000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6114\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000E+6114\"}}" + }, + { + "description": "[decq663] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364006400000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6113\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+6113\"}}" + }, + { + "description": "[decq665] fold-down full sequence (Clamped)", + "canonical_bson": "180000001364000A00000000000000000000000000FE5F00", + "degenerate_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6112\"}}", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}" + } + ] +} + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-6.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-6.json new file mode 100644 index 0000000..eba6764 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-6.json @@ -0,0 +1,131 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "parseErrors": [ + { + "description": "Incomplete Exponent", + "string": "1e" + }, + { + "description": "Exponent at the beginning", + "string": "E01" + }, + { + "description": "Just a decimal place", + "string": "." + }, + { + "description": "2 decimal places", + "string": "..3" + }, + { + "description": "2 decimal places", + "string": ".13.3" + }, + { + "description": "2 decimal places", + "string": "1..3" + }, + { + "description": "2 decimal places", + "string": "1.3.4" + }, + { + "description": "2 decimal places", + "string": "1.34." + }, + { + "description": "Decimal with no digits", + "string": ".e" + }, + { + "description": "2 signs", + "string": "+-32.4" + }, + { + "description": "2 signs", + "string": "-+32.4" + }, + { + "description": "2 negative signs", + "string": "--32.4" + }, + { + "description": "2 negative signs", + "string": "-32.-4" + }, + { + "description": "End in negative sign", + "string": "32.0-" + }, + { + "description": "2 negative signs", + "string": "32.4E--21" + }, + { + "description": "2 negative signs", + "string": "32.4E-2-1" + }, + { + "description": "2 signs", + "string": "32.4E+-21" + }, + { + "description": "Empty string", + "string": "" + }, + { + "description": "leading white space positive number", + "string": " 1" + }, + { + "description": "leading white space negative number", + "string": " -1" + }, + { + "description": "trailing white space", + "string": "1 " + }, + { + "description": "Invalid", + "string": "E" + }, + { + "description": "Invalid", + "string": "invalid" + }, + { + "description": "Invalid", + "string": "i" + }, + { + "description": "Invalid", + "string": "in" + }, + { + "description": "Invalid", + "string": "-in" + }, + { + "description": "Invalid", + "string": "Na" + }, + { + "description": "Invalid", + "string": "-Na" + }, + { + "description": "Invalid", + "string": "1.23abc" + }, + { + "description": "Invalid", + "string": "1.23abcE+02" + }, + { + "description": "Invalid", + "string": "1.23E+0aabs2" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-7.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-7.json new file mode 100644 index 0000000..0b78f12 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-7.json @@ -0,0 +1,327 @@ +{ + "description": "Decimal128", + "bson_type": "0x13", + "test_key": "d", + "parseErrors": [ + { + "description": "[basx572] Near-specials (Conversion_syntax)", + "string": "-9Inf" + }, + { + "description": "[basx516] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "-1-" + }, + { + "description": "[basx533] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "0000.." + }, + { + "description": "[basx534] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": ".0000." + }, + { + "description": "[basx535] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "00..00" + }, + { + "description": "[basx569] Near-specials (Conversion_syntax)", + "string": "0Inf" + }, + { + "description": "[basx571] Near-specials (Conversion_syntax)", + "string": "-0Inf" + }, + { + "description": "[basx575] Near-specials (Conversion_syntax)", + "string": "0sNaN" + }, + { + "description": "[basx503] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "++1" + }, + { + "description": "[basx504] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "--1" + }, + { + "description": "[basx505] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "-+1" + }, + { + "description": "[basx506] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "+-1" + }, + { + "description": "[basx510] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": " +1" + }, + { + "description": "[basx513] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": " + 1" + }, + { + "description": "[basx514] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": " - 1" + }, + { + "description": "[basx501] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "." + }, + { + "description": "[basx502] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": ".." + }, + { + "description": "[basx519] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "" + }, + { + "description": "[basx525] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "e100" + }, + { + "description": "[basx549] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "e+1" + }, + { + "description": "[basx577] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": ".e+1" + }, + { + "description": "[basx578] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "+.e+1" + }, + { + "description": "[basx581] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "E+1" + }, + { + "description": "[basx582] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": ".E+1" + }, + { + "description": "[basx583] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "+.E+1" + }, + { + "description": "[basx579] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "-.e+" + }, + { + "description": "[basx580] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "-.e" + }, + { + "description": "[basx584] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "-.E+" + }, + { + "description": "[basx585] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "-.E" + }, + { + "description": "[basx589] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "+.Inf" + }, + { + "description": "[basx586] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": ".NaN" + }, + { + "description": "[basx587] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "-.NaN" + }, + { + "description": "[basx545] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "ONE" + }, + { + "description": "[basx561] Near-specials (Conversion_syntax)", + "string": "qNaN" + }, + { + "description": "[basx573] Near-specials (Conversion_syntax)", + "string": "-sNa" + }, + { + "description": "[basx588] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": "+.sNaN" + }, + { + "description": "[basx544] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "ten" + }, + { + "description": "[basx527] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "u0b65" + }, + { + "description": "[basx526] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "u0e5a" + }, + { + "description": "[basx515] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "x" + }, + { + "description": "[basx574] Near-specials (Conversion_syntax)", + "string": "xNaN" + }, + { + "description": "[basx530] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": ".123.5" + }, + { + "description": "[basx500] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1..2" + }, + { + "description": "[basx542] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1e1.0" + }, + { + "description": "[basx553] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E+1.2.3" + }, + { + "description": "[basx543] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1e123e" + }, + { + "description": "[basx552] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E+1.2" + }, + { + "description": "[basx546] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1e.1" + }, + { + "description": "[basx547] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1e1." + }, + { + "description": "[basx554] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E++1" + }, + { + "description": "[basx555] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E--1" + }, + { + "description": "[basx556] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E+-1" + }, + { + "description": "[basx557] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E-+1" + }, + { + "description": "[basx558] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E'1" + }, + { + "description": "[basx559] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E\"1" + }, + { + "description": "[basx520] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1e-" + }, + { + "description": "[basx560] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1E" + }, + { + "description": "[basx548] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1ee" + }, + { + "description": "[basx551] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1.2.1" + }, + { + "description": "[basx550] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1.23.4" + }, + { + "description": "[basx529] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "1.34.5" + }, + { + "description": "[basx531] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "01.35." + }, + { + "description": "[basx532] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "01.35-" + }, + { + "description": "[basx518] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "3+" + }, + { + "description": "[basx521] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "7e99999a" + }, + { + "description": "[basx570] Near-specials (Conversion_syntax)", + "string": "9Inf" + }, + { + "description": "[basx512] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "12 " + }, + { + "description": "[basx517] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "12-" + }, + { + "description": "[basx507] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "12e" + }, + { + "description": "[basx508] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "12e++" + }, + { + "description": "[basx509] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "12f4" + }, + { + "description": "[basx536] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111e*123" + }, + { + "description": "[basx537] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111e123-" + }, + { + "description": "[basx540] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111e1*23" + }, + { + "description": "[basx538] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111e+12+" + }, + { + "description": "[basx539] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111e1-3-" + }, + { + "description": "[basx541] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "111E1e+3" + }, + { + "description": "[basx528] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "123,65" + }, + { + "description": "[basx523] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "7e12356789012x" + }, + { + "description": "[basx522] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)", + "string": "7e123567890x" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-mongoc.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-mongoc.json new file mode 100644 index 0000000..68bf1ff --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/decimal128-mongoc.json @@ -0,0 +1,13 @@ +{ + "description": "Decimal128 - libmongoc-specific tests", + "bson_type": "0x13", + "test_key": "d", + "valid": [ + { + "description": "Scientific - Longest", + "degenerate_bson": "1800000013640030303030303030303030303030FFFF8000", + "canonical_bson": "18000000136400386B9ED104386B9ED104386B1E33008100", + "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.036812917280316154812861194857272E-6015\"}}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/document.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/document.json new file mode 100644 index 0000000..3ec9187 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/document.json @@ -0,0 +1,36 @@ +{ + "description": "Document type (sub-documents)", + "bson_type": "0x03", + "test_key": "x", + "valid": [ + { + "description": "Empty subdoc", + "canonical_bson": "0D000000037800050000000000", + "canonical_extjson": "{\"x\" : {}}" + }, + { + "description": "Empty-string key subdoc", + "canonical_bson": "150000000378000D00000002000200000062000000", + "canonical_extjson": "{\"x\" : {\"\" : \"b\"}}" + }, + { + "description": "Single-character key subdoc", + "canonical_bson": "160000000378000E0000000261000200000062000000", + "canonical_extjson": "{\"x\" : {\"a\" : \"b\"}}" + } + ], + "decodeErrors": [ + { + "description": "Subdocument length too long: eats outer terminator", + "bson": "1800000003666F6F000F0000001062617200FFFFFF7F0000" + }, + { + "description": "Subdocument length too short: leaks terminator", + "bson": "1500000003666F6F000A0000000862617200010000" + }, + { + "description": "Invalid subdocument: bad string length in field", + "bson": "1C00000003666F6F001200000002626172000500000062617A000000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double.json new file mode 100644 index 0000000..b00be48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double.json @@ -0,0 +1,87 @@ +{ + "description": "Double type", + "bson_type": "0x01", + "test_key": "d", + "valid": [ + { + "description": "+1.0", + "canonical_bson": "10000000016400000000000000F03F00", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1.0\"}}", + "relaxed_extjson": "{\"d\" : 1.0}" + }, + { + "description": "-1.0", + "canonical_bson": "10000000016400000000000000F0BF00", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1.0\"}}", + "relaxed_extjson": "{\"d\" : -1.0}" + }, + { + "description": "+1.0001220703125", + "canonical_bson": "10000000016400000000008000F03F00", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1.0001220703125\"}}", + "relaxed_extjson": "{\"d\" : 1.0001220703125}" + }, + { + "description": "-1.0001220703125", + "canonical_bson": "10000000016400000000008000F0BF00", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1.0001220703125\"}}", + "relaxed_extjson": "{\"d\" : -1.0001220703125}" + }, + { + "description": "1.23456789012345677E+18", + "canonical_bson": "1000000001640081E97DF41022B14300", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"1234567890123456768.0\"}}", + "relaxed_extjson": "{\"d\" : 1234567890123456768.0}" + }, + { + "description": "-1.23456789012345677E+18", + "canonical_bson": "1000000001640081E97DF41022B1C300", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-1234567890123456768.0\"}}", + "relaxed_extjson": "{\"d\" : -1234567890123456768.0}" + }, + { + "description": "0.0", + "canonical_bson": "10000000016400000000000000000000", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"0.0\"}}", + "relaxed_extjson": "{\"d\" : 0.0}" + }, + { + "description": "-0.0", + "canonical_bson": "10000000016400000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-0.0\"}}", + "relaxed_extjson": "{\"d\" : -0.0}" + }, + { + "description": "NaN", + "canonical_bson": "10000000016400000000000000F87F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "lossy": true + }, + { + "description": "NaN with payload", + "canonical_bson": "10000000016400120000000000F87F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "lossy": true + }, + { + "description": "Inf", + "canonical_bson": "10000000016400000000000000F07F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}" + }, + { + "description": "-Inf", + "canonical_bson": "10000000016400000000000000F0FF00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}" + } + ], + "decodeErrors": [ + { + "description": "double truncated", + "bson": "0B0000000164000000F03F00" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double2.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double2.json new file mode 100644 index 0000000..6f5fd18 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/double2.json @@ -0,0 +1,45 @@ +{ + "description": "Double type", + "bson_type": "0x01", + "test_key": "d", + "valid": [ + { + "description": "-0.0", + "canonical_bson": "10000000016400000000000000008000", + "canonical_extjson": "{\"d\" : {\"$numberDouble\": \"-0.0\"}}", + "relaxed_extjson": "{\"d\" : -0.0}" + }, + { + "description": "NaN", + "canonical_bson": "10000000016400000000000000F87F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "lossy": true + }, + { + "description": "NaN with payload", + "canonical_bson": "10000000016400120000000000F87F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"NaN\"}}", + "lossy": true + }, + { + "description": "Inf", + "canonical_bson": "10000000016400000000000000F07F00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"Infinity\"}}" + }, + { + "description": "-Inf", + "canonical_bson": "10000000016400000000000000F0FF00", + "canonical_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}", + "relaxed_extjson": "{\"d\": {\"$numberDouble\": \"-Infinity\"}}" + } + ], + "decodeErrors": [ + { + "description": "double truncated", + "bson": "0B0000000164000000F03F00" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int32.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int32.json new file mode 100644 index 0000000..1353fc3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int32.json @@ -0,0 +1,43 @@ +{ + "description": "Int32 type", + "bson_type": "0x10", + "test_key": "i", + "valid": [ + { + "description": "MinValue", + "canonical_bson": "0C0000001069000000008000", + "canonical_extjson": "{\"i\" : {\"$numberInt\": \"-2147483648\"}}", + "relaxed_extjson": "{\"i\" : -2147483648}" + }, + { + "description": "MaxValue", + "canonical_bson": "0C000000106900FFFFFF7F00", + "canonical_extjson": "{\"i\" : {\"$numberInt\": \"2147483647\"}}", + "relaxed_extjson": "{\"i\" : 2147483647}" + }, + { + "description": "-1", + "canonical_bson": "0C000000106900FFFFFFFF00", + "canonical_extjson": "{\"i\" : {\"$numberInt\": \"-1\"}}", + "relaxed_extjson": "{\"i\" : -1}" + }, + { + "description": "0", + "canonical_bson": "0C0000001069000000000000", + "canonical_extjson": "{\"i\" : {\"$numberInt\": \"0\"}}", + "relaxed_extjson": "{\"i\" : 0}" + }, + { + "description": "1", + "canonical_bson": "0C0000001069000100000000", + "canonical_extjson": "{\"i\" : {\"$numberInt\": \"1\"}}", + "relaxed_extjson": "{\"i\" : 1}" + } + ], + "decodeErrors": [ + { + "description": "Bad int32 field length", + "bson": "090000001061000500" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int64.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int64.json new file mode 100644 index 0000000..91f4abf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/int64.json @@ -0,0 +1,43 @@ +{ + "description": "Int64 type", + "bson_type": "0x12", + "test_key": "a", + "valid": [ + { + "description": "MinValue", + "canonical_bson": "10000000126100000000000000008000", + "canonical_extjson": "{\"a\" : {\"$numberLong\" : \"-9223372036854775808\"}}", + "relaxed_extjson": "{\"a\" : -9223372036854775808}" + }, + { + "description": "MaxValue", + "canonical_bson": "10000000126100FFFFFFFFFFFFFF7F00", + "canonical_extjson": "{\"a\" : {\"$numberLong\" : \"9223372036854775807\"}}", + "relaxed_extjson": "{\"a\" : 9223372036854775807}" + }, + { + "description": "-1", + "canonical_bson": "10000000126100FFFFFFFFFFFFFFFF00", + "canonical_extjson": "{\"a\" : {\"$numberLong\" : \"-1\"}}", + "relaxed_extjson": "{\"a\" : -1}" + }, + { + "description": "0", + "canonical_bson": "10000000126100000000000000000000", + "canonical_extjson": "{\"a\" : {\"$numberLong\" : \"0\"}}", + "relaxed_extjson": "{\"a\" : 0}" + }, + { + "description": "1", + "canonical_bson": "10000000126100010000000000000000", + "canonical_extjson": "{\"a\" : {\"$numberLong\" : \"1\"}}", + "relaxed_extjson": "{\"a\" : 1}" + } + ], + "decodeErrors": [ + { + "description": "int64 field truncated", + "bson": "0C0000001261001234567800" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/maxkey.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/maxkey.json new file mode 100644 index 0000000..67cad6d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/maxkey.json @@ -0,0 +1,12 @@ +{ + "description": "Maxkey type", + "bson_type": "0x7F", + "test_key": "a", + "valid": [ + { + "description": "Maxkey", + "canonical_bson": "080000007F610000", + "canonical_extjson": "{\"a\" : {\"$maxKey\" : 1}}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/minkey.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/minkey.json new file mode 100644 index 0000000..8adee45 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/minkey.json @@ -0,0 +1,12 @@ +{ + "description": "Minkey type", + "bson_type": "0xFF", + "test_key": "a", + "valid": [ + { + "description": "Minkey", + "canonical_bson": "08000000FF610000", + "canonical_extjson": "{\"a\" : {\"$minKey\" : 1}}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type-deprecated.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type-deprecated.json new file mode 100644 index 0000000..5aac1bd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type-deprecated.json @@ -0,0 +1,15 @@ +{ + "description": "Multiple types within the same document", + "bson_type": "0x00", + "deprecated": true, + "valid": [ + { + "description": "All BSON types", + "canonical_bson": "3B020000075F69640057E193D7A9CC81B4027498B50E53796D626F6C000700000073796D626F6C0002537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C736500000C4442506F696E746572000E00000064622E636F6C6C656374696F6E0057E193D7A9CC81B4027498B1034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0006556E646566696E65640000", + "converted_bson": "4b020000075f69640057e193d7a9cc81b4027498b50253796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442506f696e746572002e0000000224726566000e00000064622e636f6c6c656374696f6e00072469640057e193d7a9cc81b4027498b100034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c000a556e646566696e65640000", + "canonical_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"Symbol\": {\"$symbol\": \"symbol\"}, \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBPointer\": {\"$dbPointer\": {\"$ref\": \"db.collection\", \"$id\": {\"$oid\": \"57e193d7a9cc81b4027498b1\"}}}, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null, \"Undefined\": {\"$undefined\": true}}", + "converted_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"Symbol\": \"symbol\", \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBPointer\": {\"$ref\": \"db.collection\", \"$id\": {\"$oid\": \"57e193d7a9cc81b4027498b1\"}}, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null, \"Undefined\": null}" + } + ] +} + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type.json new file mode 100644 index 0000000..1e1d557 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/multi-type.json @@ -0,0 +1,11 @@ +{ + "description": "Multiple types within the same document", + "bson_type": "0x00", + "valid": [ + { + "description": "All BSON types", + "canonical_bson": "F4010000075F69640057E193D7A9CC81B4027498B502537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C73650000034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0000", + "canonical_extjson": "{\"_id\": {\"$oid\": \"57e193d7a9cc81b4027498b5\"}, \"String\": \"string\", \"Int32\": {\"$numberInt\": \"42\"}, \"Int64\": {\"$numberLong\": \"42\"}, \"Double\": {\"$numberDouble\": \"-1.0\"}, \"Binary\": { \"$binary\" : {\"base64\": \"o0w498Or7cijeBSpkquNtg==\", \"subType\": \"03\"}}, \"BinaryUserDefined\": { \"$binary\" : {\"base64\": \"AQIDBAU=\", \"subType\": \"80\"}}, \"Code\": {\"$code\": \"function() {}\"}, \"CodeWithScope\": {\"$code\": \"function() {}\", \"$scope\": {}}, \"Subdocument\": {\"foo\": \"bar\"}, \"Array\": [{\"$numberInt\": \"1\"}, {\"$numberInt\": \"2\"}, {\"$numberInt\": \"3\"}, {\"$numberInt\": \"4\"}, {\"$numberInt\": \"5\"}], \"Timestamp\": {\"$timestamp\": {\"t\": 42, \"i\": 1}}, \"Regex\": {\"$regularExpression\": {\"pattern\": \"pattern\", \"options\": \"\"}}, \"DatetimeEpoch\": {\"$date\": {\"$numberLong\": \"0\"}}, \"DatetimePositive\": {\"$date\": {\"$numberLong\": \"2147483647\"}}, \"DatetimeNegative\": {\"$date\": {\"$numberLong\": \"-2147483648\"}}, \"True\": true, \"False\": false, \"DBRef\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"57fd71e96e32ab4225b723fb\"}, \"$db\": \"database\"}, \"Minkey\": {\"$minKey\": 1}, \"Maxkey\": {\"$maxKey\": 1}, \"Null\": null}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/null.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/null.json new file mode 100644 index 0000000..f9b2694 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/null.json @@ -0,0 +1,12 @@ +{ + "description": "Null type", + "bson_type": "0x0A", + "test_key": "a", + "valid": [ + { + "description": "Null", + "canonical_bson": "080000000A610000", + "canonical_extjson": "{\"a\" : null}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/oid.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/oid.json new file mode 100644 index 0000000..14e9caf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/oid.json @@ -0,0 +1,28 @@ +{ + "description": "ObjectId", + "bson_type": "0x07", + "test_key": "a", + "valid": [ + { + "description": "All zeroes", + "canonical_bson": "1400000007610000000000000000000000000000", + "canonical_extjson": "{\"a\" : {\"$oid\" : \"000000000000000000000000\"}}" + }, + { + "description": "All ones", + "canonical_bson": "14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00", + "canonical_extjson": "{\"a\" : {\"$oid\" : \"ffffffffffffffffffffffff\"}}" + }, + { + "description": "Random", + "canonical_bson": "1400000007610056E1FC72E0C917E9C471416100", + "canonical_extjson": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\"}}" + } + ], + "decodeErrors": [ + { + "description": "OID truncated", + "bson": "1200000007610056E1FC72E0C917E9C471" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/regex.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/regex.json new file mode 100644 index 0000000..c62b019 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/regex.json @@ -0,0 +1,65 @@ +{ + "description": "Regular Expression type", + "bson_type": "0x0B", + "test_key": "a", + "valid": [ + { + "description": "empty regex with no options", + "canonical_bson": "0A0000000B6100000000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"\", \"options\" : \"\"}}}" + }, + { + "description": "regex without options", + "canonical_bson": "0D0000000B6100616263000000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"\"}}}" + }, + { + "description": "regex with options", + "canonical_bson": "0F0000000B610061626300696D0000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}" + }, + { + "description": "regex with options (keys reversed)", + "canonical_bson": "0F0000000B610061626300696D0000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"im\"}}}", + "degenerate_extjson": "{\"a\" : {\"$regularExpression\" : {\"options\" : \"im\", \"pattern\": \"abc\"}}}" + }, + { + "description": "regex with slash", + "canonical_bson": "110000000B610061622F636400696D0000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab/cd\", \"options\" : \"im\"}}}" + }, + { + "description": "flags not alphabetized", + "degenerate_bson": "100000000B6100616263006D69780000", + "canonical_bson": "100000000B610061626300696D780000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"imx\"}}}", + "degenerate_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"abc\", \"options\" : \"mix\"}}}" + }, + { + "description" : "Required escapes", + "canonical_bson" : "100000000B610061625C226162000000", + "canonical_extjson": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"ab\\\\\\\"ab\", \"options\" : \"\"}}}" + }, + { + "description" : "Regular expression as value of $regex query operator", + "canonical_bson" : "180000000B247265676578007061747465726E0069780000", + "canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"ix\"}}}" + }, + { + "description" : "Regular expression as value of $regex query operator with $options", + "canonical_bson" : "270000000B247265676578007061747465726E000002246F7074696F6E73000300000069780000", + "canonical_extjson": "{\"$regex\" : {\"$regularExpression\" : { \"pattern\": \"pattern\", \"options\" : \"\"}}, \"$options\" : \"ix\"}" + } + ], + "decodeErrors": [ + { + "description": "embedded null in pattern", + "bson": "0F0000000B610061006300696D0000" + }, + { + "description": "embedded null in flags", + "bson": "100000000B61006162630069006D0000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/string.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/string.json new file mode 100644 index 0000000..bb2907b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/string.json @@ -0,0 +1,72 @@ +{ + "description": "String", + "bson_type": "0x02", + "test_key": "a", + "valid": [ + { + "description": "Empty string", + "canonical_bson": "0D000000026100010000000000", + "canonical_extjson": "{\"a\" : \"\"}" + }, + { + "description": "Single character", + "canonical_bson": "0E00000002610002000000620000", + "canonical_extjson": "{\"a\" : \"b\"}" + }, + { + "description": "Multi-character", + "canonical_bson": "190000000261000D0000006162616261626162616261620000", + "canonical_extjson": "{\"a\" : \"abababababab\"}" + }, + { + "description": "two-byte UTF-8 (\u00e9)", + "canonical_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000", + "canonical_extjson": "{\"a\" : \"éééééé\"}" + }, + { + "description": "three-byte UTF-8 (\u2606)", + "canonical_bson": "190000000261000D000000E29886E29886E29886E298860000", + "canonical_extjson": "{\"a\" : \"☆☆☆☆\"}" + }, + { + "description": "Embedded nulls", + "canonical_bson": "190000000261000D0000006162006261620062616261620000", + "canonical_extjson": "{\"a\" : \"ab\\u0000bab\\u0000babab\"}" + }, + { + "description": "Required escapes", + "canonical_bson" : "320000000261002600000061625C220102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F61620000", + "canonical_extjson" : "{\"a\":\"ab\\\\\\\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001fab\"}" + } + ], + "decodeErrors": [ + { + "description": "bad string length: 0 (but no 0x00 either)", + "bson": "0C0000000261000000000000" + }, + { + "description": "bad string length: -1", + "bson": "0C000000026100FFFFFFFF00" + }, + { + "description": "bad string length: eats terminator", + "bson": "10000000026100050000006200620000" + }, + { + "description": "bad string length: longer than rest of document", + "bson": "120000000200FFFFFF00666F6F6261720000" + }, + { + "description": "string is not null-terminated", + "bson": "1000000002610004000000616263FF00" + }, + { + "description": "empty string, but extra null", + "bson": "0E00000002610001000000000000" + }, + { + "description": "invalid UTF-8", + "bson": "0E00000002610002000000E90000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/symbol.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/symbol.json new file mode 100644 index 0000000..4e46cb9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/symbol.json @@ -0,0 +1,80 @@ +{ + "description": "Symbol", + "bson_type": "0x0E", + "deprecated": true, + "test_key": "a", + "valid": [ + { + "description": "Empty string", + "canonical_bson": "0D0000000E6100010000000000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"\"}}", + "converted_bson": "0D000000026100010000000000", + "converted_extjson": "{\"a\": \"\"}" + }, + { + "description": "Single character", + "canonical_bson": "0E0000000E610002000000620000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"b\"}}", + "converted_bson": "0E00000002610002000000620000", + "converted_extjson": "{\"a\": \"b\"}" + }, + { + "description": "Multi-character", + "canonical_bson": "190000000E61000D0000006162616261626162616261620000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"abababababab\"}}", + "converted_bson": "190000000261000D0000006162616261626162616261620000", + "converted_extjson": "{\"a\": \"abababababab\"}" + }, + { + "description": "two-byte UTF-8 (\u00e9)", + "canonical_bson": "190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"éééééé\"}}", + "converted_bson": "190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000", + "converted_extjson": "{\"a\": \"éééééé\"}" + }, + { + "description": "three-byte UTF-8 (\u2606)", + "canonical_bson": "190000000E61000D000000E29886E29886E29886E298860000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"☆☆☆☆\"}}", + "converted_bson": "190000000261000D000000E29886E29886E29886E298860000", + "converted_extjson": "{\"a\": \"☆☆☆☆\"}" + }, + { + "description": "Embedded nulls", + "canonical_bson": "190000000E61000D0000006162006261620062616261620000", + "canonical_extjson": "{\"a\": {\"$symbol\": \"ab\\u0000bab\\u0000babab\"}}", + "converted_bson": "190000000261000D0000006162006261620062616261620000", + "converted_extjson": "{\"a\": \"ab\\u0000bab\\u0000babab\"}" + } + ], + "decodeErrors": [ + { + "description": "bad symbol length: 0 (but no 0x00 either)", + "bson": "0C0000000261000000000000" + }, + { + "description": "bad symbol length: -1", + "bson": "0C000000026100FFFFFFFF00" + }, + { + "description": "bad symbol length: eats terminator", + "bson": "10000000026100050000006200620000" + }, + { + "description": "bad symbol length: longer than rest of document", + "bson": "120000000200FFFFFF00666F6F6261720000" + }, + { + "description": "symbol is not null-terminated", + "bson": "1000000002610004000000616263FF00" + }, + { + "description": "empty symbol, but extra null", + "bson": "0E00000002610001000000000000" + }, + { + "description": "invalid UTF-8", + "bson": "0E00000002610002000000E90000" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/timestamp.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/timestamp.json new file mode 100644 index 0000000..c76bc29 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/timestamp.json @@ -0,0 +1,29 @@ +{ + "description": "Timestamp type", + "bson_type": "0x11", + "test_key": "a", + "valid": [ + { + "description": "Timestamp: (123456789, 42)", + "canonical_bson": "100000001161002A00000015CD5B0700", + "canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42} } }" + }, + { + "description": "Timestamp: (123456789, 42) (keys reversed)", + "canonical_bson": "100000001161002A00000015CD5B0700", + "canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42} } }", + "degenerate_extjson": "{\"a\" : {\"$timestamp\" : {\"i\" : 42, \"t\" : 123456789} } }" + }, + { + "description": "Timestamp with high-order bit set on both seconds and increment", + "canonical_bson": "10000000116100FFFFFFFFFFFFFFFF00", + "canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 4294967295, \"i\" : 4294967295} } }" + } + ], + "decodeErrors": [ + { + "description": "Truncated timestamp field", + "bson": "0f0000001161002A00000015CD5B00" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/top.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/top.json new file mode 100644 index 0000000..68b5119 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/top.json @@ -0,0 +1,236 @@ +{ + "description": "Top-level document validity", + "bson_type": "0x00", + "valid": [ + { + "description": "Document with keys that start with $", + "canonical_bson": "0F00000010246B6579002A00000000", + "canonical_extjson": "{\"$key\": {\"$numberInt\": \"42\"}}" + } + ], + "decodeErrors": [ + { + "description": "An object size that's too small to even include the object size, but is a well-formed, empty object", + "bson": "0100000000" + }, + { + "description": "An object size that's only enough for the object size, but is a well-formed, empty object", + "bson": "0400000000" + }, + { + "description": "One object, with length shorter than size (missing EOO)", + "bson": "05000000" + }, + { + "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01", + "bson": "0500000001" + }, + { + "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff", + "bson": "05000000FF" + }, + { + "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70", + "bson": "0500000070" + }, + { + "description": "Byte count is zero (with non-zero input length)", + "bson": "00000000000000000000" + }, + { + "description": "Stated length exceeds byte count, with truncated document", + "bson": "1200000002666F6F0004000000626172" + }, + { + "description": "Stated length less than byte count, with garbage after envelope", + "bson": "1200000002666F6F00040000006261720000DEADBEEF" + }, + { + "description": "Stated length exceeds byte count, with valid envelope", + "bson": "1300000002666F6F00040000006261720000" + }, + { + "description": "Stated length less than byte count, with valid envelope", + "bson": "1100000002666F6F00040000006261720000" + }, + { + "description": "Invalid BSON type low range", + "bson": "07000000000000" + }, + { + "description": "Invalid BSON type high range", + "bson": "07000000800000" + }, + { + "description": "Document truncated mid-key", + "bson": "1200000002666F" + } + ], + "parseErrors": [ + { + "description" : "Bad $regularExpression (extra field)", + "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}" + }, + { + "description" : "Bad $regularExpression (missing options field)", + "string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\"}}}" + }, + { + "description": "Bad $regularExpression (pattern is number, not string)", + "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": 42, \"$options\" : \"\"}}}" + }, + { + "description": "Bad $regularExpression (options are number, not string)", + "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": \"a\", \"$options\" : 0}}}" + }, + { + "description" : "Bad $regularExpression (missing pattern field)", + "string" : "{\"a\" : \"$regularExpression\": {\"options\":\"ix\"}}}" + }, + { + "description": "Bad $oid (number, not string)", + "string": "{\"a\" : {\"$oid\" : 42}}" + }, + { + "description": "Bad $oid (extra field)", + "string": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\", \"unrelated\": true}}" + }, + { + "description": "Bad $numberInt (number, not string)", + "string": "{\"a\" : {\"$numberInt\" : 42}}" + }, + { + "description": "Bad $numberInt (extra field)", + "string": "{\"a\" : {\"$numberInt\" : \"42\", \"unrelated\": true}}" + }, + { + "description": "Bad $numberLong (number, not string)", + "string": "{\"a\" : {\"$numberLong\" : 42}}" + }, + { + "description": "Bad $numberLong (extra field)", + "string": "{\"a\" : {\"$numberLong\" : \"42\", \"unrelated\": true}}" + }, + { + "description": "Bad $numberDouble (number, not string)", + "string": "{\"a\" : {\"$numberDouble\" : 42}}" + }, + { + "description": "Bad $numberDouble (extra field)", + "string": "{\"a\" : {\"$numberDouble\" : \".1\", \"unrelated\": true}}" + }, + { + "description": "Bad $numberDecimal (number, not string)", + "string": "{\"a\" : {\"$numberDecimal\" : 42}}" + }, + { + "description": "Bad $numberDecimal (extra field)", + "string": "{\"a\" : {\"$numberDecimal\" : \".1\", \"unrelated\": true}}" + }, + { + "description": "Bad $binary (binary is number, not string)", + "string": "{\"x\" : {\"$binary\" : {\"base64\" : 0, \"subType\" : \"00\"}}}" + }, + { + "description": "Bad $binary (type is number, not string)", + "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"\", \"subType\" : 0}}}" + }, + { + "description": "Bad $binary (missing $type)", + "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\"}}}" + }, + { + "description": "Bad $binary (missing $binary)", + "string": "{\"x\" : {\"$binary\" : {\"subType\" : \"00\"}}}" + }, + { + "description": "Bad $binary (extra field)", + "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\", \"subType\" : 0, \"unrelated\": true}}}" + }, + { + "description": "Bad $code (type is number, not string)", + "string": "{\"a\" : {\"$code\" : 42}}" + }, + { + "description": "Bad $code (extra field)", + "string": "{\"a\" : {\"$code\" : \"\", \"unrelated\": true}}" + }, + { + "description": "Bad $code with $scope (scope is number, not doc)", + "string": "{\"x\" : {\"$code\" : \"\", \"$scope\" : 42}}" + }, + { + "description": "Bad $timestamp (type is number, not doc)", + "string": "{\"a\" : {\"$timestamp\" : 42} }" + }, + { + "description": "Bad $timestamp ('t' type is string, not number)", + "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : 42} } }" + }, + { + "description": "Bad $timestamp ('i' type is string, not number)", + "string": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : \"42\"} } }" + }, + { + "description": "Bad $timestamp (extra field at same level as $timestamp)", + "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\"}, \"unrelated\": true } }" + }, + { + "description": "Bad $timestamp (extra field at same level as t and i)", + "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\", \"unrelated\": true} } }" + }, + { + "description": "Bad $timestamp (missing t)", + "string": "{\"a\" : {\"$timestamp\" : {\"i\" : \"42\"} } }" + }, + { + "description": "Bad $timestamp (missing i)", + "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\"} } }" + }, + { + "description": "Bad $date (number, not string or hash)", + "string": "{\"a\" : {\"$date\" : 42}}" + }, + { + "description": "Bad $date (extra field)", + "string": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330501\"}, \"unrelated\": true}}" + }, + { + "description": "Bad DBRef (ref is number, not string)", + "string": "{\"x\" : {\"$ref\" : 42, \"$id\" : \"abc\"}}" + }, + { + "description": "Bad DBRef (db is number, not string)", + "string": "{\"x\" : {\"$ref\" : \"a\", \"$id\" : \"abc\", \"$db\" : 42}}" + }, + { + "description": "Bad $minKey (boolean, not integer)", + "string": "{\"a\" : {\"$minKey\" : true}}" + }, + { + "description": "Bad $minKey (wrong integer)", + "string": "{\"a\" : {\"$minKey\" : 0}}" + }, + { + "description": "Bad $minKey (extra field)", + "string": "{\"a\" : {\"$minKey\" : 1, \"unrelated\": true}}" + }, + { + "description": "Bad $maxKey (boolean, not integer)", + "string": "{\"a\" : {\"$maxKey\" : true}}" + }, + { + "description": "Bad $maxKey (wrong integer)", + "string": "{\"a\" : {\"$maxKey\" : 0}}" + }, + { + "description": "Bad $maxKey (extra field)", + "string": "{\"a\" : {\"$maxKey\" : 1, \"unrelated\": true}}" + }, + { + "description": "Bad DBpointer (extra field)", + "string": "{\"a\": {\"$dbPointer\": {\"a\": {\"$numberInt\": \"1\"}, \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}, \"c\": {\"$numberInt\": \"2\"}, \"$ref\": \"b\"}}}" + } + + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/undefined.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/undefined.json new file mode 100644 index 0000000..285f068 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/bson_corpus/undefined.json @@ -0,0 +1,15 @@ +{ + "description": "Undefined type (deprecated)", + "bson_type": "0x06", + "deprecated": true, + "test_key": "a", + "valid": [ + { + "description": "Undefined", + "canonical_bson": "0800000006610000", + "canonical_extjson": "{\"a\" : {\"$undefined\" : true}}", + "converted_bson": "080000000A610000", + "converted_extjson": "{\"a\" : null}" + } + ] +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/test.json b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/test.json new file mode 100644 index 0000000..34d7eac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/json/test.json @@ -0,0 +1,2 @@ +{"foo": "bar", "a": 1} +{"_id": {"$oid": "aabbccddeeff001122334455"}} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-atomic.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-atomic.c new file mode 100644 index 0000000..e08f269 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-atomic.c @@ -0,0 +1,56 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "TestSuite.h" + + +static void +test1 (void) +{ + int32_t v = 0; + + bson_atomic_int_add (&v, 1); + BSON_ASSERT (v == 1); +} + + +static void +test2 (void) +{ + int64_t v = 0; + + bson_atomic_int64_add (&v, 1); + BSON_ASSERT (v == 1); +} + + +static void +test3 (void) +{ + bson_memory_barrier (); +} + + +void +test_atomic_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/atomic/int/add", test1); + TestSuite_Add (suite, "/atomic/int64/add", test2); + TestSuite_Add (suite, "/atomic/memory_barrier", test3); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-basic.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-basic.c new file mode 100644 index 0000000..7e9f3d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-basic.c @@ -0,0 +1,663 @@ +#include "TestSuite.h" + +#include + +static void +test_utf8 (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_utf8 (&expected, "hello", -1, "world", -1); + BCON_APPEND (&bcon, "hello", "world"); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + +static void +test_double (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_double (&expected, "foo", -1, 1.1); + BCON_APPEND (&bcon, "foo", BCON_DOUBLE (1.1)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + +static void +test_decimal128 (void) +{ + bson_t bcon, expected; + bson_decimal128_t dec; + bson_decimal128_from_string ("120E20", &dec); + + bson_init (&bcon); + bson_init (&expected); + + bson_append_decimal128 (&expected, "foo", -1, &dec); + BCON_APPEND (&bcon, "foo", BCON_DECIMAL128 (&dec)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + +static void +test_binary (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_binary ( + &expected, "foo", -1, BSON_SUBTYPE_BINARY, (uint8_t *) "deadbeef", 8); + + BCON_APPEND (&bcon, + "foo", + BCON_BIN (BSON_SUBTYPE_BINARY, (const uint8_t *) "deadbeef", 8), + NULL); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_undefined (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_undefined (&expected, "foo", -1); + + BCON_APPEND (&bcon, "foo", BCON_UNDEFINED); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_oid (void) +{ + bson_t bcon, expected; + bson_oid_t oid; + + bson_init (&bcon); + bson_init (&expected); + + bson_oid_init (&oid, NULL); + + bson_append_oid (&expected, "foo", -1, &oid); + BCON_APPEND (&bcon, "foo", BCON_OID (&oid)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_bool (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_bool (&expected, "foo", -1, 1); + + BCON_APPEND (&bcon, "foo", BCON_BOOL (1)); + + bson_eq_bson (&bcon, &expected); + + bson_reinit (&bcon); + bson_reinit (&expected); + + bson_append_bool (&expected, "foo", -1, 0); + + BCON_APPEND (&bcon, "foo", BCON_BOOL (0)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_date_time (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_date_time (&expected, "foo", -1, 10000); + + BCON_APPEND (&bcon, "foo", BCON_DATE_TIME (10000)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_null (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_null (&expected, "foo", -1); + + BCON_APPEND (&bcon, "foo", BCON_NULL); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_regex (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + /* option flags are sorted */ + bson_append_regex (&expected, "foo", -1, "^foo|bar$", "mis"); + BCON_APPEND (&bcon, "foo", BCON_REGEX ("^foo|bar$", "msi")); + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_dbpointer (void) +{ + bson_t bcon, expected; + bson_oid_t oid; + + bson_init (&bcon); + bson_init (&expected); + + bson_oid_init (&oid, NULL); + + bson_append_dbpointer (&expected, "foo", -1, "collection", &oid); + + BCON_APPEND (&bcon, "foo", BCON_DBPOINTER ("collection", &oid)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_code (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_code (&expected, "foo", -1, "var a = {};"); + + BCON_APPEND (&bcon, "foo", BCON_CODE ("var a = {};")); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_symbol (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_symbol (&expected, "foo", -1, "deadbeef", -1); + + BCON_APPEND (&bcon, "foo", BCON_SYMBOL ("deadbeef")); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_codewscope (void) +{ + bson_t bcon, expected, scope; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&scope); + + bson_append_int32 (&scope, "b", -1, 10); + + bson_append_code_with_scope (&expected, "foo", -1, "var a = b;", &scope); + + BCON_APPEND (&bcon, "foo", BCON_CODEWSCOPE ("var a = b;", &scope)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&scope); +} + + +static void +test_int32 (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_int32 (&expected, "foo", -1, 100); + + BCON_APPEND (&bcon, "foo", BCON_INT32 (100)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_timestamp (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_timestamp (&expected, "foo", -1, 100, 1000); + + BCON_APPEND (&bcon, "foo", BCON_TIMESTAMP (100, 1000)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_int64 (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_int64 (&expected, "foo", -1, 100); + + BCON_APPEND (&bcon, "foo", BCON_INT64 (100)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_maxkey (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_maxkey (&expected, "foo", -1); + BCON_APPEND (&bcon, "foo", BCON_MAXKEY); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_minkey (void) +{ + bson_t bcon, expected; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_minkey (&expected, "foo", -1); + BCON_APPEND (&bcon, "foo", BCON_MINKEY); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_bson_document (void) +{ + bson_t bcon, expected, child; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + + bson_append_utf8 (&child, "bar", -1, "baz", -1); + bson_append_document (&expected, "foo", -1, &child); + + BCON_APPEND (&bcon, "foo", BCON_DOCUMENT (&child)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&child); +} + + +static void +test_bson_array (void) +{ + bson_t bcon, expected, child; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + + bson_append_utf8 (&child, "0", -1, "baz", -1); + bson_append_array (&expected, "foo", -1, &child); + + BCON_APPEND (&bcon, "foo", BCON_ARRAY (&child)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&child); +} + + +static void +test_inline_array (void) +{ + bson_t bcon, expected, child; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + + bson_append_utf8 (&child, "0", -1, "baz", -1); + bson_append_array (&expected, "foo", -1, &child); + + BCON_APPEND (&bcon, "foo", "[", "baz", "]"); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&child); + bson_destroy (&expected); +} + + +static void +test_inline_doc (void) +{ + bson_t bcon, expected, child; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + + bson_append_utf8 (&child, "bar", -1, "baz", -1); + bson_append_document (&expected, "foo", -1, &child); + + BCON_APPEND (&bcon, "foo", "{", "bar", "baz", "}"); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&child); +} + + +static void +test_inline_nested (void) +{ + bson_t bcon, expected, foo, bar, third; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&foo); + bson_init (&bar); + bson_init (&third); + + bson_append_utf8 (&third, "hello", -1, "world", -1); + bson_append_int32 (&bar, "0", -1, 1); + bson_append_int32 (&bar, "1", -1, 2); + bson_append_document (&bar, "2", -1, &third); + bson_append_array (&foo, "bar", -1, &bar); + bson_append_document (&expected, "foo", -1, &foo); + + BCON_APPEND (&bcon, + "foo", + "{", + "bar", + "[", + BCON_INT32 (1), + BCON_INT32 (2), + "{", + "hello", + "world", + "}", + "]", + "}"); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&foo); + bson_destroy (&bar); + bson_destroy (&third); +} + + +static void +test_concat (void) +{ + bson_t bcon, expected, child, child2; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + bson_init (&child2); + + bson_append_utf8 (&child, "hello", -1, "world", -1); + bson_append_document (&expected, "foo", -1, &child); + + BCON_APPEND (&bcon, "foo", "{", BCON (&child), "}"); + + bson_eq_bson (&bcon, &expected); + + bson_reinit (&bcon); + bson_reinit (&expected); + bson_reinit (&child); + + bson_append_utf8 (&child, "0", -1, "bar", -1); + bson_append_utf8 (&child, "1", -1, "baz", -1); + bson_append_array (&expected, "foo", -1, &child); + + bson_append_utf8 (&child2, "0", -1, "baz", -1); + BCON_APPEND (&bcon, "foo", "[", "bar", BCON (&child2), "]"); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&child); + bson_destroy (&child2); + bson_destroy (&expected); +} + + +static void +test_iter (void) +{ + bson_t bcon, expected; + bson_iter_t iter; + + bson_init (&bcon); + bson_init (&expected); + + bson_append_int32 (&expected, "foo", -1, 100); + bson_iter_init_find (&iter, &expected, "foo"); + + BCON_APPEND (&bcon, "foo", BCON_ITER (&iter)); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); +} + + +static void +test_bcon_new (void) +{ + bson_t expected; + bson_t *bcon; + + bson_init (&expected); + + bson_append_utf8 (&expected, "hello", -1, "world", -1); + bcon = BCON_NEW ("hello", "world"); + + bson_eq_bson (bcon, &expected); + + bson_destroy (bcon); + bson_destroy (&expected); +} + + +static void +test_append_ctx_helper (bson_t *bson, ...) +{ + va_list ap; + bcon_append_ctx_t ctx; + bcon_append_ctx_init (&ctx); + + va_start (ap, bson); + + bcon_append_ctx_va (bson, &ctx, &ap); + + va_arg (ap, char *); + + BCON_APPEND_CTX (bson, &ctx, "c", "d"); + + bcon_append_ctx_va (bson, &ctx, &ap); + + va_end (ap); +} + +static void +test_append_ctx (void) +{ + bson_t bcon, expected, child; + + bson_init (&bcon); + bson_init (&expected); + bson_init (&child); + + bson_append_utf8 (&child, "c", -1, "d", -1); + bson_append_utf8 (&child, "e", -1, "f", -1); + + bson_append_document (&expected, "a", -1, &child); + + test_append_ctx_helper ( + &bcon, "a", "{", NULL, "add magic", "e", "f", "}", NULL); + + bson_eq_bson (&bcon, &expected); + + bson_destroy (&bcon); + bson_destroy (&expected); + bson_destroy (&child); +} + + +void +test_bcon_basic_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/bcon/test_utf8", test_utf8); + TestSuite_Add (suite, "/bson/bcon/test_double", test_double); + TestSuite_Add (suite, "/bson/bcon/test_binary", test_binary); + TestSuite_Add (suite, "/bson/bcon/test_undefined", test_undefined); + TestSuite_Add (suite, "/bson/bcon/test_oid", test_oid); + TestSuite_Add (suite, "/bson/bcon/test_bool", test_bool); + TestSuite_Add (suite, "/bson/bcon/test_date_time", test_date_time); + TestSuite_Add (suite, "/bson/bcon/test_null", test_null); + TestSuite_Add (suite, "/bson/bcon/test_regex", test_regex); + TestSuite_Add (suite, "/bson/bcon/test_dbpointer", test_dbpointer); + TestSuite_Add (suite, "/bson/bcon/test_code", test_code); + TestSuite_Add (suite, "/bson/bcon/test_symbol", test_symbol); + TestSuite_Add (suite, "/bson/bcon/test_codewscope", test_codewscope); + TestSuite_Add (suite, "/bson/bcon/test_int32", test_int32); + TestSuite_Add (suite, "/bson/bcon/test_timestamp", test_timestamp); + TestSuite_Add (suite, "/bson/bcon/test_int64", test_int64); + TestSuite_Add (suite, "/bson/bcon/test_decimal128", test_decimal128); + TestSuite_Add (suite, "/bson/bcon/test_maxkey", test_maxkey); + TestSuite_Add (suite, "/bson/bcon/test_minkey", test_minkey); + TestSuite_Add (suite, "/bson/bcon/test_bson_document", test_bson_document); + TestSuite_Add (suite, "/bson/bcon/test_bson_array", test_bson_array); + TestSuite_Add (suite, "/bson/bcon/test_inline_array", test_inline_array); + TestSuite_Add (suite, "/bson/bcon/test_inline_doc", test_inline_doc); + TestSuite_Add (suite, "/bson/bcon/test_inline_nested", test_inline_nested); + TestSuite_Add (suite, "/bson/bcon/test_concat", test_concat); + TestSuite_Add (suite, "/bson/bcon/test_iter", test_iter); + TestSuite_Add (suite, "/bson/bcon/test_bcon_new", test_bcon_new); + TestSuite_Add (suite, "/bson/bcon/test_append_ctx", test_append_ctx); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-extract.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-extract.c new file mode 100644 index 0000000..1370e74 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bcon-extract.c @@ -0,0 +1,522 @@ +#include + +#include "TestSuite.h" + +static void +test_utf8 (void) +{ + const char *val; + + bson_t *bcon = BCON_NEW ("hello", "world"); + + BSON_ASSERT (BCON_EXTRACT (bcon, "hello", BCONE_UTF8 (val))); + + BSON_ASSERT (strcmp (val, "world") == 0); + + bson_destroy (bcon); +} + +static void +test_double (void) +{ + double val; + + bson_t *bcon = BCON_NEW ("foo", BCON_DOUBLE (1.1)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DOUBLE (val))); + + BSON_ASSERT (val == 1.1); + + bson_destroy (bcon); +} + +static void +test_decimal128 (void) +{ + bson_decimal128_t val; + bson_decimal128_t dec; + bson_t *bcon; + + bson_decimal128_from_string ("12", &dec); + bcon = BCON_NEW ("foo", BCON_DECIMAL128 (&dec)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DECIMAL128 (val))); + + BSON_ASSERT (val.low == 0xCULL); + BSON_ASSERT (val.high == 0x3040000000000000ULL); + + bson_destroy (bcon); +} + +static void +test_binary (void) +{ + bson_subtype_t subtype; + uint32_t len; + const uint8_t *binary; + + bson_t *bcon = BCON_NEW ( + "foo", BCON_BIN (BSON_SUBTYPE_BINARY, (uint8_t *) "deadbeef", 8)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_BIN (subtype, binary, len))); + + BSON_ASSERT (subtype == BSON_SUBTYPE_BINARY); + BSON_ASSERT (len == 8); + BSON_ASSERT (memcmp (binary, "deadbeef", 8) == 0); + + bson_destroy (bcon); +} + + +static void +test_undefined (void) +{ + bson_t *bcon = BCON_NEW ("foo", BCON_UNDEFINED); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_UNDEFINED)); + + bson_destroy (bcon); +} + + +static void +test_oid (void) +{ + bson_oid_t oid; + bson_t *bcon; + const bson_oid_t *ooid; + + bson_oid_init (&oid, NULL); + + bcon = BCON_NEW ("foo", BCON_OID (&oid)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_OID (ooid))); + + BSON_ASSERT (bson_oid_equal (&oid, ooid)); + + bson_destroy (bcon); +} + +static void +test_bool (void) +{ + bool b; + + bson_t *bcon = BCON_NEW ("foo", BCON_BOOL (true)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_BOOL (b))); + + BSON_ASSERT (b == true); + + bson_destroy (bcon); +} + +static void +test_date_time (void) +{ + int64_t out; + + bson_t *bcon = BCON_NEW ("foo", BCON_DATE_TIME (10000)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DATE_TIME (out))); + + BSON_ASSERT (out == 10000); + + bson_destroy (bcon); +} + + +static void +test_null (void) +{ + bson_t *bcon = BCON_NEW ("foo", BCON_NULL); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_NULL)); + + bson_destroy (bcon); +} + + +static void +test_regex (void) +{ + const char *regex; + const char *flags; + + bson_t *bcon = BCON_NEW ("foo", BCON_REGEX ("^foo|bar$", "i")); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_REGEX (regex, flags))); + + BSON_ASSERT (strcmp (regex, "^foo|bar$") == 0); + BSON_ASSERT (strcmp (flags, "i") == 0); + + bson_destroy (bcon); +} + + +static void +test_dbpointer (void) +{ + const char *collection; + bson_oid_t oid; + const bson_oid_t *ooid; + bson_t *bcon; + + bson_oid_init (&oid, NULL); + + bcon = BCON_NEW ("foo", BCON_DBPOINTER ("collection", &oid)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DBPOINTER (collection, ooid))); + + BSON_ASSERT (strcmp (collection, "collection") == 0); + BSON_ASSERT (bson_oid_equal (ooid, &oid)); + + bson_destroy (bcon); +} + + +static void +test_code (void) +{ + const char *val; + + bson_t *bcon = BCON_NEW ("foo", BCON_CODE ("var a = {};")); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_CODE (val))); + + BSON_ASSERT (strcmp (val, "var a = {};") == 0); + + bson_destroy (bcon); +} + + +static void +test_symbol (void) +{ + const char *val; + + bson_t *bcon = BCON_NEW ("foo", BCON_SYMBOL ("symbol")); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_SYMBOL (val))); + + BSON_ASSERT (strcmp (val, "symbol") == 0); + + bson_destroy (bcon); +} + + +static void +test_codewscope (void) +{ + const char *code; + bson_t oscope; + + bson_t *scope = BCON_NEW ("b", BCON_INT32 (10)); + bson_t *bcon = BCON_NEW ("foo", BCON_CODEWSCOPE ("var a = b;", scope)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_CODEWSCOPE (code, oscope))); + + BSON_ASSERT (strcmp (code, "var a = b;") == 0); + bson_eq_bson (&oscope, scope); + + bson_destroy (&oscope); + bson_destroy (scope); + bson_destroy (bcon); +} + + +static void +test_int32 (void) +{ + int32_t i32; + + bson_t *bcon = BCON_NEW ("foo", BCON_INT32 (10)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_INT32 (i32))); + + BSON_ASSERT (i32 == 10); + + bson_destroy (bcon); +} + + +static void +test_timestamp (void) +{ + int32_t timestamp; + int32_t increment; + + bson_t *bcon = BCON_NEW ("foo", BCON_TIMESTAMP (100, 1000)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_TIMESTAMP (timestamp, increment))); + + BSON_ASSERT (timestamp == 100); + BSON_ASSERT (increment == 1000); + + bson_destroy (bcon); +} + + +static void +test_int64 (void) +{ + int64_t i64; + + bson_t *bcon = BCON_NEW ("foo", BCON_INT64 (10)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_INT64 (i64))); + + BSON_ASSERT (i64 == 10); + + bson_destroy (bcon); +} + + +static void +test_maxkey (void) +{ + bson_t *bcon = BCON_NEW ("foo", BCON_MAXKEY); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_MAXKEY)); + + bson_destroy (bcon); +} + + +static void +test_minkey (void) +{ + bson_t *bcon = BCON_NEW ("foo", BCON_MINKEY); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_MINKEY)); + + bson_destroy (bcon); +} + + +static void +test_bson_document (void) +{ + bson_t ochild; + bson_t *child = BCON_NEW ("bar", "baz"); + bson_t *bcon = BCON_NEW ("foo", BCON_DOCUMENT (child)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_DOCUMENT (ochild))); + + bson_eq_bson (&ochild, child); + + bson_destroy (&ochild); + bson_destroy (child); + bson_destroy (bcon); +} + + +static void +test_bson_array (void) +{ + bson_t ochild; + bson_t *child = BCON_NEW ("0", "baz"); + bson_t *bcon = BCON_NEW ("foo", BCON_ARRAY (child)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_ARRAY (ochild))); + + bson_eq_bson (&ochild, child); + + bson_destroy (&ochild); + bson_destroy (child); + bson_destroy (bcon); +} + + +static void +test_inline_array (void) +{ + int32_t a, b; + + bson_t *bcon = BCON_NEW ("foo", "[", BCON_INT32 (1), BCON_INT32 (2), "]"); + + BSON_ASSERT ( + BCON_EXTRACT (bcon, "foo", "[", BCONE_INT32 (a), BCONE_INT32 (b), "]")); + + BSON_ASSERT (a == 1); + BSON_ASSERT (b == 2); + + bson_destroy (bcon); +} + +static void +test_inline_doc (void) +{ + int32_t a, b; + + bson_t *bcon = + BCON_NEW ("foo", "{", "b", BCON_INT32 (2), "a", BCON_INT32 (1), "}"); + + BSON_ASSERT (BCON_EXTRACT ( + bcon, "foo", "{", "a", BCONE_INT32 (a), "b", BCONE_INT32 (b), "}")); + + BSON_ASSERT (a == 1); + BSON_ASSERT (b == 2); + + bson_destroy (bcon); +} + + +static void +test_extract_ctx_helper (bson_t *bson, ...) +{ + va_list ap; + bcon_extract_ctx_t ctx; + int i; + int n; + + bcon_extract_ctx_init (&ctx); + + va_start (ap, bson); + + n = va_arg (ap, int); + + for (i = 0; i < n; i++) { + BSON_ASSERT (bcon_extract_ctx_va (bson, &ctx, &ap)); + } + + va_end (ap); +} + +static void +test_extract_ctx (void) +{ + int32_t a, b, c; + + bson_t *bson = + BCON_NEW ("a", BCON_INT32 (1), "b", BCON_INT32 (2), "c", BCON_INT32 (3)); + + test_extract_ctx_helper (bson, + 3, + "a", + BCONE_INT32 (a), + NULL, + "b", + BCONE_INT32 (b), + NULL, + "c", + BCONE_INT32 (c), + NULL); + + BSON_ASSERT (a == 1); + BSON_ASSERT (b == 2); + BSON_ASSERT (c == 3); + + bson_destroy (bson); +} + + +static void +test_nested (void) +{ + const char *utf8; + int i32; + + bson_t *bcon = + BCON_NEW ("hello", "world", "foo", "{", "bar", BCON_INT32 (10), "}"); + + BSON_ASSERT (BCON_EXTRACT (bcon, + "hello", + BCONE_UTF8 (utf8), + "foo", + "{", + "bar", + BCONE_INT32 (i32), + "}")); + + BSON_ASSERT (strcmp ("world", utf8) == 0); + BSON_ASSERT (i32 == 10); + + bson_destroy (bcon); +} + + +static void +test_skip (void) +{ + bson_t *bcon = + BCON_NEW ("hello", "world", "foo", "{", "bar", BCON_INT32 (10), "}"); + + BSON_ASSERT (BCON_EXTRACT (bcon, + "hello", + BCONE_SKIP (BSON_TYPE_UTF8), + "foo", + "{", + "bar", + BCONE_SKIP (BSON_TYPE_INT32), + "}")); + + BSON_ASSERT (!BCON_EXTRACT (bcon, + "hello", + BCONE_SKIP (BSON_TYPE_UTF8), + "foo", + "{", + "bar", + BCONE_SKIP (BSON_TYPE_INT64), + "}")); + + bson_destroy (bcon); +} + + +static void +test_iter (void) +{ + bson_iter_t iter; + bson_t *other; + + bson_t *bcon = BCON_NEW ("foo", BCON_INT32 (10)); + + BSON_ASSERT (BCON_EXTRACT (bcon, "foo", BCONE_ITER (iter))); + + BSON_ASSERT (bson_iter_type (&iter) == BSON_TYPE_INT32); + BSON_ASSERT (bson_iter_int32 (&iter) == 10); + + other = BCON_NEW ("foo", BCON_ITER (&iter)); + + bson_eq_bson (other, bcon); + + bson_destroy (bcon); + bson_destroy (other); +} + + +void +test_bcon_extract_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/bcon/extract/test_utf8", test_utf8); + TestSuite_Add (suite, "/bson/bcon/extract/test_double", test_double); + TestSuite_Add (suite, "/bson/bcon/extract/test_decimal128", test_decimal128); + TestSuite_Add (suite, "/bson/bcon/extract/test_binary", test_binary); + TestSuite_Add (suite, "/bson/bcon/extract/test_undefined", test_undefined); + TestSuite_Add (suite, "/bson/bcon/extract/test_oid", test_oid); + TestSuite_Add (suite, "/bson/bcon/extract/test_bool", test_bool); + TestSuite_Add (suite, "/bson/bcon/extract/test_date_time", test_date_time); + TestSuite_Add (suite, "/bson/bcon/extract/test_null", test_null); + TestSuite_Add (suite, "/bson/bcon/extract/test_regex", test_regex); + TestSuite_Add (suite, "/bson/bcon/extract/test_dbpointer", test_dbpointer); + TestSuite_Add (suite, "/bson/bcon/extract/test_code", test_code); + TestSuite_Add (suite, "/bson/bcon/extract/test_symbol", test_symbol); + TestSuite_Add (suite, "/bson/bcon/extract/test_codewscope", test_codewscope); + TestSuite_Add (suite, "/bson/bcon/extract/test_int32", test_int32); + TestSuite_Add (suite, "/bson/bcon/extract/test_timestamp", test_timestamp); + TestSuite_Add (suite, "/bson/bcon/extract/test_int64", test_int64); + TestSuite_Add (suite, "/bson/bcon/extract/test_maxkey", test_maxkey); + TestSuite_Add (suite, "/bson/bcon/extract/test_minkey", test_minkey); + TestSuite_Add ( + suite, "/bson/bcon/extract/test_bson_document", test_bson_document); + TestSuite_Add (suite, "/bson/bcon/extract/test_bson_array", test_bson_array); + TestSuite_Add ( + suite, "/bson/bcon/extract/test_inline_array", test_inline_array); + TestSuite_Add (suite, "/bson/bcon/extract/test_inline_doc", test_inline_doc); + TestSuite_Add ( + suite, "/bson/bcon/extract/test_extract_ctx", test_extract_ctx); + TestSuite_Add (suite, "/bson/bcon/extract/test_nested", test_nested); + TestSuite_Add (suite, "/bson/bcon/extract/test_skip", test_skip); + TestSuite_Add (suite, "/bson/bcon/extract/test_iter", test_iter); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-corpus.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-corpus.c new file mode 100644 index 0000000..5b0fbb9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-corpus.c @@ -0,0 +1,291 @@ +#include +#include "TestSuite.h" +#include "json-test.h" +#include "corpus-test.h" + + +#define IS_NAN(dec) (dec).high == 0x7c00000000000000ull + + +typedef struct { + const char *scenario; + const char *test; +} skipped_corpus_test_t; + +skipped_corpus_test_t SKIPPED_CORPUS_TESTS[] = { + /* CDRIVER-1879, can't make Code with embedded NIL */ + {"Javascript Code", "Embedded nulls"}, + {"Javascript Code with Scope", + "Unicode and embedded null in code string, empty scope"}, + /* CDRIVER-2223, legacy extended JSON $date syntax uses numbers */ + {"Top-level document validity", "Bad $date (number, not string or hash)"}, + {0}}; + + +skipped_corpus_test_t VS2013_SKIPPED_CORPUS_TESTS[] = { + /* VS 2013 and older is imprecise stackoverflow.com/questions/32232331 */ + {"Double type", "1.23456789012345677E+18"}, + {"Double type", "-1.23456789012345677E+18"}, + {0}}; + + +static void +compare_data (const uint8_t *a, + uint32_t a_len, + const uint8_t *b, + uint32_t b_len) +{ + bson_string_t *a_str; + bson_string_t *b_str; + uint32_t i; + + if (a_len != b_len || memcmp (a, b, (size_t) a_len)) { + a_str = bson_string_new (NULL); + for (i = 0; i < a_len; i++) { + bson_string_append_printf (a_str, "%02X", (int) a[i]); + } + + b_str = bson_string_new (NULL); + for (i = 0; i < b_len; i++) { + bson_string_append_printf (b_str, "%02X", (int) b[i]); + } + + fprintf (stderr, + "unequal data of length %d and %d:\n%s\n%s\n", + a_len, + b_len, + a_str->str, + b_str->str); + + abort (); + } +} + + +static bool +is_test_skipped (const char *scenario, const char *description) +{ + skipped_corpus_test_t *skip; + + for (skip = SKIPPED_CORPUS_TESTS; skip->scenario != NULL; skip++) { + if (!strcmp (skip->scenario, scenario) && + !strcmp (skip->test, description)) { + return true; + } + } + +/* _MSC_VER 1900 is Visual Studio 2015 */ +#if (defined(_MSC_VER) && _MSC_VER < 1900) + for (skip = VS2013_SKIPPED_CORPUS_TESTS; skip->scenario != NULL; skip++) { + if (!strcmp (skip->scenario, scenario) && + !strcmp (skip->test, description)) { + return true; + } + } +#endif + + return false; +} + + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-validity + +* for cB input: + * bson_to_canonical_extended_json(cB) = cE + * bson_to_relaxed_extended_json(cB) = rE (if rE exists) + +* for cE input: + * json_to_bson(cE) = cB (unless lossy) + +* for dB input (if it exists): + * bson_to_canonical_extended_json(dB) = cE + * bson_to_relaxed_extended_json(dB) = rE (if rE exists) + +* for dE input (if it exists): + * json_to_bson(dE) = cB (unless lossy) + +* for rE input (if it exists): + bson_to_relaxed_extended_json(json_to_bson(rE)) = rE + + */ +static void +test_bson_corpus_valid (test_bson_valid_type_t *test) +{ + bson_t cB; + bson_t dB; + bson_t *decode_cE; + bson_t *decode_dE; + bson_t *decode_rE; + bson_error_t error; + + BSON_ASSERT (test->cB); + BSON_ASSERT (test->cE); + + if (is_test_skipped (test->scenario_description, test->test_description)) { + if (test_suite_debug_output ()) { + printf (" SKIP\n"); + fflush (stdout); + } + + return; + } + + BSON_ASSERT (bson_init_static (&cB, test->cB, test->cB_len)); + ASSERT_CMPJSON (bson_as_canonical_extended_json (&cB, NULL), test->cE); + + if (test->rE) { + ASSERT_CMPJSON (bson_as_relaxed_extended_json (&cB, NULL), test->rE); + } + + decode_cE = bson_new_from_json ((const uint8_t *) test->cE, -1, &error); + + ASSERT_OR_PRINT (decode_cE, error); + + if (!test->lossy) { + compare_data ( + bson_get_data (decode_cE), decode_cE->len, test->cB, test->cB_len); + } + + if (test->dB) { + BSON_ASSERT (bson_init_static (&dB, test->dB, test->dB_len)); + ASSERT_CMPJSON (bson_as_canonical_extended_json (&dB, NULL), test->cE); + + if (test->rE) { + ASSERT_CMPJSON (bson_as_relaxed_extended_json (&dB, NULL), test->rE); + } + + bson_destroy (&dB); + } + + if (test->dE) { + decode_dE = bson_new_from_json ((const uint8_t *) test->dE, -1, &error); + + ASSERT_OR_PRINT (decode_dE, error); + ASSERT_CMPJSON (bson_as_canonical_extended_json (decode_dE, NULL), + test->cE); + + if (!test->lossy) { + compare_data ( + bson_get_data (decode_dE), decode_dE->len, test->cB, test->cB_len); + } + + bson_destroy (decode_dE); + } + + if (test->rE) { + decode_rE = bson_new_from_json ((const uint8_t *) test->rE, -1, &error); + + ASSERT_OR_PRINT (decode_rE, error); + ASSERT_CMPJSON (bson_as_relaxed_extended_json (decode_rE, NULL), + test->rE); + + bson_destroy (decode_rE); + } + + bson_destroy (decode_cE); + bson_destroy (&cB); +} + + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-decode-errors + */ +static void +test_bson_corpus_decode_error (test_bson_decode_error_type_t *test) +{ + bson_t invalid_bson; + + BSON_ASSERT (test->bson); + + if (is_test_skipped (test->scenario_description, test->test_description)) { + if (test_suite_debug_output ()) { + printf (" SKIP\n"); + fflush (stdout); + } + + return; + } + + ASSERT (test->bson); + ASSERT (!bson_init_static (&invalid_bson, test->bson, test->bson_len) || + bson_empty (&invalid_bson) || + !bson_as_canonical_extended_json (&invalid_bson, NULL)); +} + + +/* +See: +github.com/mongodb/specifications/blob/master/source/bson-corpus/bson-corpus.rst +#testing-parsing-errors + */ +static void +test_bson_corpus_parse_error (test_bson_parse_error_type_t *test) +{ + BSON_ASSERT (test->str); + + if (is_test_skipped (test->scenario_description, test->test_description)) { + if (test_suite_debug_output ()) { + printf (" SKIP\n"); + fflush (stdout); + } + + return; + } + + switch (test->bson_type) { + case BSON_TYPE_EOD: /* top-level document to be parsed as JSON */ + ASSERT (!bson_new_from_json ((uint8_t *) test->str, test->str_len, NULL)); + break; + case BSON_TYPE_DECIMAL128: { + bson_decimal128_t dec; + ASSERT (!bson_decimal128_from_string (test->str, &dec)); + ASSERT (IS_NAN (dec)); + break; + } + case BSON_TYPE_DOUBLE: + case BSON_TYPE_UTF8: + case BSON_TYPE_DOCUMENT: + case BSON_TYPE_ARRAY: + case BSON_TYPE_BINARY: + case BSON_TYPE_UNDEFINED: + case BSON_TYPE_OID: + case BSON_TYPE_BOOL: + case BSON_TYPE_DATE_TIME: + case BSON_TYPE_NULL: + case BSON_TYPE_REGEX: + case BSON_TYPE_DBPOINTER: + case BSON_TYPE_CODE: + case BSON_TYPE_SYMBOL: + case BSON_TYPE_CODEWSCOPE: + case BSON_TYPE_INT32: + case BSON_TYPE_TIMESTAMP: + case BSON_TYPE_INT64: + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + default: + fprintf (stderr, "Unsupported parseError type: %#x\n", test->bson_type); + abort (); + } +} + + +static void +test_bson_corpus_cb (bson_t *scenario) +{ + corpus_test (scenario, + test_bson_corpus_valid, + test_bson_corpus_decode_error, + test_bson_corpus_parse_error); +} + +void +test_bson_corpus_install (TestSuite *suite) +{ + install_json_test_suite_with_check ( + suite, BSON_JSON_DIR "/bson_corpus", test_bson_corpus_cb); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-error.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-error.c new file mode 100644 index 0000000..c58ff51 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-error.c @@ -0,0 +1,38 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "TestSuite.h" + + +static void +test_bson_error_basic (void) +{ + bson_error_t error; + + bson_set_error (&error, 123, 456, "%s %u", "localhost", 27017); + BSON_ASSERT (!strcmp (error.message, "localhost 27017")); + ASSERT_CMPINT (error.domain, ==, 123); + ASSERT_CMPINT (error.code, ==, 456); +} + + +void +test_bson_error_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/error/basic", test_bson_error_basic); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-version.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-version.c new file mode 100644 index 0000000..9ea90d8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson-version.c @@ -0,0 +1,24 @@ +#include + +#include "TestSuite.h" + +static void +test_bson_version (void) +{ + ASSERT_CMPINT (bson_get_major_version (), ==, BSON_MAJOR_VERSION); + ASSERT_CMPINT (bson_get_minor_version (), ==, BSON_MINOR_VERSION); + ASSERT_CMPINT (bson_get_micro_version (), ==, BSON_MICRO_VERSION); + ASSERT_CMPSTR (bson_get_version (), BSON_VERSION_S); + + ASSERT (bson_check_version ( + BSON_MAJOR_VERSION, BSON_MINOR_VERSION, BSON_MICRO_VERSION)); + + ASSERT (!bson_check_version ( + BSON_MAJOR_VERSION, BSON_MINOR_VERSION + 1, BSON_MICRO_VERSION)); +} + +void +test_bson_version_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/version", test_bson_version); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson.c new file mode 100644 index 0000000..6ac94f3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-bson.c @@ -0,0 +1,2470 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#define BSON_INSIDE +#include +#undef BSON_INSIDE +#include +#include + +#include "TestSuite.h" +#include "test-conveniences.h" + +/* CDRIVER-2460 ensure the unused old BSON_ASSERT_STATIC macro still compiles */ +BSON_STATIC_ASSERT (1 == 1); + + +static bson_t * +get_bson (const char *filename) +{ + ssize_t len; + uint8_t buf[4096]; + bson_t *b; + char real_filename[256]; + int fd; + + bson_snprintf ( + real_filename, sizeof real_filename, BSON_BINARY_DIR "/%s", filename); + + real_filename[sizeof real_filename - 1] = '\0'; + + if (-1 == (fd = bson_open (real_filename, O_RDONLY))) { + fprintf (stderr, "Failed to bson_open: %s\n", real_filename); + abort (); + } + len = bson_read (fd, buf, sizeof buf); + BSON_ASSERT (len > 0); + b = bson_new_from_data (buf, (uint32_t) len); + bson_close (fd); + + return b; +} + + +static void +test_bson_new (void) +{ + bson_t *b; + + b = bson_new (); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + bson_destroy (b); + + b = bson_sized_new (32); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + bson_destroy (b); +} + + +static void +test_bson_alloc (void) +{ + static const uint8_t empty_bson[] = {5, 0, 0, 0, 0}; + bson_t *b; + + b = bson_new (); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + BSON_ASSERT ((b->flags & BSON_FLAG_INLINE)); + BSON_ASSERT (!(b->flags & BSON_FLAG_CHILD)); + BSON_ASSERT (!(b->flags & BSON_FLAG_STATIC)); + BSON_ASSERT (!(b->flags & BSON_FLAG_NO_FREE)); + bson_destroy (b); + + /* + * This checks that we fit in the inline buffer size. + */ + b = bson_sized_new (44); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + BSON_ASSERT ((b->flags & BSON_FLAG_INLINE)); + bson_destroy (b); + + /* + * Make sure we grow to next power of 2. + */ + b = bson_sized_new (121); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + BSON_ASSERT (!(b->flags & BSON_FLAG_INLINE)); + bson_destroy (b); + + /* + * Make sure we grow to next power of 2. + */ + b = bson_sized_new (129); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) 5); + BSON_ASSERT (!(b->flags & BSON_FLAG_INLINE)); + bson_destroy (b); + + b = bson_new_from_data (empty_bson, sizeof empty_bson); + ASSERT_CMPUINT32 (b->len, ==, (uint32_t) sizeof empty_bson); + BSON_ASSERT ((b->flags & BSON_FLAG_INLINE)); + BSON_ASSERT (!memcmp (bson_get_data (b), empty_bson, sizeof empty_bson)); + bson_destroy (b); +} + + +static void +BSON_ASSERT_BSON_EQUAL (const bson_t *a, const bson_t *b) +{ + const uint8_t *data1 = bson_get_data (a); + const uint8_t *data2 = bson_get_data (b); + uint32_t i; + + if (!bson_equal (a, b)) { + for (i = 0; i < BSON_MAX (a->len, b->len); i++) { + if (i >= a->len) { + printf ("a is too short len=%u\n", a->len); + abort (); + } else if (i >= b->len) { + printf ("b is too short len=%u\n", b->len); + abort (); + } + if (data1[i] != data2[i]) { + printf ("a[%u](0x%02x,%u) != b[%u](0x%02x,%u)\n", + i, + data1[i], + data1[i], + i, + data2[i], + data2[i]); + abort (); + } + } + } +} + + +static void +BSON_ASSERT_BSON_EQUAL_FILE (const bson_t *b, const char *filename) +{ + bson_t *b2 = get_bson (filename); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b2); +} + + +static void +test_bson_append_utf8 (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + b2 = get_bson ("test11.bson"); + BSON_ASSERT (bson_append_utf8 (b, "hello", -1, "world", -1)); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_symbol (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + b2 = get_bson ("test32.bson"); + BSON_ASSERT (bson_append_symbol (b, "hello", -1, "world", -1)); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_null (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_null (b, "hello", -1)); + b2 = get_bson ("test18.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_bool (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_bool (b, "bool", -1, true)); + b2 = get_bson ("test19.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_double (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_double (b, "double", -1, 123.4567)); + b2 = get_bson ("test20.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_document (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + b2 = bson_new (); + BSON_ASSERT (bson_append_document (b, "document", -1, b2)); + bson_destroy (b2); + b2 = get_bson ("test21.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_oid (void) +{ + bson_oid_t oid; + bson_t *b; + bson_t *b2; + + bson_oid_init_from_string (&oid, "1234567890abcdef1234abcd"); + + b = bson_new (); + BSON_ASSERT (bson_append_oid (b, "oid", -1, &oid)); + b2 = get_bson ("test22.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_array (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + b2 = bson_new (); + BSON_ASSERT (bson_append_utf8 (b2, "0", -1, "hello", -1)); + BSON_ASSERT (bson_append_utf8 (b2, "1", -1, "world", -1)); + BSON_ASSERT (bson_append_array (b, "array", -1, b2)); + bson_destroy (b2); + b2 = get_bson ("test23.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_binary (void) +{ + const static uint8_t binary[] = {'1', '2', '3', '4'}; + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT ( + bson_append_binary (b, "binary", -1, BSON_SUBTYPE_USER, binary, 4)); + b2 = get_bson ("test24.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_binary_deprecated (void) +{ + const static uint8_t binary[] = {'1', '2', '3', '4'}; + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_binary ( + b, "binary", -1, BSON_SUBTYPE_BINARY_DEPRECATED, binary, 4)); + b2 = get_bson ("binary_deprecated.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_time_t (void) +{ + bson_t *b; + bson_t *b2; + time_t t; + + t = 1234567890; + + b = bson_new (); + BSON_ASSERT (bson_append_time_t (b, "time_t", -1, t)); + b2 = get_bson ("test26.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_timeval (void) +{ + struct timeval tv = {0}; + bson_t *b; + bson_t *b2; + + tv.tv_sec = 1234567890; + tv.tv_usec = 0; + + b = bson_new (); + BSON_ASSERT (bson_append_timeval (b, "time_t", -1, &tv)); + b2 = get_bson ("test26.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_undefined (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_undefined (b, "undefined", -1)); + b2 = get_bson ("test25.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_regex (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_regex (b, "regex", -1, "^abcd", "ilx")); + b2 = get_bson ("test27.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_regex_w_len (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_regex_w_len (b, "regex", -1, "^abcd", 5, "ilx")); + b2 = get_bson ("test27.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); + + b = bson_new (); + BSON_ASSERT (bson_append_regex_w_len (b, "regex", -1, "^abcd", -1, "ilx")); + b2 = get_bson ("test27.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); + + b = bson_new (); + BSON_ASSERT ( + bson_append_regex_w_len (b, "regex", -1, "^abcd ", 5, "ilx")); + b2 = get_bson ("test27.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_code (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_code (b, "code", -1, "var a = {};")); + b2 = get_bson ("test29.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_code_with_scope (void) +{ + const uint8_t *scope_buf = NULL; + uint32_t scopelen = 0; + uint32_t len = 0; + bson_iter_t iter; + bool r; + const char *code = NULL; + bson_t *b; + bson_t *b2; + bson_t *scope; + bson_error_t err; + bool eof; + bson_reader_t *reader; + const bson_t *ticket_bson; + uint8_t malformed_data[] = { + 0x00, + 0x00, + 0x00, + 0x00, /* length of doc (set below) */ + 0x0F, /* code_w_s type */ + 0x00, /* empty key */ + 0x10, + 0x00, + 0x00, + 0x00, /* code_w_s length (needs to be > 14 for initial */ + /* validation so give a non-empty scope doc) */ + 0x00, + 0x00, + 0x00, + 0x00, /* invalid string length (must have trailing \0) */ + 0x08, + 0x00, + 0x00, + 0x00, /* scope doc length */ + 0x08, + 0x00, + 0x00, /* "" : false */ + 0x00, /* end of scope doc */ + 0x00 /* end of doc */ + }; + + /* Test with NULL bson, which converts to just CODE type. */ + b = bson_new (); + BSON_ASSERT ( + bson_append_code_with_scope (b, "code", -1, "var a = {};", NULL)); + b2 = get_bson ("test30.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + r = bson_iter_init_find (&iter, b, "code"); + BSON_ASSERT (r); + BSON_ASSERT (BSON_ITER_HOLDS_CODE (&iter)); /* Not codewscope */ + bson_destroy (b); + bson_destroy (b2); + + /* Empty scope is still CODEWSCOPE. */ + b = bson_new (); + scope = bson_new (); + BSON_ASSERT ( + bson_append_code_with_scope (b, "code", -1, "var a = {};", scope)); + b2 = get_bson ("code_w_empty_scope.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + r = bson_iter_init_find (&iter, b, "code"); + BSON_ASSERT (r); + BSON_ASSERT (BSON_ITER_HOLDS_CODEWSCOPE (&iter)); + bson_destroy (b); + bson_destroy (b2); + bson_destroy (scope); + + /* Test with non-empty scope */ + b = bson_new (); + scope = bson_new (); + BSON_ASSERT (bson_append_utf8 (scope, "foo", -1, "bar", -1)); + BSON_ASSERT ( + bson_append_code_with_scope (b, "code", -1, "var a = {};", scope)); + b2 = get_bson ("test31.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + r = bson_iter_init_find (&iter, b, "code"); + BSON_ASSERT (r); + BSON_ASSERT (BSON_ITER_HOLDS_CODEWSCOPE (&iter)); + code = bson_iter_codewscope (&iter, &len, &scopelen, &scope_buf); + BSON_ASSERT (len == 11); + BSON_ASSERT (scopelen == scope->len); + BSON_ASSERT (!strcmp (code, "var a = {};")); + bson_destroy (b); + bson_destroy (b2); + bson_destroy (scope); + + /* CDRIVER-2269 Test with a malformed zero length code string */ + malformed_data[0] = (uint8_t) sizeof (malformed_data); + b = bson_new_from_data (malformed_data, sizeof (malformed_data)); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_destroy (b); + + /* CDRIVER-2269 Test with malformed BSON from ticket */ + reader = + bson_reader_new_from_file (BSON_BINARY_DIR "/cdriver2269.bson", &err); + + BSON_ASSERT (reader); + ticket_bson = bson_reader_read (reader, &eof); + BSON_ASSERT (ticket_bson); + BSON_ASSERT (bson_iter_init (&iter, ticket_bson)); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_reader_destroy (reader); +} + + +static void +test_bson_append_dbpointer (void) +{ + bson_oid_t oid; + bson_t *b; + bson_t *b2; + uint8_t malformed_data[] = { + 0x0C, + 0x00, + 0x00, + 0x00, /* document length (12) */ + 0x0C, /* dbpointer type */ + 0x00, /* empty string key */ + 0x04, + 0x00, + 0x00, + 0x00, /* string length (4). This is OOB. */ + 0x00, /* empty string */ + 0x00 /* end of document */ + }; + size_t error_offset = 0; + + b = bson_new (); + bson_oid_init_from_string (&oid, "0123abcd0123abcd0123abcd"); + BSON_ASSERT (bson_append_dbpointer (b, "dbpointer", -1, "foo", &oid)); + b2 = get_bson ("test28.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); + + b = bson_new_from_data (malformed_data, sizeof (malformed_data)); + BSON_ASSERT (b); + BSON_ASSERT (!bson_validate (b, BSON_VALIDATE_NONE, &error_offset)); + BSON_ASSERT (error_offset == 6); + bson_destroy (b); +} + + +static void +test_bson_append_int32 (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_int32 (b, "a", -1, -123)); + BSON_ASSERT (bson_append_int32 (b, "c", -1, 0)); + BSON_ASSERT (bson_append_int32 (b, "b", -1, 123)); + b2 = get_bson ("test33.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_int64 (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_int64 (b, "a", -1, 100000000000000ULL)); + b2 = get_bson ("test34.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_decimal128 (void) +{ + bson_t *b; + bson_t *b2; + bson_decimal128_t value; + value.high = 0; + value.low = 1; + + b = bson_new (); + BSON_ASSERT (bson_append_decimal128 (b, "a", -1, &value)); + b2 = get_bson ("test58.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_iter (void) +{ + bson_iter_t iter; + bool r; + bson_t b; + bson_t c; + + bson_init (&b); + bson_append_int32 (&b, "a", 1, 1); + bson_append_int32 (&b, "b", 1, 2); + bson_append_int32 (&b, "c", 1, 3); + bson_append_utf8 (&b, "d", 1, "hello", 5); + + bson_init (&c); + + r = bson_iter_init_find (&iter, &b, "a"); + BSON_ASSERT (r); + r = bson_append_iter (&c, NULL, 0, &iter); + BSON_ASSERT (r); + + r = bson_iter_init_find (&iter, &b, "c"); + BSON_ASSERT (r); + r = bson_append_iter (&c, NULL, 0, &iter); + BSON_ASSERT (r); + + r = bson_iter_init_find (&iter, &b, "d"); + BSON_ASSERT (r); + r = bson_append_iter (&c, "world", -1, &iter); + BSON_ASSERT (r); + + bson_iter_init (&iter, &c); + r = bson_iter_next (&iter); + BSON_ASSERT (r); + ASSERT_CMPSTR ("a", bson_iter_key (&iter)); + ASSERT_CMPINT (BSON_TYPE_INT32, ==, bson_iter_type (&iter)); + ASSERT_CMPINT (1, ==, bson_iter_int32 (&iter)); + r = bson_iter_next (&iter); + BSON_ASSERT (r); + ASSERT_CMPSTR ("c", bson_iter_key (&iter)); + ASSERT_CMPINT (BSON_TYPE_INT32, ==, bson_iter_type (&iter)); + ASSERT_CMPINT (3, ==, bson_iter_int32 (&iter)); + r = bson_iter_next (&iter); + BSON_ASSERT (r); + ASSERT_CMPINT (BSON_TYPE_UTF8, ==, bson_iter_type (&iter)); + ASSERT_CMPSTR ("world", bson_iter_key (&iter)); + ASSERT_CMPSTR ("hello", bson_iter_utf8 (&iter, NULL)); + + bson_destroy (&b); + bson_destroy (&c); +} + + +static void +test_bson_append_timestamp (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_timestamp (b, "timestamp", -1, 1234, 9876)); + b2 = get_bson ("test35.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_maxkey (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_maxkey (b, "maxkey", -1)); + b2 = get_bson ("test37.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_minkey (void) +{ + bson_t *b; + bson_t *b2; + + b = bson_new (); + BSON_ASSERT (bson_append_minkey (b, "minkey", -1)); + b2 = get_bson ("test36.bson"); + BSON_ASSERT_BSON_EQUAL (b, b2); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_append_general (void) +{ + uint8_t bytes[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x23, 0x45}; + bson_oid_t oid; + bson_t *bson; + bson_t *array; + bson_t *subdoc; + + bson = bson_new (); + BSON_ASSERT (bson_append_int32 (bson, "int", -1, 1)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test1.bson"); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_int64 (bson, "int64", -1, 1)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test2.bson"); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_double (bson, "double", -1, 1.123)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test3.bson"); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_utf8 (bson, "string", -1, "some string", -1)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test5.bson"); + bson_destroy (bson); + + bson = bson_new (); + array = bson_new (); + BSON_ASSERT (bson_append_int32 (array, "0", -1, 1)); + BSON_ASSERT (bson_append_int32 (array, "1", -1, 2)); + BSON_ASSERT (bson_append_int32 (array, "2", -1, 3)); + BSON_ASSERT (bson_append_int32 (array, "3", -1, 4)); + BSON_ASSERT (bson_append_int32 (array, "4", -1, 5)); + BSON_ASSERT (bson_append_int32 (array, "5", -1, 6)); + BSON_ASSERT (bson_append_array (bson, "array[int]", -1, array)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test6.bson"); + bson_destroy (array); + bson_destroy (bson); + + bson = bson_new (); + array = bson_new (); + BSON_ASSERT (bson_append_double (array, "0", -1, 1.123)); + BSON_ASSERT (bson_append_double (array, "1", -1, 2.123)); + BSON_ASSERT (bson_append_array (bson, "array[double]", -1, array)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test7.bson"); + bson_destroy (array); + bson_destroy (bson); + + bson = bson_new (); + subdoc = bson_new (); + BSON_ASSERT (bson_append_int32 (subdoc, "int", -1, 1)); + BSON_ASSERT (bson_append_document (bson, "document", -1, subdoc)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test8.bson"); + bson_destroy (subdoc); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_null (bson, "null", -1)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test9.bson"); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_regex (bson, "regex", -1, "1234", "i")); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test10.bson"); + bson_destroy (bson); + + bson = bson_new (); + BSON_ASSERT (bson_append_utf8 (bson, "hello", -1, "world", -1)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test11.bson"); + bson_destroy (bson); + + bson = bson_new (); + array = bson_new (); + BSON_ASSERT (bson_append_utf8 (array, "0", -1, "awesome", -1)); + BSON_ASSERT (bson_append_double (array, "1", -1, 5.05)); + BSON_ASSERT (bson_append_int32 (array, "2", -1, 1986)); + BSON_ASSERT (bson_append_array (bson, "BSON", -1, array)); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test12.bson"); + bson_destroy (bson); + bson_destroy (array); + + bson = bson_new (); + memcpy (&oid, bytes, sizeof oid); + BSON_ASSERT (bson_append_oid (bson, "_id", -1, &oid)); + subdoc = bson_new (); + BSON_ASSERT (bson_append_oid (subdoc, "_id", -1, &oid)); + array = bson_new (); + BSON_ASSERT (bson_append_utf8 (array, "0", -1, "1", -1)); + BSON_ASSERT (bson_append_utf8 (array, "1", -1, "2", -1)); + BSON_ASSERT (bson_append_utf8 (array, "2", -1, "3", -1)); + BSON_ASSERT (bson_append_utf8 (array, "3", -1, "4", -1)); + BSON_ASSERT (bson_append_array (subdoc, "tags", -1, array)); + bson_destroy (array); + BSON_ASSERT (bson_append_utf8 (subdoc, "text", -1, "asdfanother", -1)); + array = bson_new (); + BSON_ASSERT (bson_append_utf8 (array, "name", -1, "blah", -1)); + BSON_ASSERT (bson_append_document (subdoc, "source", -1, array)); + bson_destroy (array); + BSON_ASSERT (bson_append_document (bson, "document", -1, subdoc)); + bson_destroy (subdoc); + array = bson_new (); + BSON_ASSERT (bson_append_utf8 (array, "0", -1, "source", -1)); + BSON_ASSERT (bson_append_array (bson, "type", -1, array)); + bson_destroy (array); + array = bson_new (); + BSON_ASSERT (bson_append_utf8 (array, "0", -1, "server_created_at", -1)); + BSON_ASSERT (bson_append_array (bson, "missing", -1, array)); + bson_destroy (array); + BSON_ASSERT_BSON_EQUAL_FILE (bson, "test17.bson"); + bson_destroy (bson); +} + + +static void +test_bson_append_deep (void) +{ + bson_t *a; + bson_t *tmp; + int i; + + a = bson_new (); + + for (i = 0; i < 100; i++) { + tmp = a; + a = bson_new (); + BSON_ASSERT (bson_append_document (a, "a", -1, tmp)); + bson_destroy (tmp); + } + + BSON_ASSERT_BSON_EQUAL_FILE (a, "test38.bson"); + + bson_destroy (a); +} + + +static void +test_bson_validate_dbref (void) +{ + size_t offset; + bson_t dbref, child, child2; + + /* should fail, $ref without an $id */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with non id field */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "extra", "field"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $id at the top */ + { + bson_init (&dbref); + BSON_APPEND_UTF8 (&dbref, "$ref", "foo"); + BSON_APPEND_UTF8 (&dbref, "$id", "bar"); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $id not first keys */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "extra", "field"); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $db */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$db", "bar"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, non-string $ref with $id */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_INT32 (&child, "$ref", 1); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, non-string $ref with nothing */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_INT32 (&child, "$ref", 1); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $id with non-string $db */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + BSON_APPEND_INT32 (&child, "$db", 1); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $id with non-string $db with stuff after */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + BSON_APPEND_INT32 (&child, "$db", 1); + BSON_APPEND_UTF8 (&child, "extra", "field"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should fail, $ref with $id with stuff, then $db */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + BSON_APPEND_UTF8 (&child, "extra", "field"); + BSON_APPEND_UTF8 (&child, "$db", "baz"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (!bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should succeed, $ref with $id */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should succeed, $ref with nested dbref $id */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_DOCUMENT_BEGIN (&child, "$id", &child2); + BSON_APPEND_UTF8 (&child2, "$ref", "foo2"); + BSON_APPEND_UTF8 (&child2, "$id", "bar2"); + BSON_APPEND_UTF8 (&child2, "$db", "baz2"); + bson_append_document_end (&child, &child2); + BSON_APPEND_UTF8 (&child, "$db", "baz"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should succeed, $ref with $id and $db */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + BSON_APPEND_UTF8 (&child, "$db", "baz"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } + + /* should succeed, $ref with $id and $db and trailing */ + { + bson_init (&dbref); + BSON_APPEND_DOCUMENT_BEGIN (&dbref, "dbref", &child); + BSON_APPEND_UTF8 (&child, "$ref", "foo"); + BSON_APPEND_UTF8 (&child, "$id", "bar"); + BSON_APPEND_UTF8 (&child, "$db", "baz"); + BSON_APPEND_UTF8 (&child, "extra", "field"); + bson_append_document_end (&dbref, &child); + + BSON_ASSERT (bson_validate (&dbref, BSON_VALIDATE_DOLLAR_KEYS, &offset)); + + bson_destroy (&dbref); + } +} + + +/* BSON spec requires bool value to be exactly 0 or 1 */ +static void +test_bson_validate_bool (void) +{ + /* {"b": true}, with implicit NULL at end */ + uint8_t data[] = "\x09\x00\x00\x00\x08\x62\x00\x01"; + bson_t bson; + bson_iter_t iter; + size_t err_offset = 0; + + ASSERT (bson_init_static (&bson, data, sizeof data)); + ASSERT (bson_validate (&bson, BSON_VALIDATE_NONE, &err_offset)); + ASSERT (bson_iter_init (&iter, &bson)); + ASSERT (bson_iter_next (&iter)); + ASSERT (BSON_ITER_HOLDS_BOOL (&iter)); + ASSERT (bson_iter_bool (&iter)); + + /* replace boolean value 1 with 255 */ + ASSERT (data[7] == '\x01'); + data[7] = (uint8_t) '\xff'; + + ASSERT (bson_init_static (&bson, data, 9)); + ASSERT (!bson_validate (&bson, BSON_VALIDATE_NONE, &err_offset)); + ASSERT_CMPSIZE_T (err_offset, ==, (size_t) 7); + + ASSERT (bson_iter_init (&iter, &bson)); + ASSERT (!bson_iter_next (&iter)); +} + + +/* BSON spec requires the deprecated DBPointer's value to be NULL-termed */ +static void +test_bson_validate_dbpointer (void) +{ + /* { "a": DBPointer(ObjectId(...), Collection="b") }, implicit NULL at end */ + uint8_t data[] = "\x1A\x00\x00\x00\x0C\x61\x00\x02\x00\x00\x00\x62\x00" + "\x56\xE1\xFC\x72\xE0\xC9\x17\xE9\xC4\x71\x41\x61"; + + bson_t bson; + bson_iter_t iter; + size_t err_offset = 0; + uint32_t collection_len; + const char *collection; + const bson_oid_t *oid; + + ASSERT (bson_init_static (&bson, data, sizeof data)); + ASSERT (bson_validate (&bson, BSON_VALIDATE_NONE, &err_offset)); + ASSERT (bson_iter_init (&iter, &bson)); + ASSERT (bson_iter_next (&iter)); + ASSERT (BSON_ITER_HOLDS_DBPOINTER (&iter)); + bson_iter_dbpointer (&iter, &collection_len, &collection, &oid); + ASSERT_CMPSTR (collection, "b"); + ASSERT_CMPINT (collection_len, ==, 1); + + /* replace the NULL terminator of "b" with 255 */ + ASSERT (data[12] == '\0'); + data[12] = (uint8_t) '\xff'; + + ASSERT (bson_init_static (&bson, data, sizeof data)); + ASSERT (!bson_validate (&bson, BSON_VALIDATE_NONE, &err_offset)); + ASSERT_CMPSIZE_T (err_offset, ==, (size_t) 12); + + ASSERT (bson_iter_init (&iter, &bson)); + ASSERT (!bson_iter_next (&iter)); +} + + +static void +test_bson_validate (void) +{ + char filename[64]; + size_t offset; + bson_t *b; + int i; + bson_error_t error; + + for (i = 1; i <= 38; i++) { + bson_snprintf (filename, sizeof filename, "test%u.bson", i); + b = get_bson (filename); + BSON_ASSERT (bson_validate (b, BSON_VALIDATE_NONE, &offset)); + bson_destroy (b); + } + + b = get_bson ("codewscope.bson"); + BSON_ASSERT (bson_validate (b, BSON_VALIDATE_NONE, &offset)); + bson_destroy (b); + + b = get_bson ("empty_key.bson"); + BSON_ASSERT (bson_validate (b, + BSON_VALIDATE_NONE | BSON_VALIDATE_UTF8 | + BSON_VALIDATE_DOLLAR_KEYS | + BSON_VALIDATE_DOT_KEYS, + &offset)); + bson_destroy (b); + +#define VALIDATE_TEST(_filename, _flags, _offset, _flag, _msg) \ + b = get_bson (_filename); \ + BSON_ASSERT (!bson_validate (b, _flags, &offset)); \ + ASSERT_CMPSIZE_T (offset, ==, (size_t) _offset); \ + BSON_ASSERT (!bson_validate_with_error (b, _flags, &error)); \ + ASSERT_ERROR_CONTAINS (error, BSON_ERROR_INVALID, _flag, _msg); \ + bson_destroy (b) + + VALIDATE_TEST ("overflow2.bson", + BSON_VALIDATE_NONE, + 9, + BSON_VALIDATE_NONE, + "corrupt BSON"); + VALIDATE_TEST ("trailingnull.bson", + BSON_VALIDATE_NONE, + 14, + BSON_VALIDATE_NONE, + "corrupt BSON"); + VALIDATE_TEST ("dollarquery.bson", + BSON_VALIDATE_DOLLAR_KEYS | BSON_VALIDATE_DOT_KEYS, + 4, + BSON_VALIDATE_DOLLAR_KEYS, + "keys cannot begin with \"$\": \"$query\""); + VALIDATE_TEST ("dotquery.bson", + BSON_VALIDATE_DOLLAR_KEYS | BSON_VALIDATE_DOT_KEYS, + 4, + BSON_VALIDATE_DOT_KEYS, + "keys cannot contain \".\": \"abc.def\""); + VALIDATE_TEST ("overflow3.bson", + BSON_VALIDATE_NONE, + 9, + BSON_VALIDATE_NONE, + "corrupt BSON"); + /* same outcome as above, despite different flags */ + VALIDATE_TEST ("overflow3.bson", + BSON_VALIDATE_UTF8, + 9, + BSON_VALIDATE_NONE, + "corrupt BSON"); + VALIDATE_TEST ("overflow4.bson", + BSON_VALIDATE_NONE, + 9, + BSON_VALIDATE_NONE, + "corrupt BSON"); + VALIDATE_TEST ("empty_key.bson", + BSON_VALIDATE_EMPTY_KEYS, + 4, + BSON_VALIDATE_EMPTY_KEYS, + "empty key"); + VALIDATE_TEST ( + "test40.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test41.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test42.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test43.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test44.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test45.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test46.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test47.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test48.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test49.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ("test50.bson", + BSON_VALIDATE_NONE, + 10, + BSON_VALIDATE_NONE, + "corrupt code-with-scope"); + VALIDATE_TEST ("test51.bson", + BSON_VALIDATE_NONE, + 10, + BSON_VALIDATE_NONE, + "corrupt code-with-scope"); + VALIDATE_TEST ( + "test52.bson", BSON_VALIDATE_NONE, 9, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ( + "test53.bson", BSON_VALIDATE_NONE, 6, BSON_VALIDATE_NONE, "corrupt BSON"); + VALIDATE_TEST ("test54.bson", + BSON_VALIDATE_NONE, + 12, + BSON_VALIDATE_NONE, + "corrupt BSON"); + VALIDATE_TEST ("test59.bson", + BSON_VALIDATE_NONE, + 9, + BSON_VALIDATE_NONE, + "corrupt BSON"); + + /* DBRef validation */ + b = BCON_NEW ("my_dbref", + "{", + "$ref", + BCON_UTF8 ("collection"), + "$id", + BCON_INT32 (1), + "}"); + BSON_ASSERT (bson_validate_with_error (b, BSON_VALIDATE_NONE, &error)); + BSON_ASSERT ( + bson_validate_with_error (b, BSON_VALIDATE_DOLLAR_KEYS, &error)); + bson_destroy (b); + + /* needs "$ref" before "$id" */ + b = BCON_NEW ("my_dbref", "{", "$id", BCON_INT32 (1), "}"); + BSON_ASSERT (bson_validate_with_error (b, BSON_VALIDATE_NONE, &error)); + BSON_ASSERT ( + !bson_validate_with_error (b, BSON_VALIDATE_DOLLAR_KEYS, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_INVALID, + BSON_VALIDATE_DOLLAR_KEYS, + "keys cannot begin with \"$\": \"$id\""); + bson_destroy (b); + + /* two $refs */ + b = BCON_NEW ("my_dbref", + "{", + "$ref", + BCON_UTF8 ("collection"), + "$ref", + BCON_UTF8 ("collection"), + "}"); + BSON_ASSERT (bson_validate_with_error (b, BSON_VALIDATE_NONE, &error)); + BSON_ASSERT ( + !bson_validate_with_error (b, BSON_VALIDATE_DOLLAR_KEYS, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_INVALID, + BSON_VALIDATE_DOLLAR_KEYS, + "keys cannot begin with \"$\": \"$ref\""); + bson_destroy (b); + + /* must not contain invalid key like "extra" */ + b = BCON_NEW ("my_dbref", + "{", + "$ref", + BCON_UTF8 ("collection"), + "extra", + BCON_INT32 (2), + "$id", + BCON_INT32 (1), + "}"); + BSON_ASSERT (bson_validate_with_error (b, BSON_VALIDATE_NONE, &error)); + BSON_ASSERT ( + !bson_validate_with_error (b, BSON_VALIDATE_DOLLAR_KEYS, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_INVALID, + BSON_VALIDATE_DOLLAR_KEYS, + "invalid key within DBRef subdocument: \"extra\""); + bson_destroy (b); + +#undef VALIDATE_TEST +} + + +static void +test_bson_init (void) +{ + bson_t b; + char key[12]; + int i; + + bson_init (&b); + BSON_ASSERT ((b.flags & BSON_FLAG_INLINE)); + BSON_ASSERT ((b.flags & BSON_FLAG_STATIC)); + BSON_ASSERT (!(b.flags & BSON_FLAG_RDONLY)); + for (i = 0; i < 100; i++) { + bson_snprintf (key, sizeof key, "%d", i); + BSON_ASSERT (bson_append_utf8 (&b, key, -1, "bar", -1)); + } + BSON_ASSERT (!(b.flags & BSON_FLAG_INLINE)); + bson_destroy (&b); +} + + +static void +test_bson_init_static (void) +{ + static const uint8_t data[5] = {5}; + bson_t b; + + bson_init_static (&b, data, sizeof data); + BSON_ASSERT ((b.flags & BSON_FLAG_RDONLY)); + bson_destroy (&b); +} + + +static void +test_bson_new_from_buffer (void) +{ + bson_t *b; + uint8_t *buf = bson_malloc0 (5); + size_t len = 5; + uint32_t len_le = BSON_UINT32_TO_LE (5); + + memcpy (buf, &len_le, sizeof (len_le)); + + b = bson_new_from_buffer (&buf, &len, bson_realloc_ctx, NULL); + + BSON_ASSERT (b->flags & BSON_FLAG_NO_FREE); + BSON_ASSERT (len == 5); + BSON_ASSERT (b->len == 5); + + bson_append_utf8 (b, "hello", -1, "world", -1); + + BSON_ASSERT (len == 32); + BSON_ASSERT (b->len == 22); + + bson_destroy (b); + + bson_free (buf); + + buf = NULL; + len = 0; + + b = bson_new_from_buffer (&buf, &len, bson_realloc_ctx, NULL); + + BSON_ASSERT (b->flags & BSON_FLAG_NO_FREE); + BSON_ASSERT (len == 5); + BSON_ASSERT (b->len == 5); + + bson_destroy (b); + bson_free (buf); +} + + +static void +test_bson_utf8_key (void) +{ +/* euro currency symbol */ +#define EU "\xe2\x82\xac" +#define FIVE_EUROS EU EU EU EU EU + uint32_t length; + bson_iter_t iter; + const char *str; + bson_t *b; + size_t offset; + + b = get_bson ("eurokey.bson"); + BSON_ASSERT (bson_validate (b, BSON_VALIDATE_NONE, &offset)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (!strcmp (bson_iter_key (&iter), FIVE_EUROS)); + str = bson_iter_utf8 (&iter, &length); + BSON_ASSERT (str); + BSON_ASSERT (length == 15); /* 5 3-byte sequences. */ + BSON_ASSERT (!strcmp (str, FIVE_EUROS)); + bson_destroy (b); +} + + +static void +test_bson_new_1mm (void) +{ + bson_t *b; + int i; + + for (i = 0; i < 1000000; i++) { + b = bson_new (); + bson_destroy (b); + } +} + + +static void +test_bson_init_1mm (void) +{ + bson_t b; + int i; + + for (i = 0; i < 1000000; i++) { + bson_init (&b); + bson_destroy (&b); + } +} + + +static void +test_bson_build_child (void) +{ + bson_t b; + bson_t child; + bson_t *b2; + bson_t *child2; + + bson_init (&b); + BSON_ASSERT (bson_append_document_begin (&b, "foo", -1, &child)); + BSON_ASSERT (bson_append_utf8 (&child, "bar", -1, "baz", -1)); + BSON_ASSERT (bson_append_document_end (&b, &child)); + + b2 = bson_new (); + child2 = bson_new (); + BSON_ASSERT (bson_append_utf8 (child2, "bar", -1, "baz", -1)); + BSON_ASSERT (bson_append_document (b2, "foo", -1, child2)); + bson_destroy (child2); + + BSON_ASSERT (b.len == b2->len); + BSON_ASSERT_BSON_EQUAL (&b, b2); + + bson_destroy (&b); + bson_destroy (b2); +} + + +static void +test_bson_build_child_array (void) +{ + bson_t b; + bson_t child; + bson_t *b2; + bson_t *child2; + + bson_init (&b); + BSON_ASSERT (bson_append_array_begin (&b, "foo", -1, &child)); + BSON_ASSERT (bson_append_utf8 (&child, "0", -1, "baz", -1)); + BSON_ASSERT (bson_append_array_end (&b, &child)); + + b2 = bson_new (); + child2 = bson_new (); + BSON_ASSERT (bson_append_utf8 (child2, "0", -1, "baz", -1)); + BSON_ASSERT (bson_append_array (b2, "foo", -1, child2)); + bson_destroy (child2); + + BSON_ASSERT (b.len == b2->len); + BSON_ASSERT_BSON_EQUAL (&b, b2); + + bson_destroy (&b); + bson_destroy (b2); +} + + +static void +test_bson_build_child_deep_1 (bson_t *b, int *count) +{ + bson_t child; + + (*count)++; + + BSON_ASSERT (bson_append_document_begin (b, "b", -1, &child)); + BSON_ASSERT (!(b->flags & BSON_FLAG_INLINE)); + BSON_ASSERT ((b->flags & BSON_FLAG_IN_CHILD)); + BSON_ASSERT (!(child.flags & BSON_FLAG_INLINE)); + BSON_ASSERT ((child.flags & BSON_FLAG_STATIC)); + BSON_ASSERT ((child.flags & BSON_FLAG_CHILD)); + + if (*count < 100) { + test_bson_build_child_deep_1 (&child, count); + } else { + BSON_ASSERT (bson_append_int32 (&child, "b", -1, 1234)); + } + + BSON_ASSERT (bson_append_document_end (b, &child)); + BSON_ASSERT (!(b->flags & BSON_FLAG_IN_CHILD)); +} + + +static void +test_bson_build_child_deep (void) +{ + union { + bson_t b; + bson_impl_alloc_t a; + } u; + int count = 0; + + bson_init (&u.b); + BSON_ASSERT ((u.b.flags & BSON_FLAG_INLINE)); + test_bson_build_child_deep_1 (&u.b, &count); + BSON_ASSERT (!(u.b.flags & BSON_FLAG_INLINE)); + BSON_ASSERT ((u.b.flags & BSON_FLAG_STATIC)); + BSON_ASSERT (!(u.b.flags & BSON_FLAG_NO_FREE)); + BSON_ASSERT (!(u.b.flags & BSON_FLAG_RDONLY)); + BSON_ASSERT (bson_validate (&u.b, BSON_VALIDATE_NONE, NULL)); + BSON_ASSERT (((bson_impl_alloc_t *) &u.b)->alloclen == 1024); + BSON_ASSERT_BSON_EQUAL_FILE (&u.b, "test39.bson"); + bson_destroy (&u.b); +} + + +static void +test_bson_build_child_deep_no_begin_end_1 (bson_t *b, int *count) +{ + bson_t child; + + (*count)++; + + bson_init (&child); + if (*count < 100) { + test_bson_build_child_deep_1 (&child, count); + } else { + BSON_ASSERT (bson_append_int32 (&child, "b", -1, 1234)); + } + BSON_ASSERT (bson_append_document (b, "b", -1, &child)); + bson_destroy (&child); +} + + +static void +test_bson_build_child_deep_no_begin_end (void) +{ + union { + bson_t b; + bson_impl_alloc_t a; + } u; + + int count = 0; + + bson_init (&u.b); + test_bson_build_child_deep_no_begin_end_1 (&u.b, &count); + BSON_ASSERT (bson_validate (&u.b, BSON_VALIDATE_NONE, NULL)); + BSON_ASSERT (u.a.alloclen == 1024); + BSON_ASSERT_BSON_EQUAL_FILE (&u.b, "test39.bson"); + bson_destroy (&u.b); +} + + +static void +test_bson_count_keys (void) +{ + bson_t b; + + bson_init (&b); + BSON_ASSERT (bson_append_int32 (&b, "0", -1, 0)); + BSON_ASSERT (bson_append_int32 (&b, "1", -1, 1)); + BSON_ASSERT (bson_append_int32 (&b, "2", -1, 2)); + ASSERT_CMPINT (bson_count_keys (&b), ==, 3); + bson_destroy (&b); +} + + +static void +test_bson_copy (void) +{ + bson_t b; + bson_t *c; + + bson_init (&b); + BSON_ASSERT (bson_append_int32 (&b, "foobar", -1, 1234)); + c = bson_copy (&b); + BSON_ASSERT_BSON_EQUAL (&b, c); + bson_destroy (c); + bson_destroy (&b); +} + + +static void +test_bson_copy_to (void) +{ + bson_t b; + bson_t c; + int i; + + /* + * Test inline structure copy. + */ + bson_init (&b); + BSON_ASSERT (bson_append_int32 (&b, "foobar", -1, 1234)); + bson_copy_to (&b, &c); + BSON_ASSERT_BSON_EQUAL (&b, &c); + bson_destroy (&c); + bson_destroy (&b); + + /* + * Test malloced copy. + */ + bson_init (&b); + for (i = 0; i < 1000; i++) { + BSON_ASSERT (bson_append_int32 (&b, "foobar", -1, 1234)); + } + bson_copy_to (&b, &c); + BSON_ASSERT_BSON_EQUAL (&b, &c); + bson_destroy (&c); + bson_destroy (&b); +} + + +static void +test_bson_copy_to_excluding_noinit (void) +{ + bson_iter_t iter; + bool r; + bson_t b; + bson_t c; + int i; + + bson_init (&b); + bson_append_int32 (&b, "a", 1, 1); + bson_append_int32 (&b, "b", 1, 2); + + bson_init (&c); + bson_copy_to_excluding_noinit (&b, &c, "b", NULL); + r = bson_iter_init_find (&iter, &c, "a"); + BSON_ASSERT (r); + r = bson_iter_init_find (&iter, &c, "b"); + BSON_ASSERT (!r); + + i = bson_count_keys (&b); + ASSERT_CMPINT (i, ==, 2); + + i = bson_count_keys (&c); + ASSERT_CMPINT (i, ==, 1); + + bson_destroy (&b); + bson_destroy (&c); +} + + +static void +test_bson_append_overflow (void) +{ + const char *key = "a"; + uint32_t len; + bson_t b; + + len = BSON_MAX_SIZE; + len -= 4; /* len */ + len -= 1; /* type */ + len -= 1; /* value */ + len -= 1; /* end byte */ + + bson_init (&b); + BSON_ASSERT (!bson_append_bool (&b, key, len, true)); + bson_destroy (&b); +} + + +static void +test_bson_initializer (void) +{ + bson_t b = BSON_INITIALIZER; + + BSON_ASSERT (bson_empty (&b)); + bson_append_bool (&b, "foo", -1, true); + BSON_ASSERT (!bson_empty (&b)); + bson_destroy (&b); +} + + +static void +test_bson_concat (void) +{ + bson_t a = BSON_INITIALIZER; + bson_t b = BSON_INITIALIZER; + bson_t c = BSON_INITIALIZER; + + bson_append_int32 (&a, "abc", 3, 1); + bson_append_int32 (&b, "def", 3, 1); + bson_concat (&a, &b); + + bson_append_int32 (&c, "abc", 3, 1); + bson_append_int32 (&c, "def", 3, 1); + + BSON_ASSERT (0 == bson_compare (&c, &a)); + + bson_destroy (&a); + bson_destroy (&b); + bson_destroy (&c); +} + + +static void +test_bson_reinit (void) +{ + bson_t b = BSON_INITIALIZER; + int i; + + for (i = 0; i < 1000; i++) { + bson_append_int32 (&b, "", 0, i); + } + + bson_reinit (&b); + + for (i = 0; i < 1000; i++) { + bson_append_int32 (&b, "", 0, i); + } + + bson_destroy (&b); +} + + +static void +test_bson_macros (void) +{ + const uint8_t data[] = {1, 2, 3, 4}; + bson_t b = BSON_INITIALIZER; + bson_t ar = BSON_INITIALIZER; + bson_decimal128_t dec; + bson_oid_t oid; + struct timeval tv; + time_t t; + + dec.high = 0x3040000000000000ULL; + dec.low = 0x0ULL; + + t = time (NULL); +#ifdef BSON_OS_WIN32 + tv.tv_sec = (long) t; +#else + tv.tv_sec = t; +#endif + tv.tv_usec = 0; + + bson_oid_init (&oid, NULL); + + BSON_APPEND_ARRAY (&b, "0", &ar); + BSON_APPEND_BINARY (&b, "1", 0, data, sizeof data); + BSON_APPEND_BOOL (&b, "2", true); + BSON_APPEND_CODE (&b, "3", "function(){}"); + BSON_APPEND_CODE_WITH_SCOPE (&b, "4", "function(){}", &ar); + BSON_APPEND_DOUBLE (&b, "6", 123.45); + BSON_APPEND_DOCUMENT (&b, "7", &ar); + BSON_APPEND_INT32 (&b, "8", 123); + BSON_APPEND_INT64 (&b, "9", 456); + BSON_APPEND_MINKEY (&b, "10"); + BSON_APPEND_MAXKEY (&b, "11"); + BSON_APPEND_NULL (&b, "12"); + BSON_APPEND_OID (&b, "13", &oid); + BSON_APPEND_REGEX (&b, "14", "^abc", "i"); + BSON_APPEND_UTF8 (&b, "15", "utf8"); + BSON_APPEND_SYMBOL (&b, "16", "symbol"); + BSON_APPEND_TIME_T (&b, "17", t); + BSON_APPEND_TIMEVAL (&b, "18", &tv); + BSON_APPEND_DATE_TIME (&b, "19", 123); + BSON_APPEND_TIMESTAMP (&b, "20", 123, 0); + BSON_APPEND_UNDEFINED (&b, "21"); + BSON_APPEND_DECIMAL128 (&b, "22", &dec); + + bson_destroy (&b); + bson_destroy (&ar); +} + + +static void +test_bson_clear (void) +{ + bson_t *doc = NULL; + + bson_clear (&doc); + BSON_ASSERT (doc == NULL); + + doc = bson_new (); + BSON_ASSERT (doc != NULL); + bson_clear (&doc); + BSON_ASSERT (doc == NULL); +} + + +static void +bloat (bson_t *b) +{ + uint32_t i; + char buf[16]; + const char *key; + + for (i = 0; i < 100; i++) { + bson_uint32_to_string (i, &key, buf, sizeof buf); + BSON_APPEND_UTF8 (b, key, "long useless value foo bar baz quux quizzle"); + } + + /* spilled over */ + ASSERT (!(b->flags & BSON_FLAG_INLINE)); +} + + +static void +test_bson_steal (void) +{ + bson_t stack_alloced; + bson_t *heap_alloced; + bson_t dst; + uint8_t *alloc; + uint8_t *buf; + size_t len; + uint32_t len_le; + + /* inline, stack-allocated */ + bson_init (&stack_alloced); + BSON_APPEND_INT32 (&stack_alloced, "a", 1); + ASSERT (bson_steal (&dst, &stack_alloced)); + ASSERT (bson_has_field (&dst, "a")); + ASSERT (dst.flags & BSON_FLAG_INLINE); + /* src was invalidated */ + ASSERT (!bson_validate (&stack_alloced, BSON_VALIDATE_NONE, 0)); + bson_destroy (&dst); + + /* spilled over, stack-allocated */ + bson_init (&stack_alloced); + bloat (&stack_alloced); + alloc = ((bson_impl_alloc_t *) &stack_alloced)->alloc; + ASSERT (bson_steal (&dst, &stack_alloced)); + /* data was transferred */ + ASSERT (alloc == ((bson_impl_alloc_t *) &dst)->alloc); + ASSERT (bson_has_field (&dst, "99")); + ASSERT (!(dst.flags & BSON_FLAG_INLINE)); + ASSERT (!bson_validate (&stack_alloced, BSON_VALIDATE_NONE, 0)); + bson_destroy (&dst); + + /* inline, heap-allocated */ + heap_alloced = bson_new (); + BSON_APPEND_INT32 (heap_alloced, "a", 1); + ASSERT (bson_steal (&dst, heap_alloced)); + ASSERT (bson_has_field (&dst, "a")); + ASSERT (dst.flags & BSON_FLAG_INLINE); + bson_destroy (&dst); + + /* spilled over, heap-allocated */ + heap_alloced = bson_new (); + bloat (heap_alloced); + alloc = ((bson_impl_alloc_t *) heap_alloced)->alloc; + ASSERT (bson_steal (&dst, heap_alloced)); + /* data was transferred */ + ASSERT (alloc == ((bson_impl_alloc_t *) &dst)->alloc); + ASSERT (bson_has_field (&dst, "99")); + ASSERT (!(dst.flags & BSON_FLAG_INLINE)); + bson_destroy (&dst); + + /* test stealing from a bson created with bson_new_from_buffer */ + buf = bson_malloc0 (5); + len = 5; + len_le = BSON_UINT32_TO_LE (5); + memcpy (buf, &len_le, sizeof (len_le)); + heap_alloced = bson_new_from_buffer (&buf, &len, bson_realloc_ctx, NULL); + ASSERT (bson_steal (&dst, heap_alloced)); + ASSERT (dst.flags & BSON_FLAG_NO_FREE); + ASSERT (dst.flags & BSON_FLAG_STATIC); + ASSERT (((bson_impl_alloc_t *) &dst)->realloc == bson_realloc_ctx); + ASSERT (((bson_impl_alloc_t *) &dst)->realloc_func_ctx == NULL); + bson_destroy (&dst); + bson_free (buf); +} + +static void +BSON_ASSERT_KEY_AND_VALUE (const bson_t *bson) +{ + bson_iter_t iter; + + ASSERT (bson_iter_init_find (&iter, bson, "key")); + ASSERT (BSON_ITER_HOLDS_UTF8 (&iter)); + ASSERT_CMPSTR ("value", bson_iter_utf8 (&iter, NULL)); +} + + +static void +test_bson_reserve_buffer (void) +{ + bson_t src = BSON_INITIALIZER; + bson_t stack_alloced; + bson_t *heap_alloced; + uint8_t *buf; + + /* inline, stack-allocated */ + bson_init (&stack_alloced); + BSON_APPEND_UTF8 (&src, "key", "value"); + ASSERT ((buf = bson_reserve_buffer (&stack_alloced, src.len))); + ASSERT_CMPUINT32 (src.len, ==, stack_alloced.len); + ASSERT (stack_alloced.flags & BSON_FLAG_INLINE); + memcpy (buf, ((bson_impl_inline_t *) &src)->data, src.len); + /* data was transferred */ + BSON_ASSERT_KEY_AND_VALUE (&stack_alloced); + bson_destroy (&stack_alloced); + + /* spilled over, stack-allocated */ + bloat (&src); + bson_init (&stack_alloced); + ASSERT ((buf = bson_reserve_buffer (&stack_alloced, src.len))); + ASSERT_CMPUINT32 (src.len, ==, stack_alloced.len); + ASSERT (!(stack_alloced.flags & BSON_FLAG_INLINE)); + memcpy (buf, ((bson_impl_alloc_t *) &src)->alloc, src.len); + BSON_ASSERT_KEY_AND_VALUE (&stack_alloced); + ASSERT (bson_has_field (&stack_alloced, "99")); + bson_destroy (&src); + bson_destroy (&stack_alloced); + + /* inline, heap-allocated */ + heap_alloced = bson_new (); + bson_init (&src); + BSON_APPEND_UTF8 (&src, "key", "value"); + ASSERT ((buf = bson_reserve_buffer (heap_alloced, src.len))); + ASSERT_CMPUINT32 (src.len, ==, heap_alloced->len); + ASSERT (heap_alloced->flags & BSON_FLAG_INLINE); + memcpy (buf, ((bson_impl_inline_t *) &src)->data, src.len); + BSON_ASSERT_KEY_AND_VALUE (heap_alloced); + bson_destroy (heap_alloced); + + /* spilled over, heap-allocated */ + heap_alloced = bson_new (); + bloat (&src); + ASSERT ((buf = bson_reserve_buffer (heap_alloced, src.len))); + ASSERT_CMPUINT32 (src.len, ==, heap_alloced->len); + ASSERT (!(heap_alloced->flags & BSON_FLAG_INLINE)); + memcpy (buf, ((bson_impl_alloc_t *) &src)->alloc, src.len); + BSON_ASSERT_KEY_AND_VALUE (heap_alloced); + ASSERT (bson_has_field (heap_alloced, "99")); + + bson_destroy (&src); + bson_destroy (heap_alloced); +} + + +static void +test_bson_reserve_buffer_errors (void) +{ + bson_t bson = BSON_INITIALIZER; + bson_t child; + uint8_t data[5] = {0}; + uint32_t len_le; + + /* too big */ + ASSERT (!bson_reserve_buffer (&bson, (uint32_t) (INT32_MAX - bson.len - 1))); + + /* make a static bson, it refuses bson_reserve_buffer since it's read-only */ + bson_destroy (&bson); + len_le = BSON_UINT32_TO_LE (5); + memcpy (data, &len_le, sizeof (len_le)); + ASSERT (bson_init_static (&bson, data, sizeof data)); + ASSERT (!bson_reserve_buffer (&bson, 10)); + + /* parent's and child's buffers are locked */ + bson_init (&bson); + BSON_APPEND_DOCUMENT_BEGIN (&bson, "child", &child); + ASSERT (!bson_reserve_buffer (&bson, 10)); + ASSERT (!bson_reserve_buffer (&child, 10)); + /* unlock parent's buffer */ + bson_append_document_end (&bson, &child); + ASSERT (bson_reserve_buffer (&bson, 10)); + + bson_destroy (&bson); +} + + +static void +test_bson_destroy_with_steal (void) +{ + bson_t *b1; + bson_t b2; + uint32_t len = 0; + uint8_t *data; + int i; + + b1 = bson_new (); + for (i = 0; i < 100; i++) { + BSON_APPEND_INT32 (b1, "some-key", i); + } + + data = bson_destroy_with_steal (b1, true, &len); + BSON_ASSERT (data); + BSON_ASSERT (len == 1405); + bson_free (data); + data = NULL; + + bson_init (&b2); + len = 0; + for (i = 0; i < 100; i++) { + BSON_APPEND_INT32 (&b2, "some-key", i); + } + BSON_ASSERT (!bson_destroy_with_steal (&b2, false, &len)); + BSON_ASSERT (len == 1405); + + bson_init (&b2); + BSON_ASSERT (!bson_destroy_with_steal (&b2, false, NULL)); + + bson_init (&b2); + data = bson_destroy_with_steal (&b2, true, &len); + BSON_ASSERT (data); + BSON_ASSERT (len == 5); + bson_free (data); + data = NULL; +} + + +static void +test_bson_has_field (void) +{ + bson_t *b; + bool r; + + b = BCON_NEW ("foo", "[", "{", "bar", BCON_INT32 (1), "}", "]"); + + r = bson_has_field (b, "foo"); + BSON_ASSERT (r); + + r = bson_has_field (b, "foo.0"); + BSON_ASSERT (r); + + r = bson_has_field (b, "foo.0.bar"); + BSON_ASSERT (r); + + r = bson_has_field (b, "0"); + BSON_ASSERT (!r); + + r = bson_has_field (b, "bar"); + BSON_ASSERT (!r); + + r = bson_has_field (b, "0.bar"); + BSON_ASSERT (!r); + + bson_destroy (b); +} + + +static void +test_next_power_of_two (void) +{ + size_t s; + + s = 3; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 4); + + s = 4; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 4); + + s = 33; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 64); + + s = 91; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 128); + + s = 939524096UL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 1073741824); + + s = 1073741824UL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 1073741824UL); + +#if BSON_WORD_SIZE == 64 + s = 4294967296LL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 4294967296LL); + + s = 4294967297LL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 8589934592LL); + + s = 17179901952LL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 34359738368LL); + + s = 9223372036854775807ULL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 9223372036854775808ULL); + + s = 36028795806651656ULL; + s = bson_next_power_of_two (s); + BSON_ASSERT (s == 36028797018963968ULL); +#endif +} + + +void +visit_corrupt (const bson_iter_t *iter, void *data) +{ + *((bool *) data) = true; +} + + +static void +test_bson_visit_invalid_field (void) +{ + /* key is invalid utf-8 char: {"\x80": 1} */ + const char data[] = "\x0c\x00\x00\x00\x10\x80\x00\x01\x00\x00\x00\x00"; + bson_t b; + bson_iter_t iter; + bson_visitor_t visitor = {0}; + bool visited = false; + + visitor.visit_corrupt = visit_corrupt; + BSON_ASSERT (bson_init_static (&b, (const uint8_t *) data, sizeof data - 1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (!bson_iter_visit_all (&iter, &visitor, (void *) &visited)); + BSON_ASSERT (visited); +} + + +typedef struct { + bool visited; + const char *key; + uint32_t type_code; +} unsupported_type_test_data_t; + + +void +visit_unsupported_type (const bson_iter_t *iter, + const char *key, + uint32_t type_code, + void *data) +{ + unsupported_type_test_data_t *context; + + context = (unsupported_type_test_data_t *) data; + context->visited = true; + context->key = key; + context->type_code = type_code; +} + + +static void +test_bson_visit_unsupported_type (void) +{ + /* {k: 1}, but instead of BSON type 0x10 (int32), use unknown type 0x33 */ + const char data[] = "\x0c\x00\x00\x00\x33k\x00\x01\x00\x00\x00\x00"; + bson_t b; + bson_iter_t iter; + unsupported_type_test_data_t context = {0}; + bson_visitor_t visitor = {0}; + + visitor.visit_unsupported_type = visit_unsupported_type; + + BSON_ASSERT (bson_init_static (&b, (const uint8_t *) data, sizeof data - 1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (!bson_iter_visit_all (&iter, &visitor, (void *) &context)); + BSON_ASSERT (!bson_iter_next (&iter)); + BSON_ASSERT (context.visited); + BSON_ASSERT (!strcmp (context.key, "k")); + BSON_ASSERT (context.type_code == '\x33'); +} + + +static void +test_bson_visit_unsupported_type_bad_key (void) +{ + /* key is invalid utf-8 char, '\x80' */ + const char data[] = "\x0c\x00\x00\x00\x33\x80\x00\x01\x00\x00\x00\x00"; + bson_t b; + bson_iter_t iter; + unsupported_type_test_data_t context = {0}; + bson_visitor_t visitor = {0}; + + visitor.visit_unsupported_type = visit_unsupported_type; + + BSON_ASSERT (bson_init_static (&b, (const uint8_t *) data, sizeof data - 1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (!bson_iter_visit_all (&iter, &visitor, (void *) &context)); + BSON_ASSERT (!bson_iter_next (&iter)); + + /* unsupported type error wasn't reported, because the bson is corrupt */ + BSON_ASSERT (!context.visited); +} + + +static void +test_bson_visit_unsupported_type_empty_key (void) +{ + /* {"": 1}, but instead of BSON type 0x10 (int32), use unknown type 0x33 */ + const char data[] = "\x0b\x00\x00\x00\x33\x00\x01\x00\x00\x00\x00"; + bson_t b; + bson_iter_t iter; + unsupported_type_test_data_t context = {0}; + bson_visitor_t visitor = {0}; + + visitor.visit_unsupported_type = visit_unsupported_type; + + BSON_ASSERT (bson_init_static (&b, (const uint8_t *) data, sizeof data - 1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (!bson_iter_visit_all (&iter, &visitor, (void *) &context)); + BSON_ASSERT (!bson_iter_next (&iter)); + BSON_ASSERT (context.visited); + BSON_ASSERT (!strcmp (context.key, "")); + BSON_ASSERT (context.type_code == '\x33'); +} + + +static void +test_bson_subtype_2 (void) +{ + bson_t b; + /* taken from BSON Corpus Tests */ + const char ok[] = "\x13\x00\x00\x00\x05\x78\x00\x06\x00\x00\x00\x02\x02\x00" + "\x00\x00\xff\xff\x00"; + + /* Deprecated subtype 0x02 includes a redundant length inside the binary + * payload. Check that we validate this length. + */ + const char len_too_long[] = "\x13\x00\x00\x00\x05\x78\x00\x06\x00\x00\x00" + "\x02\x03\x00\x00\x00\xFF\xFF\x00"; + const char len_too_short[] = "\x13\x00\x00\x00\x05\x78\x00\x06\x00\x00\x00" + "\x02\x01\x00\x00\x00\xFF\xFF\x00"; + const char len_negative[] = "\x13\x00\x00\x00\x05\x78\x00\x06\x00\x00\x00" + "\x02\xFF\xFF\xFF\xFF\xFF\xFF\x00"; + + bson_t *bson_ok = BCON_NEW ("x", BCON_BIN (2, (uint8_t *) "\xff\xff", 2)); + + BSON_ASSERT (bson_init_static (&b, (uint8_t *) ok, sizeof (ok) - 1)); + BSON_ASSERT (bson_validate (&b, BSON_VALIDATE_NONE, 0)); + BSON_ASSERT (0 == bson_compare (&b, bson_ok)); + + BSON_ASSERT (bson_init_static ( + &b, (uint8_t *) len_too_long, sizeof (len_too_long) - 1)); + BSON_ASSERT (!bson_validate (&b, BSON_VALIDATE_NONE, 0)); + + BSON_ASSERT (bson_init_static ( + &b, (uint8_t *) len_too_short, sizeof (len_too_short) - 1)); + BSON_ASSERT (!bson_validate (&b, BSON_VALIDATE_NONE, 0)); + + BSON_ASSERT (bson_init_static ( + &b, (uint8_t *) len_negative, sizeof (len_negative) - 1)); + BSON_ASSERT (!bson_validate (&b, BSON_VALIDATE_NONE, 0)); + + bson_destroy (bson_ok); +} + +/* CDRIVER-2455 Off-by-one error while appending regex */ +void +test_bson_regex_lengths (void) +{ + bson_t new = BSON_INITIALIZER; + bson_oid_t oid; + + bson_oid_init_from_string (&oid, "1234567890abcdef12345678"); + bson_append_oid (&new, "0123456", -1, &oid); + + bson_append_regex (&new, + "0_________1_________2_________3___4", + -1, + "0_________1_________2_________3_________4_________5___4", + "i"); + + ASSERT (new.len == 121); + ASSERT (new.flags &BSON_FLAG_STATIC); + ASSERT (!(new.flags &BSON_FLAG_INLINE)); + + bson_destroy (&new); +} + +void +test_bson_empty_binary (void) +{ + uint8_t data = 0xAB; + bson_t test; + const bson_value_t *value; + bson_value_t copy; + bson_iter_t iter; + + bson_init (&test); + bson_append_binary (&test, "test", 4, BSON_SUBTYPE_BINARY, &data, 0); + BSON_ASSERT (bson_iter_init_find (&iter, &test, "test")); + value = bson_iter_value (&iter); + /* CDRIVER-2569, this would memcpy (0 bytes) to a NULL destination. */ + bson_value_copy (value, ©); + + bson_value_destroy (©); + bson_destroy (&test); +} + +void +test_bson_iter_key_len (void) +{ + bson_t *bson = bson_with_all_types (); + bson_iter_t iter; + + BSON_ASSERT (bson_iter_init (&iter, bson)); + while (bson_iter_next (&iter)) { + ASSERT_WITH_MSG (strlen (bson_iter_key (&iter)) == + bson_iter_key_len (&iter), + "iter_key_len differs from real key length. got %d but " + "expected %d for key %s\n", + bson_iter_key_len (&iter), + (int) strlen (bson_iter_key (&iter)), + bson_iter_key (&iter)); + } +} + + +void +test_bson_iter_init_from_data_at_offset (void) +{ + bson_t *bson = bson_with_all_types (); + /* zero out iter, since bson_iter_init doesn't zero out iter->value. */ + bson_iter_t iter = {0}; + + BSON_ASSERT (bson_iter_init (&iter, bson)); + ASSERT_CMPINT (bson_iter_offset (&iter), ==, 0); + while (bson_iter_next (&iter)) { + const uint8_t *data = bson_get_data (bson); + int keylen = bson_iter_key_len (&iter); + uint32_t offset = bson_iter_offset (&iter); + bson_iter_t recreated = {0}; + + BSON_ASSERT (bson_iter_init_from_data_at_offset ( + &recreated, data, bson->len, offset, keylen)); + if (memcmp ((void *) &iter, (void *) &recreated, sizeof (bson_iter_t)) != + 0) { + int i; + bson_iter_t *iters[] = {&iter, &recreated}; + fprintf (stderr, + "recreated iterator does not match initial iterator:\n"); + for (i = 0; i < 2; i++) { + fprintf (stderr, "iter %d: ", i); + fprintf (stderr, + "len=%d, off=%d, type=%d, key=%d, d1=%d, d2=%d, " + "d3=%d, d4=%d, next_off=%d, err_off=%d\n", + iters[i]->len, + iters[i]->off, + iters[i]->type, + iters[i]->key, + iters[i]->d1, + iters[i]->d2, + iters[i]->d3, + iters[i]->d4, + iters[i]->next_off, + iters[i]->err_off); + } + ASSERT (false); + } + } +} + +void +test_bson_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/new", test_bson_new); + TestSuite_Add (suite, "/bson/new_from_buffer", test_bson_new_from_buffer); + TestSuite_Add (suite, "/bson/init", test_bson_init); + TestSuite_Add (suite, "/bson/init_static", test_bson_init_static); + TestSuite_Add (suite, "/bson/basic", test_bson_alloc); + TestSuite_Add (suite, "/bson/append_overflow", test_bson_append_overflow); + TestSuite_Add (suite, "/bson/append_array", test_bson_append_array); + TestSuite_Add (suite, "/bson/append_binary", test_bson_append_binary); + TestSuite_Add (suite, + "/bson/append_binary_deprecated", + test_bson_append_binary_deprecated); + TestSuite_Add (suite, "/bson/append_bool", test_bson_append_bool); + TestSuite_Add (suite, "/bson/append_code", test_bson_append_code); + TestSuite_Add ( + suite, "/bson/append_code_with_scope", test_bson_append_code_with_scope); + TestSuite_Add (suite, "/bson/append_dbpointer", test_bson_append_dbpointer); + TestSuite_Add (suite, "/bson/append_document", test_bson_append_document); + TestSuite_Add (suite, "/bson/append_double", test_bson_append_double); + TestSuite_Add (suite, "/bson/append_int32", test_bson_append_int32); + TestSuite_Add (suite, "/bson/append_int64", test_bson_append_int64); + TestSuite_Add ( + suite, "/bson/append_decimal128", test_bson_append_decimal128); + TestSuite_Add (suite, "/bson/append_iter", test_bson_append_iter); + TestSuite_Add (suite, "/bson/append_maxkey", test_bson_append_maxkey); + TestSuite_Add (suite, "/bson/append_minkey", test_bson_append_minkey); + TestSuite_Add (suite, "/bson/append_null", test_bson_append_null); + TestSuite_Add (suite, "/bson/append_oid", test_bson_append_oid); + TestSuite_Add (suite, "/bson/append_regex", test_bson_append_regex); + TestSuite_Add ( + suite, "/bson/append_regex_w_len", test_bson_append_regex_w_len); + TestSuite_Add (suite, "/bson/append_utf8", test_bson_append_utf8); + TestSuite_Add (suite, "/bson/append_symbol", test_bson_append_symbol); + TestSuite_Add (suite, "/bson/append_time_t", test_bson_append_time_t); + TestSuite_Add (suite, "/bson/append_timestamp", test_bson_append_timestamp); + TestSuite_Add (suite, "/bson/append_timeval", test_bson_append_timeval); + TestSuite_Add (suite, "/bson/append_undefined", test_bson_append_undefined); + TestSuite_Add (suite, "/bson/append_general", test_bson_append_general); + TestSuite_Add (suite, "/bson/append_deep", test_bson_append_deep); + TestSuite_Add (suite, "/bson/utf8_key", test_bson_utf8_key); + TestSuite_Add (suite, "/bson/validate", test_bson_validate); + TestSuite_Add (suite, "/bson/validate/dbref", test_bson_validate_dbref); + TestSuite_Add (suite, "/bson/validate/bool", test_bson_validate_bool); + TestSuite_Add ( + suite, "/bson/validate/dbpointer", test_bson_validate_dbpointer); + TestSuite_Add (suite, "/bson/new_1mm", test_bson_new_1mm); + TestSuite_Add (suite, "/bson/init_1mm", test_bson_init_1mm); + TestSuite_Add (suite, "/bson/build_child", test_bson_build_child); + TestSuite_Add (suite, "/bson/build_child_deep", test_bson_build_child_deep); + TestSuite_Add (suite, + "/bson/build_child_deep_no_begin_end", + test_bson_build_child_deep_no_begin_end); + TestSuite_Add ( + suite, "/bson/build_child_array", test_bson_build_child_array); + TestSuite_Add (suite, "/bson/count", test_bson_count_keys); + TestSuite_Add (suite, "/bson/copy", test_bson_copy); + TestSuite_Add (suite, "/bson/copy_to", test_bson_copy_to); + TestSuite_Add (suite, + "/bson/copy_to_excluding_noinit", + test_bson_copy_to_excluding_noinit); + TestSuite_Add (suite, "/bson/initializer", test_bson_initializer); + TestSuite_Add (suite, "/bson/concat", test_bson_concat); + TestSuite_Add (suite, "/bson/reinit", test_bson_reinit); + TestSuite_Add (suite, "/bson/macros", test_bson_macros); + TestSuite_Add (suite, "/bson/clear", test_bson_clear); + TestSuite_Add (suite, "/bson/steal", test_bson_steal); + TestSuite_Add (suite, "/bson/reserve_buffer", test_bson_reserve_buffer); + TestSuite_Add ( + suite, "/bson/reserve_buffer/errors", test_bson_reserve_buffer_errors); + TestSuite_Add ( + suite, "/bson/destroy_with_steal", test_bson_destroy_with_steal); + TestSuite_Add (suite, "/bson/has_field", test_bson_has_field); + TestSuite_Add ( + suite, "/bson/visit_invalid_field", test_bson_visit_invalid_field); + TestSuite_Add ( + suite, "/bson/unsupported_type", test_bson_visit_unsupported_type); + TestSuite_Add (suite, + "/bson/unsupported_type/bad_key", + test_bson_visit_unsupported_type_bad_key); + TestSuite_Add (suite, + "/bson/unsupported_type/empty_key", + test_bson_visit_unsupported_type_empty_key); + TestSuite_Add (suite, "/bson/binary_subtype_2", test_bson_subtype_2); + TestSuite_Add (suite, "/bson/regex_length", test_bson_regex_lengths); + TestSuite_Add (suite, "/util/next_power_of_two", test_next_power_of_two); + TestSuite_Add (suite, "/bson/empty_binary", test_bson_empty_binary); + TestSuite_Add (suite, "/bson/iter/key_len", test_bson_iter_key_len); + TestSuite_Add (suite, + "/bson/iter/init_from_data_at_offset", + test_bson_iter_init_from_data_at_offset); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-clock.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-clock.c new file mode 100644 index 0000000..830d70c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-clock.c @@ -0,0 +1,25 @@ +#include + +#include "TestSuite.h" + + +static void +test_get_monotonic_time (void) +{ + int64_t t; + int64_t t2; + + t = bson_get_monotonic_time (); + t2 = bson_get_monotonic_time (); + BSON_ASSERT (t); + BSON_ASSERT (t2); + ASSERT_CMPINT64 (t, <=, t2); +} + + +void +test_clock_install (TestSuite *suite) +{ + TestSuite_Add ( + suite, "/bson/clock/get_monotonic_time", test_get_monotonic_time); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-decimal128.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-decimal128.c new file mode 100644 index 0000000..f80c4e6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-decimal128.c @@ -0,0 +1,815 @@ +/* + * Copyright 2015 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "TestSuite.h" + + +/* + *---------------------------------------------------------------------------- + * decimal128_to_string tests + * + * The following tests confirm functionality of the decimal128_to_string + *function. + * + * All decimal test data is generated using the Intel Decimal Floating-Point + * Math Library's bid128_from_string routine. + * + *---------------------------------------------------------------------------- + */ + + +#define DECIMAL128_FROM_ULLS(dec, h, l) \ + do { \ + (dec).high = (h); \ + (dec).low = (l); \ + } while (0); + + +static void +test_decimal128_to_string__infinity (void) +{ + bson_decimal128_t positive_infinity; + bson_decimal128_t negative_infinity; + char bid_string[BSON_DECIMAL128_STRING]; + + DECIMAL128_FROM_ULLS (positive_infinity, 0x7800000000000000, 0); + DECIMAL128_FROM_ULLS (negative_infinity, 0xf800000000000000, 0); + + bson_decimal128_to_string (&positive_infinity, bid_string); + BSON_ASSERT (!strcmp (bid_string, "Infinity")); + + bson_decimal128_to_string (&negative_infinity, bid_string); + BSON_ASSERT (!strcmp (bid_string, "-Infinity")); +} + + +static void +test_decimal128_to_string__nan (void) +{ + bson_decimal128_t dec_pnan; + bson_decimal128_t dec_nnan; + bson_decimal128_t dec_psnan; + bson_decimal128_t dec_nsnan; + bson_decimal128_t dec_payload_nan; + + /* All the above should just be NaN. */ + char bid_string[BSON_DECIMAL128_STRING]; + + DECIMAL128_FROM_ULLS (dec_pnan, 0x7c00000000000000, 0); + DECIMAL128_FROM_ULLS (dec_nnan, 0xfc00000000000000, 0); + DECIMAL128_FROM_ULLS (dec_psnan, 0x7e00000000000000, 0); + DECIMAL128_FROM_ULLS (dec_nsnan, 0xfe00000000000000, 0); + DECIMAL128_FROM_ULLS (dec_payload_nan, 0x7e00000000000000, 12); + + bson_decimal128_to_string (&dec_pnan, bid_string); + BSON_ASSERT (!strcmp (bid_string, "NaN")); + + bson_decimal128_to_string (&dec_nnan, bid_string); + BSON_ASSERT (!strcmp (bid_string, "NaN")); + + bson_decimal128_to_string (&dec_psnan, bid_string); + BSON_ASSERT (!strcmp (bid_string, "NaN")); + + bson_decimal128_to_string (&dec_nsnan, bid_string); + BSON_ASSERT (!strcmp (bid_string, "NaN")); + + bson_decimal128_to_string (&dec_payload_nan, bid_string); + BSON_ASSERT (!strcmp (bid_string, "NaN")); +} + + +static void +test_decimal128_to_string__regular (void) +{ + char bid_string[BSON_DECIMAL128_STRING]; + bson_decimal128_t one; + bson_decimal128_t zero; + bson_decimal128_t two; + bson_decimal128_t negative_one; + bson_decimal128_t negative_zero; + bson_decimal128_t tenth; + bson_decimal128_t smallest_regular; + bson_decimal128_t largest_regular; + bson_decimal128_t trailing_zeros; + bson_decimal128_t all_digits; + bson_decimal128_t full_house; + + DECIMAL128_FROM_ULLS (one, 0x3040000000000000, 0x0000000000000001); + DECIMAL128_FROM_ULLS (zero, 0x3040000000000000, 0x0000000000000000); + DECIMAL128_FROM_ULLS (two, 0x3040000000000000, 0x0000000000000002); + DECIMAL128_FROM_ULLS (negative_one, 0xb040000000000000, 0x0000000000000001); + DECIMAL128_FROM_ULLS (negative_zero, 0xb040000000000000, 0x0000000000000000); + DECIMAL128_FROM_ULLS ( + tenth, 0x303e000000000000, 0x0000000000000001); /* 0.1 */ + /* 0.001234 */ + DECIMAL128_FROM_ULLS ( + smallest_regular, 0x3034000000000000, 0x00000000000004d2); + /* 12345789012 */ + DECIMAL128_FROM_ULLS ( + largest_regular, 0x3040000000000000, 0x0000001cbe991a14); + /* 0.00123400000 */ + DECIMAL128_FROM_ULLS ( + trailing_zeros, 0x302a000000000000, 0x00000000075aef40); + /* 0.1234567890123456789012345678901234 */ + DECIMAL128_FROM_ULLS (all_digits, 0x2ffc3cde6fff9732, 0xde825cd07e96aff2); + + /* 5192296858534827628530496329220095 */ + DECIMAL128_FROM_ULLS (full_house, 0x3040ffffffffffff, 0xffffffffffffffff); + + bson_decimal128_to_string (&one, bid_string); + BSON_ASSERT (!strcmp ("1", bid_string)); + + bson_decimal128_to_string (&zero, bid_string); + BSON_ASSERT (!strcmp ("0", bid_string)); + + bson_decimal128_to_string (&two, bid_string); + BSON_ASSERT (!strcmp ("2", bid_string)); + + bson_decimal128_to_string (&negative_one, bid_string); + BSON_ASSERT (!strcmp ("-1", bid_string)); + + bson_decimal128_to_string (&negative_zero, bid_string); + BSON_ASSERT (!strcmp ("-0", bid_string)); + + bson_decimal128_to_string (&tenth, bid_string); + BSON_ASSERT (!strcmp ("0.1", bid_string)); + + bson_decimal128_to_string (&smallest_regular, bid_string); + BSON_ASSERT (!strcmp ("0.001234", bid_string)); + + bson_decimal128_to_string (&largest_regular, bid_string); + BSON_ASSERT (!strcmp ("123456789012", bid_string)); + + bson_decimal128_to_string (&trailing_zeros, bid_string); + BSON_ASSERT (!strcmp ("0.00123400000", bid_string)); + + bson_decimal128_to_string (&all_digits, bid_string); + BSON_ASSERT (!strcmp ("0.1234567890123456789012345678901234", bid_string)); + + bson_decimal128_to_string (&full_house, bid_string); + BSON_ASSERT (!strcmp ("5192296858534827628530496329220095", bid_string)); +} + + +static void +test_decimal128_to_string__scientific (void) +{ + char bid_string[BSON_DECIMAL128_STRING]; + + bson_decimal128_t huge; /* 1.000000000000000000000000000000000E+6144 */ + bson_decimal128_t tiny; /* 1E-6176 */ + bson_decimal128_t neg_tiny; /* -1E-6176 */ + bson_decimal128_t large; /* 9.999987654321E+112 */ + bson_decimal128_t largest; /* 9.999999999999999999999999999999999E+6144 */ + bson_decimal128_t tiniest; /* 9.999999999999999999999999999999999E-6143 */ + bson_decimal128_t trailing_zero; /* 1.050E9 */ + bson_decimal128_t one_trailing_zero; /* 1.050E4 */ + bson_decimal128_t move_decimal; /* 105 */ + bson_decimal128_t move_decimal_after; /* 1.05E3 */ + bson_decimal128_t trailing_zero_no_decimal; /* 1E3 */ + + DECIMAL128_FROM_ULLS (huge, 0x5ffe314dc6448d93, 0x38c15b0a00000000); + DECIMAL128_FROM_ULLS (tiny, 0x0000000000000000, 0x0000000000000001); + DECIMAL128_FROM_ULLS (neg_tiny, 0x8000000000000000, 0x0000000000000001); + DECIMAL128_FROM_ULLS (large, 0x3108000000000000, 0x000009184db63eb1); + DECIMAL128_FROM_ULLS (largest, 0x5fffed09bead87c0, 0x378d8e63ffffffff); + DECIMAL128_FROM_ULLS (tiniest, 0x0001ed09bead87c0, 0x378d8e63ffffffff); + DECIMAL128_FROM_ULLS (trailing_zero, 0x304c000000000000, 0x000000000000041a); + DECIMAL128_FROM_ULLS ( + one_trailing_zero, 0x3042000000000000, 0x000000000000041a); + DECIMAL128_FROM_ULLS (move_decimal, 0x3040000000000000, 0x0000000000000069); + DECIMAL128_FROM_ULLS ( + move_decimal_after, 0x3042000000000000, 0x0000000000000069); + DECIMAL128_FROM_ULLS ( + trailing_zero_no_decimal, 0x3046000000000000, 0x0000000000000001); + + bson_decimal128_to_string (&huge, bid_string); + BSON_ASSERT ( + !strcmp ("1.000000000000000000000000000000000E+6144", bid_string)); + + bson_decimal128_to_string (&tiny, bid_string); + BSON_ASSERT (!strcmp ("1E-6176", bid_string)); + + bson_decimal128_to_string (&neg_tiny, bid_string); + BSON_ASSERT (!strcmp ("-1E-6176", bid_string)); + + bson_decimal128_to_string (&neg_tiny, bid_string); + BSON_ASSERT (!strcmp ("-1E-6176", bid_string)); + + bson_decimal128_to_string (&large, bid_string); + BSON_ASSERT (!strcmp ("9.999987654321E+112", bid_string)); + + bson_decimal128_to_string (&largest, bid_string); + BSON_ASSERT ( + !strcmp ("9.999999999999999999999999999999999E+6144", bid_string)); + + bson_decimal128_to_string (&tiniest, bid_string); + BSON_ASSERT ( + !strcmp ("9.999999999999999999999999999999999E-6143", bid_string)); + + bson_decimal128_to_string (&trailing_zero, bid_string); + BSON_ASSERT (!strcmp ("1.050E+9", bid_string)); + + bson_decimal128_to_string (&one_trailing_zero, bid_string); + BSON_ASSERT (!strcmp ("1.050E+4", bid_string)); + + bson_decimal128_to_string (&move_decimal, bid_string); + BSON_ASSERT (!strcmp ("105", bid_string)); + + bson_decimal128_to_string (&move_decimal_after, bid_string); + BSON_ASSERT (!strcmp ("1.05E+3", bid_string)); + + bson_decimal128_to_string (&trailing_zero_no_decimal, bid_string); + BSON_ASSERT (!strcmp ("1E+3", bid_string)); +} + + +static void +test_decimal128_to_string__zeros (void) +{ + char bid_string[BSON_DECIMAL128_STRING]; + + bson_decimal128_t zero; /* 0 */ + bson_decimal128_t pos_exp_zero; /* 0E+300 */ + bson_decimal128_t neg_exp_zero; /* 0E-600 */ + + DECIMAL128_FROM_ULLS (zero, 0x3040000000000000, 0x0000000000000000); + DECIMAL128_FROM_ULLS (pos_exp_zero, 0x3298000000000000, 0x0000000000000000); + DECIMAL128_FROM_ULLS (neg_exp_zero, 0x2b90000000000000, 0x0000000000000000); + + bson_decimal128_to_string (&zero, bid_string); + BSON_ASSERT (!strcmp ("0", bid_string)); + + bson_decimal128_to_string (&pos_exp_zero, bid_string); + BSON_ASSERT (!strcmp ("0E+300", bid_string)); + + bson_decimal128_to_string (&neg_exp_zero, bid_string); + BSON_ASSERT (!strcmp ("0E-600", bid_string)); +} + + +#define IS_NAN(dec) (dec).high == 0x7c00000000000000ull + + +static void +test_decimal128_from_string__invalid_inputs (void) +{ + bson_decimal128_t dec; + + bson_decimal128_from_string (".", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string (".e", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("invalid", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("in", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("i", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("E02", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("..1", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("1abcede", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("1.24abc", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("1.24abcE+02", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("1.24E+02abc2d", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("E+02", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("e+02", &dec); + BSON_ASSERT (IS_NAN (dec)); + + bson_decimal128_from_string_w_len (".", 1, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len (".e", 2, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("", 0, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("invalid", 7, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("in", 2, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("i", 1, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("E02", 3, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("..1", 3, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("1abcede", 7, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("1.24abc", 7, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("1.24abcE+02", 11, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("1.24E+02abc2d", 13, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("E+02", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("e+02", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); +} + + +static void +test_decimal128_from_string__nan (void) +{ + bson_decimal128_t dec; + + bson_decimal128_from_string ("NaN", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("+NaN", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("-NaN", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("-nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("1e", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("+nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("Nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("+Nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string ("-Nan", &dec); + BSON_ASSERT (IS_NAN (dec)); + + bson_decimal128_from_string_w_len ("NaN", 3, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("+NaN", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("-NaN", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("-nan", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("1e", 2, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("+nan", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("nan", 3, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("Nan", 3, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("+Nan", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); + bson_decimal128_from_string_w_len ("-Nan", 4, &dec); + BSON_ASSERT (IS_NAN (dec)); +} + + +#define IS_PINFINITY(dec) (dec).high == 0x7800000000000000 +#define IS_NINFINITY(dec) (dec).high == 0xf800000000000000 + + +static void +test_decimal128_from_string__infinity (void) +{ + bson_decimal128_t dec; + + bson_decimal128_from_string ("Infinity", &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string ("+Infinity", &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string ("+Inf", &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string ("-Inf", &dec); + BSON_ASSERT (IS_NINFINITY (dec)); + bson_decimal128_from_string ("-Infinity", &dec); + BSON_ASSERT (IS_NINFINITY (dec)); + + bson_decimal128_from_string_w_len ("Infinity", 8, &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string_w_len ("+Infinity", 9, &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string_w_len ("+Inf", 4, &dec); + BSON_ASSERT (IS_PINFINITY (dec)); + bson_decimal128_from_string_w_len ("-Inf", 4, &dec); + BSON_ASSERT (IS_NINFINITY (dec)); + bson_decimal128_from_string_w_len ("-Infinity", 9, &dec); + BSON_ASSERT (IS_NINFINITY (dec)); +} + + +static bool +decimal128_equal (bson_decimal128_t *dec, uint64_t high, uint64_t low) +{ + bson_decimal128_t test; + DECIMAL128_FROM_ULLS (test, high, low); + return memcmp (dec, &test, sizeof (*dec)) == 0; +} + +static void +test_decimal128_from_string__simple (void) +{ + bson_decimal128_t one; + bson_decimal128_t negative_one; + bson_decimal128_t zero; + bson_decimal128_t negative_zero; + bson_decimal128_t number; + bson_decimal128_t number_two; + bson_decimal128_t negative_number; + bson_decimal128_t fractional_number; + bson_decimal128_t leading_zeros; + bson_decimal128_t leading_insignificant_zeros; + + bson_decimal128_from_string ("1", &one); + bson_decimal128_from_string ("-1", &negative_one); + bson_decimal128_from_string ("0", &zero); + bson_decimal128_from_string ("-0", &negative_zero); + bson_decimal128_from_string ("12345678901234567", &number); + bson_decimal128_from_string ("989898983458", &number_two); + bson_decimal128_from_string ("-12345678901234567", &negative_number); + + bson_decimal128_from_string ("0.12345", &fractional_number); + bson_decimal128_from_string ("0.0012345", &leading_zeros); + + bson_decimal128_from_string ("00012345678901234567", + &leading_insignificant_zeros); + + BSON_ASSERT ( + decimal128_equal (&one, 0x3040000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&negative_one, 0xb040000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&zero, 0x3040000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &negative_zero, 0xb040000000000000, 0x0000000000000000)); + BSON_ASSERT ( + decimal128_equal (&number, 0x3040000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT ( + decimal128_equal (&number_two, 0x3040000000000000, 0x000000e67a93c822)); + BSON_ASSERT (decimal128_equal ( + &negative_number, 0xb040000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT (decimal128_equal ( + &fractional_number, 0x3036000000000000, 0x0000000000003039)); + BSON_ASSERT (decimal128_equal ( + &leading_zeros, 0x3032000000000000, 0x0000000000003039)); + BSON_ASSERT (decimal128_equal ( + &leading_insignificant_zeros, 0x3040000000000000, 0x002bdc545d6b4b87)); + + + bson_decimal128_from_string_w_len ("1", 1, &one); + bson_decimal128_from_string_w_len ("-1", 2, &negative_one); + bson_decimal128_from_string_w_len ("0", 1, &zero); + bson_decimal128_from_string_w_len ("-0", 2, &negative_zero); + bson_decimal128_from_string_w_len ("12345678901234567", 17, &number); + bson_decimal128_from_string_w_len ("989898983458", 12, &number_two); + bson_decimal128_from_string_w_len ( + "-12345678901234567", 18, &negative_number); + + bson_decimal128_from_string_w_len ("0.12345", 7, &fractional_number); + bson_decimal128_from_string_w_len ("0.0012345", 9, &leading_zeros); + + bson_decimal128_from_string_w_len ( + "00012345678901234567", 20, &leading_insignificant_zeros); + + BSON_ASSERT ( + decimal128_equal (&one, 0x3040000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&negative_one, 0xb040000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&zero, 0x3040000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &negative_zero, 0xb040000000000000, 0x0000000000000000)); + BSON_ASSERT ( + decimal128_equal (&number, 0x3040000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT ( + decimal128_equal (&number_two, 0x3040000000000000, 0x000000e67a93c822)); + BSON_ASSERT (decimal128_equal ( + &negative_number, 0xb040000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT (decimal128_equal ( + &fractional_number, 0x3036000000000000, 0x0000000000003039)); + BSON_ASSERT (decimal128_equal ( + &leading_zeros, 0x3032000000000000, 0x0000000000003039)); + BSON_ASSERT (decimal128_equal ( + &leading_insignificant_zeros, 0x3040000000000000, 0x002bdc545d6b4b87)); +} + + +static void +test_decimal128_from_string__scientific (void) +{ + bson_decimal128_t ten; + bson_decimal128_t ten_again; + bson_decimal128_t one; + bson_decimal128_t huge_exp; + bson_decimal128_t tiny_exp; + bson_decimal128_t fractional; + bson_decimal128_t trailing_zeros; + + bson_decimal128_from_string ("10e0", &ten); + bson_decimal128_from_string ("1e1", &ten_again); + bson_decimal128_from_string ("10e-1", &one); + + BSON_ASSERT ( + decimal128_equal (&ten, 0x3040000000000000, 0x000000000000000a)); + BSON_ASSERT ( + decimal128_equal (&ten_again, 0x3042000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&one, 0x303e000000000000, 0x000000000000000a)); + + bson_decimal128_from_string ("12345678901234567e6111", &huge_exp); + bson_decimal128_from_string ("1e-6176", &tiny_exp); + + BSON_ASSERT ( + decimal128_equal (&huge_exp, 0x5ffe000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT ( + decimal128_equal (&tiny_exp, 0x0000000000000000, 0x0000000000000001)); + + bson_decimal128_from_string ("-100E-10", &fractional); + bson_decimal128_from_string ("10.50E8", &trailing_zeros); + + BSON_ASSERT ( + decimal128_equal (&fractional, 0xb02c000000000000, 0x0000000000000064)); + BSON_ASSERT (decimal128_equal ( + &trailing_zeros, 0x304c000000000000, 0x000000000000041a)); + + + bson_decimal128_from_string_w_len ("10e0", 4, &ten); + bson_decimal128_from_string_w_len ("1e1", 3, &ten_again); + bson_decimal128_from_string_w_len ("10e-1", 5, &one); + + BSON_ASSERT ( + decimal128_equal (&ten, 0x3040000000000000, 0x000000000000000a)); + BSON_ASSERT ( + decimal128_equal (&ten_again, 0x3042000000000000, 0x0000000000000001)); + BSON_ASSERT ( + decimal128_equal (&one, 0x303e000000000000, 0x000000000000000a)); + + bson_decimal128_from_string_w_len ("12345678901234567e6111", 22, &huge_exp); + bson_decimal128_from_string_w_len ("1e-6176", 7, &tiny_exp); + + BSON_ASSERT ( + decimal128_equal (&huge_exp, 0x5ffe000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT ( + decimal128_equal (&tiny_exp, 0x0000000000000000, 0x0000000000000001)); + + bson_decimal128_from_string_w_len ("-100E-10", 8, &fractional); + bson_decimal128_from_string_w_len ("10.50E8", 7, &trailing_zeros); + + BSON_ASSERT ( + decimal128_equal (&fractional, 0xb02c000000000000, 0x0000000000000064)); + BSON_ASSERT (decimal128_equal ( + &trailing_zeros, 0x304c000000000000, 0x000000000000041a)); +} + + +static void +test_decimal128_from_string__large (void) +{ + bson_decimal128_t large; + bson_decimal128_t all_digits; + bson_decimal128_t largest; + bson_decimal128_t tiniest; + bson_decimal128_t full_house; + + bson_decimal128_from_string ("12345689012345789012345", &large); + bson_decimal128_from_string ("1234567890123456789012345678901234", + &all_digits); + bson_decimal128_from_string ("9.999999999999999999999999999999999E+6144", + &largest); + bson_decimal128_from_string ("9.999999999999999999999999999999999E-6143", + &tiniest); + bson_decimal128_from_string ("5.192296858534827628530496329220095E+33", + &full_house); + + BSON_ASSERT ( + decimal128_equal (&large, 0x304000000000029d, 0x42da3a76f9e0d979)); + BSON_ASSERT ( + decimal128_equal (&all_digits, 0x30403cde6fff9732, 0xde825cd07e96aff2)); + BSON_ASSERT ( + decimal128_equal (&largest, 0x5fffed09bead87c0, 0x378d8e63ffffffff)); + BSON_ASSERT ( + decimal128_equal (&tiniest, 0x0001ed09bead87c0, 0x378d8e63ffffffff)); + BSON_ASSERT ( + decimal128_equal (&full_house, 0x3040ffffffffffff, 0xffffffffffffffff)); + + + bson_decimal128_from_string_w_len ("12345689012345789012345", -1, &large); + bson_decimal128_from_string_w_len ( + "1234567890123456789012345678901234", -1, &all_digits); + bson_decimal128_from_string_w_len ( + "9.999999999999999999999999999999999E+6144", -1, &largest); + bson_decimal128_from_string_w_len ( + "9.999999999999999999999999999999999E-6143", -1, &tiniest); + bson_decimal128_from_string_w_len ( + "5.192296858534827628530496329220095E+33", -1, &full_house); + + BSON_ASSERT ( + decimal128_equal (&large, 0x304000000000029d, 0x42da3a76f9e0d979)); + BSON_ASSERT ( + decimal128_equal (&all_digits, 0x30403cde6fff9732, 0xde825cd07e96aff2)); + BSON_ASSERT ( + decimal128_equal (&largest, 0x5fffed09bead87c0, 0x378d8e63ffffffff)); + BSON_ASSERT ( + decimal128_equal (&tiniest, 0x0001ed09bead87c0, 0x378d8e63ffffffff)); + BSON_ASSERT ( + decimal128_equal (&full_house, 0x3040ffffffffffff, 0xffffffffffffffff)); +} + + +static void +test_decimal128_from_string__exponent_normalization (void) +{ + bson_decimal128_t trailing_zeros; + bson_decimal128_t one_normalize; + bson_decimal128_t no_normalize; + bson_decimal128_t a_disaster; + + bson_decimal128_from_string ("1000000000000000000000000000000000000000", + &trailing_zeros); + bson_decimal128_from_string ("10000000000000000000000000000000000", + &one_normalize); + bson_decimal128_from_string ("1000000000000000000000000000000000", + &no_normalize); + bson_decimal128_from_string ( + "100000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000", + &a_disaster); + + BSON_ASSERT (decimal128_equal ( + &trailing_zeros, 0x304c314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT (decimal128_equal ( + &one_normalize, 0x3042314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT ( + decimal128_equal (&no_normalize, 0x3040314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT ( + decimal128_equal (&a_disaster, 0x37cc314dc6448d93, 0x38c15b0a00000000)); + + + bson_decimal128_from_string_w_len ( + "1000000000000000000000000000000000000000", -1, &trailing_zeros); + bson_decimal128_from_string_w_len ( + "10000000000000000000000000000000000", -1, &one_normalize); + bson_decimal128_from_string_w_len ( + "1000000000000000000000000000000000", -1, &no_normalize); + bson_decimal128_from_string_w_len ( + "100000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000", + -1, + &a_disaster); + + BSON_ASSERT (decimal128_equal ( + &trailing_zeros, 0x304c314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT (decimal128_equal ( + &one_normalize, 0x3042314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT ( + decimal128_equal (&no_normalize, 0x3040314dc6448d93, 0x38c15b0a00000000)); + BSON_ASSERT ( + decimal128_equal (&a_disaster, 0x37cc314dc6448d93, 0x38c15b0a00000000)); +} + + +static void +test_decimal128_from_string__zeros (void) +{ + bson_decimal128_t zero; + bson_decimal128_t exponent_zero; + bson_decimal128_t large_exponent; + bson_decimal128_t negative_zero; + + bson_decimal128_from_string ("0", &zero); + bson_decimal128_from_string ("0e-611", &exponent_zero); + bson_decimal128_from_string ("0e+6000", &large_exponent); + bson_decimal128_from_string ("-0e-1", &negative_zero); + + BSON_ASSERT ( + decimal128_equal (&zero, 0x3040000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &exponent_zero, 0x2b7a000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &large_exponent, 0x5f20000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &negative_zero, 0xb03e000000000000, 0x0000000000000000)); + + + bson_decimal128_from_string_w_len ("0", 1, &zero); + bson_decimal128_from_string_w_len ("0e-611", -1, &exponent_zero); + bson_decimal128_from_string_w_len ("0e+6000", 7, &large_exponent); + bson_decimal128_from_string_w_len ("-0e-1", 5, &negative_zero); + + BSON_ASSERT ( + decimal128_equal (&zero, 0x3040000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &exponent_zero, 0x2b7a000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &large_exponent, 0x5f20000000000000, 0x0000000000000000)); + BSON_ASSERT (decimal128_equal ( + &negative_zero, 0xb03e000000000000, 0x0000000000000000)); +} + +static void +test_decimal128_from_string_w_len__special (void) +{ + bson_decimal128_t number; + bson_decimal128_t number_two; + bson_decimal128_t negative_number; + + /* These strings have more bytes than the length indicates. */ + bson_decimal128_from_string_w_len ("12345678901234567abcd", 17, &number); + bson_decimal128_from_string_w_len ("989898983458abcd", 12, &number_two); + bson_decimal128_from_string_w_len ( + "-12345678901234567abcd", 18, &negative_number); + + BSON_ASSERT ( + decimal128_equal (&number, 0x3040000000000000, 0x002bdc545d6b4b87)); + BSON_ASSERT ( + decimal128_equal (&number_two, 0x3040000000000000, 0x000000e67a93c822)); + BSON_ASSERT (decimal128_equal ( + &negative_number, 0xb040000000000000, 0x002bdc545d6b4b87)); +} + +void +test_decimal128_install (TestSuite *suite) +{ + TestSuite_Add (suite, + "/bson/decimal128/to_string/infinity", + test_decimal128_to_string__infinity); + TestSuite_Add ( + suite, "/bson/decimal128/to_string/nan", test_decimal128_to_string__nan); + TestSuite_Add (suite, + "/bson/decimal128/to_string/regular", + test_decimal128_to_string__regular); + TestSuite_Add (suite, + "/bson/decimal128/to_string/scientific", + test_decimal128_to_string__scientific); + TestSuite_Add (suite, + "/bson/decimal128/to_string/zero", + test_decimal128_to_string__zeros); + TestSuite_Add (suite, + "/bson/decimal128/from_string/invalid", + test_decimal128_from_string__invalid_inputs); + TestSuite_Add (suite, + "/bson/decimal128/from_string/nan", + test_decimal128_from_string__nan); + TestSuite_Add (suite, + "/bson/decimal128/from_string/infinity", + test_decimal128_from_string__infinity); + TestSuite_Add (suite, + "/bson/decimal128/from_string/basic", + test_decimal128_from_string__simple); + TestSuite_Add (suite, + "/bson/decimal128/from_string/scientific", + test_decimal128_from_string__scientific); + TestSuite_Add (suite, + "/bson/decimal128/from_string/large", + test_decimal128_from_string__large); + TestSuite_Add (suite, + "/bson/decimal128/from_string/exponent_normalization", + test_decimal128_from_string__exponent_normalization); + TestSuite_Add (suite, + "/bson/decimal128/from_string/zero", + test_decimal128_from_string__zeros); + TestSuite_Add (suite, + "/bson/decimal128/from_string/with_length", + test_decimal128_from_string_w_len__special); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-endian.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-endian.c new file mode 100644 index 0000000..0f4f247 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-endian.c @@ -0,0 +1,59 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "TestSuite.h" + + +static void +test_swap16 (void) +{ + uint16_t v = 0xFCBA; + + BSON_ASSERT (BSON_UINT16_SWAP_LE_BE (v) == 0xBAFC); + BSON_ASSERT (__bson_uint16_swap_slow (v) == 0xBAFC); +} + + +static void +test_swap32 (void) +{ + uint32_t v = 0x00112233; + + BSON_ASSERT (BSON_UINT32_SWAP_LE_BE (v) == 0x33221100); + BSON_ASSERT (__bson_uint32_swap_slow (v) == 0x33221100); +} + + +static void +test_swap64 (void) +{ + uint64_t v = 0x0011223344556677ULL; + + BSON_ASSERT (BSON_UINT64_SWAP_LE_BE (v) == 0x7766554433221100ULL); + BSON_ASSERT (__bson_uint64_swap_slow (v) == 0x7766554433221100ULL); +} + + +void +test_endian_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/endian/swap16", test_swap16); + TestSuite_Add (suite, "/endian/swap32", test_swap32); + TestSuite_Add (suite, "/endian/swap64", test_swap64); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-fnv.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-fnv.c new file mode 100644 index 0000000..138ef13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-fnv.c @@ -0,0 +1,207 @@ +/* + * Please do not copyright this code. This code is in the public domain. + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * By: + * chongo /\oo/\ + * http://www.isthe.com/chongo/ + */ + +#include "bson/bson-fnv-private.h" +#include "TestSuite.h" + +/* REPEAT500 - repeat a string 500 times */ +#define R500(x) R100 (x) R100 (x) R100 (x) R100 (x) R100 (x) +#define R100(x) \ + R10 (x) \ + R10 (x) R10 (x) R10 (x) R10 (x) R10 (x) R10 (x) R10 (x) R10 (x) R10 (x) +#define R10(x) x x x x x x x x x x + +struct hash_test_vector { + char *str; /* start of test vector buffer */ + uint32_t hash; /* length of test vector */ +}; + +/* Source for below tests: http://www.isthe.com/chongo/src/fnv/test_fnv.c */ +static void +test_fnv_check_hashes (void) +{ + unsigned i; + + struct hash_test_vector v[] = { + {"", (uint32_t) 0x1c9d44}, + {"a", (uint32_t) 0x0c29c8}, + {"b", (uint32_t) 0x0c2d02}, + {"c", (uint32_t) 0x0c2cb4}, + {"d", (uint32_t) 0x0c2492}, + {"e", (uint32_t) 0x0c2200}, + {"f", (uint32_t) 0x0c277a}, + {"fo", (uint32_t) 0x22e820}, + {"foo", (uint32_t) 0xf37e7e}, + {"foob", (uint32_t) 0x5076d0}, + {"fooba", (uint32_t) 0xaaa1b3}, + {"foobar", (uint32_t) 0x9cf9d7}, + {"ch", (uint32_t) 0x299f11}, + {"cho", (uint32_t) 0x85801c}, + {"chon", (uint32_t) 0x29778b}, + {"chong", (uint32_t) 0x46b985}, + {"chongo", (uint32_t) 0x564ec0}, + {"chongo ", (uint32_t) 0xdd5c0c}, + {"chongo w", (uint32_t) 0x77eded}, + {"chongo wa", (uint32_t) 0xca9677}, + {"chongo was", (uint32_t) 0xeb9b9a}, + {"chongo was ", (uint32_t) 0xe67a30}, + {"chongo was h", (uint32_t) 0xd32f6a}, + {"chongo was he", (uint32_t) 0x743fc8}, + {"chongo was her", (uint32_t) 0x006376}, + {"chongo was here", (uint32_t) 0x9c99cb}, + {"chongo was here!", (uint32_t) 0x8524b9}, + {"chongo was here!\n", (uint32_t) 0x993001}, + {"cu", (uint32_t) 0x298129}, + {"cur", (uint32_t) 0x5637c9}, + {"curd", (uint32_t) 0xb9140f}, + {"curds", (uint32_t) 0x5bf5a7}, + {"curds ", (uint32_t) 0xc42805}, + {"curds a", (uint32_t) 0xcc0e97}, + {"curds an", (uint32_t) 0x3b4c5d}, + {"curds and", (uint32_t) 0x59f0a7}, + {"curds and ", (uint32_t) 0x94de0b}, + {"curds and w", (uint32_t) 0x5a0a72}, + {"curds and wh", (uint32_t) 0xbee56f}, + {"curds and whe", (uint32_t) 0x8363fd}, + {"curds and whey", (uint32_t) 0xd5346c}, + {"curds and whey\n", (uint32_t) 0xa14715}, + {"hi", (uint32_t) 0x3af6f2}, + {"hello", (uint32_t) 0x9f2ce4}, + {"\x40\x51\x4e\x44", (uint32_t) 0x17906a}, + {"\x44\x4e\x51\x40", (uint32_t) 0x0bfece}, + {"\x40\x51\x4e\x4a", (uint32_t) 0x178d02}, + {"\x4a\x4e\x51\x40", (uint32_t) 0xaddad9}, + {"\x40\x51\x4e\x54", (uint32_t) 0x17a9ca}, + {"\x54\x4e\x51\x40", (uint32_t) 0x2633a1}, + {"127.0.0.1", (uint32_t) 0xa3d116}, + {"127.0.0.2", (uint32_t) 0xa3cf8c}, + {"127.0.0.3", (uint32_t) 0xa3cdfe}, + {"64.81.78.68", (uint32_t) 0x5636ba}, + {"64.81.78.74", (uint32_t) 0x53e841}, + {"64.81.78.84", (uint32_t) 0x5b8948}, + {"feedface", (uint32_t) 0x88b139}, + {"feedfacedaffdeed", (uint32_t) 0x364109}, + {"feedfacedeadbeef", (uint32_t) 0x7604b9}, + {"line 1\nline 2\nline 3", (uint32_t) 0xb4eab4}, + {"chongo /\\../\\", (uint32_t) 0x4e927c}, + {"chongo (Landon Curt Noll) /\\../\\", (uint32_t) 0x1b25e1}, + {"Evgeni was here :D", (uint32_t) 0xebf05e}, + {"http://antwrp.gsfc.nasa.gov/apod/astropix.html", (uint32_t) 0x524a34}, + {"http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", (uint32_t) 0x16ef98}, + {"http://epod.usra.edu/", (uint32_t) 0x648bd3}, + {"http://exoplanet.eu/", (uint32_t) 0xa4bc83}, + {"http://hvo.wr.usgs.gov/cam3/", (uint32_t) 0x53ae47}, + {"http://hvo.wr.usgs.gov/cams/HMcam/", (uint32_t) 0x302859}, + {"http://hvo.wr.usgs.gov/kilauea/update/deformation.html", + (uint32_t) 0x6deda7}, + {"http://hvo.wr.usgs.gov/kilauea/update/images.html", + (uint32_t) 0x36db15}, + {"http://hvo.wr.usgs.gov/kilauea/update/maps.html", (uint32_t) 0x9d33fc}, + {"http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", + (uint32_t) 0xbb6ce2}, + {"http://neo.jpl.nasa.gov/risk/", (uint32_t) 0xf83893}, + {"http://norvig.com/21-days.html", (uint32_t) 0x08bf51}, + {"http://primes.utm.edu/curios/home.php", (uint32_t) 0xcc8e5f}, + {"http://slashdot.org/", (uint32_t) 0xe20f9f}, + {"http://tux.wr.usgs.gov/Maps/155.25-19.5.html", (uint32_t) 0xe97f2e}, + {"http://volcano.wr.usgs.gov/kilaueastatus.php", (uint32_t) 0x37b27b}, + {"http://www.avo.alaska.edu/activity/Redoubt.php", (uint32_t) 0x9e874a}, + {"http://www.dilbert.com/fast/", (uint32_t) 0xe63f5a}, + {"http://www.fourmilab.ch/gravitation/orbits/", (uint32_t) 0xb50b11}, + {"http://www.fpoa.net/", (uint32_t) 0xd678e6}, + {"http://www.ioccc.org/index.html", (uint32_t) 0xd5b723}, + {"http://www.isthe.com/cgi-bin/number.cgi", (uint32_t) 0x450bb7}, + {"http://www.isthe.com/chongo/bio.html", (uint32_t) 0x72d79d}, + {"http://www.isthe.com/chongo/index.html", (uint32_t) 0x06679c}, + {"http://www.isthe.com/chongo/src/calc/lucas-calc", (uint32_t) 0x52e15c}, + {"http://www.isthe.com/chongo/tech/astro/venus2004.html", + (uint32_t) 0x9664f7}, + {"http://www.isthe.com/chongo/tech/astro/vita.html", (uint32_t) 0x3258b6}, + {"http://www.isthe.com/chongo/tech/comp/c/expert.html", + (uint32_t) 0xed6ea7}, + {"http://www.isthe.com/chongo/tech/comp/calc/index.html", + (uint32_t) 0x7d7ce2}, + {"http://www.isthe.com/chongo/tech/comp/fnv/index.html", + (uint32_t) 0xc71ba1}, + {"http://www.isthe.com/chongo/tech/math/number/howhigh.html", + (uint32_t) 0x84f14b}, + {"http://www.isthe.com/chongo/tech/math/number/number.html", + (uint32_t) 0x8ecf2e}, + {"http://www.isthe.com/chongo/tech/math/prime/mersenne.html", + (uint32_t) 0x94f673}, + {"http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", + (uint32_t) 0x970112}, + {"http://www.lavarnd.org/cgi-bin/corpspeak.cgi", (uint32_t) 0x6e172a}, + {"http://www.lavarnd.org/cgi-bin/haiku.cgi", (uint32_t) 0xf8f6e7}, + {"http://www.lavarnd.org/cgi-bin/rand-none.cgi", (uint32_t) 0xf58843}, + {"http://www.lavarnd.org/cgi-bin/randdist.cgi", (uint32_t) 0x17b6b2}, + {"http://www.lavarnd.org/index.html", (uint32_t) 0xad4cfb}, + {"http://www.lavarnd.org/what/nist-test.html", (uint32_t) 0x256811}, + {"http://www.macosxhints.com/", (uint32_t) 0xb18dd8}, + {"http://www.mellis.com/", (uint32_t) 0x61c153}, + {"http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", + (uint32_t) 0x47d20d}, + {"http://www.nature.nps.gov/air/webcams/parks/havoso2alert/" + "timelines_24.cfm", + (uint32_t) 0x8b689f}, + {"http://www.paulnoll.com/", (uint32_t) 0xd2a40b}, + {"http://www.pepysdiary.com/", (uint32_t) 0x549b0a}, + {"http://www.sciencenews.org/index/home/activity/view", + (uint32_t) 0xe1b55b}, + {"http://www.skyandtelescope.com/", (uint32_t) 0x0cd3d1}, + {"http://www.sput.nl/~rob/sirius.html", (uint32_t) 0x471605}, + {"http://www.systemexperts.com/", (uint32_t) 0x5eef10}, + {"http://www.tq-international.com/phpBB3/index.php", (uint32_t) 0xed3629}, + {"http://www.travelquesttours.com/index.htm", (uint32_t) 0x624952}, + {"http://www.wunderground.com/global/stations/89606.html", + (uint32_t) 0x9b8688}, + {R10 ("21701"), (uint32_t) 0x15e25f}, + {R10 ("M21701"), (uint32_t) 0xa98d05}, + {R10 ("2^21701-1"), (uint32_t) 0xdf8bcc}, + {R10 ("\x54\xc5"), (uint32_t) 0x1e9051}, + {R10 ("\xc5\x54"), (uint32_t) 0x3f70db}, + {R10 ("23209"), (uint32_t) 0x95aedb}, + {R10 ("M23209"), (uint32_t) 0xa7f7d7}, + {R10 ("2^23209-1"), (uint32_t) 0x3bc660}, + {R10 ("\x5a\xa9"), (uint32_t) 0x610967}, + {R10 ("\xa9\x5a"), (uint32_t) 0x157785}, + {R10 ("391581216093"), (uint32_t) 0x2b2800}, + {R10 ("391581*2^216093-1"), (uint32_t) 0x8239ef}, + {R10 ("\x05\xf9\x9d\x03\x4c\x81"), (uint32_t) 0x5869f5}, + {R10 ("FEDCBA9876543210"), (uint32_t) 0x415c76}, + {R10 ("\xfe\xdc\xba\x98\x76\x54\x32\x10"), (uint32_t) 0xe4ff6f}, + {R10 ("EFCDAB8967452301"), (uint32_t) 0xb7977d}, + {R10 ("\xef\xcd\xab\x89\x67\x45\x23\x01"), (uint32_t) 0xa43a7b}, + {R10 ("0123456789ABCDEF"), (uint32_t) 0xb3be1e}, + {R10 ("\x01\x23\x45\x67\x89\xab\xcd\xef"), (uint32_t) 0x777aaf}, + {R10 ("1032547698BADCFE"), (uint32_t) 0x21c38a}, + {R10 ("\x10\x32\x54\x76\x98\xba\xdc\xfe"), (uint32_t) 0x9d0839}, + {R500 ("\x07"), (uint32_t) 0xa27250}, + {R500 ("~"), (uint32_t) 0xc5c656}, + {R500 ("\x7f"), (uint32_t) 0x3b0800}, + {NULL, 0} /* MUST BE LAST */ + }; + + for (i = 0; v[i].str != NULL; ++i) { + ASSERT_CMPUINT32 (_mongoc_fnv_24a_str (v[i].str), ==, v[i].hash); + } +} + +void +test_fnv_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/fnv/check_hashes", test_fnv_check_hashes); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iso8601.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iso8601.c new file mode 100644 index 0000000..91bb67f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iso8601.c @@ -0,0 +1,386 @@ +#include + +#include "bson/bson-iso8601-private.h" +#include "TestSuite.h" + +#define IS_TIME_T_SMALL (sizeof (time_t) == sizeof (int32_t)) + +static void +test_date (const char *str, int64_t millis) +{ + int64_t v; + bson_error_t error; + + if (!_bson_iso8601_date_parse (str, strlen (str), &v, &error)) { + fprintf (stderr, "could not parse (%s)\n", str); + abort (); + } + + if (v != millis) { + fprintf (stderr, + "parsed value not correct: %" PRId64 " != %" PRId64 "\n", + millis, + v); + + fprintf (stderr, "parsing: [%s]\n", str); + abort (); + } +} + + +static void +test_date_io (const char *str_in, const char *str_out, int64_t millis) +{ + bson_string_t *bson_str; + + test_date (str_in, millis); + + bson_str = bson_string_new (NULL); + _bson_iso8601_date_format (millis, bson_str); + ASSERT_CMPSTR (bson_str->str, str_out); + bson_string_free (bson_str, true); +} + + +/* round trip str -> millis -> str */ +static void +test_date_rt (const char *str, int64_t millis) +{ + test_date_io (str, str, millis); +} + + +static void +test_date_should_fail (const char *str) +{ + int64_t v; + bson_error_t error; + + if (_bson_iso8601_date_parse (str, strlen (str), &v, &error)) { + fprintf (stderr, "should not be able to parse (%s)\n", str); + abort (); + } +} + +static void +test_bson_iso8601_utc (void) +{ + /* Allowed date format: + * YYYY-MM-DDTHH:MM[:SS[.m[m[m]]]]Z + * Year, month, day, hour, and minute are required, while the seconds + * component and one to + * three milliseconds are optional. + */ + + test_date_rt ("1971-02-03T04:05:06.789Z", 34401906789ULL); + test_date_io ( + "1971-02-03T04:05:06.78Z", "1971-02-03T04:05:06.780Z", 34401906780ULL); + test_date_io ( + "1971-02-03T04:05:06.7Z", "1971-02-03T04:05:06.700Z", 34401906700ULL); + test_date_rt ("1971-02-03T04:05:06Z", 34401906000ULL); + test_date_io ("1971-02-03T04:05Z", "1971-02-03T04:05:00Z", 34401900000ULL); + test_date_io ("1970-01-01T00:00:00.000Z", "1970-01-01T00:00:00Z", 0ULL); + test_date_rt ("1970-06-30T01:06:40.981Z", 15556000981ULL); + test_date ("1970-01-01T00:00:00.000+0100", -3600LL * 1000); + + if (!IS_TIME_T_SMALL) { + test_date_rt ("2058-02-20T18:29:11.100Z", 2781455351100ULL); + test_date ("3001-01-01T08:00:00.000Z", 32535244800000ULL); + } + + test_date_rt ("2013-02-20T18:29:11.100Z", 1361384951100ULL); + + /* from the BSON Corpus Tests */ + test_date_io ("1970-01-01T00:00:00.000Z", "1970-01-01T00:00:00Z", 0); + test_date_rt ("2012-12-24T12:15:30.500Z", 1356351330500); + test_date ("1960-12-24T12:15:30.500Z", -284643869500LL); +} + +static void +test_bson_iso8601_local (void) +{ + /* Allowed date format: + * YYYY-MM-DDTHH:MM[:SS[.m[m[m]]]]+HHMM + * Year, month, day, hour, and minute are required, while the seconds + * component and one to + * three milliseconds are optional. The time zone offset must be four + * digits. + */ + + test_date_io ("1971-02-03T09:16:06.789+0511", + "1971-02-03T04:05:06.789Z", + 34401906789ULL); + test_date_io ("1971-02-03T09:16:06.78+0511", + "1971-02-03T04:05:06.780Z", + 34401906780ULL); + test_date_io ( + "1971-02-03T09:16:06.7+0511", "1971-02-03T04:05:06.700Z", 34401906700ULL); + test_date_io ( + "1971-02-03T09:16:06+0511", "1971-02-03T04:05:06Z", 34401906000ULL); + test_date_io ( + "1971-02-03T09:16+0511", "1971-02-03T04:05:00Z", 34401900000ULL); + test_date_io ("1970-01-01T00:00:00.000Z", "1970-01-01T00:00:00Z", 0ULL); + test_date_rt ("1970-06-30T01:06:40.981Z", 15556000981ULL); + test_date_io ("1970-06-29T21:06:40.981-0400", + "1970-06-30T01:06:40.981Z", + 15556000981ULL); + test_date_io ("1969-12-31T16:00:00.000-0800", "1970-01-01T00:00:00Z", 0ULL); + + if (!IS_TIME_T_SMALL) { + test_date_io ("2058-02-20T13:29:11.100-0500", + "2058-02-20T18:29:11.100Z", + 2781455351100ULL); + test_date_rt ("3000-12-31T23:59:59Z", 32535215999000ULL); + } else { + test_date_rt ("2038-01-19T03:14:07Z", 2147483647000ULL); + } + + test_date_io ("2013-02-20T13:29:11.100-0500", + "2013-02-20T18:29:11.100Z", + 1361384951100ULL); + test_date_io ("2013-02-20T13:29:11.100-0501", + "2013-02-20T18:30:11.100Z", + 1361385011100ULL); + test_date ("0000-01-01T00:00:00.000Z", -62167219200000LL); + test_date ("0000-01-01T00:00:00.000+2300", -62167302000000LL); + test_date ("9999-01-01T00:00:00.000Z", 253370764800000ULL); +} + +static void +test_bson_iso8601_invalid (void) +{ + /* Invalid decimal */ + test_date_should_fail ("1970-01-01T00:00:00.0.0Z"); + test_date_should_fail ("1970-01-01T00:00:.0.000Z"); + test_date_should_fail ("1970-01-01T00:.0:00.000Z"); + test_date_should_fail ("1970-01-01T.0:00:00.000Z"); + test_date_should_fail ("1970-01-.1T00:00:00.000Z"); + test_date_should_fail ("1970-.1-01T00:00:00.000Z"); + test_date_should_fail (".970-01-01T00:00:00.000Z"); + + /* Extra sign characters */ + test_date_should_fail ("1970-01-01T00:00:00.+00Z"); + test_date_should_fail ("1970-01-01T00:00:+0.000Z"); + test_date_should_fail ("1970-01-01T00:+0:00.000Z"); + test_date_should_fail ("1970-01-01T+0:00:00.000Z"); + test_date_should_fail ("1970-01-+1T00:00:00.000Z"); + test_date_should_fail ("1970-+1-01T00:00:00.000Z"); + test_date_should_fail ("+970-01-01T00:00:00.000Z"); + + test_date_should_fail ("1970-01-01T00:00:00.-00Z"); + test_date_should_fail ("1970-01-01T00:00:-0.000Z"); + test_date_should_fail ("1970-01-01T00:-0:00.000Z"); + test_date_should_fail ("1970-01-01T-0:00:00.000Z"); + test_date_should_fail ("1970-01--1T00:00:00.000Z"); + test_date_should_fail ("1970--1-01T00:00:00.000Z"); + test_date_should_fail ("-970-01-01T00:00:00.000Z"); + + /* Out of range */ + test_date_should_fail ("1970-01-01T00:60:00.000Z"); + test_date_should_fail ("1970-01-01T24:00:00.000Z"); + test_date_should_fail ("1970-01-32T00:00:00.000Z"); + test_date_should_fail ("1970-01-00T00:00:00.000Z"); + test_date_should_fail ("1970-13-01T00:00:00.000Z"); + test_date_should_fail ("1970-00-01T00:00:00.000Z"); + test_date_should_fail ("10000-01-01T00:00:00.000Z"); + test_date_should_fail ("-10000-01-01T00:00:00.000Z"); + + /* Invalid lengths */ + test_date_should_fail ("01970-01-01T00:00:00.000Z"); + test_date_should_fail ("1970-001-01T00:00:00.000Z"); + test_date_should_fail ("1970-01-001T00:00:00.000Z"); + test_date_should_fail ("1970-01-01T000:00:00.000Z"); + test_date_should_fail ("1970-01-01T00:000:00.000Z"); + test_date_should_fail ("1970-01-01T00:00:000.000Z"); + test_date_should_fail ("1970-01-01T00:00:00.0000Z"); + test_date_should_fail ("197-01-01T00:00:00.000Z"); + test_date_should_fail ("1970-1-01T00:00:00.000Z"); + test_date_should_fail ("1970-01-1T00:00:00.000Z"); + test_date_should_fail ("1970-01-01T0:00:00.000Z"); + test_date_should_fail ("1970-01-01T00:0:00.000Z"); + test_date_should_fail ("1970-01-01T00:00:0.000Z"); + + /* Invalid delimiters */ + test_date_should_fail ("1970+01-01T00:00:00.000Z"); + test_date_should_fail ("1970-01+01T00:00:00.000Z"); + test_date_should_fail ("1970-01-01Q00:00:00.000Z"); + test_date_should_fail ("1970-01-01T00-00:00.000Z"); + test_date_should_fail ("1970-01-01T00:00-00.000Z"); + test_date_should_fail ("1970-01-01T00:00:00-000Z"); + + /* Missing numbers */ + test_date_should_fail ("1970--01T00:00:00.000Z"); + test_date_should_fail ("1970-01-T00:00:00.000Z"); + test_date_should_fail ("1970-01-01T:00:00.000Z"); + test_date_should_fail ("1970-01-01T00::00.000Z"); + test_date_should_fail ("1970-01-01T00:00:.000Z"); + test_date_should_fail ("1970-01-01T00:00:00.Z"); + + /* Bad time offset field */ + test_date_should_fail ("1970-01-01T05:00:01ZZ"); + test_date_should_fail ("1970-01-01T05:00:01+"); + test_date_should_fail ("1970-01-01T05:00:01-"); + test_date_should_fail ("1970-01-01T05:00:01-11111"); + test_date_should_fail ("1970-01-01T05:00:01Z1111"); + test_date_should_fail ("1970-01-01T05:00:01+111"); + test_date_should_fail ("1970-01-01T05:00:01+1160"); + test_date_should_fail ("1970-01-01T05:00:01+2400"); + test_date_should_fail ("1970-01-01T05:00:01+00+0"); + + /* Bad prefixes */ + test_date_should_fail ("1970-01-01T05:00:01."); + test_date_should_fail ("1970-01-01T05:00:"); + test_date_should_fail ("1970-01-01T05:"); + test_date_should_fail ("1970-01-01T"); + test_date_should_fail ("1970-01-"); + test_date_should_fail ("1970-"); + test_date_should_fail ("1970-01-01T05+0500"); + test_date_should_fail ("1970-01-01+0500"); + test_date_should_fail ("1970-01+0500"); + test_date_should_fail ("1970+0500"); + test_date_should_fail ("1970-01-01T01Z"); + test_date_should_fail ("1970-01-01Z"); + test_date_should_fail ("1970-01Z"); + test_date_should_fail ("1970Z"); + + /* No local time */ + test_date_should_fail ("1970-01-01T00:00:00.000"); + test_date_should_fail ("1970-01-01T00:00:00"); + test_date_should_fail ("1970-01-01T00:00"); + test_date_should_fail ("1970-01-01T00"); + test_date_should_fail ("1970-01-01"); + test_date_should_fail ("1970-01"); + test_date_should_fail ("1970"); + + /* Invalid hex base specifiers */ + test_date_should_fail ("x970-01-01T00:00:00.000Z"); + test_date_should_fail ("1970-x1-01T00:00:00.000Z"); + test_date_should_fail ("1970-01-x1T00:00:00.000Z"); + test_date_should_fail ("1970-01-01Tx0:00:00.000Z"); + test_date_should_fail ("1970-01-01T00:x0:00.000Z"); + test_date_should_fail ("1970-01-01T00:00:x0.000Z"); + test_date_should_fail ("1970-01-01T00:00:00.x00Z"); +} + +static void +test_bson_iso8601_leap_year (void) +{ + test_date_rt ("1972-02-29T00:00:00Z", 68169600000ULL); + test_date_rt ("1976-02-29T00:00:00Z", 194400000000ULL); + test_date_rt ("1980-02-29T00:00:00Z", 320630400000ULL); + test_date_rt ("1984-02-29T00:00:00Z", 446860800000ULL); + test_date_rt ("1988-02-29T00:00:00Z", 573091200000ULL); + test_date_rt ("1992-02-29T00:00:00Z", 699321600000ULL); + test_date_rt ("1996-02-29T00:00:00Z", 825552000000ULL); + test_date_rt ("2000-02-29T00:00:00Z", 951782400000ULL); + test_date_rt ("2004-02-29T00:00:00Z", 1078012800000ULL); + test_date_rt ("2008-02-29T00:00:00Z", 1204243200000ULL); + test_date_rt ("2012-02-29T00:00:00Z", 1330473600000ULL); + test_date_rt ("2016-02-29T00:00:00Z", 1456704000000ULL); + test_date_rt ("2020-02-29T00:00:00Z", 1582934400000ULL); + test_date_rt ("2024-02-29T00:00:00Z", 1709164800000ULL); + test_date_rt ("2028-02-29T00:00:00Z", 1835395200000ULL); + test_date_rt ("2032-02-29T00:00:00Z", 1961625600000ULL); + test_date_rt ("2036-02-29T00:00:00Z", 2087856000000ULL); + + if (!IS_TIME_T_SMALL) { + test_date_rt ("2040-02-29T00:00:00Z", 2214086400000ULL); + test_date_rt ("2044-02-29T00:00:00Z", 2340316800000ULL); + test_date_rt ("2048-02-29T00:00:00Z", 2466547200000ULL); + test_date_rt ("2052-02-29T00:00:00Z", 2592777600000ULL); + test_date_rt ("2056-02-29T00:00:00Z", 2719008000000ULL); + test_date_rt ("2060-02-29T00:00:00Z", 2845238400000ULL); + test_date_rt ("2064-02-29T00:00:00Z", 2971468800000ULL); + test_date_rt ("2068-02-29T00:00:00Z", 3097699200000ULL); + test_date_rt ("2072-02-29T00:00:00Z", 3223929600000ULL); + test_date_rt ("2076-02-29T00:00:00Z", 3350160000000ULL); + test_date_rt ("2080-02-29T00:00:00Z", 3476390400000ULL); + test_date_rt ("2084-02-29T00:00:00Z", 3602620800000ULL); + test_date_rt ("2088-02-29T00:00:00Z", 3728851200000ULL); + test_date_rt ("2092-02-29T00:00:00Z", 3855081600000ULL); + test_date_rt ("2096-02-29T00:00:00Z", 3981312000000ULL); + test_date_rt ("2104-02-29T00:00:00Z", 4233686400000ULL); + test_date_rt ("2108-02-29T00:00:00Z", 4359916800000ULL); + test_date_rt ("2112-02-29T00:00:00Z", 4486147200000ULL); + test_date_rt ("2116-02-29T00:00:00Z", 4612377600000ULL); + test_date_rt ("2120-02-29T00:00:00Z", 4738608000000ULL); + test_date_rt ("2124-02-29T00:00:00Z", 4864838400000ULL); + test_date_rt ("2128-02-29T00:00:00Z", 4991068800000ULL); + test_date_rt ("2132-02-29T00:00:00Z", 5117299200000ULL); + test_date_rt ("2136-02-29T00:00:00Z", 5243529600000ULL); + test_date_rt ("2140-02-29T00:00:00Z", 5369760000000ULL); + test_date_rt ("2144-02-29T00:00:00Z", 5495990400000ULL); + test_date_rt ("2148-02-29T00:00:00Z", 5622220800000ULL); + test_date_rt ("2152-02-29T00:00:00Z", 5748451200000ULL); + test_date_rt ("2156-02-29T00:00:00Z", 5874681600000ULL); + test_date_rt ("2160-02-29T00:00:00Z", 6000912000000ULL); + test_date_rt ("2164-02-29T00:00:00Z", 6127142400000ULL); + test_date_rt ("2168-02-29T00:00:00Z", 6253372800000ULL); + test_date_rt ("2172-02-29T00:00:00Z", 6379603200000ULL); + test_date_rt ("2176-02-29T00:00:00Z", 6505833600000ULL); + test_date_rt ("2180-02-29T00:00:00Z", 6632064000000ULL); + test_date_rt ("2184-02-29T00:00:00Z", 6758294400000ULL); + test_date_rt ("2188-02-29T00:00:00Z", 6884524800000ULL); + test_date_rt ("2192-02-29T00:00:00Z", 7010755200000ULL); + test_date_rt ("2196-02-29T00:00:00Z", 7136985600000ULL); + test_date_rt ("2204-02-29T00:00:00Z", 7389360000000ULL); + test_date_rt ("2208-02-29T00:00:00Z", 7515590400000ULL); + test_date_rt ("2212-02-29T00:00:00Z", 7641820800000ULL); + test_date_rt ("2216-02-29T00:00:00Z", 7768051200000ULL); + test_date_rt ("2220-02-29T00:00:00Z", 7894281600000ULL); + test_date_rt ("2224-02-29T00:00:00Z", 8020512000000ULL); + test_date_rt ("2228-02-29T00:00:00Z", 8146742400000ULL); + test_date_rt ("2232-02-29T00:00:00Z", 8272972800000ULL); + test_date_rt ("2236-02-29T00:00:00Z", 8399203200000ULL); + test_date_rt ("2240-02-29T00:00:00Z", 8525433600000ULL); + test_date_rt ("2244-02-29T00:00:00Z", 8651664000000ULL); + test_date_rt ("2248-02-29T00:00:00Z", 8777894400000ULL); + test_date_rt ("2252-02-29T00:00:00Z", 8904124800000ULL); + test_date_rt ("2256-02-29T00:00:00Z", 9030355200000ULL); + test_date_rt ("2260-02-29T00:00:00Z", 9156585600000ULL); + test_date_rt ("2264-02-29T00:00:00Z", 9282816000000ULL); + test_date_rt ("2268-02-29T00:00:00Z", 9409046400000ULL); + test_date_rt ("2272-02-29T00:00:00Z", 9535276800000ULL); + test_date_rt ("2276-02-29T00:00:00Z", 9661507200000ULL); + test_date_rt ("2280-02-29T00:00:00Z", 9787737600000ULL); + test_date_rt ("2284-02-29T00:00:00Z", 9913968000000ULL); + test_date_rt ("2288-02-29T00:00:00Z", 10040198400000ULL); + test_date_rt ("2292-02-29T00:00:00Z", 10166428800000ULL); + test_date_rt ("2296-02-29T00:00:00Z", 10292659200000ULL); + test_date_rt ("2304-02-29T00:00:00Z", 10545033600000ULL); + test_date_rt ("2308-02-29T00:00:00Z", 10671264000000ULL); + test_date_rt ("2312-02-29T00:00:00Z", 10797494400000ULL); + test_date_rt ("2316-02-29T00:00:00Z", 10923724800000ULL); + test_date_rt ("2320-02-29T00:00:00Z", 11049955200000ULL); + test_date_rt ("2324-02-29T00:00:00Z", 11176185600000ULL); + test_date_rt ("2328-02-29T00:00:00Z", 11302416000000ULL); + test_date_rt ("2332-02-29T00:00:00Z", 11428646400000ULL); + test_date_rt ("2336-02-29T00:00:00Z", 11554876800000ULL); + test_date_rt ("2340-02-29T00:00:00Z", 11681107200000ULL); + test_date_rt ("2344-02-29T00:00:00Z", 11807337600000ULL); + test_date_rt ("2348-02-29T00:00:00Z", 11933568000000ULL); + test_date_rt ("2352-02-29T00:00:00Z", 12059798400000ULL); + test_date_rt ("2356-02-29T00:00:00Z", 12186028800000ULL); + test_date_rt ("2360-02-29T00:00:00Z", 12312259200000ULL); + test_date_rt ("2364-02-29T00:00:00Z", 12438489600000ULL); + test_date_rt ("2368-02-29T00:00:00Z", 12564720000000ULL); + test_date_rt ("2372-02-29T00:00:00Z", 12690950400000ULL); + test_date_rt ("2376-02-29T00:00:00Z", 12817180800000ULL); + test_date_rt ("2380-02-29T00:00:00Z", 12943411200000ULL); + test_date_rt ("2384-02-29T00:00:00Z", 13069641600000ULL); + test_date_rt ("2388-02-29T00:00:00Z", 13195872000000ULL); + test_date_rt ("2392-02-29T00:00:00Z", 13322102400000ULL); + test_date_rt ("2396-02-29T00:00:00Z", 13448332800000ULL); + test_date_rt ("2400-02-29T00:00:00Z", 13574563200000ULL); + } +} + +void +test_iso8601_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/iso8601/utc", test_bson_iso8601_utc); + TestSuite_Add (suite, "/bson/iso8601/local", test_bson_iso8601_local); + TestSuite_Add (suite, "/bson/iso8601/invalid", test_bson_iso8601_invalid); + TestSuite_Add ( + suite, "/bson/iso8601/leap_year", test_bson_iso8601_leap_year); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iter.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iter.c new file mode 100644 index 0000000..6f2c090 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-iter.c @@ -0,0 +1,777 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "TestSuite.h" + +#define FUZZ_N_PASSES 100000 + +static bson_t * +get_bson (const char *filename) +{ + uint8_t buf[4096]; + bson_t *b; + ssize_t len; + int fd; + + if (-1 == (fd = bson_open (filename, O_RDONLY))) { + fprintf (stderr, "Failed to open: %s\n", filename); + abort (); + } + if ((len = bson_read (fd, buf, sizeof buf)) < 0) { + fprintf (stderr, "Failed to read: %s\n", filename); + abort (); + } + BSON_ASSERT (len > 0); + b = bson_new_from_data (buf, (uint32_t) len); + bson_close (fd); + + return b; +} + + +static void +test_bson_iter_utf8 (void) +{ + uint32_t len = 0; + bson_iter_t iter; + bson_t *b; + char *s; + + b = bson_new (); + BSON_ASSERT (bson_append_utf8 (b, "foo", -1, "bar", -1)); + BSON_ASSERT (bson_append_utf8 (b, "bar", -1, "baz", -1)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_UTF8 (&iter)); + BSON_ASSERT (!strcmp (bson_iter_key (&iter), "foo")); + BSON_ASSERT (!strcmp (bson_iter_utf8 (&iter, NULL), "bar")); + s = bson_iter_dup_utf8 (&iter, &len); + ASSERT_CMPSTR ("bar", s); + ASSERT_CMPINT (len, ==, 3); + bson_free (s); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_UTF8 (&iter)); + BSON_ASSERT (!strcmp (bson_iter_key (&iter), "bar")); + BSON_ASSERT (!strcmp (bson_iter_utf8 (&iter, NULL), "baz")); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_destroy (b); +} + + +static void +test_bson_iter_mixed (void) +{ + bson_iter_t iter; + bson_decimal128_t iter_value; + bson_decimal128_t value; + bson_t *b; + bson_t *b2; + + b = bson_new (); + b2 = bson_new (); + + value.high = 0; + value.low = 1; + + BSON_ASSERT (bson_append_utf8 (b2, "foo", -1, "bar", -1)); + BSON_ASSERT (bson_append_code (b, "0", -1, "var a = {};")); + BSON_ASSERT (bson_append_code_with_scope (b, "1", -1, "var b = {};", b2)); + BSON_ASSERT (bson_append_int32 (b, "2", -1, 1234)); + BSON_ASSERT (bson_append_int64 (b, "3", -1, 4567)); + BSON_ASSERT (bson_append_time_t (b, "4", -1, 123456)); + BSON_ASSERT (bson_append_decimal128 (b, "5", -1, &value)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_CODE (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_CODEWSCOPE (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_DATE_TIME (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_DECIMAL128 (&iter)); + BSON_ASSERT (!bson_iter_next (&iter)); + BSON_ASSERT (bson_iter_init_find (&iter, b, "3")); + BSON_ASSERT (!strcmp (bson_iter_key (&iter), "3")); + BSON_ASSERT (bson_iter_int64 (&iter) == 4567); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (BSON_ITER_HOLDS_DATE_TIME (&iter)); + BSON_ASSERT (bson_iter_time_t (&iter) == 123456); + BSON_ASSERT (bson_iter_date_time (&iter) == 123456000); + BSON_ASSERT (bson_iter_next (&iter)); + bson_iter_decimal128 (&iter, &iter_value); + /* This test uses memcmp because libbson lacks decimal128 comparison. */ + BSON_ASSERT (memcmp (&iter_value, &value, sizeof (value)) == 0); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_iter_overflow (void) +{ + bson_iter_t iter; + bson_t *b; + + b = get_bson (BSON_BINARY_DIR "/overflow1.bson"); + BSON_ASSERT (!b); + + b = get_bson (BSON_BINARY_DIR "/overflow2.bson"); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_destroy (b); +} + + +static void +test_bson_iter_binary_deprecated (void) +{ + bson_subtype_t subtype; + uint32_t binary_len; + const uint8_t *binary; + bson_iter_t iter; + bson_t *b; + + b = get_bson (BSON_BINARY_DIR "/binary_deprecated.bson"); + BSON_ASSERT (b); + + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + bson_iter_binary (&iter, &subtype, &binary_len, &binary); + BSON_ASSERT (binary_len == 4); + BSON_ASSERT (memcmp (binary, "1234", 4) == 0); + + bson_destroy (b); +} + + +static void +test_bson_iter_timeval (void) +{ + bson_iter_t iter; + bson_t *b; + struct timeval tv; + + b = get_bson (BSON_BINARY_DIR "/test26.bson"); + BSON_ASSERT (b); + + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + bson_iter_timeval (&iter, &tv); + BSON_ASSERT (tv.tv_sec == 1234567890); + BSON_ASSERT (tv.tv_usec == 0); + + bson_destroy (b); +} + + +static void +test_bson_iter_trailing_null (void) +{ + bson_iter_t iter; + bson_t *b; + + b = get_bson (BSON_BINARY_DIR "/trailingnull.bson"); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + bson_destroy (b); +} + + +static void +test_bson_iter_fuzz (void) +{ + uint8_t *data; + uint32_t len = 512; + uint32_t len_le; + uint32_t r; + bson_iter_t iter; + bson_t *b; + uint32_t i; + int pass; + + len_le = BSON_UINT32_TO_LE (len); + + for (pass = 0; pass < FUZZ_N_PASSES; pass++) { + data = bson_malloc0 (len); + memcpy (data, &len_le, sizeof (len_le)); + + for (i = 4; i < len; i += 4) { + r = rand (); + memcpy (&data[i], &r, sizeof (r)); + } + + if (!(b = bson_new_from_data (data, len))) { + /* + * It could fail on buffer length or missing trailing null byte. + */ + bson_free (data); + continue; + } + + BSON_ASSERT (b); + + /* + * TODO: Most of the following ignores the key. That should be fixed + * but has it's own perils too. + */ + + BSON_ASSERT (bson_iter_init (&iter, b)); + while (bson_iter_next (&iter)) { + BSON_ASSERT (iter.next_off < len); + switch (bson_iter_type (&iter)) { + case BSON_TYPE_ARRAY: + case BSON_TYPE_DOCUMENT: { + const uint8_t *child = NULL; + uint32_t child_len = 0; + + bson_iter_document (&iter, &child_len, &child); + if (child_len) { + BSON_ASSERT (child); + BSON_ASSERT (child_len >= 5); + BSON_ASSERT ((iter.off + child_len) < b->len); + BSON_ASSERT (child_len < (uint32_t) -1); + memcpy (&child_len, child, sizeof (child_len)); + child_len = BSON_UINT32_FROM_LE (child_len); + BSON_ASSERT (child_len >= 5); + } + } break; + case BSON_TYPE_DOUBLE: + case BSON_TYPE_UTF8: + case BSON_TYPE_BINARY: + case BSON_TYPE_UNDEFINED: + break; + case BSON_TYPE_OID: + BSON_ASSERT (iter.off + 12 < iter.len); + break; + case BSON_TYPE_BOOL: + case BSON_TYPE_DATE_TIME: + case BSON_TYPE_NULL: + case BSON_TYPE_REGEX: + /* TODO: check for 2 valid cstring. */ + case BSON_TYPE_DBPOINTER: + case BSON_TYPE_CODE: + case BSON_TYPE_SYMBOL: + case BSON_TYPE_CODEWSCOPE: + case BSON_TYPE_INT32: + case BSON_TYPE_TIMESTAMP: + case BSON_TYPE_INT64: + case BSON_TYPE_DECIMAL128: + case BSON_TYPE_MAXKEY: + case BSON_TYPE_MINKEY: + break; + case BSON_TYPE_EOD: + default: + /* Code should not be reached. */ + BSON_ASSERT (false); + break; + } + } + + bson_destroy (b); + bson_free (data); + } +} + + +static void +test_bson_iter_regex (void) +{ + bson_iter_t iter; + bson_t *b; + + b = bson_new (); + BSON_ASSERT (bson_append_regex (b, "foo", -1, "^abcd", "")); + BSON_ASSERT (bson_append_regex (b, "foo", -1, "^abcd", NULL)); + BSON_ASSERT (bson_append_regex (b, "foo", -1, "^abcd", "ix")); + + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + BSON_ASSERT (bson_iter_next (&iter)); + + bson_destroy (b); +} + + +static void +test_bson_iter_next_after_finish (void) +{ + bson_iter_t iter; + bson_t *b; + int i; + + b = bson_new (); + BSON_ASSERT (bson_append_int32 (b, "key", -1, 1234)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_next (&iter)); + for (i = 0; i < 1000; i++) { + BSON_ASSERT (!bson_iter_next (&iter)); + } + bson_destroy (b); +} + + +static void +test_bson_iter_find_case (void) +{ + bson_t b; + bson_iter_t iter; + + bson_init (&b); + BSON_ASSERT (bson_append_utf8 (&b, "key", -1, "value", -1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find_case (&iter, "KEY")); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (!bson_iter_find (&iter, "KEY")); + bson_destroy (&b); +} + + +static void +test_bson_iter_find_w_len (void) +{ + bson_t b; + bson_iter_t iter; + + bson_init (&b); + BSON_ASSERT (bson_append_utf8 (&b, "key", -1, "value", -1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find_w_len (&iter, "key", 3)); + bson_destroy (&b); + + bson_init (&b); + BSON_ASSERT (bson_append_utf8 (&b, "key", -1, "value", -1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find_w_len (&iter, "keys", 3)); + bson_destroy (&b); + + bson_init (&b); + BSON_ASSERT (bson_append_utf8 (&b, "key", -1, "value", -1)); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find_w_len (&iter, "key", -1)); + bson_destroy (&b); +} + + +static void +test_bson_iter_init_find_w_len (void) +{ + bson_t b; + bson_iter_t iter; + + bson_init (&b); + BSON_ASSERT (bson_append_utf8 (&b, "key", -1, "value", -1)); + BSON_ASSERT (bson_iter_init_find_w_len (&iter, &b, "key", 3)); + BSON_ASSERT (bson_iter_init_find_w_len (&iter, &b, "keys", 3)); + BSON_ASSERT (bson_iter_init_find_w_len (&iter, &b, "key", -1)); + bson_destroy (&b); +} + + +static void +test_bson_iter_empty_key (void) +{ + /* create a bson document empty keys. */ + bson_t *bson = BCON_NEW ( + "", "{", "x", BCON_INT32 (1), "", "{", "y", BCON_INT32 (2), "}", "}"); + bson_iter_t iter; + bson_iter_t descendant; + + BSON_ASSERT (bson_iter_init_find (&iter, bson, "")); + BSON_ASSERT (bson_iter_init_find_case (&iter, bson, "")); + BSON_ASSERT (BSON_ITER_HOLDS_DOCUMENT (&iter)); + /* tests fixes applied in CDRIVER-2755. */ + /* a find_w_len and length 0 should also find the key. */ + BSON_ASSERT (bson_iter_init_find_w_len (&iter, bson, "", 0)); + BSON_ASSERT (BSON_ITER_HOLDS_DOCUMENT (&iter)); + /* similarly, we should descend on an empty key. */ + bson_iter_init (&iter, bson); + BSON_ASSERT (bson_iter_find_descendant (&iter, ".x", &descendant)); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&descendant)); + ASSERT_CMPINT (bson_iter_int32 (&descendant), ==, 1); + bson_iter_init (&iter, bson); + BSON_ASSERT (bson_iter_find_descendant (&iter, "..y", &descendant)); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&descendant)); + ASSERT_CMPINT (bson_iter_int32 (&descendant), ==, 2); + bson_destroy (bson); +} + + +static void +test_bson_iter_as_double (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + ASSERT (bson_append_double (&b, "key", -1, 1234.1234)); + ASSERT (bson_iter_init_find (&iter, &b, "key")); + ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + ASSERT (bson_iter_as_double (&iter) == 1234.1234); + bson_destroy (&b); + + bson_init (&b); + ASSERT (bson_append_int32 (&b, "key", -1, 1234)); + ASSERT (bson_iter_init_find (&iter, &b, "key")); + ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + ASSERT (bson_iter_as_double (&iter) == 1234.0); + bson_destroy (&b); + + bson_init (&b); + ASSERT (bson_append_int64 (&b, "key", -1, 4321)); + ASSERT (bson_iter_init_find (&iter, &b, "key")); + ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT (bson_iter_as_double (&iter) == 4321.0); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_int32 (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + BSON_ASSERT (bson_append_int32 (&b, "key", -1, 1234)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + bson_iter_overwrite_int32 (&iter, 4321); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + ASSERT_CMPINT (bson_iter_int32 (&iter), ==, 4321); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_int64 (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + BSON_ASSERT (bson_append_int64 (&b, "key", -1, 1234)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + bson_iter_overwrite_int64 (&iter, 4641); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) 4641); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_decimal128 (void) +{ + bson_iter_t iter; + bson_t b; + bson_decimal128_t value; + bson_decimal128_t new_value; + bson_decimal128_t iter_value; + + value.high = 0; + value.low = 1; + + new_value.high = 0; + new_value.low = 2; + + bson_init (&b); + BSON_ASSERT (bson_append_decimal128 (&b, "key", -1, &value)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_DECIMAL128 (&iter)); + bson_iter_overwrite_decimal128 (&iter, &new_value); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_DECIMAL128 (&iter)); + BSON_ASSERT (bson_iter_decimal128 (&iter, &iter_value)); + BSON_ASSERT (memcmp (&iter_value, &new_value, sizeof (new_value)) == 0); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_double (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + BSON_ASSERT (bson_append_double (&b, "key", -1, 1234.1234)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + bson_iter_overwrite_double (&iter, 4641.1234); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + ASSERT_CMPDOUBLE (bson_iter_double (&iter), ==, 4641.1234); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_bool (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + BSON_ASSERT (bson_append_bool (&b, "key", -1, true)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_BOOL (&iter)); + bson_iter_overwrite_bool (&iter, false); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_BOOL (&iter)); + ASSERT_CMPINT (bson_iter_bool (&iter), ==, false); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_oid (void) +{ + bson_oid_t oid; + bson_iter_t iter; + bson_t b; + + bson_oid_init_from_string (&oid, "000000000000000000001234"); + bson_init (&b); + BSON_ASSERT (BSON_APPEND_OID (&b, "key", &oid)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + bson_oid_init_from_string (&oid, "000000000000000000004321"); + bson_iter_overwrite_oid (&iter, &oid); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + ASSERT_CMPOID (bson_iter_oid (&iter), &oid); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_timestamp (void) +{ + bson_iter_t iter; + bson_t b; + uint32_t t, i; + + bson_init (&b); + BSON_ASSERT (BSON_APPEND_TIMESTAMP (&b, "key", 1, 2)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + bson_iter_overwrite_timestamp (&iter, 3, 4); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + bson_iter_timestamp (&iter, &t, &i); + ASSERT_CMPUINT32 (t, ==, 3); + ASSERT_CMPUINT32 (i, ==, 4); + bson_destroy (&b); +} + + +static void +test_bson_iter_overwrite_date_time (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + BSON_ASSERT (BSON_APPEND_DATE_TIME (&b, "key", 1234567890)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + bson_iter_overwrite_date_time (&iter, -1234567890); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + ASSERT_CMPINT64 (bson_iter_date_time (&iter), ==, -1234567890); + bson_destroy (&b); +} + + +static void +test_bson_iter_recurse (void) +{ + bson_iter_t iter; + bson_iter_t child; + bson_t b; + bson_t cb; + + bson_init (&b); + bson_init (&cb); + BSON_ASSERT (bson_append_int32 (&cb, "0", 1, 0)); + BSON_ASSERT (bson_append_int32 (&cb, "1", 1, 1)); + BSON_ASSERT (bson_append_int32 (&cb, "2", 1, 2)); + BSON_ASSERT (bson_append_array (&b, "key", -1, &cb)); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_ARRAY (&iter)); + BSON_ASSERT (bson_iter_recurse (&iter, &child)); + BSON_ASSERT (bson_iter_find (&child, "0")); + BSON_ASSERT (bson_iter_find (&child, "1")); + BSON_ASSERT (bson_iter_find (&child, "2")); + BSON_ASSERT (!bson_iter_next (&child)); + bson_destroy (&b); + bson_destroy (&cb); +} + + +static void +test_bson_iter_init_find_case (void) +{ + bson_t b; + bson_iter_t iter; + + bson_init (&b); + BSON_ASSERT (bson_append_int32 (&b, "FOO", -1, 1234)); + BSON_ASSERT (bson_iter_init_find_case (&iter, &b, "foo")); + ASSERT_CMPINT (bson_iter_int32 (&iter), ==, 1234); + bson_destroy (&b); +} + + +static void +test_bson_iter_find_descendant (void) +{ + bson_iter_t iter; + bson_iter_t desc; + bson_t *b; + + b = get_bson (BSON_BINARY_DIR "/dotkey.bson"); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_find_descendant (&iter, "a.b.c.0", &desc)); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&desc)); + BSON_ASSERT (bson_iter_int32 (&desc) == 1); + bson_destroy (b); + + b = BCON_NEW ( + "foo", "{", "bar", "[", "{", "baz", BCON_INT32 (1), "}", "]", "}"); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_find_descendant (&iter, "foo.bar.0.baz", &desc)); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&desc)); + BSON_ASSERT (bson_iter_int32 (&desc) == 1); + bson_destroy (b); + + b = BCON_NEW ("nModified", BCON_INT32 (1), "n", BCON_INT32 (2)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_find_descendant (&iter, "n", &desc)); + BSON_ASSERT (!strcmp (bson_iter_key (&desc), "n")); + bson_destroy (b); + + b = BCON_NEW ("", BCON_INT32 (1), "n", BCON_INT32 (2)); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (bson_iter_find_descendant (&iter, "n", &desc)); + BSON_ASSERT (!strcmp (bson_iter_key (&desc), "n")); + bson_destroy (b); +} + + +static void +test_bson_iter_as_bool (void) +{ + bson_iter_t iter; + bson_t b; + + bson_init (&b); + bson_append_int32 (&b, "int32[true]", -1, 1); + bson_append_int32 (&b, "int32[false]", -1, 0); + bson_append_int64 (&b, "int64[true]", -1, 1); + bson_append_int64 (&b, "int64[false]", -1, 0); + bson_append_double (&b, "int64[true]", -1, 1.0); + bson_append_double (&b, "int64[false]", -1, 0.0); + + bson_iter_init (&iter, &b); + bson_iter_next (&iter); + ASSERT_CMPINT (true, ==, bson_iter_as_bool (&iter)); + bson_iter_next (&iter); + ASSERT_CMPINT (false, ==, bson_iter_as_bool (&iter)); + bson_iter_next (&iter); + ASSERT_CMPINT (true, ==, bson_iter_as_bool (&iter)); + bson_iter_next (&iter); + ASSERT_CMPINT (false, ==, bson_iter_as_bool (&iter)); + bson_iter_next (&iter); + ASSERT_CMPINT (true, ==, bson_iter_as_bool (&iter)); + bson_iter_next (&iter); + ASSERT_CMPINT (false, ==, bson_iter_as_bool (&iter)); + + bson_destroy (&b); +} + +static void +test_bson_iter_from_data (void) +{ + /* {"b": true}, with implicit NULL at end */ + uint8_t data[] = "\x09\x00\x00\x00\x08\x62\x00\x01"; + bson_iter_t iter; + + ASSERT (bson_iter_init_from_data (&iter, data, sizeof data)); + ASSERT (bson_iter_next (&iter)); + ASSERT (BSON_ITER_HOLDS_BOOL (&iter)); + ASSERT (bson_iter_bool (&iter)); +} + +void +test_iter_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/iter/test_string", test_bson_iter_utf8); + TestSuite_Add (suite, "/bson/iter/test_mixed", test_bson_iter_mixed); + TestSuite_Add (suite, "/bson/iter/test_overflow", test_bson_iter_overflow); + TestSuite_Add (suite, "/bson/iter/test_timeval", test_bson_iter_timeval); + TestSuite_Add ( + suite, "/bson/iter/test_trailing_null", test_bson_iter_trailing_null); + TestSuite_Add (suite, "/bson/iter/test_fuzz", test_bson_iter_fuzz); + TestSuite_Add (suite, "/bson/iter/test_regex", test_bson_iter_regex); + TestSuite_Add (suite, + "/bson/iter/test_next_after_finish", + test_bson_iter_next_after_finish); + TestSuite_Add (suite, "/bson/iter/test_find_case", test_bson_iter_find_case); + TestSuite_Add ( + suite, "/bson/iter/test_find_w_len", test_bson_iter_find_w_len); + TestSuite_Add ( + suite, "/bson/iter/test_init_find_w_len", test_bson_iter_init_find_w_len); + TestSuite_Add ( + suite, "/bson/iter/test_bson_iter_as_double", test_bson_iter_as_double); + TestSuite_Add ( + suite, "/bson/iter/test_overwrite_int32", test_bson_iter_overwrite_int32); + TestSuite_Add ( + suite, "/bson/iter/test_overwrite_int64", test_bson_iter_overwrite_int64); + TestSuite_Add (suite, + "/bson/iter/test_overwrite_double", + test_bson_iter_overwrite_double); + TestSuite_Add ( + suite, "/bson/iter/test_overwrite_bool", test_bson_iter_overwrite_bool); + TestSuite_Add ( + suite, "/bson/iter/test_overwrite_oid", test_bson_iter_overwrite_oid); + TestSuite_Add (suite, + "/bson/iter/test_overwrite_timestamp", + test_bson_iter_overwrite_timestamp); + TestSuite_Add (suite, + "/bson/iter/test_overwrite_date_time", + test_bson_iter_overwrite_date_time); + TestSuite_Add (suite, + "/bson/iter/test_bson_iter_overwrite_decimal128", + test_bson_iter_overwrite_decimal128); + TestSuite_Add (suite, "/bson/iter/recurse", test_bson_iter_recurse); + TestSuite_Add ( + suite, "/bson/iter/init_find_case", test_bson_iter_init_find_case); + TestSuite_Add ( + suite, "/bson/iter/find_descendant", test_bson_iter_find_descendant); + TestSuite_Add (suite, "/bson/iter/as_bool", test_bson_iter_as_bool); + TestSuite_Add ( + suite, "/bson/iter/binary_deprecated", test_bson_iter_binary_deprecated); + TestSuite_Add (suite, "/bson/iter/from_data", test_bson_iter_from_data); + TestSuite_Add (suite, "/bson/iter/empty_key", test_bson_iter_empty_key); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-json.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-json.c new file mode 100644 index 0000000..9c63404 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-json.c @@ -0,0 +1,2949 @@ +/* required on old Windows for rand_s to be defined */ +#define _CRT_RAND_S + +#include +#include + +#include "TestSuite.h" +#include "test-conveniences.h" + +static ssize_t +test_bson_json_read_cb_helper (void *string, uint8_t *buf, size_t len) +{ + size_t str_size = strlen ((char *) string); + if (str_size) { + memcpy (buf, string, BSON_MIN (str_size, len)); + return str_size; + } else { + return 0; + } +} + +static void +test_bson_json_allow_multiple (void) +{ + int32_t one; + bson_error_t error; + bson_json_reader_t *reader; + bson_t bson; + const char *collection; + const bson_oid_t *oid; + bson_oid_t oid_expected; + int i; + /* nested JSON tests code that reuses parser stack frames, CDRIVER-2524 */ + char *multiple_json = + "{\"a\": 1}" + "{\"b\": {\"$dbPointer\": " + " {\"$ref\": \"c\", \"$id\": {\"$oid\": \"12341234123412abcdababcd\"}}}}" + "{\"c\": {\"x\": 1}}"; + + bson_oid_init_from_string (&oid_expected, "12341234123412abcdababcd"); + + for (i = 0; i < 2; i++) { + reader = bson_json_reader_new (multiple_json, + &test_bson_json_read_cb_helper, + NULL, + i == 1 /* allow_multiple */, + 0); + + BSON_ASSERT (reader); + + /* read first json */ + bson_init (&bson); + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + BCON_EXTRACT (&bson, "a", BCONE_INT32 (one)); + ASSERT_CMPINT (1, ==, one); + + /* read second json */ + bson_reinit (&bson); + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + BCON_EXTRACT (&bson, "b", BCONE_DBPOINTER (collection, oid)); + ASSERT_CMPSTR (collection, "c"); + BSON_ASSERT (0 == bson_oid_compare (oid, &oid_expected)); + + /* read third json */ + bson_reinit (&bson); + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + BCON_EXTRACT (&bson, "c", BCONE_INT32 (one)); + ASSERT_CMPINT (1, ==, one); + + /* surprisingly, the reader begins at the start of the string again */ + bson_reinit (&bson); + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + BCON_EXTRACT (&bson, "a", BCONE_INT32 (one)); + ASSERT_CMPINT (1, ==, one); + + bson_json_reader_destroy (reader); + bson_destroy (&bson); + } +} + + +static void +test_bson_as_json_x1000 (void) +{ + bson_oid_t oid; + bson_decimal128_t decimal128; + bson_t *b; + bson_t *b2; + char *str; + size_t len; + int i; + + decimal128.high = 0x3040000000000000ULL; + decimal128.low = 0x000000000000000B; + bson_oid_init_from_string (&oid, "123412341234abcdabcdabcd"); + + b = bson_new (); + BSON_ASSERT (bson_append_utf8 (b, "utf8", -1, "bar", -1)); + BSON_ASSERT (bson_append_int32 (b, "int32", -1, 1234)); + BSON_ASSERT (bson_append_int64 (b, "int64", -1, 4321)); + BSON_ASSERT (bson_append_double (b, "double", -1, 123.4)); + BSON_ASSERT (bson_append_undefined (b, "undefined", -1)); + BSON_ASSERT (bson_append_null (b, "null", -1)); + BSON_ASSERT (bson_append_oid (b, "oid", -1, &oid)); + BSON_ASSERT (bson_append_bool (b, "true", -1, true)); + BSON_ASSERT (bson_append_bool (b, "false", -1, false)); + BSON_ASSERT (bson_append_time_t (b, "date", -1, time (NULL))); + BSON_ASSERT ( + bson_append_timestamp (b, "timestamp", -1, (uint32_t) time (NULL), 1234)); + BSON_ASSERT (bson_append_regex (b, "regex", -1, "^abcd", "xi")); + BSON_ASSERT ( + bson_append_dbpointer (b, "dbpointer", -1, "mycollection", &oid)); + BSON_ASSERT (bson_append_minkey (b, "minkey", -1)); + BSON_ASSERT (bson_append_maxkey (b, "maxkey", -1)); + BSON_ASSERT (bson_append_symbol (b, "symbol", -1, "var a = {};", -1)); + BSON_ASSERT (bson_append_decimal128 (b, "decimal128", -1, &decimal128)); + + b2 = bson_new (); + BSON_ASSERT (bson_append_int32 (b2, "0", -1, 60)); + BSON_ASSERT (bson_append_document (b, "document", -1, b2)); + BSON_ASSERT (bson_append_array (b, "array", -1, b2)); + + { + const uint8_t binary[] = {0, 1, 2, 3, 4}; + BSON_ASSERT (bson_append_binary ( + b, "binary", -1, BSON_SUBTYPE_BINARY, binary, sizeof binary)); + } + + for (i = 0; i < 1000; i++) { + str = bson_as_json (b, &len); + bson_free (str); + } + + bson_destroy (b); + bson_destroy (b2); +} + + +static void +test_bson_as_json_multi (void) +{ + bson_t *b; + char *str; + size_t len; + + b = bson_new (); + + { + bson_oid_t oid; + bson_oid_init_from_string (&oid, "57e193d7a9cc81b4027498b5"); + BSON_ASSERT (bson_append_oid (b, "_id", -1, &oid)); + } + + BSON_ASSERT (bson_append_symbol (b, "Symbol", -1, "symbol", -1)); + BSON_ASSERT (bson_append_utf8 (b, "String", -1, "string", -1)); + BSON_ASSERT (bson_append_int32 (b, "Int32", -1, 42)); + BSON_ASSERT (bson_append_int64 (b, "Int64", -1, 42)); + BSON_ASSERT (bson_append_double (b, "Double", -1, -1.0)); + + { + const uint8_t binary[] = {0xa3, + 0x4c, + 0x38, + 0xf7, + 0xc3, + 0xab, + 0xed, + 0xc8, + 0xa3, + 0x78, + 0x14, + 0xa9, + 0x92, + 0xab, + 0x8d, + 0xb6}; + BSON_ASSERT (bson_append_binary ( + b, "Binary", -1, BSON_SUBTYPE_UUID_DEPRECATED, binary, sizeof binary)); + } + + { + const uint8_t binary[] = {1, 2, 3, 4, 5}; + BSON_ASSERT (bson_append_binary ( + b, "BinaryUserDefined", -1, BSON_SUBTYPE_USER, binary, sizeof binary)); + } + + BSON_ASSERT (bson_append_code (b, "Code", -1, "function() {}")); + + { + bson_t *scope = bson_new (); + BSON_ASSERT (bson_append_code_with_scope ( + b, "CodeWithScope", -1, "function() {}", scope)); + bson_destroy (scope); + } + + { + bson_t *document = bson_new (); + BSON_ASSERT (bson_append_utf8 (document, "foo", -1, "bar", -1)); + BSON_ASSERT (bson_append_document (b, "Subdocument", -1, document)); + bson_destroy (document); + } + + { + bson_t *array = bson_new (); + BSON_ASSERT (bson_append_int32 (array, "0", -1, 1)); + BSON_ASSERT (bson_append_int32 (array, "1", -1, 2)); + BSON_ASSERT (bson_append_int32 (array, "2", -1, 3)); + BSON_ASSERT (bson_append_int32 (array, "3", -1, 4)); + BSON_ASSERT (bson_append_int32 (array, "4", -1, 5)); + BSON_ASSERT (bson_append_array (b, "Array", -1, array)); + bson_destroy (array); + } + + BSON_ASSERT (bson_append_timestamp (b, "Timestamp", -1, 42, 1)); + BSON_ASSERT (bson_append_regex (b, "Regex", -1, "pattern", "")); + BSON_ASSERT (bson_append_date_time (b, "DatetimeEpoch", -1, 0)); + BSON_ASSERT (bson_append_date_time ( + b, "DatetimePositive", -1, (int64_t) 2147483647LL)); + BSON_ASSERT (bson_append_date_time ( + b, "DatetimeNegative", -1, (int64_t) -2147483648LL)); + BSON_ASSERT (bson_append_bool (b, "True", -1, true)); + BSON_ASSERT (bson_append_bool (b, "False", -1, false)); + + { + bson_oid_t oid; + bson_oid_init_from_string (&oid, "57e193d7a9cc81b4027498b1"); + BSON_ASSERT ( + bson_append_dbpointer (b, "DBPointer", -1, "collection", &oid)); + } + + { + bson_oid_t oid; + bson_t *dbref = bson_new (); + bson_oid_init_from_string (&oid, "57fd71e96e32ab4225b723fb"); + BSON_ASSERT (bson_append_utf8 (dbref, "$ref", -1, "collection", -1)); + BSON_ASSERT (bson_append_oid (dbref, "$id", -1, &oid)); + BSON_ASSERT (bson_append_utf8 (dbref, "$db", -1, "database", -1)); + BSON_ASSERT (bson_append_document (b, "DBRef", -1, dbref)); + bson_destroy (dbref); + } + + BSON_ASSERT (bson_append_minkey (b, "Minkey", -1)); + BSON_ASSERT (bson_append_maxkey (b, "Maxkey", -1)); + BSON_ASSERT (bson_append_null (b, "Null", -1)); + BSON_ASSERT (bson_append_undefined (b, "Undefined", -1)); + + { + bson_decimal128_t decimal128; + decimal128.high = 0x3040000000000000ULL; + decimal128.low = 0x000000000000000B; + BSON_ASSERT (bson_append_decimal128 (b, "Decimal128", -1, &decimal128)); + } + + str = bson_as_json (b, &len); + + /* Based on multi-type-deprecated.json from BSON Corpus Tests. */ + ASSERT_CMPSTR ( + str, + "{" + " \"_id\" : { \"$oid\" : \"57e193d7a9cc81b4027498b5\" }," + " \"Symbol\" : \"symbol\"," + " \"String\" : \"string\"," + " \"Int32\" : 42," + " \"Int64\" : 42," + " \"Double\" : -1.0," + " \"Binary\" : { \"$binary\" : \"o0w498Or7cijeBSpkquNtg==\", \"$type\" : " + "\"03\" }," + " \"BinaryUserDefined\" : { \"$binary\" : \"AQIDBAU=\", \"$type\" : " + "\"80\" }," + " \"Code\" : { \"$code\" : \"function() {}\" }," + " \"CodeWithScope\" : { \"$code\" : \"function() {}\", \"$scope\" : { } " + "}," + " \"Subdocument\" : { \"foo\" : \"bar\" }," + " \"Array\" : [ 1, 2, 3, 4, 5 ]," + " \"Timestamp\" : { \"$timestamp\" : { \"t\" : 42, \"i\" : 1 } }," + " \"Regex\" : { \"$regex\" : \"pattern\", \"$options\" : \"\" }," + " \"DatetimeEpoch\" : { \"$date\" : 0 }," + " \"DatetimePositive\" : { \"$date\" : 2147483647 }," + " \"DatetimeNegative\" : { \"$date\" : -2147483648 }," + " \"True\" : true," + " \"False\" : false," + " \"DBPointer\" : { \"$ref\" : \"collection\", \"$id\" : " + "\"57e193d7a9cc81b4027498b1\" }," + " \"DBRef\" : { \"$ref\" : \"collection\", \"$id\" : { \"$oid\" : " + "\"57fd71e96e32ab4225b723fb\" }, \"$db\" : \"database\" }," + " \"Minkey\" : { \"$minKey\" : 1 }," + " \"Maxkey\" : { \"$maxKey\" : 1 }," + " \"Null\" : null," + " \"Undefined\" : { \"$undefined\" : true }," + " \"Decimal128\" : { \"$numberDecimal\" : \"11\" } }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_string (void) +{ + size_t len; + bson_t *b; + char *str; + + b = bson_new (); + BSON_ASSERT (bson_append_utf8 (b, "foo", -1, "bar", -1)); + str = bson_as_json (b, &len); + BSON_ASSERT (len == 17); + BSON_ASSERT (!strcmp ("{ \"foo\" : \"bar\" }", str)); + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_int32 (void) +{ + size_t len; + bson_t *b; + char *str; + + b = bson_new (); + BSON_ASSERT (bson_append_int32 (b, "foo", -1, 1234)); + str = bson_as_json (b, &len); + BSON_ASSERT (len == 16); + BSON_ASSERT (!strcmp ("{ \"foo\" : 1234 }", str)); + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_int64 (void) +{ + size_t len; + bson_t *b; + char *str; + + b = bson_new (); + BSON_ASSERT (bson_append_int64 (b, "foo", -1, 341234123412341234ULL)); + str = bson_as_json (b, &len); + BSON_ASSERT (len == 30); + BSON_ASSERT (!strcmp ("{ \"foo\" : 341234123412341234 }", str)); + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_double (void) +{ + size_t len; + bson_t *b; + char *str; + char *expected; + + b = bson_new (); + BSON_ASSERT (bson_append_double (b, "foo", -1, 123.5)); + BSON_ASSERT (bson_append_double (b, "bar", -1, 3)); + BSON_ASSERT (bson_append_double (b, "baz", -1, -1)); + BSON_ASSERT (bson_append_double (b, "quux", -1, 0.03125)); + BSON_ASSERT (bson_append_double (b, "huge", -1, 1e99)); + str = bson_as_json (b, &len); + + expected = bson_strdup_printf ("{" + " \"foo\" : 123.5," + " \"bar\" : 3.0," + " \"baz\" : -1.0," + " \"quux\" : 0.03125," + " \"huge\" : %.20g }", + 1e99); + + ASSERT_CMPSTR (str, expected); + + bson_free (expected); + bson_free (str); + bson_destroy (b); +} + + +#if defined(NAN) && defined(INFINITY) +static void +test_bson_as_json_double_nonfinite (void) +{ + size_t len; + bson_t *b; + char *str; + char *expected; + + b = bson_new (); + BSON_ASSERT (bson_append_double (b, "nan", -1, NAN)); + BSON_ASSERT (bson_append_double (b, "pos_inf", -1, INFINITY)); + BSON_ASSERT (bson_append_double (b, "neg_inf", -1, -INFINITY)); + str = bson_as_json (b, &len); + + expected = bson_strdup_printf ("{" + " \"nan\" : %.20g," + " \"pos_inf\" : %.20g," + " \"neg_inf\" : %.20g }", + NAN, + INFINITY, + -INFINITY); + + ASSERT_CMPSTR (str, expected); + + bson_free (expected); + bson_free (str); + bson_destroy (b); +} +#endif + + +static void +test_bson_as_json_decimal128 (void) +{ + size_t len; + bson_t *b; + char *str; + bson_decimal128_t decimal128; + decimal128.high = 0x3040000000000000ULL; + decimal128.low = 0x000000000000000B; + + b = bson_new (); + BSON_ASSERT (bson_append_decimal128 (b, "decimal128", -1, &decimal128)); + str = bson_as_json (b, &len); + ASSERT_CMPSTR (str, + "{ " + "\"decimal128\" : { \"$numberDecimal\" : \"11\" }" + " }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_code (void) +{ + bson_t code = BSON_INITIALIZER; + bson_t scope = BSON_INITIALIZER; + char *str; + + BSON_ASSERT (bson_append_code (&code, "c", -1, "function () {}")); + str = bson_as_json (&code, NULL); + ASSERT_CMPSTR (str, "{ \"c\" : { \"$code\" : \"function () {}\" } }"); + + bson_free (str); + bson_reinit (&code); + + /* empty scope */ + BSON_ASSERT ( + BSON_APPEND_CODE_WITH_SCOPE (&code, "c", "function () {}", &scope)); + str = bson_as_json (&code, NULL); + ASSERT_CMPSTR ( + str, "{ \"c\" : { \"$code\" : \"function () {}\", \"$scope\" : { } } }"); + + bson_free (str); + bson_reinit (&code); + + BSON_APPEND_INT32 (&scope, "x", 1); + BSON_ASSERT ( + BSON_APPEND_CODE_WITH_SCOPE (&code, "c", "function () {}", &scope)); + str = bson_as_json (&code, NULL); + ASSERT_CMPSTR (str, + "{ \"c\" : { \"$code\" : \"function () {}\", \"$scope\" " + ": { \"x\" : 1 } } }"); + + bson_free (str); + bson_reinit (&code); + + /* test that embedded quotes are backslash-escaped */ + BSON_ASSERT (BSON_APPEND_CODE (&code, "c", "return \"a\"")); + str = bson_as_json (&code, NULL); + + /* hard to read, this is { "c" : { "$code" : "return \"a\"" } } */ + ASSERT_CMPSTR (str, "{ \"c\" : { \"$code\" : \"return \\\"a\\\"\" } }"); + + bson_free (str); + bson_destroy (&code); + bson_destroy (&scope); +} + + +static void +test_bson_as_json_date_time (void) +{ + bson_t *b; + char *str; + size_t len; + + b = bson_new (); + BSON_ASSERT (bson_append_date_time (b, "epoch", -1, 0)); + BSON_ASSERT (bson_append_date_time (b, "negative", -1, -123456000)); + BSON_ASSERT (bson_append_date_time (b, "positive", -1, 123456000)); + str = bson_as_json (b, &len); + + ASSERT_CMPSTR (str, + "{" + " \"epoch\" : { \"$date\" : 0 }," + " \"negative\" : { \"$date\" : -123456000 }," + " \"positive\" : { \"$date\" : 123456000 } }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_regex (void) +{ + bson_t *b; + char *str; + size_t len; + + b = bson_new (); + BSON_ASSERT (bson_append_regex (b, "regex", -1, "^abcd", "xi")); + BSON_ASSERT (bson_append_regex (b, "escaping", -1, "^\"", "")); + BSON_ASSERT (bson_append_regex (b, "ordered", -1, "^abcd", "ilmsux")); + BSON_ASSERT (bson_append_regex (b, "unordered", -1, "^abcd", "xusmli")); + BSON_ASSERT (bson_append_regex (b, "duplicate", -1, "^abcd", "mmiii")); + BSON_ASSERT (bson_append_regex (b, "unsupported", -1, "^abcd", "jkmlvz")); + str = bson_as_json (b, &len); + + ASSERT_CMPSTR (str, + "{" + " \"regex\" : { \"$regex\" : \"^abcd\", \"$options\" " + ": \"ix\" }," + " \"escaping\" : { \"$regex\" : \"^\\\"\", \"$options\" " + ": \"\" }," + " \"ordered\" : { \"$regex\" : \"^abcd\", \"$options\" " + ": \"ilmsux\" }," + " \"unordered\" : { \"$regex\" : \"^abcd\", \"$options\" " + ": \"ilmsux\" }," + " \"duplicate\" : { \"$regex\" : \"^abcd\", \"$options\" " + ": \"im\" }," + " \"unsupported\" : { \"$regex\" : \"^abcd\", \"$options\" " + ": \"lm\" } }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_symbol (void) +{ + bson_t *b; + char *str; + size_t len; + + b = bson_new (); + BSON_ASSERT (bson_append_symbol (b, "symbol", -1, "foo", -1)); + BSON_ASSERT (bson_append_symbol (b, "escaping", -1, "\"bar\"", -1)); + str = bson_as_json (b, &len); + + ASSERT_CMPSTR (str, + "{" + " \"symbol\" : \"foo\"," + " \"escaping\" : \"\\\"bar\\\"\" }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_utf8 (void) +{ +/* euro currency symbol */ +#define EU "\xe2\x82\xac" +#define FIVE_EUROS EU EU EU EU EU + size_t len; + bson_t *b; + char *str; + + b = bson_new (); + BSON_ASSERT (bson_append_utf8 (b, FIVE_EUROS, -1, FIVE_EUROS, -1)); + str = bson_as_json (b, &len); + BSON_ASSERT (!strcmp (str, "{ \"" FIVE_EUROS "\" : \"" FIVE_EUROS "\" }")); + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_json_dbpointer (void) +{ + bson_oid_t oid; + bson_t *b; + char *str; + size_t len; + + bson_oid_init_from_string (&oid, "12341234123412abcdababcd"); + + b = bson_new (); + BSON_ASSERT (bson_append_dbpointer (b, "dbpointer", -1, "collection", &oid)); + BSON_ASSERT (bson_append_dbpointer (b, "escaping", -1, "\"coll\"", &oid)); + str = bson_as_json (b, &len); + + ASSERT_CMPSTR (str, + "{" + " \"dbpointer\" : { \"$ref\" : \"collection\", \"$id\" " + ": \"12341234123412abcdababcd\" }," + " \"escaping\" : { \"$ref\" : \"\\\"coll\\\"\", \"$id\" " + ": \"12341234123412abcdababcd\" } }"); + + bson_free (str); + bson_destroy (b); +} + + +static void +test_bson_as_canonical_extended_json_dbpointer (void) +{ + bson_oid_t oid; + bson_t *b; + size_t len; + char *str; + + bson_oid_init_from_string (&oid, "12341234123412abcdababcd"); + b = bson_new (); + BSON_ASSERT (BSON_APPEND_DBPOINTER (b, "p", "coll", &oid)); + str = bson_as_canonical_extended_json (b, &len); + ASSERT_CMPJSON (str, + "{ \"p\" : { \"$dbPointer\" : { \"$ref\" : " + "\"coll\", \"$id\" : { \"$oid\" : " + "\"12341234123412abcdababcd\" } } } }"); + + bson_destroy (b); +} + + +static void +test_bson_as_json_stack_overflow (void) +{ + uint8_t *buf; + bson_t b; + size_t buflen = 1024 * 1024 * 17; + char *str; + int fd; + ssize_t r; + + buf = bson_malloc0 (buflen); + + fd = bson_open (BSON_BINARY_DIR "/stackoverflow.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + r = bson_read (fd, buf, buflen); + BSON_ASSERT (r == 16777220); + + r = bson_init_static (&b, buf, 16777220); + BSON_ASSERT (r); + + str = bson_as_json (&b, NULL); + BSON_ASSERT (str); + + r = !!strstr (str, "..."); + BSON_ASSERT (r); + + bson_free (str); + bson_destroy (&b); + bson_free (buf); +} + + +static void +test_bson_corrupt (void) +{ + uint8_t *buf; + bson_t b; + size_t buflen = 1024; + char *str; + int fd; + ssize_t r; + + buf = bson_malloc0 (buflen); + + fd = bson_open (BSON_BINARY_DIR "/test55.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + r = bson_read (fd, buf, buflen); + BSON_ASSERT (r == 24); + + r = bson_init_static (&b, buf, (uint32_t) r); + BSON_ASSERT (r); + + str = bson_as_json (&b, NULL); + BSON_ASSERT (!str); + + bson_destroy (&b); + bson_free (buf); +} + +static void +test_bson_corrupt_utf8 (void) +{ + uint8_t *buf; + bson_t b; + size_t buflen = 1024; + char *str; + int fd; + ssize_t r; + + buf = bson_malloc0 (buflen); + + fd = bson_open (BSON_BINARY_DIR "/test56.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + r = bson_read (fd, buf, buflen); + BSON_ASSERT (r == 42); + + r = bson_init_static (&b, buf, (uint32_t) r); + BSON_ASSERT (r); + + str = bson_as_json (&b, NULL); + BSON_ASSERT (!str); + + bson_destroy (&b); + bson_free (buf); +} + +static void +test_bson_corrupt_binary (void) +{ + uint8_t *buf; + bson_t b; + size_t buflen = 1024; + char *str; + int fd; + ssize_t r; + + buf = bson_malloc0 (buflen); + + fd = bson_open (BSON_BINARY_DIR "/test57.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + r = bson_read (fd, buf, buflen); + BSON_ASSERT (r == 26); + + r = bson_init_static (&b, buf, (uint32_t) r); + BSON_ASSERT (r); + + str = bson_as_json (&b, NULL); + BSON_ASSERT (!str); + + bson_destroy (&b); + bson_free (buf); +} + +#ifndef BSON_HAVE_RAND_R +static int +rand_r (unsigned int *seed) +{ + srand (*seed); + return rand (); +} +#endif + +#ifdef _WIN32 +#define RAND_R rand_s +#else +#define RAND_R rand_r +#endif + +static char * +rand_str (size_t maxlen, + unsigned int *seed /* IN / OUT */, + char *buf /* IN / OUT */) +{ + size_t len = RAND_R (seed) % (maxlen - 1); + size_t i; + + for (i = 0; i < len; i++) { + buf[i] = (char) ('a' + i % 26); + } + + buf[len] = '\0'; + return buf; +} + +/* test with random buffer sizes to ensure we parse whole keys and values when + * reads pause and resume in the middle of tokens */ +static void +test_bson_json_read_buffering (void) +{ + bson_t **bsons; + char *json_tmp; + bson_string_t *json; + bson_error_t error; + bson_t bson_out = BSON_INITIALIZER; + int i; + unsigned int seed = 42; + int n_docs, docs_idx; + int n_elems, elem_idx; + char key[25]; + char val[25]; + bson_json_reader_t *reader; + int r; + + json = bson_string_new (NULL); + + /* parse between 1 and 10 JSON objects */ + for (n_docs = 1; n_docs < 10; n_docs++) { + /* do 50 trials */ + for (i = 0; i < 50; i++) { + bsons = bson_malloc (n_docs * sizeof (bson_t *)); + for (docs_idx = 0; docs_idx < n_docs; docs_idx++) { + /* a BSON document with up to 10 strings and numbers */ + bsons[docs_idx] = bson_new (); + n_elems = RAND_R (&seed) % 5; + for (elem_idx = 0; elem_idx < n_elems; elem_idx++) { + bson_append_utf8 (bsons[docs_idx], + rand_str (sizeof key, &seed, key), + -1, + rand_str (sizeof val, &seed, val), + -1); + + bson_append_int32 (bsons[docs_idx], + rand_str (sizeof key, &seed, key), + -1, + RAND_R (&seed) % INT32_MAX); + } + + /* append the BSON document's JSON representation to "json" */ + json_tmp = bson_as_json (bsons[docs_idx], NULL); + BSON_ASSERT (json_tmp); + bson_string_append (json, json_tmp); + bson_free (json_tmp); + } + + reader = bson_json_data_reader_new ( + true /* "allow_multiple" is unused */, + (size_t) RAND_R (&seed) % 100 /* bufsize*/); + + bson_json_data_reader_ingest ( + reader, (uint8_t *) json->str, json->len); + + for (docs_idx = 0; docs_idx < n_docs; docs_idx++) { + bson_reinit (&bson_out); + r = bson_json_reader_read (reader, &bson_out, &error); + if (r == -1) { + fprintf (stderr, "%s\n", error.message); + abort (); + } + + BSON_ASSERT (r); + bson_eq_bson (&bson_out, bsons[docs_idx]); + } + + /* finished parsing */ + ASSERT_CMPINT ( + 0, ==, bson_json_reader_read (reader, &bson_out, &error)); + + bson_json_reader_destroy (reader); + bson_string_truncate (json, 0); + + for (docs_idx = 0; docs_idx < n_docs; docs_idx++) { + bson_destroy (bsons[docs_idx]); + } + + bson_free (bsons); + } + } + + bson_string_free (json, true); + bson_destroy (&bson_out); +} + +static void +_test_bson_json_read_compare (const char *json, int size, ...) +{ + bson_error_t error = {0}; + bson_json_reader_t *reader; + va_list ap; + int r; + bson_t *compare; + bson_t bson = BSON_INITIALIZER; + + reader = bson_json_data_reader_new ((size == 1), size); + bson_json_data_reader_ingest (reader, (uint8_t *) json, strlen (json)); + + va_start (ap, size); + + while ((r = bson_json_reader_read (reader, &bson, &error))) { + if (r == -1) { + fprintf (stderr, "%s\n", error.message); + abort (); + } + + compare = va_arg (ap, bson_t *); + + BSON_ASSERT (compare); + + bson_eq_bson (&bson, compare); + + bson_destroy (compare); + + bson_reinit (&bson); + } + + va_end (ap); + + bson_json_reader_destroy (reader); + bson_destroy (&bson); +} + +static void +test_bson_json_read (void) +{ + char *json = bson_strdup_printf ( + "%s { \"after\": \"b\" } { \"twice\" : true }", json_with_all_types ()); + + bson_oid_t oid; + bson_t *first, *second, *third; + + bson_oid_init_from_string (&oid, "000000000000000000000000"); + + first = bson_copy (bson_with_all_types ()); + second = BCON_NEW ("after", "b"); + third = BCON_NEW ("twice", BCON_BOOL (true)); + + _test_bson_json_read_compare (json, 5, first, second, third, NULL); + bson_free (json); +} + +static void +test_bson_json_read_raw_utf8 (void) +{ + bson_t *bson; + bson_iter_t iter; + + bson = bson_new_from_json ( + (const uint8_t *) "{\"" EU "\": \"" EU "\"}", -1, NULL); + ASSERT (bson); + ASSERT (bson_iter_init_find (&iter, bson, EU)); + ASSERT_CMPSTR (bson_iter_key (&iter), EU); + ASSERT_CMPSTR (bson_iter_utf8 (&iter, NULL), EU); + ASSERT (!bson_iter_next (&iter)); + + bson_destroy (bson); +} + +static void +test_bson_json_read_corrupt_utf8 (void) +{ + const char *bad_key = "{ \"\x80\" : \"a\"}"; + const char *bad_value = "{ \"a\" : \"\x80\"}"; + bson_error_t error = {0}; + + BSON_ASSERT (!bson_new_from_json ((uint8_t *) bad_key, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "invalid bytes in UTF8 string"); + + memset (&error, 0, sizeof error); + + BSON_ASSERT (!bson_new_from_json ((uint8_t *) bad_value, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "invalid bytes in UTF8 string"); +} + + +/* exercise early exit from _bson_as_json_visit_document/array, CDRIVER-2541 */ +static void +test_bson_json_read_corrupt_document (void) +{ + /* like {a: {a: "\x80"}}, the value is invalid UTF-8 */ + const char bad_doc[] = "\x16\x00\x00\x00" /* length */ + "\x03\x61\x00" /* subdoc field with key "a" */ + "\x0e\x00\x00\x00" /* length of subdoc in bytes */ + "\x02\x61\x00\x02\x00\x00\x00\x80\x00" /* a: "\x80" */ + "\x00"; /* terminator */ + + /* like {a: ["\x80"]}, the inner value is invalid UTF-8 */ + const char bad_array[] = "\x16\x00\x00\x00" /* length */ + "\x04\x61\x00" /* array field with key "a" */ + "\x0e\x00\x00\x00" /* length of array in bytes */ + "\x02\x30\x00" /* key "0" */ + "\x02\x00\x00\x00\x80\x00" /* string "\x80" */ + "\x00"; /* terminator */ + + bson_t bson; + BSON_ASSERT ( + bson_init_static (&bson, (uint8_t *) bad_doc, sizeof (bad_doc))); + BSON_ASSERT (!bson_as_json (&bson, NULL)); + BSON_ASSERT ( + bson_init_static (&bson, (uint8_t *) bad_array, sizeof (bad_array))); + BSON_ASSERT (!bson_as_json (&bson, NULL)); +} + + +static void +test_bson_json_read_decimal128 (void) +{ + const char *json = "{ \"decimal\" : { \"$numberDecimal\" : \"123.5\" }}"; + bson_decimal128_t dec; + bson_t *doc; + + bson_decimal128_from_string ("123.5", &dec); + doc = BCON_NEW ("decimal", BCON_DECIMAL128 (&dec)); + + _test_bson_json_read_compare (json, 5, doc, NULL); +} + + +static void +test_bson_json_read_dbpointer (void) +{ + bson_t b; + bson_error_t error; + bool r; + + /* must have both $ref and $id, $id must be ObjectId */ + const char *invalid[] = { + "{\"p\": {\"$dbPointer\": {\"$ref\": \"db.collection\"}}", + "$dbPointer requires both $id and $ref", + + "{\"p\": {\"$dbPointer\": {\"$ref\": \"db.collection\", \"$id\": 1}}", + "$dbPointer.$id must be like {\"$oid\": ...\"}", + + "{\"p\": {\"$dbPointer\": {\"$id\": {" + "\"$oid\": \"57e193d7a9cc81b4027498b1\"}}}}", + "$dbPointer requires both $id and $ref", + + "{\"p\": {\"$dbPointer\": {}}}", + "Empty $dbPointer", + + NULL}; + + const char **p; + + for (p = invalid; *p; p += 2) { + r = bson_init_from_json (&b, *p, -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS ( + error, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_INVALID_PARAM, *(p + 1)); + } +} + + +static void +test_bson_json_read_legacy_regex (void) +{ + bson_t b; + bson_error_t error; + bool r; + const char *pattern; + const char *flags; + + r = bson_init_from_json ( + &b, "{\"a\": {\"$regex\": \"abc\", \"$options\": \"ix\"}}", -1, &error); + ASSERT_OR_PRINT (r, error); + BCON_EXTRACT (&b, "a", BCONE_REGEX (pattern, flags)); + ASSERT_CMPSTR (pattern, "abc"); + ASSERT_CMPSTR (flags, "ix"); + + bson_destroy (&b); + + r = bson_init_from_json (&b, "{\"a\": {\"$regex\": \"abc\"}}", -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Missing \"$options\" after \"$regex\""); + + memset (&error, 0, sizeof error); + + r = bson_init_from_json (&b, "{\"a\": {\"$options\": \"ix\"}}", -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Missing \"$regex\" after \"$options\""); +} + + +static void +test_bson_json_read_regex_options_order (void) +{ + bson_t b; + bson_error_t error; + bool r; + const char *pattern; + const char *flags; + + r = bson_init_from_json ( + &b, "{\"a\": {\"$regex\": \"\", \"$options\": \"ism\"}}", -1, &error); + ASSERT_OR_PRINT (r, error); + BCON_EXTRACT (&b, "a", BCONE_REGEX (pattern, flags)); + ASSERT_CMPSTR (flags, "ims"); + + bson_destroy (&b); + + r = bson_init_from_json ( + &b, "{\"a\": {\"$regex\": \"\", \"$options\": \"misl\"}}", -1, &error); + ASSERT_OR_PRINT (r, error); + BCON_EXTRACT (&b, "a", BCONE_REGEX (pattern, flags)); + ASSERT_CMPSTR (flags, "ilms"); + + bson_destroy (&b); +} + + +static void +test_bson_json_read_binary (void) +{ + bson_error_t error; + bson_t b; + bool r; + bson_subtype_t subtype; + uint32_t len; + const uint8_t *binary; + + r = bson_init_from_json ( + &b, + "{\"b\": {\"$binary\": {\"base64\": \"Zm9v\", \"subType\": \"05\"}}}", + -1, + &error); + ASSERT_OR_PRINT (r, error); + + BCON_EXTRACT (&b, "b", BCONE_BIN (subtype, binary, len)); + ASSERT_CMPINT ((int) subtype, ==, 5); + ASSERT_CMPUINT32 (len, ==, (uint32_t) 3); + ASSERT_CMPSTR ((const char *) binary, "foo"); + + bson_destroy (&b); + + r = bson_init_from_json ( + &b, + "{\"b\": {\"$binary\": {\"subType\": \"05\", \"base64\": \"Zm9v\"}}}", + -1, + &error); + ASSERT_OR_PRINT (r, error); + BCON_EXTRACT (&b, "b", BCONE_BIN (subtype, binary, len)); + ASSERT_CMPINT ((int) subtype, ==, 5); + ASSERT_CMPUINT32 (len, ==, (uint32_t) 3); + ASSERT_CMPSTR ((const char *) binary, "foo"); + + bson_destroy (&b); + + /* no base64 */ + r = bson_init_from_json ( + &b, "{\"b\": {\"$binary\": {\"subType\": \"5\"}}}", -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Missing \"base64\" after \"subType\""); + + memset (&error, 0, sizeof error); + + /* no subType */ + r = bson_init_from_json ( + &b, "{\"b\": {\"$binary\": {\"base64\": \"Zm9v\"}}}", -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Missing \"subType\" after \"base64\""); +} + + +static void +test_bson_json_read_legacy_binary (void) +{ + const char *jsons[] = {"{\"x\": {\"$binary\": \"Zm9v\", \"$type\": \"05\"}}", + "{\"x\": {\"$type\": \"05\", \"$binary\": \"Zm9v\"}}", + NULL}; + + const char **json; + bson_error_t error; + bson_t b; + bool r; + bson_subtype_t subtype; + uint32_t len; + const uint8_t *binary; + + for (json = jsons; *json; json++) { + r = bson_init_from_json (&b, *json, -1, &error); + + ASSERT_OR_PRINT (r, error); + BCON_EXTRACT (&b, "x", BCONE_BIN (subtype, binary, len)); + ASSERT_CMPINT ((int) subtype, ==, 5); + ASSERT_CMPUINT32 (len, ==, (uint32_t) 3); + ASSERT_CMPSTR ((const char *) binary, "foo"); + + bson_destroy (&b); + } +} + + +static void +test_json_reader_new_from_file (void) +{ + const char *path = BSON_JSON_DIR "/test.json"; + const char *bar; + const bson_oid_t *oid; + bson_oid_t oid_expected; + int32_t one; + bson_t bson = BSON_INITIALIZER; + bson_json_reader_t *reader; + bson_error_t error; + + reader = bson_json_reader_new_from_file (path, &error); + BSON_ASSERT (reader); + + /* read two documents */ + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + + BCON_EXTRACT (&bson, "foo", BCONE_UTF8 (bar), "a", BCONE_INT32 (one)); + ASSERT_CMPSTR ("bar", bar); + ASSERT_CMPINT (1, ==, one); + + bson_reinit (&bson); + ASSERT_CMPINT (1, ==, bson_json_reader_read (reader, &bson, &error)); + + BCON_EXTRACT (&bson, "_id", BCONE_OID (oid)); + bson_oid_init_from_string (&oid_expected, "aabbccddeeff001122334455"); + BSON_ASSERT (bson_oid_equal (&oid_expected, oid)); + + bson_destroy (&bson); + bson_json_reader_destroy (reader); +} + +static void +test_json_reader_new_from_bad_path (void) +{ + const char *bad_path = BSON_JSON_DIR "/does-not-exist"; + bson_json_reader_t *reader; + bson_error_t error; + + reader = bson_json_reader_new_from_file (bad_path, &error); + BSON_ASSERT (!reader); + ASSERT_CMPINT (BSON_ERROR_READER, ==, error.domain); + ASSERT_CMPINT (BSON_ERROR_READER_BADFD, ==, error.code); +} + +static void +test_bson_json_error (const char *json, int domain, bson_json_error_code_t code) +{ + bson_error_t error; + bson_t *bson; + + bson = bson_new_from_json ((const uint8_t *) json, strlen (json), &error); + + BSON_ASSERT (!bson); + BSON_ASSERT (error.domain == domain); + BSON_ASSERT (error.code == code); +} + +static void +test_bson_json_read_empty (void) +{ + bson_error_t error; + bson_t *bson_ptr; + bson_t bson; + + bson_ptr = bson_new_from_json ((uint8_t *) "", 0, &error); + BSON_ASSERT (!bson_ptr); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Empty JSON string"); + + memset (&error, 0, sizeof error); + bson_init_from_json (&bson, "", 0, &error); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Empty JSON string"); +} + +static void +test_bson_json_read_missing_complex (void) +{ + const char *json = "{ \n\ + \"foo\" : { \n\ + \"$options\" : \"ism\"\n\ + }\n\ + }"; + + test_bson_json_error ( + json, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_INVALID_PARAM); +} + +static void +test_bson_json_read_invalid_binary (void) +{ + bson_error_t error; + const char *json = + "{ " + " \"bin\" : { \"$binary\" : \"invalid\", \"$type\" : \"80\" } }"; + bson_t b; + bool r; + + r = bson_init_from_json (&b, json, -1, &error); + BSON_ASSERT (!r); +} + +static void +test_bson_json_read_invalid_json (void) +{ + const char *json = "{ \n\ + \"foo\" : { \n\ + }"; + bson_t *b; + + test_bson_json_error ( + json, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_CORRUPT_JS); + + b = bson_new_from_json ((uint8_t *) "1", 1, NULL); + BSON_ASSERT (!b); + + b = bson_new_from_json ((uint8_t *) "*", 1, NULL); + BSON_ASSERT (!b); + + b = bson_new_from_json ((uint8_t *) "", 0, NULL); + BSON_ASSERT (!b); + + b = bson_new_from_json ((uint8_t *) "asdfasdf", -1, NULL); + BSON_ASSERT (!b); + + b = bson_new_from_json ((uint8_t *) "{\"a\":*}", -1, NULL); + BSON_ASSERT (!b); +} + +static ssize_t +test_bson_json_read_bad_cb_helper (void *_ctx, uint8_t *buf, size_t len) +{ + return -1; +} + +static void +test_bson_json_read_bad_cb (void) +{ + bson_error_t error; + bson_json_reader_t *reader; + int r; + bson_t bson = BSON_INITIALIZER; + + reader = bson_json_reader_new ( + NULL, &test_bson_json_read_bad_cb_helper, NULL, false, 0); + + r = bson_json_reader_read (reader, &bson, &error); + + BSON_ASSERT (r == -1); + BSON_ASSERT (error.domain == BSON_ERROR_JSON); + BSON_ASSERT (error.code == BSON_JSON_ERROR_READ_CB_FAILURE); + + bson_json_reader_destroy (reader); + bson_destroy (&bson); +} + +static ssize_t +test_bson_json_read_invalid_helper (void *ctx, uint8_t *buf, size_t len) +{ + BSON_ASSERT (len); + *buf = 0x80; /* no UTF-8 sequence can start with 0x80 */ + return 1; +} + +static void +test_bson_json_read_invalid (void) +{ + bson_error_t error; + bson_json_reader_t *reader; + int r; + bson_t bson = BSON_INITIALIZER; + + reader = bson_json_reader_new ( + NULL, test_bson_json_read_invalid_helper, NULL, false, 0); + + r = bson_json_reader_read (reader, &bson, &error); + + BSON_ASSERT (r == -1); + BSON_ASSERT (error.domain == BSON_ERROR_JSON); + BSON_ASSERT (error.code == BSON_JSON_ERROR_READ_CORRUPT_JS); + + bson_json_reader_destroy (reader); + bson_destroy (&bson); +} + +static void +test_bson_json_number_long (void) +{ + bson_error_t error; + bson_iter_t iter; + bson_t b; + bool r; + + r = bson_init_from_json ( + &b, "{\"key\": {\"$numberLong\": \"4611686018427387904\"}}", -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find (&iter, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + BSON_ASSERT (bson_iter_int64 (&iter) == 4611686018427387904LL); + bson_destroy (&b); + + BSON_ASSERT (!bson_init_from_json ( + &b, "{\"key\": {\"$numberLong\": \"461168601abcd\"}}", -1, &error)); + BSON_ASSERT (!bson_init_from_json ( + &b, "{\"key\": {\"$numberLong\": \"461168601abcd\"}}", -1, &error)); + + /* INT64_MAX */ + r = bson_init_from_json ( + &b, "{\"x\": {\"$numberLong\": \"9223372036854775807\"}}", -1, &error); + ASSERT_OR_PRINT (r, error); + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) INT64_MAX); + bson_destroy (&b); + + /* INT64_MIN */ + r = bson_init_from_json ( + &b, "{\"x\": {\"$numberLong\": \"-9223372036854775808\"}}", -1, &error); + ASSERT_OR_PRINT (r, error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) INT64_MIN); + bson_destroy (&b); + + /* INT64_MAX + 1 */ + r = bson_init_from_json ( + &b, "{\"x\": {\"$numberLong\": \"9223372036854775808\"}}", -1, &error); + + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"9223372036854775808\" is out of range"); + + memset (&error, 0, sizeof error); + + /* INT64_MIN - 1 */ + r = bson_init_from_json ( + &b, "{\"x\": {\"$numberLong\": \"-9223372036854775809\"}}", -1, &error); + + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"-9223372036854775809\" is out of range"); + + memset (&error, 0, sizeof error); + + r = bson_init_from_json ( + &b, "{\"x\": {\"$numberLong\": \"10000000000000000000\"}}", -1, &error); + + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"10000000000000000000\" is out of range"); + + memset (&error, 0, sizeof error); + + /* INT64_MIN - 2 */ + r = bson_init_from_json (&b, "{\"x\": -10000000000000000000}", -1, &error); + + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"-10000000000000000000\" is out of range"); +} + +static void +test_bson_json_number_long_zero (void) +{ + bson_error_t error; + bson_iter_t iter; + const char *json = "{ \"key\": { \"$numberLong\": \"0\" }}"; + bson_t b; + bool r; + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find (&iter, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + BSON_ASSERT (bson_iter_int64 (&iter) == 0); + bson_destroy (&b); +} + +static void +test_bson_json_code (void) +{ + const char *json_code = "{\"a\": {\"$code\": \"b\"}}"; + bson_t *bson_code = BCON_NEW ("a", BCON_CODE ("b")); + + const char *json_code_w_nulls = "{\"a\": {\"$code\": \"b\\u0000c\\u0000\"}}"; + bson_t *bson_code_w_nulls = BCON_NEW ("a", BCON_CODE ("b\0c\0")); + + const char *json_code_w_scope = "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"var\": 1}}}"; + bson_t *scope1 = BCON_NEW ("var", BCON_INT32 (1)); + bson_t *bson_code_w_scope = BCON_NEW ("a", BCON_CODEWSCOPE ("b", scope1)); + + const char *json_code_w_scope_special = + "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"var2\": {\"$numberLong\": \"2\"}}}}"; + bson_t *scope2 = BCON_NEW ("var2", BCON_INT64 (2)); + bson_t *bson_code_w_scope_special = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", scope2)); + + const char *json_2_codes_w_scope = + "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"var\": 1}}," + " \"c\": {\"$code\": \"d\", " + " \"$scope\": {\"var2\": {\"$numberLong\": \"2\"}}}}"; + bson_t *bson_2_codes_w_scope = BCON_NEW ( + "a", BCON_CODEWSCOPE ("b", scope1), "c", BCON_CODEWSCOPE ("d", scope2)); + + const char *json_code_then_regular = + "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"var\": 1}}," + " \"c\": {\"key1\": \"value\", " + " \"subdoc\": {\"key2\": \"value2\"}}}"; + + bson_t *bson_code_then_regular = BCON_NEW ("a", + BCON_CODEWSCOPE ("b", scope1), + "c", + "{", + "key1", + BCON_UTF8 ("value"), + "subdoc", + "{", + "key2", + BCON_UTF8 ("value2"), + "}", + "}"); + + const char *json_code_w_scope_reverse = "{\"a\": {\"$scope\": {\"var\": 1}, " + " \"$code\": \"b\"}}"; + bson_t *bson_code_w_scope_reverse = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", scope1)); + + const char *json_code_w_scope_nest = "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"var\": {}}}}"; + bson_t *scope3 = BCON_NEW ("var", "{", "}"); + bson_t *bson_code_w_scope_nest = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", scope3)); + + const char *json_code_w_scope_nest_deep = + "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"arr\": [1, 2], \"d\": {}," + " \"n\": {\"$numberLong\": \"1\"}," + " \"d2\": {\"x\": 1, \"d3\": {\"z\": 3}}}}}"; + + bson_t *scope_deep = BCON_NEW ("arr", + "[", + BCON_INT32 (1), + BCON_INT32 (2), + "]", + "d", + "{", + "}", + "n", + BCON_INT64 (1), + "d2", + "{", + "x", + BCON_INT32 (1), + "d3", + "{", + "z", + BCON_INT32 (3), + "}", + "}"); + + bson_t *bson_code_w_scope_nest_deep = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", scope_deep)); + + const char *json_code_w_empty_scope = "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {}}}"; + bson_t *empty = bson_new (); + bson_t *bson_code_w_empty_scope = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", empty)); + + const char *json_code_in_scope = + "{\"a\": {\"$code\": \"b\", " + " \"$scope\": {\"x\": {\"$code\": \"c\"}}}}"; + + bson_t *code_in_scope = BCON_NEW ("x", "{", "$code", BCON_UTF8 ("c"), "}"); + bson_t *bson_code_in_scope = + BCON_NEW ("a", BCON_CODEWSCOPE ("b", code_in_scope)); + + typedef struct { + const char *json; + bson_t *expected_bson; + } code_test_t; + + code_test_t tests[] = { + {json_code, bson_code}, + {json_code_w_nulls, bson_code_w_nulls}, + {json_code_w_scope, bson_code_w_scope}, + {json_code_w_scope_special, bson_code_w_scope_special}, + {json_code_then_regular, bson_code_then_regular}, + {json_2_codes_w_scope, bson_2_codes_w_scope}, + {json_code_w_scope_reverse, bson_code_w_scope_reverse}, + {json_code_w_scope_nest, bson_code_w_scope_nest}, + {json_code_w_scope_nest_deep, bson_code_w_scope_nest_deep}, + {json_code_w_empty_scope, bson_code_w_empty_scope}, + {json_code_in_scope, bson_code_in_scope}, + }; + + int n_tests = sizeof (tests) / sizeof (code_test_t); + int i; + bson_t b; + bool r; + bson_error_t error; + + for (i = 0; i < n_tests; i++) { + r = bson_init_from_json (&b, tests[i].json, -1, &error); + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + bson_eq_bson (&b, tests[i].expected_bson); + bson_destroy (&b); + } + + for (i = 0; i < n_tests; i++) { + bson_destroy (tests[i].expected_bson); + } + + bson_destroy (scope1); + bson_destroy (scope2); + bson_destroy (scope3); + bson_destroy (scope_deep); + bson_destroy (code_in_scope); + bson_destroy (empty); +} + +static void +test_bson_json_code_errors (void) +{ + bson_error_t error; + bson_t b; + bool r; + size_t i; + + typedef struct { + const char *json; + const char *error_message; + } code_error_test_t; + + code_error_test_t tests[] = { + {"{\"a\": {\"$scope\": {}}", "Missing $code after $scope"}, + {"{\"a\": {\"$scope\": {}, \"$x\": 1}", "Invalid key \"$x\""}, + {"{\"a\": {\"$scope\": {\"a\": 1}}", "Missing $code after $scope"}, + {"{\"a\": {\"$code\": \"\", \"$scope\": \"a\"}}", + "Invalid read of \"a\""}, + {"{\"a\": {\"$code\": \"\", \"$scope\": 1}}", + "Unexpected integer 1 in state \"IN_BSON_TYPE_SCOPE_STARTMAP\""}, + {"{\"a\": {\"$code\": \"\", \"$scope\": []}}", "Invalid read of \"[\""}, + {"{\"a\": {\"$code\": \"\", \"x\": 1}}", + "Invalid key \"x\". Looking for values for type \"code\""}, + {"{\"a\": {\"$code\": \"\", \"$x\": 1}}", "Invalid key \"$x\""}, + {"{\"a\": {\"$code\": \"\", \"$numberLong\": \"1\"}}", + "Invalid key \"$numberLong\""}, + }; + + for (i = 0; i < sizeof (tests) / (sizeof (code_error_test_t)); i++) { + r = bson_init_from_json (&b, tests[i].json, -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + tests[i].error_message); + } +} + +static const bson_oid_t * +oid_zero (void) +{ + static bool initialized = false; + static bson_oid_t oid; + + if (!initialized) { + bson_oid_init_from_string (&oid, "000000000000000000000000"); + initialized = true; + } + + return &oid; +} + +static void +test_bson_json_dbref (void) +{ + bson_error_t error; + + const char *json_with_objectid = + "{ \"key\": {" + "\"$ref\": \"collection\"," + "\"$id\": {\"$oid\": \"000000000000000000000000\"}}}"; + + bson_t *bson_with_objectid = BCON_NEW ("key", + "{", + "$ref", + BCON_UTF8 ("collection"), + "$id", + BCON_OID (oid_zero ()), + "}"); + + const char *json_with_int_id = "{ \"key\": {" + "\"$ref\": \"collection\"," + "\"$id\": 1}}"; + + bson_t *bson_with_int_id = BCON_NEW ( + "key", "{", "$ref", BCON_UTF8 ("collection"), "$id", BCON_INT32 (1), "}"); + + const char *json_with_subdoc_id = "{ \"key\": {" + "\"$ref\": \"collection\"," + "\"$id\": {\"a\": 1}}}"; + + bson_t *bson_with_subdoc_id = BCON_NEW ("key", + "{", + "$ref", + BCON_UTF8 ("collection"), + "$id", + "{", + "a", + BCON_INT32 (1), + "}", + "}"); + + const char *json_with_metadata = "{ \"key\": {" + "\"$ref\": \"collection\"," + "\"$id\": 1," + "\"meta\": true}}"; + + bson_t *bson_with_metadata = BCON_NEW ("key", + "{", + "$ref", + BCON_UTF8 ("collection"), + "$id", + BCON_INT32 (1), + "meta", + BCON_BOOL (true), + "}"); + + bson_t b; + bool r; + + typedef struct { + const char *json; + bson_t *expected_bson; + } dbref_test_t; + + dbref_test_t tests[] = { + {json_with_objectid, bson_with_objectid}, + {json_with_int_id, bson_with_int_id}, + {json_with_subdoc_id, bson_with_subdoc_id}, + {json_with_metadata, bson_with_metadata}, + }; + + int n_tests = sizeof (tests) / sizeof (dbref_test_t); + int i; + + for (i = 0; i < n_tests; i++) { + r = bson_init_from_json (&b, tests[i].json, -1, &error); + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + bson_eq_bson (&b, tests[i].expected_bson); + bson_destroy (&b); + } + + for (i = 0; i < n_tests; i++) { + bson_destroy (tests[i].expected_bson); + } +} + +static void +test_bson_json_uescape (void) +{ + bson_error_t error; + bson_t b; + bool r; + + const char *euro = "{ \"euro\": \"\\u20AC\"}"; + bson_t *bson_euro = BCON_NEW ("euro", BCON_UTF8 ("\xE2\x82\xAC")); + + const char *crlf = "{ \"crlf\": \"\\r\\n\"}"; + bson_t *bson_crlf = BCON_NEW ("crlf", BCON_UTF8 ("\r\n")); + + const char *quote = "{ \"quote\": \"\\\"\"}"; + bson_t *bson_quote = BCON_NEW ("quote", BCON_UTF8 ("\"")); + + const char *backslash = "{ \"backslash\": \"\\\\\"}"; + bson_t *bson_backslash = BCON_NEW ("backslash", BCON_UTF8 ("\\")); + + const char *empty = "{ \"\": \"\"}"; + bson_t *bson_empty = BCON_NEW ("", BCON_UTF8 ("")); + + const char *escapes = "{ \"escapes\": \"\\f\\b\\t\"}"; + bson_t *bson_escapes = BCON_NEW ("escapes", BCON_UTF8 ("\f\b\t")); + + const char *nil_byte = "{ \"nil\": \"\\u0000\"}"; + bson_t *bson_nil_byte = bson_new (); /* we'll append "\0" to it, below */ + + typedef struct { + const char *json; + bson_t *expected_bson; + } uencode_test_t; + + uencode_test_t tests[] = { + {euro, bson_euro}, + {crlf, bson_crlf}, + {quote, bson_quote}, + {backslash, bson_backslash}, + {empty, bson_empty}, + {escapes, bson_escapes}, + {nil_byte, bson_nil_byte}, + }; + + int n_tests = sizeof (tests) / sizeof (uencode_test_t); + int i; + + bson_append_utf8 (bson_nil_byte, "nil", -1, "\0", 1); + + for (i = 0; i < n_tests; i++) { + r = bson_init_from_json (&b, tests[i].json, -1, &error); + + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + bson_eq_bson (&b, tests[i].expected_bson); + bson_destroy (&b); + } + + for (i = 0; i < n_tests; i++) { + bson_destroy (tests[i].expected_bson); + } +} + +static void +test_bson_json_uescape_key (void) +{ + bson_error_t error; + bson_t b; + bool r; + + bson_t *bson_euro = BCON_NEW ("\xE2\x82\xAC", BCON_UTF8 ("euro")); + + r = bson_init_from_json (&b, "{ \"\\u20AC\": \"euro\"}", -1, &error); + BSON_ASSERT (r); + bson_eq_bson (&b, bson_euro); + + bson_destroy (&b); + bson_destroy (bson_euro); +} + +static void +test_bson_json_uescape_bad (void) +{ + bson_error_t error; + bson_t b; + bool r; + + r = bson_init_from_json (&b, "{ \"bad\": \"\\u1\"}", -1, &error); + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "UESCAPE_TOOSHORT"); +} + + +static void +test_bson_json_int32 (void) +{ + bson_t b; + bson_iter_t iter; + bson_error_t error; + + /* INT32_MAX */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": 2147483647 }", -1, &error), error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + ASSERT_CMPINT32 (bson_iter_int32 (&iter), ==, (int32_t) 2147483647LL); + bson_destroy (&b); + + /* INT32_MIN */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": -2147483648 }", -1, &error), error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + ASSERT_CMPINT32 (bson_iter_int32 (&iter), ==, (int32_t) -2147483648LL); + bson_destroy (&b); + + /* INT32_MAX + 1 */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": 2147483648 }", -1, &error), error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) 2147483648LL); + bson_destroy (&b); + + /* INT32_MIN - 1 */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": -2147483649 }", -1, &error), error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) -2147483649LL); + bson_destroy (&b); +} + + +static void +test_bson_json_int64 (void) +{ + bson_t b; + bson_iter_t iter; + bson_error_t error; + + /* INT64_MAX */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": 9223372036854775807 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 ( + bson_iter_int64 (&iter), ==, (int64_t) 9223372036854775807LL); + bson_destroy (&b); + + /* INT64_MIN */ + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": -9223372036854775808 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) INT64_MIN); + bson_destroy (&b); + + /* INT64_MAX + 1 */ + BSON_ASSERT ( + !bson_init_from_json (&b, "{ \"x\": 9223372036854775808 }", -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"9223372036854775808\" is out of range"); + + memset (&error, 0, sizeof error); + + /* INT64_MIN - 1 */ + BSON_ASSERT ( + !bson_init_from_json (&b, "{ \"x\": -9223372036854775809 }", -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"-9223372036854775809\" is out of range"); + + memset (&error, 0, sizeof error); + + BSON_ASSERT ( + !bson_init_from_json (&b, "{ \"x\": 10000000000000000000 }", -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"10000000000000000000\" is out of range"); + + memset (&error, 0, sizeof error); + + /* INT64_MIN - 2 */ + BSON_ASSERT (!bson_init_from_json ( + &b, "{ \"x\": -10000000000000000000 }", -1, &error)); + + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "Number \"-10000000000000000000\" is out of range"); +} + + +static void +test_bson_json_double (void) +{ + bson_t b; + bson_error_t error; + bson_iter_t iter; + + ASSERT_OR_PRINT (bson_init_from_json (&b, "{ \"x\": 1 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT32 (&iter)); + ASSERT_CMPINT32 (bson_iter_int32 (&iter), ==, (int32_t) 1); + bson_destroy (&b); + + ASSERT_OR_PRINT ( + bson_init_from_json (&b, "{ \"x\": 4294967296 }", -1, &error), error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_INT64 (&iter)); + ASSERT_CMPINT64 (bson_iter_int64 (&iter), ==, (int64_t) 4294967296); + bson_destroy (&b); + + ASSERT_OR_PRINT (bson_init_from_json (&b, "{ \"x\": 1.0 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + ASSERT_CMPDOUBLE (bson_iter_double (&iter), ==, 1.0); + bson_destroy (&b); + + ASSERT_OR_PRINT (bson_init_from_json (&b, "{ \"x\": 0.0 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + ASSERT_CMPDOUBLE (bson_iter_double (&iter), ==, 0.0); + bson_destroy (&b); + + ASSERT_OR_PRINT (bson_init_from_json (&b, "{ \"x\": -0.0 }", -1, &error), + error); + + BSON_ASSERT (bson_iter_init_find (&iter, &b, "x")); + BSON_ASSERT (BSON_ITER_HOLDS_DOUBLE (&iter)); + ASSERT_CMPDOUBLE (bson_iter_double (&iter), ==, 0.0); + +/* check that "x" is -0.0. signbit not available on Solaris or VS 2010 */ +#if !defined(__sun) && (!defined(_MSC_VER) || (_MSC_VER >= 1800)) + BSON_ASSERT (signbit (bson_iter_double (&iter))); +#endif + + bson_destroy (&b); +} + + +static void +test_bson_json_double_overflow (void) +{ + const char *nums[] = {"2e400", "-2e400", NULL}; + const char **p; + char *j; + bson_error_t error; + bson_t b; + + for (p = nums; *p; p++) { + j = bson_strdup_printf ("{ \"d\" : %s }", *p); + BSON_ASSERT (!bson_init_from_json (&b, j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "out of range"); + + bson_free (j); + memset (&error, 0, sizeof error); + + /* same test with canonical Extended JSON */ + j = bson_strdup_printf ("{ \"d\" : { \"$numberDouble\" : \"%s\" } }", *p); + BSON_ASSERT (!bson_init_from_json (&b, j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_INVALID_PARAM, + "out of range"); + + bson_free (j); + } +} + + +static void +test_bson_json_nan (void) +{ + bson_error_t error; + bson_t b; + double d; + + /* should parse any capitalization of NaN */ + const char *jsons[] = {"{ \"d\": NaN }", + "{ \"d\": nAn }", + "{ \"d\": {\"$numberDouble\": \"NaN\" } }", + "{ \"d\": {\"$numberDouble\": \"nAn\" } }", + NULL}; + + /* test our patch to JSONSL that updates its state while parsing "n..." */ + const char *bad[] = {"{ \"d\": NaNn }", + "{ \"d\": nul }", + "{ \"d\": nulll }", + "{ \"d\": nulll }", + "{ \"d\": foo }", + "{ \"d\": NULL }", + "{ \"d\": nall }", + NULL}; + + const char *partial[] = {"{ \"d\": nu", "{ \"d\": na", "{ \"d\": n", NULL}; + const char **j; + + for (j = jsons; *j; j++) { + BSON_ASSERT (bson_init_from_json (&b, *j, -1, &error)); + BSON_ASSERT (BCON_EXTRACT (&b, "d", BCONE_DOUBLE (d))); + BSON_ASSERT (d != d); + bson_destroy (&b); + } + + for (j = bad; *j; j++) { + BSON_ASSERT (!bson_init_from_json (&b, *j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "Got parse error at"); + memset (&error, 0, sizeof error); + } + + for (j = partial; *j; j++) { + BSON_ASSERT (!bson_init_from_json (&b, *j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "Incomplete JSON"); + memset (&error, 0, sizeof error); + } +} + +static void +test_bson_json_infinity (void) +{ + bson_error_t error; + bson_t b; + double d; + + /* should parse any capitalization of Infinity */ + const char *infs[] = {"{ \"d\": Infinity }", + "{ \"d\": infinity }", + "{ \"d\": inFINIty }", + NULL}; + + const char *negs[] = {"{ \"d\": -Infinity }", + "{ \"d\": -infinity }", + "{ \"d\": -inFINIty }", + NULL}; + + const char *bad[] = {"{ \"d\": Infinityy }", + "{ \"d\": Infinit }", + "{ \"d\": -Infinityy }", + "{ \"d\": -Infinit }", + "{ \"d\": infinityy }", + "{ \"d\": infinit }", + "{ \"d\": -infinityy }", + "{ \"d\": -infinit }", + NULL}; + + const char *partial[] = {"{ \"d\": In", "{ \"d\": I", "{ \"d\": i", NULL}; + const char **j; + + for (j = infs; *j; j++) { + BSON_ASSERT (bson_init_from_json (&b, *j, -1, &error)); + BSON_ASSERT (BCON_EXTRACT (&b, "d", BCONE_DOUBLE (d))); + /* Infinite */ + BSON_ASSERT (d == d && ((d - d) != (d - d))); + bson_destroy (&b); + } + + for (j = negs; *j; j++) { + BSON_ASSERT (bson_init_from_json (&b, *j, -1, &error)); + BSON_ASSERT (BCON_EXTRACT (&b, "d", BCONE_DOUBLE (d))); + /* Infinite */ + BSON_ASSERT (d == d && ((d - d) != (d - d))); + BSON_ASSERT (d < 0); + bson_destroy (&b); + } + + for (j = bad; *j; j++) { + BSON_ASSERT (!bson_init_from_json (&b, *j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "Got parse error at"); + memset (&error, 0, sizeof error); + } + + for (j = partial; *j; j++) { + BSON_ASSERT (!bson_init_from_json (&b, *j, -1, &error)); + ASSERT_ERROR_CONTAINS (error, + BSON_ERROR_JSON, + BSON_JSON_ERROR_READ_CORRUPT_JS, + "Incomplete JSON"); + memset (&error, 0, sizeof error); + } +} + + +static void +test_bson_json_null (void) +{ + bson_error_t error; + bson_t b; + + const char *json = "{ \"x\": null }"; + BSON_ASSERT (bson_init_from_json (&b, json, -1, &error)); + BSON_ASSERT (BCON_EXTRACT (&b, "x", BCONE_NULL)); + bson_destroy (&b); +} + + +static void +test_bson_json_empty_final_object (void) +{ + const char *json = "{\"a\": {\"b\": {}}}"; + bson_t *bson = BCON_NEW ("a", "{", "b", "{", "}", "}"); + bson_t b; + bool r; + bson_error_t error; + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + bson_eq_bson (&b, bson); + + bson_destroy (&b); + bson_destroy (bson); +} + +static void +test_bson_json_number_decimal (void) +{ + bson_error_t error; + bson_iter_t iter; + bson_decimal128_t decimal128; + const char *json = "{ \"key\" : { \"$numberDecimal\": \"11\" }}"; + bson_t b; + bool r; + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + BSON_ASSERT (bson_iter_init (&iter, &b)); + BSON_ASSERT (bson_iter_find (&iter, "key")); + BSON_ASSERT (BSON_ITER_HOLDS_DECIMAL128 (&iter)); + bson_iter_decimal128 (&iter, &decimal128); + BSON_ASSERT (decimal128.low == 11); + BSON_ASSERT (decimal128.high == 0x3040000000000000ULL); + bson_destroy (&b); +} + +static void +test_bson_json_inc (void) +{ + /* test that reproduces a bug with special mode checking. Specifically, + * mistaking '$inc' for '$id' + * + * From https://github.com/mongodb/mongo-c-driver/issues/62 + */ + bson_error_t error; + const char *json = "{ \"$inc\" : { \"ref\" : 1 } }"; + bson_t b; + bool r; + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + bson_destroy (&b); +} + +static void +test_bson_json_array (void) +{ + bson_error_t error; + const char *json = "[ 0, 1, 2, 3 ]"; + bson_t b, compare; + bool r; + + bson_init (&compare); + bson_append_int32 (&compare, "0", 1, 0); + bson_append_int32 (&compare, "1", 1, 1); + bson_append_int32 (&compare, "2", 1, 2); + bson_append_int32 (&compare, "3", 1, 3); + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&compare); + bson_destroy (&b); +} + +static void +test_bson_json_array_single (void) +{ + bson_error_t error; + const char *json = "[ 0 ]"; + bson_t b, compare; + bool r; + + bson_init (&compare); + bson_append_int32 (&compare, "0", 1, 0); + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&compare); + bson_destroy (&b); +} + +static void +test_bson_json_array_int64 (void) +{ + bson_error_t error; + const char *json = "[ { \"$numberLong\" : \"123\" }," + " { \"$numberLong\" : \"42\" } ]"; + bson_t b, compare; + bool r; + + bson_init (&compare); + bson_append_int64 (&compare, "0", 1, 123); + bson_append_int64 (&compare, "1", 1, 42); + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&compare); + bson_destroy (&b); +} + +static void +test_bson_json_array_subdoc (void) +{ + bson_error_t error; + const char *json = "[ { \"a\" : 123 } ]"; + bson_t b, compare, subdoc; + bool r; + + bson_init (&compare); + bson_init (&subdoc); + bson_append_int32 (&subdoc, "a", 1, 123); + bson_append_document (&compare, "0", 1, &subdoc); + + r = bson_init_from_json (&b, json, -1, &error); + if (!r) + fprintf (stderr, "%s\n", error.message); + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&subdoc); + bson_destroy (&compare); + bson_destroy (&b); +} + +static void +test_bson_json_date_check (const char *json, int64_t value) +{ + bson_error_t error = {0}; + bson_t b, compare; + bool r; + + bson_init (&compare); + + BSON_APPEND_DATE_TIME (&compare, "dt", value); + + r = bson_init_from_json (&b, json, -1, &error); + + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&compare); + bson_destroy (&b); +} + + +static void +test_bson_json_date_error (const char *json, const char *msg) +{ + bson_error_t error = {0}; + bson_t b; + bool r; + r = bson_init_from_json (&b, json, -1, &error); + if (r) { + fprintf (stderr, "parsing %s should fail\n", json); + } + BSON_ASSERT (!r); + ASSERT_ERROR_CONTAINS ( + error, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_INVALID_PARAM, msg); +} + +static void +test_bson_json_date (void) +{ + /* to make a timestamp, "python3 -m pip install iso8601" and in Python 3: + * iso8601.parse_date("2016-12-13T12:34:56.123Z").timestamp() * 1000 + */ + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : \"2016-12-13T12:34:56.123Z\" } }", + 1481632496123); + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T00:00:00.000Z\" } }", 0); + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : \"1969-12-31T16:00:00.000-0800\" } }", 0); + + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000+01:00\" } }", + "Could not parse"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:30:\" } }", + "reached end of date while looking for seconds"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:+01:00\" } }", + "seconds is required"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:30:00.\" } }", + "reached end of date while looking for milliseconds"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.+01:00\" } }", + "milliseconds is required"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"foo-01-01T00:00:00.000Z\" } }", + "year must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-foo-01T00:00:00.000Z\" } }", + "month must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-fooT00:00:00.000Z\" } }", + "day must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01Tfoo:00:00.000Z\" } }", + "hour must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T00:foo:00.000Z\" } }", + "minute must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T00:00:foo.000Z\" } }", + "seconds must be an integer"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000\" } }", + "timezone is required"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000X\" } }", + "timezone is required"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000+1\" } }", + "could not parse timezone"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000+xx00\" } }", + "could not parse timezone"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000+2400\" } }", + "timezone hour must be at most 23"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000-2400\" } }", + "timezone hour must be at most 23"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000+0060\" } }", + "timezone minute must be at most 59"); + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : \"1970-01-01T01:00:00.000-0060\" } }", + "timezone minute must be at most 59"); +} + + +static void +test_bson_json_date_legacy (void) +{ + test_bson_json_date_check ("{ \"dt\" : { \"$date\" : 0 } }", 0); + test_bson_json_date_check ("{ \"dt\" : { \"$date\" : 1356351330500 } }", + 1356351330500); + test_bson_json_date_check ("{ \"dt\" : { \"$date\" : -62135593139000 } }", + -62135593139000); + + /* INT64_MAX */ + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : 9223372036854775807 } }", INT64_MAX); + + /* INT64_MIN */ + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : -9223372036854775808 } }", INT64_MIN); + + /* INT64_MAX + 1 */ + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : 9223372036854775808 } }", + "Number \"9223372036854775808\" is out of range"); + + /* INT64_MIN - 1 */ + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : -9223372036854775809 } }", + "Number \"-9223372036854775809\" is out of range"); + + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : 10000000000000000000 } }", + "Number \"10000000000000000000\" is out of range"); + + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : -10000000000000000000 } }", + "Number \"-10000000000000000000\" is out of range"); +} + + +static void +test_bson_json_date_numberlong (void) +{ + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : {\"$numberLong\": \"0\" } } }", 0); + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : {\"$numberLong\": \"1356351330500\" } } }", + 1356351330500); + test_bson_json_date_check ( + "{ \"dt\" : { \"$date\" : { \"$numberLong\" : \"-62135593139000\" } } }", + -62135593139000); + + /* INT64_MAX */ + test_bson_json_date_check ("{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"9223372036854775807\" } } }", + INT64_MAX); + + /* INT64_MIN */ + test_bson_json_date_check ("{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"-9223372036854775808\" } } }", + INT64_MIN); + + /* INT64_MAX + 1 */ + test_bson_json_date_error ("{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"9223372036854775808\" } } }", + "Number \"9223372036854775808\" is out of range"); + + /* INT64_MIN - 1 */ + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"-9223372036854775809\" } } }", + "Number \"-9223372036854775809\" is out of range"); + + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"10000000000000000000\" } } }", + "Number \"10000000000000000000\" is out of range"); + + test_bson_json_date_error ( + "{ \"dt\" : { \"$date\" : { \"$numberLong\" " + ": \"-10000000000000000000\" } } }", + "Number \"-10000000000000000000\" is out of range"); +} + + +static void +test_bson_json_timestamp (void) +{ + bson_error_t error = {0}; + bson_t b, compare; + bool r; + + bson_init (&compare); + + BSON_APPEND_TIMESTAMP ( + &compare, "ts", (uint32_t) 1486785977, (uint32_t) 1234); + + r = bson_init_from_json ( + &b, + "{\"ts\": {\"$timestamp\": {\"t\": 1486785977, \"i\": 1234}}}", + -1, + &error); + + if (!r) { + fprintf (stderr, "%s\n", error.message); + } + + BSON_ASSERT (r); + + bson_eq_bson (&b, &compare); + bson_destroy (&compare); + bson_destroy (&b); +} + + +static void +test_bson_array_as_json (void) +{ + bson_t d = BSON_INITIALIZER; + size_t len; + char *str; + + str = bson_array_as_json (&d, &len); + BSON_ASSERT (0 == strcmp (str, "[ ]")); + BSON_ASSERT (len == 3); + bson_free (str); + + BSON_APPEND_INT32 (&d, "0", 1); + str = bson_array_as_json (&d, &len); + BSON_ASSERT (0 == strcmp (str, "[ 1 ]")); + BSON_ASSERT (len == 5); + bson_free (str); + + /* test corrupted bson */ + BSON_APPEND_UTF8 (&d, "1", "\x80"); /* bad UTF-8 */ + str = bson_array_as_json (&d, &len); + BSON_ASSERT (!str); + BSON_ASSERT (!len); + + bson_destroy (&d); +} + + +static void +test_bson_as_json_spacing (void) +{ + bson_t d = BSON_INITIALIZER; + size_t len; + char *str; + + str = bson_as_json (&d, &len); + BSON_ASSERT (0 == strcmp (str, "{ }")); + BSON_ASSERT (len == 3); + bson_free (str); + + BSON_APPEND_INT32 (&d, "a", 1); + str = bson_as_json (&d, &len); + BSON_ASSERT (0 == strcmp (str, "{ \"a\" : 1 }")); + BSON_ASSERT (len == 11); + bson_free (str); + + bson_destroy (&d); +} + + +static void +test_bson_json_errors (void) +{ + typedef const char *test_bson_json_error_t[2]; + test_bson_json_error_t tests[] = { + {"{\"x\": {\"$numberLong\": 1}}", + "Invalid state for integer read: INT64"}, + {"{\"x\": {\"$binary\": 1}}", "Unexpected integer 1 in type \"binary\""}, + {"{\"x\": {\"$numberInt\": true}}", + "Invalid read of boolean in state IN_BSON_TYPE"}, + {"{\"x\": {\"$dbPointer\": true}}", + "Invalid read of boolean in state IN_BSON_TYPE_DBPOINTER_STARTMAP"}, + {"{\"x\": {\"$numberInt\": \"8589934592\"}}", + "Invalid input string \"8589934592\", looking for INT32"}, + {0}, + }; + + bson_error_t error; + test_bson_json_error_t *p; + + for (p = tests; *(p[0]); p++) { + BSON_ASSERT (!bson_new_from_json ((const uint8_t *) (*p)[0], -1, &error)); + ASSERT_ERROR_CONTAINS ( + error, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_INVALID_PARAM, (*p)[1]); + } +} + + +static void +test_bson_integer_width (void) +{ + const char *sd = "{\"v\":-1234567890123, \"x\":12345678901234}"; + char *match; + bson_error_t err; + bson_t *bs = bson_new_from_json ((const uint8_t *) sd, strlen (sd), &err); + + match = bson_as_json (bs, 0); + ASSERT_CMPSTR (match, "{ \"v\" : -1234567890123, \"x\" : 12345678901234 }"); + + bson_free (match); + bson_destroy (bs); +} + + +static void +test_bson_json_null_in_str (void) +{ + const char bad_json[] = "{\"a\":\"\0\"}"; + const char cdriver2305[] = "{\"\0"; + bson_error_t err; + ASSERT (!bson_new_from_json ( + (const uint8_t *) bad_json, sizeof (bad_json) - 1, &err)); + ASSERT_ERROR_CONTAINS ( + err, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_CORRUPT_JS, "Got parse error"); + memset (&err, 0, sizeof err); + ASSERT (!bson_new_from_json ( + (const uint8_t *) cdriver2305, sizeof (cdriver2305) - 1, &err)); + ASSERT_ERROR_CONTAINS ( + err, BSON_ERROR_JSON, BSON_JSON_ERROR_READ_CORRUPT_JS, "Got parse error"); +} + +static char * +_single_to_double (const char *json) +{ + char *copy; + char *to_ret = copy = bson_malloc (strlen (json) + 1); + strcpy (copy, json); + while (*copy) { + if (*copy == '\'') { + *copy = '\"'; + } else { + copy++; + } + } + return to_ret; +} + +static void +_test_json_produces_multiple (const char *json_in, int err_expected, ...) +{ + bson_t bson_in = BSON_INITIALIZER; + bson_t *bson_expected; + bson_error_t err = {0}; + int ret; + va_list ap; + char *json = _single_to_double (json_in); + bson_json_reader_t *reader = + bson_json_data_reader_new (false /* ignored */, 512 /* buffer size */); + + va_start (ap, err_expected); + + bson_json_data_reader_ingest (reader, (uint8_t *) json, strlen (json)); + while ((ret = bson_json_reader_read (reader, &bson_in, &err)) == 1) { + bson_expected = va_arg (ap, bson_t *); + if (!bson_expected) { + fprintf (stderr, "Extra bson documents returned for input %s\n", json); + abort (); + } + if (bson_compare (&bson_in, bson_expected) != 0) { + char *expect = bson_as_json (bson_expected, NULL); + char *in = bson_as_json (&bson_in, NULL); + fprintf ( + stderr, "Got %s, but expected %s for input %s\n", expect, in, json); + bson_free (expect); + bson_free (in); + abort (); + } + bson_destroy (bson_expected); + bson_reinit (&bson_in); + } + + if (ret == 0) { + ASSERT (!err_expected); + } else { + ASSERT_OR_PRINT (err_expected, err); + } + + if (va_arg (ap, bson_t *) != NULL) { + fprintf (stderr, "Not all bson docs matched for input %s\n", json); + abort (); + } + + va_end (ap); + + bson_json_reader_destroy (reader); + bson_destroy (&bson_in); + bson_free (json); +} + +#define TEST_JSON_PRODUCES_MULTIPLE(_json, _has_err, ...) \ + _test_json_produces_multiple (_json, _has_err, __VA_ARGS__, NULL); + +static void +test_bson_as_json_multi_object (void) +{ + /* Test malformed documents that produce errors */ + TEST_JSON_PRODUCES_MULTIPLE ("[],[{''", 1, NULL); + + TEST_JSON_PRODUCES_MULTIPLE ("{},[{''", 1, NULL); + + + /* Test the desired multiple document behavior */ + TEST_JSON_PRODUCES_MULTIPLE ("{'a': 1} {'b': 1}", + 0, + BCON_NEW ("a", BCON_INT32 (1)), + BCON_NEW ("b", BCON_INT32 (1))); + + TEST_JSON_PRODUCES_MULTIPLE ( + "{}{}{}", 0, bson_new (), bson_new (), bson_new ()); + + /* Test strange behavior we may consider changing */ + + /* Combines both documents into one? */ + TEST_JSON_PRODUCES_MULTIPLE ( + "{'a': 1}, {'b': 1}", + 0, + BCON_NEW ("a", BCON_INT32 (1), "b", BCON_INT32 (1))); + + TEST_JSON_PRODUCES_MULTIPLE ( + "{},{'a': 1}", 0, BCON_NEW ("a", BCON_INT32 (1))); + + TEST_JSON_PRODUCES_MULTIPLE ( + "{},{},{'a': 1}", 0, BCON_NEW ("a", BCON_INT32 (1))); + + TEST_JSON_PRODUCES_MULTIPLE ( + "[],{'a': 1}", 0, BCON_NEW ("a", BCON_INT32 (1))); + + /* We support a root level array */ + TEST_JSON_PRODUCES_MULTIPLE ("[]", 0, bson_new ()); + + TEST_JSON_PRODUCES_MULTIPLE ( + "[{'x': 0}]", 0, BCON_NEW ("0", "{", "x", BCON_INT32 (0), "}")); + + /* Yet this fails */ + TEST_JSON_PRODUCES_MULTIPLE ("[],[{'a': 1}]", 1, NULL); +} + +void +test_json_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/as_json/x1000", test_bson_as_json_x1000); + TestSuite_Add (suite, "/bson/as_json/multi", test_bson_as_json_multi); + TestSuite_Add (suite, "/bson/as_json/string", test_bson_as_json_string); + TestSuite_Add (suite, "/bson/as_json/int32", test_bson_as_json_int32); + TestSuite_Add (suite, "/bson/as_json/int64", test_bson_as_json_int64); + TestSuite_Add (suite, "/bson/as_json/double", test_bson_as_json_double); +#if defined(NAN) && defined(INFINITY) + TestSuite_Add (suite, + "/bson/as_json/double/nonfinite", + test_bson_as_json_double_nonfinite); +#endif + TestSuite_Add (suite, "/bson/as_json/code", test_bson_as_json_code); + TestSuite_Add ( + suite, "/bson/as_json/date_time", test_bson_as_json_date_time); + TestSuite_Add (suite, "/bson/as_json/regex", test_bson_as_json_regex); + TestSuite_Add (suite, "/bson/as_json/symbol", test_bson_as_json_symbol); + TestSuite_Add (suite, "/bson/as_json/utf8", test_bson_as_json_utf8); + TestSuite_Add ( + suite, "/bson/as_json/dbpointer", test_bson_as_json_dbpointer); + TestSuite_Add (suite, + "/bson/as_canonical_extended_json/dbpointer", + test_bson_as_canonical_extended_json_dbpointer); + TestSuite_Add ( + suite, "/bson/as_json/stack_overflow", test_bson_as_json_stack_overflow); + TestSuite_Add (suite, "/bson/as_json/corrupt", test_bson_corrupt); + TestSuite_Add (suite, "/bson/as_json/corrupt_utf8", test_bson_corrupt_utf8); + TestSuite_Add ( + suite, "/bson/as_json/corrupt_binary", test_bson_corrupt_binary); + TestSuite_Add (suite, "/bson/as_json_spacing", test_bson_as_json_spacing); + TestSuite_Add (suite, "/bson/array_as_json", test_bson_array_as_json); + TestSuite_Add ( + suite, "/bson/json/allow_multiple", test_bson_json_allow_multiple); + TestSuite_Add ( + suite, "/bson/json/read/buffering", test_bson_json_read_buffering); + TestSuite_Add (suite, "/bson/json/read", test_bson_json_read); + TestSuite_Add (suite, "/bson/json/inc", test_bson_json_inc); + TestSuite_Add (suite, "/bson/json/array", test_bson_json_array); + TestSuite_Add ( + suite, "/bson/json/array/single", test_bson_json_array_single); + TestSuite_Add (suite, "/bson/json/array/int64", test_bson_json_array_int64); + TestSuite_Add ( + suite, "/bson/json/array/subdoc", test_bson_json_array_subdoc); + TestSuite_Add (suite, "/bson/json/date", test_bson_json_date); + TestSuite_Add (suite, "/bson/json/date/legacy", test_bson_json_date_legacy); + TestSuite_Add ( + suite, "/bson/json/date/long", test_bson_json_date_numberlong); + TestSuite_Add (suite, "/bson/json/timestamp", test_bson_json_timestamp); + TestSuite_Add (suite, "/bson/json/read/empty", test_bson_json_read_empty); + TestSuite_Add (suite, + "/bson/json/read/missing_complex", + test_bson_json_read_missing_complex); + TestSuite_Add (suite, + "/bson/json/read/invalid_binary", + test_bson_json_read_invalid_binary); + TestSuite_Add ( + suite, "/bson/json/read/invalid_json", test_bson_json_read_invalid_json); + TestSuite_Add (suite, "/bson/json/read/bad_cb", test_bson_json_read_bad_cb); + TestSuite_Add ( + suite, "/bson/json/read/invalid", test_bson_json_read_invalid); + TestSuite_Add ( + suite, "/bson/json/read/raw_utf8", test_bson_json_read_raw_utf8); + TestSuite_Add ( + suite, "/bson/json/read/corrupt_utf8", test_bson_json_read_corrupt_utf8); + TestSuite_Add (suite, + "/bson/json/read/corrupt_document", + test_bson_json_read_corrupt_document); + TestSuite_Add ( + suite, "/bson/json/read/decimal128", test_bson_json_read_decimal128); + TestSuite_Add ( + suite, "/bson/json/read/dbpointer", test_bson_json_read_dbpointer); + TestSuite_Add ( + suite, "/bson/json/read/legacy_regex", test_bson_json_read_legacy_regex); + TestSuite_Add (suite, + "/bson/json/read/regex_options_order", + test_bson_json_read_regex_options_order); + TestSuite_Add (suite, "/bson/json/read/binary", test_bson_json_read_binary); + TestSuite_Add (suite, + "/bson/json/read/legacy_binary", + test_bson_json_read_legacy_binary); + TestSuite_Add ( + suite, "/bson/json/read/file", test_json_reader_new_from_file); + TestSuite_Add ( + suite, "/bson/json/read/bad_path", test_json_reader_new_from_bad_path); + TestSuite_Add ( + suite, "/bson/json/read/$numberLong", test_bson_json_number_long); + TestSuite_Add (suite, + "/bson/json/read/$numberLong/zero", + test_bson_json_number_long_zero); + TestSuite_Add (suite, "/bson/json/read/code", test_bson_json_code); + TestSuite_Add ( + suite, "/bson/json/read/code/errors", test_bson_json_code_errors); + TestSuite_Add (suite, "/bson/json/read/dbref", test_bson_json_dbref); + TestSuite_Add (suite, "/bson/json/read/uescape", test_bson_json_uescape); + TestSuite_Add ( + suite, "/bson/json/read/uescape/key", test_bson_json_uescape_key); + TestSuite_Add ( + suite, "/bson/json/read/uescape/bad", test_bson_json_uescape_bad); + TestSuite_Add (suite, "/bson/json/read/int32", test_bson_json_int32); + TestSuite_Add (suite, "/bson/json/read/int64", test_bson_json_int64); + TestSuite_Add (suite, "/bson/json/read/double", test_bson_json_double); + TestSuite_Add ( + suite, "/bson/json/read/double/overflow", test_bson_json_double_overflow); + TestSuite_Add (suite, "/bson/json/read/double/nan", test_bson_json_nan); + TestSuite_Add ( + suite, "/bson/json/read/double/infinity", test_bson_json_infinity); + TestSuite_Add (suite, "/bson/json/read/null", test_bson_json_null); + TestSuite_Add ( + suite, "/bson/json/read/empty_final", test_bson_json_empty_final_object); + TestSuite_Add ( + suite, "/bson/as_json/decimal128", test_bson_as_json_decimal128); + TestSuite_Add ( + suite, "/bson/json/read/$numberDecimal", test_bson_json_number_decimal); + TestSuite_Add (suite, "/bson/json/errors", test_bson_json_errors); + TestSuite_Add (suite, "/bson/integer/width", test_bson_integer_width); + TestSuite_Add ( + suite, "/bson/json/read/null_in_str", test_bson_json_null_in_str); + TestSuite_Add ( + suite, "/bson/as_json/multi_object", test_bson_as_json_multi_object); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-oid.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-oid.c new file mode 100644 index 0000000..50f50b6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-oid.c @@ -0,0 +1,353 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#define BSON_INSIDE +#include "common-thread-private.h" +#undef BSON_INSIDE + +#ifdef BSON_HAVE_STRINGS_H +#include +#endif + +#include "TestSuite.h" + +#define N_THREADS 4 + +static const char *gTestOids[] = {"000000000000000000000000", + "010101010101010101010101", + "0123456789abcdefafcdef03", + "fcdeab182763817236817236", + "ffffffffffffffffffffffff", + "eeeeeeeeeeeeeeeeeeeeeeee", + "999999999999999999999999", + "111111111111111111111111", + NULL}; + +static const char *gTestOidsCase[] = {"0123456789ABCDEFAFCDEF03", + "FCDEAB182763817236817236", + "FFFFFFFFFFFFFFFFFFFFFFFF", + "EEEEEEEEEEEEEEEEEEEEEEEE", + "01234567890ACBCDEFabcdef", + NULL}; + +static const char *gTestOidsFail[] = {" ", + "abasdf ", + "asdfasdfasdfasdfasdf ", + "00000000000000000000000z", + "00187263123ghh21382812a8", + NULL}; + +static void * +oid_worker (void *data) +{ + bson_context_t *context = data; + bson_oid_t oid; + bson_oid_t oid2; + int i; + + bson_oid_init (&oid2, context); + for (i = 0; i < 500000; i++) { + bson_oid_init (&oid, context); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); + BSON_ASSERT (0 < bson_oid_compare (&oid, &oid2)); + bson_oid_copy (&oid, &oid2); + } + + return NULL; +} + +static void +test_bson_oid_init_from_string (void) +{ + bson_context_t *context; + bson_oid_t oid; + char str[25]; + int i; + + context = bson_context_new (BSON_CONTEXT_NONE); + + /* + * Test successfully parsed oids. + */ + + for (i = 0; gTestOids[i]; i++) { + bson_oid_init_from_string (&oid, gTestOids[i]); + bson_oid_to_string (&oid, str); + BSON_ASSERT (!strcmp (str, gTestOids[i])); + } + + /* + * Test successfully parsed oids (case-insensitive). + */ + for (i = 0; gTestOidsCase[i]; i++) { + char oid_lower[25]; + int j; + + bson_oid_init_from_string (&oid, gTestOidsCase[i]); + bson_oid_to_string (&oid, str); + BSON_ASSERT (!bson_strcasecmp (str, gTestOidsCase[i])); + + for (j = 0; gTestOidsCase[i][j]; j++) { + oid_lower[j] = tolower (gTestOidsCase[i][j]); + } + + oid_lower[24] = '\0'; + BSON_ASSERT (!strcmp (str, oid_lower)); + } + + /* + * Test that sizeof(str) works (len of 25 with \0 instead of 24). + */ + BSON_ASSERT (bson_oid_is_valid ("ffffffffffffffffffffffff", 24)); + bson_oid_init_from_string (&oid, "ffffffffffffffffffffffff"); + bson_oid_to_string (&oid, str); + BSON_ASSERT (bson_oid_is_valid (str, sizeof str)); + + /* + * Test the failures. + */ + + for (i = 0; gTestOidsFail[i]; i++) { + bson_oid_init_from_string (&oid, gTestOidsFail[i]); + bson_oid_to_string (&oid, str); + BSON_ASSERT (strcmp (str, gTestOidsFail[i])); + } + + bson_context_destroy (context); +} + + +static void +test_bson_oid_hash (void) +{ + bson_oid_t oid; + + bson_oid_init_from_string (&oid, "000000000000000000000000"); + BSON_ASSERT (bson_oid_hash (&oid) == 1487062149); +} + + +static void +test_bson_oid_compare (void) +{ + bson_oid_t oid; + bson_oid_t oid2; + + bson_oid_init_from_string (&oid, "000000000000000000001234"); + bson_oid_init_from_string (&oid2, "000000000000000000001234"); + BSON_ASSERT (0 == bson_oid_compare (&oid, &oid2)); + BSON_ASSERT (true == bson_oid_equal (&oid, &oid2)); + + bson_oid_init_from_string (&oid, "000000000000000000001234"); + bson_oid_init_from_string (&oid2, "000000000000000000004321"); + BSON_ASSERT (bson_oid_compare (&oid, &oid2) < 0); + BSON_ASSERT (bson_oid_compare (&oid2, &oid) > 0); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); +} + + +static void +test_bson_oid_copy (void) +{ + bson_oid_t oid; + bson_oid_t oid2; + + bson_oid_init_from_string (&oid, "000000000000000000001234"); + bson_oid_init_from_string (&oid2, "000000000000000000004321"); + bson_oid_copy (&oid, &oid2); + BSON_ASSERT (true == bson_oid_equal (&oid, &oid2)); +} + + +static void +test_bson_oid_init (void) +{ + bson_context_t *context; + bson_oid_t oid; + bson_oid_t oid2; + int i; + + context = bson_context_new (BSON_CONTEXT_NONE); + bson_oid_init (&oid, context); + for (i = 0; i < 10000; i++) { + bson_oid_init (&oid2, context); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); + BSON_ASSERT (0 > bson_oid_compare (&oid, &oid2)); + bson_oid_copy (&oid2, &oid); + } + bson_context_destroy (context); + + /* + * Test that the shared context works. + */ + bson_oid_init (&oid, NULL); + BSON_ASSERT (bson_context_get_default ()); +} + + +static void +test_bson_oid_init_sequence (void) +{ + bson_context_t *context; + bson_oid_t oid; + bson_oid_t oid2; + int i; + + context = bson_context_new (BSON_CONTEXT_NONE); + bson_oid_init_sequence (&oid, context); + for (i = 0; i < 10000; i++) { + bson_oid_init_sequence (&oid2, context); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); + BSON_ASSERT (0 > bson_oid_compare (&oid, &oid2)); + bson_oid_copy (&oid2, &oid); + } + bson_context_destroy (context); +} + + +static void +test_bson_oid_init_sequence_thread_safe (void) +{ + bson_context_t *context; + bson_oid_t oid; + bson_oid_t oid2; + int i; + + context = bson_context_new (BSON_CONTEXT_THREAD_SAFE); + bson_oid_init_sequence (&oid, context); + for (i = 0; i < 10000; i++) { + bson_oid_init_sequence (&oid2, context); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); + BSON_ASSERT (0 > bson_oid_compare (&oid, &oid2)); + bson_oid_copy (&oid2, &oid); + } + bson_context_destroy (context); +} + + +#ifdef BSON_HAVE_SYSCALL_TID +static void +test_bson_oid_init_sequence_with_tid (void) +{ + bson_context_t *context; + bson_oid_t oid; + bson_oid_t oid2; + int i; + + context = bson_context_new (BSON_CONTEXT_USE_TASK_ID); + bson_oid_init_sequence (&oid, context); + for (i = 0; i < 10000; i++) { + bson_oid_init_sequence (&oid2, context); + BSON_ASSERT (false == bson_oid_equal (&oid, &oid2)); + BSON_ASSERT (0 > bson_oid_compare (&oid, &oid2)); + bson_oid_copy (&oid2, &oid); + } + bson_context_destroy (context); +} +#endif + + +static void +test_bson_oid_get_time_t (void) +{ + bson_context_t *context; + bson_oid_t oid; + uint32_t start = (uint32_t) time (NULL); + + context = bson_context_new (BSON_CONTEXT_NONE); + bson_oid_init (&oid, context); + ASSERT_CMPUINT32 ((uint32_t) bson_oid_get_time_t (&oid), >=, start); + ASSERT_CMPUINT32 ( + (uint32_t) bson_oid_get_time_t (&oid), <=, (uint32_t) time (NULL)); + + bson_context_destroy (context); +} + + +static void +test_bson_oid_init_with_threads (void) +{ + bson_context_t *context; + int i; + + { + bson_context_flags_t flags = BSON_CONTEXT_NONE; + bson_context_t *contexts[N_THREADS]; + bson_thread_t threads[N_THREADS]; + +#ifdef BSON_HAVE_SYSCALL_TID + flags |= BSON_CONTEXT_USE_TASK_ID; +#endif + + for (i = 0; i < N_THREADS; i++) { + contexts[i] = bson_context_new (flags); + bson_thread_create (&threads[i], oid_worker, contexts[i]); + } + + for (i = 0; i < N_THREADS; i++) { + bson_thread_join (threads[i]); + } + + for (i = 0; i < N_THREADS; i++) { + bson_context_destroy (contexts[i]); + } + } + + /* + * Test threaded generation of oids using a single context; + */ + { + bson_thread_t threads[N_THREADS]; + + context = bson_context_new (BSON_CONTEXT_THREAD_SAFE); + + for (i = 0; i < N_THREADS; i++) { + bson_thread_create (&threads[i], oid_worker, context); + } + + for (i = 0; i < N_THREADS; i++) { + bson_thread_join (threads[i]); + } + + bson_context_destroy (context); + } +} + +void +test_oid_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/oid/init", test_bson_oid_init); + TestSuite_Add ( + suite, "/bson/oid/init_from_string", test_bson_oid_init_from_string); + TestSuite_Add ( + suite, "/bson/oid/init_sequence", test_bson_oid_init_sequence); + TestSuite_Add (suite, + "/bson/oid/init_sequence_thread_safe", + test_bson_oid_init_sequence_thread_safe); +#ifdef BSON_HAVE_SYSCALL_TID + TestSuite_Add (suite, + "/bson/oid/init_sequence_with_tid", + test_bson_oid_init_sequence_with_tid); +#endif + TestSuite_Add ( + suite, "/bson/oid/init_with_threads", test_bson_oid_init_with_threads); + TestSuite_Add (suite, "/bson/oid/hash", test_bson_oid_hash); + TestSuite_Add (suite, "/bson/oid/compare", test_bson_oid_compare); + TestSuite_Add (suite, "/bson/oid/copy", test_bson_oid_copy); + TestSuite_Add (suite, "/bson/oid/get_time_t", test_bson_oid_get_time_t); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-reader.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-reader.c new file mode 100644 index 0000000..9c6b6e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-reader.c @@ -0,0 +1,331 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "TestSuite.h" + + +static void +test_reader_from_data (void) +{ + bson_reader_t *reader; + uint8_t *buffer; + const bson_t *b; + uint32_t i; + bool eof = false; + + buffer = bson_malloc0 (4095); + for (i = 0; i < 4095; i += 5) { + buffer[i] = 5; + } + + reader = bson_reader_new_from_data (buffer, 4095); + + for (i = 0; (b = bson_reader_read (reader, &eof)); i++) { + const uint8_t *buf = bson_get_data (b); + + /* do nothing */ + BSON_ASSERT (b->len == 5); + BSON_ASSERT (buf[0] == 5); + BSON_ASSERT (buf[1] == 0); + BSON_ASSERT (buf[2] == 0); + BSON_ASSERT (buf[3] == 0); + BSON_ASSERT (buf[4] == 0); + } + + BSON_ASSERT (i == (4095 / 5)); + + ASSERT_CMPINT (eof, ==, true); + + bson_free (buffer); + + bson_reader_destroy (reader); +} + + +static void +test_reader_from_data_overflow (void) +{ + bson_reader_t *reader; + uint8_t *buffer; + const bson_t *b; + uint32_t i; + bool eof = false; + + buffer = bson_malloc0 (4096); + for (i = 0; i < 4095; i += 5) { + buffer[i] = 5; + } + + buffer[4095] = 5; + + reader = bson_reader_new_from_data (buffer, 4096); + + for (i = 0; (b = bson_reader_read (reader, &eof)); i++) { + const uint8_t *buf = bson_get_data (b); + BSON_ASSERT (b->len == 5); + BSON_ASSERT (buf[0] == 5); + BSON_ASSERT (buf[1] == 0); + BSON_ASSERT (buf[2] == 0); + BSON_ASSERT (buf[3] == 0); + BSON_ASSERT (buf[4] == 0); + eof = false; + } + + BSON_ASSERT (i == (4095 / 5)); + + ASSERT_CMPINT (eof, ==, false); + + bson_free (buffer); + + bson_reader_destroy (reader); +} + +static void +test_reader_from_data_document_length_too_large (void) +{ + bson_reader_t *reader; + uint8_t *buffer; + bool eof = false; + + buffer = bson_malloc0 (5); + buffer[0] = 6; + + reader = bson_reader_new_from_data (buffer, 5); + BSON_ASSERT (!bson_reader_read (reader, &eof)); + ASSERT_CMPINT (eof, ==, false); + + bson_free (buffer); + + bson_reader_destroy (reader); +} + +static void +test_reader_from_data_document_length_too_small (void) +{ + bson_reader_t *reader; + uint8_t *buffer; + bool eof = false; + + buffer = bson_malloc0 (5); + buffer[0] = 4; + + reader = bson_reader_new_from_data (buffer, 5); + BSON_ASSERT (!bson_reader_read (reader, &eof)); + ASSERT_CMPINT (eof, ==, false); + + bson_free (buffer); + + bson_reader_destroy (reader); +} + +static ssize_t +test_reader_from_handle_read (void *handle, void *buf, size_t len) +{ + return bson_read (*(int *) handle, buf, len); +} + +static void +test_reader_from_handle_destroy (void *handle) +{ + bson_close (*(int *) handle); +} + +static void +test_reader_from_handle (void) +{ + bson_reader_t *reader; + const bson_t *b; + bson_iter_t iter; + uint32_t i; + bool eof = true; + int fd; + + fd = bson_open (BSON_BINARY_DIR "/stream.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + reader = bson_reader_new_from_handle ((void *) &fd, + &test_reader_from_handle_read, + &test_reader_from_handle_destroy); + + for (i = 0; i < 1000; i++) { + eof = false; + b = bson_reader_read (reader, &eof); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + } + + ASSERT_CMPINT (eof, ==, false); + b = bson_reader_read (reader, &eof); + BSON_ASSERT (!b); + ASSERT_CMPINT (eof, ==, true); + bson_reader_destroy (reader); +} + + +static void +test_reader_tell (void) +{ + bson_reader_t *reader; + const bson_t *b; + uint32_t i; + bson_iter_t iter; + bool eof = true; + int fd; + + fd = bson_open (BSON_BINARY_DIR "/stream.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + reader = bson_reader_new_from_handle ((void *) &fd, + &test_reader_from_handle_read, + &test_reader_from_handle_destroy); + + for (i = 0; i < 1000; i++) { + if (i) { + ASSERT_CMPINT (5 * i, ==, (int) bson_reader_tell (reader)); + } else { + ASSERT_CMPINT (0, ==, (int) bson_reader_tell (reader)); + } + eof = false; + b = bson_reader_read (reader, &eof); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + } + + ASSERT_CMPINT (5000, ==, (int) bson_reader_tell (reader)); + ASSERT (!eof); + b = bson_reader_read (reader, &eof); + BSON_ASSERT (!b); + BSON_ASSERT (eof); + bson_reader_destroy (reader); +} + + +static void +test_reader_from_handle_corrupt (void) +{ + bson_reader_t *reader; + const bson_t *b; + uint32_t i; + bson_iter_t iter; + bool eof; + int fd; + + fd = bson_open (BSON_BINARY_DIR "/stream_corrupt.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + reader = bson_reader_new_from_handle ((void *) &fd, + &test_reader_from_handle_read, + &test_reader_from_handle_destroy); + + for (i = 0; i < 1000; i++) { + b = bson_reader_read (reader, &eof); + BSON_ASSERT (b); + BSON_ASSERT (bson_iter_init (&iter, b)); + BSON_ASSERT (!bson_iter_next (&iter)); + } + + b = bson_reader_read (reader, &eof); + BSON_ASSERT (!b); + bson_reader_destroy (reader); +} + + +static void +test_reader_grow_buffer (void) +{ + bson_reader_t *reader; + const bson_t *b; + bool eof = false; + int fd; + + fd = bson_open (BSON_BINARY_DIR "/readergrow.bson", O_RDONLY); + BSON_ASSERT (-1 != fd); + + reader = bson_reader_new_from_handle ((void *) &fd, + &test_reader_from_handle_read, + &test_reader_from_handle_destroy); + + b = bson_reader_read (reader, &eof); + BSON_ASSERT (b); + BSON_ASSERT (!eof); + + b = bson_reader_read (reader, &eof); + BSON_ASSERT (!b); + BSON_ASSERT (eof); + + bson_reader_destroy (reader); +} + + +static void +test_reader_reset (void) +{ + uint8_t buffer[10]; + bson_reader_t *reader; + bool eof; + + memset (buffer, 0, sizeof buffer); + + /* two empty bson documents, length prefix indicates 5 bytes */ + buffer[0] = buffer[5] = 5; + + reader = bson_reader_new_from_data (buffer, sizeof buffer); + + BSON_ASSERT (bson_reader_read (reader, &eof)->len == 5 && !eof); + BSON_ASSERT (bson_reader_read (reader, &eof)->len == 5 && !eof); + BSON_ASSERT (!bson_reader_read (reader, &eof) && eof); + BSON_ASSERT (bson_reader_tell (reader) == 10); + + bson_reader_reset (reader); + + BSON_ASSERT (bson_reader_tell (reader) == 0); + BSON_ASSERT (bson_reader_read (reader, &eof)->len == 5 && !eof); + BSON_ASSERT (bson_reader_read (reader, &eof)->len == 5 && !eof); + BSON_ASSERT (!bson_reader_read (reader, &eof) && eof); + BSON_ASSERT (bson_reader_tell (reader) == 10); + + bson_reader_destroy (reader); +} + + +void +test_reader_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/reader/new_from_data", test_reader_from_data); + TestSuite_Add (suite, + "/bson/reader/new_from_data_overflow", + test_reader_from_data_overflow); + TestSuite_Add (suite, + "/bson/reader/new_from_data_document_length_too_large", + test_reader_from_data_document_length_too_large); + TestSuite_Add (suite, + "/bson/reader/new_from_data_document_length_too_small", + test_reader_from_data_document_length_too_small); + TestSuite_Add ( + suite, "/bson/reader/new_from_handle", test_reader_from_handle); + TestSuite_Add (suite, "/bson/reader/tell", test_reader_tell); + TestSuite_Add (suite, + "/bson/reader/new_from_handle_corrupt", + test_reader_from_handle_corrupt); + TestSuite_Add (suite, "/bson/reader/grow_buffer", test_reader_grow_buffer); + TestSuite_Add (suite, "/bson/reader/reset", test_reader_reset); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-string.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-string.c new file mode 100644 index 0000000..8efd004 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-string.c @@ -0,0 +1,326 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "TestSuite.h" + + +static void +test_bson_string_new (void) +{ + bson_string_t *str; + char *s; + + str = bson_string_new (NULL); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, "")); + bson_free (s); + + str = bson_string_new (""); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!*s); + BSON_ASSERT (0 == strcmp (s, "")); + bson_free (s); + + str = bson_string_new ("abcdef"); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, "abcdef")); + bson_free (s); + + str = bson_string_new (""); + s = bson_string_free (str, true); + BSON_ASSERT (!s); +} + + +static void +test_bson_string_append (void) +{ + bson_string_t *str; + char *s; + + str = bson_string_new (NULL); + bson_string_append (str, "christian was here"); + bson_string_append (str, "\n"); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, "christian was here\n")); + bson_free (s); + + str = bson_string_new (">>>"); + bson_string_append (str, "^^^"); + bson_string_append (str, "<<<"); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, ">>>^^^<<<")); + bson_free (s); +} + + +static void +test_bson_string_append_c (void) +{ + bson_string_t *str; + char *s; + + str = bson_string_new (NULL); + bson_string_append_c (str, 'c'); + bson_string_append_c (str, 'h'); + bson_string_append_c (str, 'r'); + bson_string_append_c (str, 'i'); + bson_string_append_c (str, 's'); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, "chris")); + bson_free (s); +} + + +static void +test_bson_string_append_printf (void) +{ + bson_string_t *str; + + str = bson_string_new ("abcd "); + bson_string_append_printf (str, "%d %d %d", 1, 2, 3); + BSON_ASSERT (!strcmp (str->str, "abcd 1 2 3")); + bson_string_truncate (str, 2); + BSON_ASSERT (!strcmp (str->str, "ab")); + bson_string_free (str, true); +} + + +static void +test_bson_string_append_unichar (void) +{ + static const unsigned char test1[] = {0xe2, 0x82, 0xac, 0}; + bson_string_t *str; + char *s; + + str = bson_string_new (NULL); + bson_string_append_unichar (str, 0x20AC); + s = bson_string_free (str, false); + BSON_ASSERT (s); + BSON_ASSERT (!strcmp (s, (const char *) test1)); + bson_free (s); +} + + +static void +test_bson_strdup_printf (void) +{ + char *s; + + s = bson_strdup_printf ("%s:%u", "localhost", 27017); + BSON_ASSERT (!strcmp (s, "localhost:27017")); + bson_free (s); +} + + +static void +test_bson_strdup (void) +{ + char *s; + + s = bson_strdup ("localhost:27017"); + BSON_ASSERT (!strcmp (s, "localhost:27017")); + bson_free (s); +} + + +static void +test_bson_strndup (void) +{ + char *s; + + s = bson_strndup ("asdf", 2); + BSON_ASSERT (!strcmp (s, "as")); + bson_free (s); + + s = bson_strndup ("asdf", 10); + BSON_ASSERT (!strcmp (s, "asdf")); + bson_free (s); + + /* Some tests where we truncate to size n-1, n, n+1 */ + s = bson_strndup ("asdf", 3); + BSON_ASSERT (!strcmp (s, "asd")); + bson_free (s); + + s = bson_strndup ("asdf", 4); + BSON_ASSERT (!strcmp (s, "asdf")); + bson_free (s); + + s = bson_strndup ("asdf", 5); + BSON_ASSERT (!strcmp (s, "asdf")); + bson_free (s); +} + + +static void +test_bson_strnlen (void) +{ + char *s = "test"; + + ASSERT_CMPINT ((int) strlen (s), ==, (int) bson_strnlen (s, 100)); +} + + +typedef struct { + const char *str; + int base; + int64_t rv; + const char *remaining; + int _errno; +} strtoll_test; + + +static void +test_bson_ascii_strtoll (void) +{ +#ifdef END +#undef END +#endif +#define END "" + int64_t rv; + int i; + char *endptr; + strtoll_test tests[] = { + /* input, base, expected output, # of chars parsed, expected errno */ + {"1", 10, 1, END, 0}, + {"+1", 10, 1, END, 0}, + {"-1", 10, -1, END, 0}, + {"0", 10, 0, END, 0}, + {"0 ", 10, 0, " ", 0}, + {" 0 ", 10, 0, " ", 0}, + {" 0", 10, 0, END, 0}, + {" 0\"", 10, 0, "\"", 0}, + {"0l", 10, 0, "l", 0}, + {"0l ", 10, 0, "l ", 0}, + {"0u", 10, 0, "u", 0}, + {"0u ", 10, 0, "u ", 0}, + {"0L", 10, 0, "L", 0}, + {"0L ", 10, 0, "L ", 0}, + {"0U", 10, 0, "U", 0}, + {"0U ", 10, 0, "U ", 0}, + {"-0", 10, 0, END, 0}, + {"+0", 10, 0, END, 0}, + {"010", 8, 8, END, 0}, + /* stroll "takes as many characters as possible to form a valid base-n + * integer", so it ignores "8" and returns 0 */ + {"08", 0, 0, "8", 0}, + {"010", 10, 10, END, 0}, + {"010", 8, 8, END, 0}, + {"010", 0, 8, END, 0}, + {"68719476736", 10, 68719476736, END, 0}, + {"-68719476736", 10, -68719476736, END, 0}, + {"+68719476736", 10, 68719476736, END, 0}, + {" 68719476736 ", 10, 68719476736, " ", 0}, + {" 68719476736 ", 0, 68719476736, " ", 0}, + {" -68719476736 ", 10, -68719476736, " ", 0}, + {" -68719476736 ", 0, -68719476736, " ", 0}, + {" 4611686018427387904LL", 10, 4611686018427387904LL, "LL", 0}, + {" -4611686018427387904LL ", 10, -4611686018427387904LL, "LL ", 0}, + {"0x1000000000", 16, 68719476736, END, 0}, + {"0x1000000000", 0, 68719476736, END, 0}, + {"-0x1000000000", 16, -68719476736, END, 0}, + {"-0x1000000000", 0, -68719476736, END, 0}, + {"+0x1000000000", 16, 68719476736, END, 0}, + {"+0x1000000000", 0, 68719476736, END, 0}, + {"01234", 8, 668, END, 0}, + {"01234", 0, 668, END, 0}, + {"-01234", 8, -668, END, 0}, + {"-01234", 0, -668, END, 0}, + {"+01234", 8, 668, END, 0}, + {"+01234", 0, 668, END, 0}, + {"9223372036854775807", 10, INT64_MAX, END, 0}, + {"-9223372036854775808", 10, INT64_MIN, END, 0}, + {"9223372036854775808", 10, INT64_MAX, "8", ERANGE}, /* LLONG_MAX+1 */ + {"-9223372036854775809", 10, INT64_MIN, "9", ERANGE}, /* LLONG_MIN-1 */ + {"18446744073709551615", 10, INT64_MAX, "5", ERANGE}, /* 2*LLONG_MAX+1 */ + {"-18446744073709551618", 10, INT64_MIN, "8", ERANGE}, /* 2*LLONG_MIN-1 */ + {NULL}}; + + for (i = 0; tests[i].str; i++) { + errno = 0; + + rv = bson_ascii_strtoll (tests[i].str, &endptr, tests[i].base); + ASSERT_CMPINT64 (rv, ==, tests[i].rv); + ASSERT_CMPINT (errno, ==, tests[i]._errno); + ASSERT_CMPSTR (endptr, tests[i].remaining); + } +#undef END +} + + +static void +test_bson_strncpy (void) +{ + char buf[5]; + + bson_strncpy (buf, "foo", sizeof buf); + ASSERT_CMPSTR ("foo", buf); + bson_strncpy (buf, "foobar", sizeof buf); + ASSERT_CMPSTR ("foob", buf); + /* CDRIVER-2596 make sure strncpy with size 0 doesn't write to buf[-1] */ + bson_strncpy (buf + 1, "z", 0); + ASSERT_CMPSTR ("foob", buf); +} + + +static void +test_bson_snprintf (void) +{ + char buf[] = "ab"; + + /* CDRIVER-2595 make sure snprintf with size 0 doesn't write to buf[-1] */ + ASSERT_CMPINT (bson_snprintf (buf + 1, 0, "%d", 1), ==, 0); + ASSERT_CMPSTR (buf, "ab"); +} + + +static void +test_bson_strcasecmp (void) +{ + BSON_ASSERT (!bson_strcasecmp ("FoO", "foo")); + BSON_ASSERT (bson_strcasecmp ("Foa", "foo") < 0); + BSON_ASSERT (bson_strcasecmp ("FoZ", "foo") > 0); +} + + +void +test_string_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/string/new", test_bson_string_new); + TestSuite_Add (suite, "/bson/string/append", test_bson_string_append); + TestSuite_Add (suite, "/bson/string/append_c", test_bson_string_append_c); + TestSuite_Add ( + suite, "/bson/string/append_printf", test_bson_string_append_printf); + TestSuite_Add ( + suite, "/bson/string/append_unichar", test_bson_string_append_unichar); + TestSuite_Add (suite, "/bson/string/strdup", test_bson_strdup); + TestSuite_Add (suite, "/bson/string/strdup_printf", test_bson_strdup_printf); + TestSuite_Add (suite, "/bson/string/strndup", test_bson_strndup); + TestSuite_Add (suite, "/bson/string/ascii_strtoll", test_bson_ascii_strtoll); + TestSuite_Add (suite, "/bson/string/strncpy", test_bson_strncpy); + TestSuite_Add (suite, "/bson/string/snprintf", test_bson_snprintf); + TestSuite_Add (suite, "/bson/string/strnlen", test_bson_strnlen); + TestSuite_Add (suite, "/bson/string/strcasecmp", test_bson_strcasecmp); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-utf8.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-utf8.c new file mode 100644 index 0000000..14fe08d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-utf8.c @@ -0,0 +1,268 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "TestSuite.h" + + +static void +test_bson_utf8_validate (void) +{ + static const unsigned char test1[] = { + 0xe2, 0x82, 0xac, ' ', 0xe2, 0x82, 0xac, ' ', 0xe2, 0x82, 0xac, 0}; + static const unsigned char test2[] = {0xc0, 0x80, 0}; + static const unsigned char out_of_bound[] = { + 0xfd, 0x9f, 0xb0, 0x80, 0x80, 0x80, 0}; + static const unsigned char bad[] = {0xed, 0xa0, 0xa5, 0}; + + BSON_ASSERT (bson_utf8_validate ("asdf", 4, false)); + BSON_ASSERT (bson_utf8_validate ("asdf", 4, true)); + BSON_ASSERT (bson_utf8_validate ("asdf", 5, true)); + BSON_ASSERT (!bson_utf8_validate ("asdf", 5, false)); + + BSON_ASSERT (bson_utf8_validate ((const char *) test1, 11, true)); + BSON_ASSERT (bson_utf8_validate ((const char *) test1, 11, false)); + BSON_ASSERT (bson_utf8_validate ((const char *) test1, 12, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) test1, 12, false)); + + BSON_ASSERT (bson_utf8_validate ((const char *) test2, 2, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) test2, 2, false)); + + /* + * This character is allowed in 6-byte-sequence UTF-8 standard but seen as + * out of bound in 4-byte-sequence UTF-8 standard (RFC 3629). + */ + BSON_ASSERT (!bson_utf8_validate ((const char *) out_of_bound, 1, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) out_of_bound, 1, false)); + + /* + * Some UTF-8 code points are prohibited to match the constraints of + * the UTF-16 character encoding (RFC 3629). + */ + BSON_ASSERT (!bson_utf8_validate ((const char *) bad, 1, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) bad, 1, false)); +} + + +static void +test_bson_utf8_escape_for_json (void) +{ + char *str; + char *unescaped = "\x0e"; + + str = bson_utf8_escape_for_json ("my\0key", 6); + BSON_ASSERT (0 == memcmp (str, "my\\u0000key", 7)); + bson_free (str); + + str = bson_utf8_escape_for_json ("my\"key", 6); + BSON_ASSERT (0 == memcmp (str, "my\\\"key", 8)); + bson_free (str); + + str = bson_utf8_escape_for_json ("my\\key", 6); + BSON_ASSERT (0 == memcmp (str, "my\\\\key", 8)); + bson_free (str); + + str = bson_utf8_escape_for_json ("\\\"\\\"", -1); + BSON_ASSERT (0 == memcmp (str, "\\\\\\\"\\\\\\\"", 9)); + bson_free (str); + + str = bson_utf8_escape_for_json (unescaped, -1); + BSON_ASSERT (0 == memcmp (str, "\\u000e", 7)); + bson_free (str); +} + + +static void +test_bson_utf8_invalid (void) +{ + /* no UTF-8 sequence can start with 0x80 */ + static const unsigned char bad[] = {0x80, 0}; + + BSON_ASSERT (!bson_utf8_validate ((const char *) bad, 1, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) bad, 1, false)); + BSON_ASSERT (!bson_utf8_escape_for_json ((const char *) bad, 1)); +} + + +static void +test_bson_utf8_nil (void) +{ + static const unsigned char test[] = {'a', 0, 'b', 0}; + char *str; + + BSON_ASSERT (bson_utf8_validate ((const char *) test, 3, true)); + BSON_ASSERT (!bson_utf8_validate ((const char *) test, 3, false)); + + /* no length provided, stop at first nil */ + str = bson_utf8_escape_for_json ((const char *) test, -1); + ASSERT_CMPSTR ("a", str); + bson_free (str); + + str = bson_utf8_escape_for_json ((const char *) test, 3); + ASSERT_CMPSTR ("a\\u0000b", str); + bson_free (str); +} + + +static void +test_bson_utf8_get_char (void) +{ + static const char *test1 = "asdf"; + static const unsigned char test2[] = { + 0xe2, 0x82, 0xac, ' ', 0xe2, 0x82, 0xac, ' ', 0xe2, 0x82, 0xac, 0}; + const char *c; + + c = test1; + BSON_ASSERT (bson_utf8_get_char (c) == 'a'); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == 's'); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == 'd'); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == 'f'); + c = bson_utf8_next_char (c); + BSON_ASSERT (!*c); + + c = (const char *) test2; + BSON_ASSERT (bson_utf8_get_char (c) == 0x20AC); + c = bson_utf8_next_char (c); + BSON_ASSERT (c == (const char *) test2 + 3); + BSON_ASSERT (bson_utf8_get_char (c) == ' '); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == 0x20AC); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == ' '); + c = bson_utf8_next_char (c); + BSON_ASSERT (bson_utf8_get_char (c) == 0x20AC); + c = bson_utf8_next_char (c); + BSON_ASSERT (!*c); +} + + +static void +test_bson_utf8_from_unichar (void) +{ + static const char test1[] = {'a'}; + static const unsigned char test2[] = {0xc3, 0xbf}; + static const unsigned char test3[] = {0xe2, 0x82, 0xac}; + uint32_t len; + char str[6]; + + /* + * First possible sequence of a certain length. + */ + bson_utf8_from_unichar (0, str, &len); + BSON_ASSERT (len == 1); + bson_utf8_from_unichar (0x00000080, str, &len); + BSON_ASSERT (len == 2); + bson_utf8_from_unichar (0x00000800, str, &len); + BSON_ASSERT (len == 3); + bson_utf8_from_unichar (0x00010000, str, &len); + BSON_ASSERT (len == 4); + + /* + * Last possible sequence of a certain length. + */ + bson_utf8_from_unichar (0x0000007F, str, &len); + BSON_ASSERT (len == 1); + bson_utf8_from_unichar (0x000007FF, str, &len); + BSON_ASSERT (len == 2); + bson_utf8_from_unichar (0x0000FFFF, str, &len); + BSON_ASSERT (len == 3); + bson_utf8_from_unichar (0x0010FFFF, str, &len); + BSON_ASSERT (len == 4); + + /* + * Other interesting values. + */ + bson_utf8_from_unichar (0x0000D7FF, str, &len); + BSON_ASSERT (len == 3); + bson_utf8_from_unichar (0x0000E000, str, &len); + BSON_ASSERT (len == 3); + bson_utf8_from_unichar (0x0000FFFD, str, &len); + BSON_ASSERT (len == 3); + bson_utf8_from_unichar (0x0010EFFF, str, &len); + BSON_ASSERT (len == 4); + bson_utf8_from_unichar (0x00110000, str, &len); + BSON_ASSERT (len == 4); + + bson_utf8_from_unichar ('a', str, &len); + BSON_ASSERT (len == 1); + BSON_ASSERT (!memcmp (test1, str, 1)); + + bson_utf8_from_unichar (0xFF, str, &len); + BSON_ASSERT (len == 2); + BSON_ASSERT (!memcmp ((const char *) test2, str, 2)); + + bson_utf8_from_unichar (0x20AC, str, &len); + BSON_ASSERT (len == 3); + BSON_ASSERT (!memcmp ((const char *) test3, str, 3)); +} + + +static void +test_bson_utf8_non_shortest (void) +{ + static const char *tests[] = { + "\xE0\x80\x80", /* Non-shortest form representation of U+0000 */ + "\xF0\x80\x80\x80", /* Non-shortest form representation of U+0000 */ + + "\xE0\x83\xBF", /* Non-shortest form representation of U+00FF */ + "\xF0\x80\x83\xBF", /* Non-shortest form representation of U+00FF */ + + "\xF0\x80\xA3\x80", /* Non-shortest form representation of U+08C0 */ + + NULL}; + static const char *valid_tests[] = { + "\xC0\x80", /* Non-shortest form representation of U+0000. + * This is how \0 should be encoded. Special casing + * to allow for use in things like strlen(). */ + + NULL}; + int i; + + for (i = 0; tests[i]; i++) { + if (bson_utf8_validate (tests[i], strlen (tests[i]), false)) { + fprintf (stderr, "non-shortest form failure, test %d\n", i); + BSON_ASSERT (false); + } + } + + for (i = 0; valid_tests[i]; i++) { + if (!bson_utf8_validate (valid_tests[i], strlen (valid_tests[i]), true)) { + fprintf (stderr, "non-shortest form failure, valid_tests %d\n", i); + BSON_ASSERT (false); + } + } +} + + +void +test_utf8_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/utf8/validate", test_bson_utf8_validate); + TestSuite_Add (suite, "/bson/utf8/invalid", test_bson_utf8_invalid); + TestSuite_Add (suite, "/bson/utf8/nil", test_bson_utf8_nil); + TestSuite_Add ( + suite, "/bson/utf8/escape_for_json", test_bson_utf8_escape_for_json); + TestSuite_Add ( + suite, "/bson/utf8/get_char_next_char", test_bson_utf8_get_char); + TestSuite_Add ( + suite, "/bson/utf8/from_unichar", test_bson_utf8_from_unichar); + TestSuite_Add ( + suite, "/bson/utf8/non_shortest", test_bson_utf8_non_shortest); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-value.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-value.c new file mode 100644 index 0000000..cd82658 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-value.c @@ -0,0 +1,137 @@ +/* + * Copyright 2014 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "TestSuite.h" + + +static void +test_value_basic (void) +{ + static const uint8_t raw[16] = {0}; + const bson_value_t *value; + bson_value_t copy; + bson_iter_t iter; + bson_oid_t oid; + bson_t other = BSON_INITIALIZER; + bson_t *doc; + bson_t sub = BSON_INITIALIZER; + bool r; + int i; + + bson_oid_init (&oid, NULL); + + doc = BCON_NEW ("double", + BCON_DOUBLE (123.4), + "utf8", + "this is my string", + "document", + BCON_DOCUMENT (&sub), + "array", + BCON_DOCUMENT (&sub), + "binary", + BCON_BIN (BSON_SUBTYPE_BINARY, raw, sizeof raw), + "undefined", + BCON_UNDEFINED, + "oid", + BCON_OID (&oid), + "bool", + BCON_BOOL (true), + "datetime", + BCON_DATE_TIME (12345678), + "null", + BCON_NULL, + "regex", + BCON_REGEX ("^hello", "i"), + "dbpointer", + BCON_DBPOINTER ("test.test", &oid), + "code", + BCON_CODE ("var a = function() {}"), + "symbol", + BCON_SYMBOL ("my_symbol"), + "codewscope", + BCON_CODEWSCOPE ("var a = 1;", &sub), + "int32", + BCON_INT32 (1234), + "timestamp", + BCON_TIMESTAMP (1234, 4567), + "int64", + BCON_INT32 (4321), + "maxkey", + BCON_MAXKEY, + "minkey", + BCON_MINKEY); + + r = bson_iter_init (&iter, doc); + BSON_ASSERT (r); + + for (i = 0; i < 20; i++) { + r = bson_iter_next (&iter); + BSON_ASSERT (r); + + value = bson_iter_value (&iter); + BSON_ASSERT (value); + + bson_value_copy (value, ©); + + r = bson_append_value (&other, bson_iter_key (&iter), -1, ©); + BSON_ASSERT (r); + + bson_value_destroy (©); + } + + r = bson_iter_next (&iter); + BSON_ASSERT (!r); + + bson_destroy (doc); + bson_destroy (&sub); + bson_destroy (&other); +} + + +static void +test_value_decimal128 (void) +{ + const bson_value_t *value; + bson_value_t copy; + bson_iter_t iter; + bson_decimal128_t dec; + bson_t other = BSON_INITIALIZER; + bson_t *doc; + + BSON_ASSERT (bson_decimal128_from_string ("123.5", &dec)); + doc = BCON_NEW ("decimal128", BCON_DECIMAL128 (&dec)); + BSON_ASSERT (bson_iter_init (&iter, doc) && bson_iter_next (&iter)); + value = bson_iter_value (&iter); + BSON_ASSERT (value); + bson_value_copy (value, ©); + BSON_ASSERT (bson_append_value (&other, bson_iter_key (&iter), -1, ©)); + + bson_value_destroy (©); + bson_destroy (doc); + bson_destroy (&other); +} + + +void +test_value_install (TestSuite *suite) +{ + TestSuite_Add (suite, "/bson/value/basic", test_value_basic); + TestSuite_Add (suite, "/bson/value/decimal128", test_value_decimal128); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-writer.c b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-writer.c new file mode 100644 index 0000000..f786049 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/tests/test-writer.c @@ -0,0 +1,196 @@ +/* + * Copyright 2013 MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "TestSuite.h" + + +static void * +test_bson_writer_custom_realloc_helper (void *mem, size_t num_bytes, void *ctx) +{ + int *x = (int *) ctx; + + *x = *x + 1; + return bson_realloc (mem, num_bytes); +} + +static void +test_bson_writer_custom_realloc (void) +{ + bson_writer_t *writer; + uint8_t *buf = bson_malloc (0); + size_t buflen = 0; + bson_t *b; + int x = 0; + + writer = bson_writer_new ( + &buf, &buflen, 0, test_bson_writer_custom_realloc_helper, &x); + + BSON_ASSERT (bson_writer_begin (writer, &b)); + + BSON_ASSERT (bson_append_utf8 (b, "hello", -1, "world", -1)); + + bson_writer_end (writer); + + bson_writer_destroy (writer); + + ASSERT_CMPINT (x, >, 0); + + bson_free (buf); +} + + +static void +test_bson_writer_shared_buffer (void) +{ + bson_writer_t *writer; + uint8_t *buf = bson_malloc0 (32); + bool rolled_back = false; + size_t buflen = 32; + size_t n_bytes; + bson_t *b; + const char *key; + char keystr[32]; + int i = 0; + int j = 0; + int n_docs = 10000; + + writer = bson_writer_new (&buf, &buflen, 0, bson_realloc_ctx, NULL); + + for (i = 0; i < n_docs; i++) { + BSON_ASSERT (bson_writer_begin (writer, &b)); + + for (j = 0; j < 1000; j++) { + bson_uint32_to_string (j, &key, keystr, sizeof keystr); + BSON_ASSERT (bson_append_int64 (b, key, -1, j)); + } + + if (bson_writer_get_length (writer) > (48 * 1024 * 1024)) { + rolled_back = true; + bson_writer_rollback (writer); + break; + } else { + bson_writer_end (writer); + } + } + + n_bytes = bson_writer_get_length (writer); + + bson_writer_destroy (writer); + + ASSERT_CMPSIZE_T (n_bytes, <, (size_t) (48 * 1024 * 1024)); + BSON_ASSERT (rolled_back); + + bson_free (buf); +} + + +static void +test_bson_writer_empty_sequence (void) +{ + const uint8_t testdata[] = {5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, + 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0}; + bson_writer_t *writer; + uint8_t *buf = NULL; + bson_t *b; + size_t len = 0; + int r; + int i; + + writer = bson_writer_new (&buf, &len, 0, bson_realloc_ctx, NULL); + for (i = 0; i < 5; i++) { + BSON_ASSERT (bson_writer_begin (writer, &b)); + bson_writer_end (writer); + } + r = memcmp (buf, testdata, 25); + BSON_ASSERT (r == 0); + bson_writer_destroy (writer); + bson_free (buf); +} + + +static void +test_bson_writer_null_realloc (void) +{ + const uint8_t testdata[] = {5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, + 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}; + bson_writer_t *writer; + uint8_t *buf = bson_malloc0 (32); + size_t buflen = 32; + bson_t *b; + int r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, NULL, NULL); + for (i = 0; i < 6; i++) { + BSON_ASSERT (bson_writer_begin (writer, &b)); + bson_writer_end (writer); + } + + BSON_ASSERT (!bson_writer_begin (writer, &b)); + + r = memcmp (buf, testdata, 32); + BSON_ASSERT (r == 0); + bson_writer_destroy (writer); + + bson_free (buf); +} + +static void +test_bson_writer_null_realloc_2 (void) +{ + const uint8_t testdata[] = {5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, + 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}; + bson_writer_t *writer; + uint8_t *buf = bson_malloc0 (32); + size_t buflen = 32; + bson_t *b; + int r; + int i; + + writer = bson_writer_new (&buf, &buflen, 0, NULL, NULL); + for (i = 0; i < 5; i++) { + BSON_ASSERT (bson_writer_begin (writer, &b)); + bson_writer_end (writer); + } + + BSON_ASSERT (bson_writer_begin (writer, &b)); + BSON_ASSERT (!bson_append_int32 (b, "a", -1, 123)); + bson_writer_end (writer); + + r = memcmp (buf, testdata, 32); + BSON_ASSERT (r == 0); + bson_writer_destroy (writer); + + bson_free (buf); +} + +void +test_writer_install (TestSuite *suite) +{ + TestSuite_Add ( + suite, "/bson/writer/custom_realloc", test_bson_writer_custom_realloc); + TestSuite_Add ( + suite, "/bson/writer/shared_buffer", test_bson_writer_shared_buffer); + TestSuite_Add ( + suite, "/bson/writer/empty_sequence", test_bson_writer_empty_sequence); + TestSuite_Add ( + suite, "/bson/writer/null_realloc", test_bson_writer_null_realloc); + TestSuite_Add ( + suite, "/bson/writer/null_realloc_2", test_bson_writer_null_realloc_2); +} diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/CMakeLists.txt new file mode 100644 index 0000000..b474ba9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/CMakeLists.txt @@ -0,0 +1,1004 @@ +cmake_minimum_required (VERSION 3.1) + +project (libmongoc C) + +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../build/cmake) + +include (InstallRequiredSystemLibraries) + +message ("libmongoc version (from VERSION_CURRENT file): ${MONGOC_VERSION}") +if (NOT ${MONGOC_VERSION} STREQUAL ${MONGOC_RELEASED_VERSION}) + message ("libmongoc previous release (from VERSION_RELEASED file): ${MONGOC_RELEASED_VERSION}") +endif () + +# Defaults. +set (MONGOC_ENABLE_SSL 0) +set (MONGOC_ENABLE_SSL_OPENSSL 0) +set (MONGOC_HAVE_ASN1_STRING_GET0_DATA 0) +set (MONGOC_ENABLE_SSL_LIBRESSL 0) +set (MONGOC_ENABLE_SSL_SECURE_TRANSPORT 0) +set (MONGOC_ENABLE_SSL_SECURE_CHANNEL 0) + +set (MONGOC_ENABLE_CRYPTO 0) +set (MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0) +set (MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 0) +set (MONGOC_ENABLE_CRYPTO_CNG 0) + +set (MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE 0) + +set (MONGOC_ENABLE_COMPRESSION 0) +set (MONGOC_ENABLE_COMPRESSION_SNAPPY 0) +set (MONGOC_ENABLE_COMPRESSION_ZLIB 0) + +if (ENABLE_COVERAGE) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage") +endif () + +if (NOT ENABLE_ZLIB MATCHES "SYSTEM|AUTO|BUNDLED|OFF") + message (FATAL_ERROR + "ENABLE_ZLIB option must be SYSTEM, BUNDLED, AUTO, or OFF" + ) +endif () + +# Disable warnings on bundled zlib source files. +set_source_files_properties (${ZLIB_SOURCES} PROPERTIES COMPILE_FLAGS -w) + +# Copy zconf.h.in to zconf.h; even when using system zlib, the 'dist' target +# will look for zconf.h in that location. +configure_file ( + "${SOURCE_DIR}/src/zlib-1.2.11/zconf.h.in" + "${CMAKE_BINARY_DIR}/src/zlib-1.2.11/zconf.h" + COPYONLY +) +if (ENABLE_ZLIB MATCHES "SYSTEM|AUTO") + message (STATUS "Searching for zlib CMake packages") + include (FindZLIB) + if (ZLIB_FOUND) + message ("-- zlib found version \"${ZLIB_VERSION_STRING}\"") + message ("-- zlib include path \"${ZLIB_INCLUDE_DIRS}\"") + message ("-- zlib libraries \"${ZLIB_LIBRARIES}\"") + include_directories ("${ZLIB_INCLUDE_DIRS}") + else () + if (ENABLE_ZLIB STREQUAL "SYSTEM") + message (FATAL_ERROR + "Unable to find system zlib package. Either specify the zlib \ + location by setting ZLIB_ROOT, or else set ENABLE_ZLIB=BUNDLED or \ + set ENABLE_ZLIB=OFF." + ) + endif () + set (ZLIB_LIBRARIES "") + endif () +endif () + +if ( (ENABLE_ZLIB STREQUAL "BUNDLED") + OR (ENABLE_ZLIB STREQUAL "AUTO" AND NOT ZLIB_FOUND) ) + message (STATUS "Enabling zlib compression (bundled)") + set (SOURCES ${SOURCES} ${ZLIB_SOURCES}) + + list ( + APPEND + MONGOC_INTERNAL_INCLUDE_DIRS + "${SOURCE_DIR}/src/zlib-1.2.11" + "${CMAKE_BINARY_DIR}/src/zlib-1.2.11" + ) +endif () + +if (NOT ENABLE_ZLIB STREQUAL "OFF") + # At this point the system zlib was found, or the bundled library was used + include (CheckIncludeFiles) + check_include_files ("unistd.h" HAVE_UNISTD_H) + check_include_files ("stdarg.h" HAVE_STDARG_H) + set (MONGOC_ENABLE_COMPRESSION 1) + set (MONGOC_ENABLE_COMPRESSION_ZLIB 1) +else () + message (STATUS "Disabling zlib compression") +endif () + +if (NOT ENABLE_SSL STREQUAL OFF) + # Try OpenSSL automatically everywhere but Mac and Windows. + if (ENABLE_SSL STREQUAL "OPENSSL" + OR (NOT APPLE AND NOT WIN32 AND ENABLE_SSL STREQUAL "AUTO")) + # Sets OPENSSL_FOUND on success. + include (FindOpenSSL) + endif () + + if (ENABLE_SSL STREQUAL LIBRESSL) + include (FindPkgConfig) + message ("-- Searching for LibreSSL/libtls") + pkg_check_modules (LIBRESSL libtls) + if (LIBRESSL_FOUND) + message ("-- Found ${LIBRESSL_LIBRARIES}") + set (SSL_LIBRARIES ${LIBRESSL_LIBRARIES}) + if (LIBRESSL_INCLUDE_DIRS) + include_directories ("${LIBRESSL_INCLUDE_DIRS}") + endif () + link_directories ("${LIBRESSL_LIBRARY_DIRS}") + set (LIBRESSL 1) + else () + message ("-- Not found") + endif () + endif () + + if (ENABLE_SSL STREQUAL DARWIN OR (APPLE AND ENABLE_SSL STREQUAL "AUTO")) + if (APPLE) + set (SECURE_TRANSPORT 1) + else () + message (FATAL_ERROR "ENABLE_SSL=DARWIN only supported on Mac OS X") + endif () + endif () + + if (ENABLE_SSL STREQUAL WINDOWS OR (WIN32 AND ENABLE_SSL STREQUAL "AUTO")) + if (WIN32) + set (SECURE_CHANNEL 1) + else () + message (FATAL_ERROR "ENABLE_SSL=WINDOWS only supported on Windows") + endif () + endif () + + if (NOT OPENSSL_FOUND AND NOT SECURE_TRANSPORT AND NOT SECURE_CHANNEL AND NOT LIBRESSL) + if (ENABLE_SSL STREQUAL AUTO) + set (ENABLE_SSL OFF) + else () + message (FATAL_ERROR "No SSL library found") + endif () + endif () +endif () + +if (OPENSSL_FOUND) + if (WIN32 AND OPENSSL_VERSION GREATER 1.1 AND NOT + ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.7) + message (FATAL_ERROR "Building against OpenSSL 1.1.0 and later requires CMake 3.7 or later (hint:" + " You can also compile against Windows Secure Transport with -DENABLE_SSL=WINDOWS") + endif () + if (APPLE AND NOT OPENSSL_ROOT_DIR) + message (WARNING "Building with OpenSSL but OPENSSL_ROOT_DIR not defined. If build fails to link" + " to OpenSSL, define OPENSSL_ROOT_DIR as the path to the OpenSSL installation directory.") + endif () + include (CheckLibraryExists) + # Check for newer OpenSSL string function. + check_library_exists (ssl + ASN1_STRING_get0_data "openssl/asn1.h" HAVE_ASN1_STRING_GET0_DATA + ) + if (HAVE_ASN1_STRING_GET0_DATA) + set (MONGOC_HAVE_ASN1_STRING_GET0_DATA 1) + endif () + set (MONGOC_ENABLE_SSL 1) + set (MONGOC_ENABLE_SSL_OPENSSL 1) + set (MONGOC_ENABLE_CRYPTO 1) + set (MONGOC_ENABLE_CRYPTO_LIBCRYPTO 1) +elseif (SECURE_TRANSPORT) + set (MONGOC_ENABLE_SSL 1) + set (MONGOC_ENABLE_SSL_SECURE_TRANSPORT 1) + set (MONGOC_ENABLE_CRYPTO 1) + set (MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 1) +elseif (SECURE_CHANNEL) + set (MONGOC_ENABLE_SSL 1) + set (MONGOC_ENABLE_SSL_SECURE_CHANNEL 1) + set (MONGOC_ENABLE_CRYPTO 1) + set (MONGOC_ENABLE_CRYPTO_CNG 1) +elseif (LIBRESSL) + set (MONGOC_ENABLE_SSL 1) + set (MONGOC_ENABLE_SSL_LIBRESSL 1) + set (MONGOC_ENABLE_CRYPTO 1) + set (MONGOC_ENABLE_CRYPTO_LIBCRYPTO 1) +endif () + +if (ENABLE_CRYPTO_SYSTEM_PROFILE) + if (OPENSSL_FOUND) + set (MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE 1) + else () + message (FATAL_ERROR "ENABLE_CRYPTO_SYSTEM_PROFILE only available with OpenSSL") + endif () +endif () + +if (NOT ENABLE_SASL MATCHES "CYRUS|GSSAPI|SSPI|AUTO|OFF") + message (FATAL_ERROR + "ENABLE_SASL option must be CYRUS, GSSAPI, SSPI, AUTO, or OFF") +endif () + +# Defaults. +set (MONGOC_ENABLE_SASL 0) +set (MONGOC_ENABLE_SASL_CYRUS 0) +set (MONGOC_ENABLE_SASL_GSSAPI 0) +set (MONGOC_ENABLE_SASL_SSPI 0) +set (MONGOC_HAVE_SASL_CLIENT_DONE 0) + +# After CDRIVER-2654, the GSSAPI option will be entirely removed. +if (ENABLE_SASL STREQUAL "GSSAPI") + message (WARNING "ENABLE_SASL=GSSAPI is not supported. Using CYRUS instead.") + set (ENABLE_SASL "CYRUS") +endif() + +if (NOT ENABLE_SASL STREQUAL OFF) + if (ENABLE_SASL MATCHES "AUTO|CYRUS") + # Sets SASL_LIBRARIES. + include (FindSASL2) + endif () + + if (SASL_FOUND) + set (MONGOC_ENABLE_SASL 1) + set (MONGOC_ENABLE_SASL_CYRUS 1) + elseif ( (ENABLE_SASL MATCHES "SSPI|AUTO") AND WIN32) + set (MONGOC_ENABLE_SASL 1) + set (MONGOC_ENABLE_SASL_SSPI 1) + elseif ( (ENABLE_SASL MATCHES "GSSAPI|AUTO") AND DARWIN) + set (MONGOC_ENABLE_SASL 1) + set (MONGOC_ENABLE_SASL_GSSAPI 1) + endif () +else () + set (MONGOC_ENABLE_SASL 0) +endif () + + +if (ENABLE_AUTOMATIC_INIT_AND_CLEANUP) + set (MONGOC_NO_AUTOMATIC_GLOBALS 0) +else () + set (MONGOC_NO_AUTOMATIC_GLOBALS 1) +endif () + +include (CheckTypeSize) +if (WIN32) + SET (CMAKE_EXTRA_INCLUDE_FILES "ws2tcpip.h") +else () + SET (CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h") +endif () +CHECK_TYPE_SIZE (socklen_t HAVE_SOCKLEN) +SET (CMAKE_EXTRA_INCLUDE_FILES) + +if (HAVE_SOCKLEN) + set (MONGOC_HAVE_SOCKLEN 1) + set (MONGOC_SOCKET_ARG3 "socklen_t") +else () + set (MONGOC_HAVE_SOCKLEN 0) + set (MONGOC_SOCKET_ARG3 "int") +endif () + +include (FindResSearch) +include (CheckSchedGetCPU) + +function (mongoc_get_accept_args ARG2 ARG3) + SET (VAR 0) + foreach (ARG2_VAL "struct sockaddr" "void") + foreach (ARG3_VAL "socklen_t" "size_t" "int") + + MATH (EXPR VAR "${VAR}+1") + + FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/accept_test${VAR}.c + "#include + #include + + int main () + { + int a = 0; + ${ARG2_VAL} *b = 0; + ${ARG3_VAL} *c = 0; + accept (a, b, c); + return 0; + } + ") + + TRY_COMPILE (RES ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/accept_test${VAR}.c CMAKE_FLAGS + "-Werror -DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" OUTPUT_VARIABLE LOG2) + + if (RES) + message ( + STATUS + "Detected parameters: accept (int, ${ARG2_VAL} *, ${ARG3_VAL} *)") + + set (${ARG2} ${ARG2_VAL} PARENT_SCOPE) + set (${ARG3} ${ARG3_VAL} PARENT_SCOPE) + return () + endif () + + endforeach () + endforeach () + +endfunction () + +# Reasonable defaults. +set (MONGOC_SOCKET_ARG2 "struct sockaddr") +set (MONGOC_SOCKET_ARG3 "socklen_t") + +if (NOT WIN32) + mongoc_get_accept_args (MONGOC_SOCKET_ARG2 MONGOC_SOCKET_ARG3) +endif () + +set (MONGOC_API_VERSION 1.0) + +set (CPACK_PACKAGE_VERSION_MAJOR ${MONGOC_MAJOR_VERSION}) +set (CPACK_PACKAGE_VERSION_MINOR ${MONGOC_MINOR_VERSION}) + +set (MONGOC_CC ${CMAKE_C_COMPILER}) +set (MONGOC_USER_SET_CFLAGS ${CMAKE_C_FLAGS}) +set (MONGOC_USER_SET_LDFLAGS ${CMAKE_EXE_LINKER_FLAGS}) + +set (MONGOC_TRACE 0) + +if (ENABLE_TRACING) + set (MONGOC_TRACE 1) +endif () + +# Sets SNAPPY_LIBRARIES and SNAPPY_INCLUDE_DIRS. +include (FindSnappy) +if (SNAPPY_INCLUDE_DIRS) + set (MONGOC_ENABLE_COMPRESSION 1) + include_directories ("${SNAPPY_INCLUDE_DIRS}") +endif () + +set (MONGOC_ENABLE_SHM_COUNTERS 0) + +if (NOT ENABLE_SHM_COUNTERS MATCHES "ON|OFF|AUTO") + message (FATAL_ERROR "ENABLE_SHM_COUNTERS option must be ON, OFF, or AUTO") +endif () + +if (ENABLE_SHM_COUNTERS STREQUAL "AUTO") + if (UNIX AND NOT APPLE) + set (ENABLE_SHM_COUNTERS ON) + endif () +endif () + +if (ENABLE_SHM_COUNTERS STREQUAL "ON") + if (APPLE OR NOT UNIX) + message ( + FATAL_ERROR + "Shared memory performance counters not supported on Mac or Windows") + endif () + set (MONGOC_ENABLE_SHM_COUNTERS 1) + set (SHM_LIBRARIES rt) +endif () + +if (NOT ENABLE_ICU MATCHES "AUTO|ON|OFF") + message (FATAL_ERROR, "ENABLE_ICU option must be AUTO, ON, or OFF") +endif() + +if (NOT ENABLE_ICU STREQUAL OFF) + if (ENABLE_ICU STREQUAL ON) + # do not suppress log output if find_package cannot find ICU + find_package (ICU COMPONENTS uc) + elseif (ENABLE_ICU STREQUAL AUTO) + find_package (ICU QUIET COMPONENTS uc) + endif() + if (ICU_FOUND) + set (MONGOC_ENABLE_ICU 1) + include_directories ("${ICU_INCLUDE_DIR}") + elseif (ENABLE_ICU STREQUAL ON) + message (FATAL_ERROR "No ICU library found. If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.") + elseif (ENABLE_ICU STREQUAL AUTO) + message (STATUS "No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.") + message (STATUS "If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.") + endif() +endif() + +configure_file ( + "${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-config.h.in" + "${PROJECT_BINARY_DIR}/src/mongoc/mongoc-config.h" +) + +configure_file ( + "${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-version.h.in" + "${PROJECT_BINARY_DIR}/src/mongoc/mongoc-version.h" +) + +if (ENABLE_APPLE_FRAMEWORK) + configure_file ( + "${PROJECT_SOURCE_DIR}/src/mongoc/modules/module.modulemap.in" + "${PROJECT_BINARY_DIR}/src/mongoc/modules/module.modulemap" + ) +endif () + +include_directories ("${PROJECT_BINARY_DIR}/src") +include_directories ("${PROJECT_SOURCE_DIR}/src") +include_directories ("${PROJECT_SOURCE_DIR}/../../src/common") + +set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-apm.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-array.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-async.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-async-cmd.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-buffer.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-bulk-operation.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-change-stream.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client-pool.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cluster.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cluster-sasl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-collection.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-compression.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-counters.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-array.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-cmd.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-cmd-deprecated.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-find.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-find-cmd.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-find-opquery.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-legacy.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor-array.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-database.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-error.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-find-and-modify.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-init.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file-list.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file-page.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file-list.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-handshake.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-host-list.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-index.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-init.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-list.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-linux-distro-scanner.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-log.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-matcher.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-matcher-op.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-memcmp.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cmd.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-opts.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-opts-helpers.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-queue.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-read-concern.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-read-prefs.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rpc.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-description.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-stream.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client-session.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-set.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-socket.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-buffered.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-buffered.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-file.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-gridfs.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-socket.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-topology.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-topology-description.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-topology-description-apm.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-topology-scanner.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-uri.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-util.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-version-functions.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-write-command.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-write-command-legacy.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-write-concern.c + ${PROJECT_SOURCE_DIR}/../../src/common/common-b64.c + ${PROJECT_SOURCE_DIR}/../../src/common/common-md5.c +) + +set (HEADERS + ${PROJECT_BINARY_DIR}/src/mongoc/mongoc-config.h + ${PROJECT_BINARY_DIR}/src/mongoc/mongoc-version.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-apm.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-bulk-operation.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-change-stream.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client-pool.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-collection.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cursor.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-database.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-error.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-flags.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-find-and-modify.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file-page.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gridfs-file-list.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-handshake.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-host-list.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-init.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-index.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-iovec.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-log.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-macros.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-matcher.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-opcode.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-read-concern.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-read-prefs.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-description.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client-session.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-socket.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-libressl.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-openssl.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-buffered.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-file.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-gridfs.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-socket.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-topology-description.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-uri.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-version-functions.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-write-concern.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rand.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls.h + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-ssl.h +) + +set (HEADERS_FORWARDING + ${PROJECT_SOURCE_DIR}/src/mongoc/forwarding/mongoc.h +) + +if (NOT ENABLE_SSL STREQUAL OFF) + set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-scram.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-ssl.c + ) + + if (OPENSSL_FOUND) + message (STATUS "Compiling against OpenSSL") + set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto-openssl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rand-openssl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-openssl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-openssl-bio.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-openssl.c + ) + set (SSL_LIBRARIES ${OPENSSL_LIBRARIES}) + include_directories (${OPENSSL_INCLUDE_DIR}) + if (WIN32) + set (SSL_LIBRARIES ${SSL_LIBRARIES} crypt32.lib) + endif () + elseif (SECURE_TRANSPORT) + message (STATUS "Compiling against Secure Transport") + set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto-common-crypto.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rand-common-crypto.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-secure-transport.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-secure-transport.c + ) + set (SSL_LIBRARIES "-framework CoreFoundation -framework Security") + elseif (SECURE_CHANNEL) + message (STATUS "Compiling against Secure Channel") + set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto-cng.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rand-cng.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-secure-channel.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-secure-channel.c + ) + set (SSL_LIBRARIES secur32.lib crypt32.lib Bcrypt.lib) + elseif (LIBRESSL) + message (STATUS "Compiling against LibreSSL") + set (SOURCES ${SOURCES} + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto-openssl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-rand-openssl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-tls-libressl.c + ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-libressl.c + ) + set (SSL_LIBRARIES -ltls -lcrypto) + endif () +else () + message (STATUS "SSL disabled") +endif () # ENABLE_SSL + +if (MONGOC_ENABLE_SASL) + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-sasl.c) + if (MONGOC_ENABLE_SASL_CYRUS) + message (STATUS "Compiling against Cyrus SASL") + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cluster-cyrus.c) + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cyrus.c) + include_directories (${SASL_INCLUDE_DIRS}) + elseif (MONGOC_ENABLE_SASL_SSPI) + message (STATUS "Compiling against Windows SSPI") + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cluster-sspi.c) + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-sspi.c) + set (SASL_LIBRARIES secur32.lib crypt32.lib Shlwapi.lib) + elseif (MONGOC_ENABLE_SASL_GSSAPI) + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-cluster-gssapi.c) + set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-gssapi.c) + if (APPLE) + message (STATUS "Compiling against macOS GSS") + set (LIBRARIES ${LIBRARIES} -framework GSS) + else () + message (FATAL_ERROR "gssapi missing krb5-config support in cmake") + endif () + endif () +else () + message (STATUS "SASL disabled") +endif () + + +set (THREADS_PREFER_PTHREAD_FLAG 1) +find_package (Threads REQUIRED) +if (CMAKE_USE_PTHREADS_INIT) + set (THREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) +endif () + +set (LIBRARIES + ${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES} + ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} Threads::Threads ${ICU_LIBRARIES} +) + +if (WIN32) + set (LIBRARIES ${LIBRARIES} ws2_32) +endif () + +add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden) +target_link_libraries (mongoc_shared ${LIBRARIES} ${BSON_LIBRARIES}) +target_include_directories (mongoc_shared BEFORE PUBLIC ${BSON_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS}) +target_compile_definitions (mongoc_shared PUBLIC MONGOC_COMPILATION ${BSON_DEFINITIONS}) + +set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) +set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "mongoc-${MONGOC_API_VERSION}" PREFIX "lib") + +if (MONGOC_ENABLE_STATIC) + add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + target_link_libraries (mongoc_static ${LIBRARIES} ${BSON_STATIC_LIBRARIES}) + target_include_directories (mongoc_static BEFORE PUBLIC ${BSON_STATIC_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS}) + target_compile_definitions (mongoc_static PUBLIC MONGOC_COMPILATION MONGOC_STATIC ${BSON_STATIC_DEFINITIONS}) + set_target_properties (mongoc_static PROPERTIES VERSION 0.0.0) + set_target_properties (mongoc_static PROPERTIES OUTPUT_NAME "mongoc-static-${MONGOC_API_VERSION}") +endif () + +if (ENABLE_APPLE_FRAMEWORK) + set_target_properties (mongoc_shared PROPERTIES + FRAMEWORK TRUE + MACOSX_FRAMEWORK_BUNDLE_VERSION ${MONGOC_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MONGOC_VERSION} + MACOSX_FRAMEWORK_IDENTIFIER org.mongodb.mongoc + OUTPUT_NAME "mongoc" + PUBLIC_HEADER "${HEADERS}" + ) +endif () + +add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c) +target_link_libraries (mongoc-stat mongoc_shared) + +# mongoc-stat works if shared memory performance counters are enabled. +if (ENABLE_SHM_COUNTERS STREQUAL "ON") + install (PROGRAMS ${PROJECT_BINARY_DIR}/mongoc-stat + DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif () + +function (mongoc_add_test test use_shared) + if (ENABLE_TESTS) + add_executable (${test} ${ARGN}) + if (NOT MSVC) + # We've tests that test our deprecated api. MSVC 2013 will complain about invalid flag + set_source_files_properties (${ARGN} PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations) + endif () + target_include_directories (${test} PRIVATE ${PROJECT_SOURCE_DIR}/tests) + if (${use_shared}) + target_link_libraries (${test} mongoc_shared) + target_include_directories (${test} PRIVATE ${BSON_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS}) + else () + target_compile_definitions (${test} PUBLIC "MONGOC_COMPILATION") + target_link_libraries (${test} mongoc_static) + target_include_directories (${test} PRIVATE ${BSON_STATIC_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS}) + endif () + target_link_libraries (${test} ${RESOLV_LIBRARIES}) + if (WIN32) + target_link_libraries (${test} shlwapi) + else () + target_link_libraries (${test}) + endif () + endif () +endfunction () + +function (mongoc_add_example example use_shared) + if (ENABLE_EXAMPLES) + add_executable (${example} ${ARGN}) + if (${use_shared}) + target_link_libraries (${example} mongoc_shared) + else () + target_link_libraries (${example} mongoc_static) + endif () + if (WIN32) + target_link_libraries (${example} shlwapi) + endif () + set (EXAMPLES ${EXAMPLES} ${example}) + endif () +endfunction () + +set (test-libmongoc-sources + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/corpus-test.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/corpus-test.h + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-atomic.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bson.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bson-corpus.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bson-error.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bson-version.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-endian.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-clock.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-decimal128.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-fnv.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-iso8601.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-iter.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-json.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-oid.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-reader.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-string.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-utf8.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-value.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-writer.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bcon-basic.c + ${PROJECT_SOURCE_DIR}/../../src/libbson/tests/test-bcon-extract.c + ${PROJECT_SOURCE_DIR}/tests/debug-stream.c + ${PROJECT_SOURCE_DIR}/tests/json-test.c + ${PROJECT_SOURCE_DIR}/tests/json-test-monitoring.c + ${PROJECT_SOURCE_DIR}/tests/json-test-operations.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/future.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/future-functions.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/future-value.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/sync-queue.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/mock-rs.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/mock-server.c + ${PROJECT_SOURCE_DIR}/tests/mock_server/request.c + ${PROJECT_SOURCE_DIR}/tests/test-conveniences.c + ${PROJECT_SOURCE_DIR}/tests/test-libmongoc.c + ${PROJECT_SOURCE_DIR}/tests/test-happy-eyeballs.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-array.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-async.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-buffer.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-bulk.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-change-stream.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-client.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-client-pool.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-cluster.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-collection.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-collection-find.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-collection-find-with-opts.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-connection-uri.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-command-monitoring.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-counters.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-crud.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-cursor.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-database.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-error.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-exhaust.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-find-and-modify.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-gridfs.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-gridfs-file-page.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-handshake.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-linux-distro-scanner.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-list.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-log.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-matcher.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-max-staleness.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-opts.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-queue.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-read-concern.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-read-write-concern.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-read-prefs.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-retryable-writes.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-rpc.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-sample-commands.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-scram.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-sdam.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-sdam-monitoring.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-server-selection.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-server-selection-errors.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-transactions.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-client-session.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-set.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-socket.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-dns.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-stream.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-thread.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-topology.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-topology-description.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-topology-reconcile.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-topology-scanner.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-uri.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-version.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-usleep.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-util.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-write-commands.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-write-concern.c + ${PROJECT_SOURCE_DIR}/tests/TestSuite.c +) + +if (MONGOC_ENABLE_SSL) + set (test-libmongoc-sources ${test-libmongoc-sources} + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-x509.c + ${PROJECT_SOURCE_DIR}/tests/ssl-test.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-stream-tls.c + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-stream-tls-error.c + ) +endif () + +if (MONGOC_ENABLE_SASL_CYRUS) + set (test-libmongoc-sources ${test-libmongoc-sources} + ${PROJECT_SOURCE_DIR}/tests/test-mongoc-cyrus.c + ) +endif () + +mongoc_add_test (test-libmongoc FALSE ${test-libmongoc-sources}) +mongoc_add_test (test-mongoc-gssapi TRUE ${PROJECT_SOURCE_DIR}/tests/test-mongoc-gssapi.c) + +if (ENABLE_TESTS) + enable_testing () + add_test (NAME test-libmongoc + COMMAND test-libmongoc + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../.. + ) + + # "make test" doesn't compile tests, so we create "make check" which compiles + # and runs tests: https://gitlab.kitware.com/cmake/cmake/issues/8774 + add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} -V + DEPENDS test-libmongoc + ) +endif () + +# examples/ +mongoc_add_example (example-client TRUE ${PROJECT_SOURCE_DIR}/examples/example-client.c) +mongoc_add_example (example-collection-watch TRUE ${PROJECT_SOURCE_DIR}/examples/example-collection-watch.c) +if (NOT WIN32) + mongoc_add_example (example-resume TRUE ${PROJECT_SOURCE_DIR}/examples/example-resume.c) +endif() +mongoc_add_example (example-start-at-optime TRUE ${PROJECT_SOURCE_DIR}/examples/example-start-at-optime.c) +mongoc_add_example (example-command-monitoring TRUE ${PROJECT_SOURCE_DIR}/examples/example-command-monitoring.c) +mongoc_add_example (example-command-with-opts TRUE ${PROJECT_SOURCE_DIR}/examples/example-command-with-opts.c) +mongoc_add_example (example-create-indexes TRUE ${PROJECT_SOURCE_DIR}/examples/example-create-indexes.c) +mongoc_add_example (example-gridfs TRUE ${PROJECT_SOURCE_DIR}/examples/example-gridfs.c) +if (NOT WIN32 AND ENABLE_EXAMPLES) + mongoc_add_example (example-pool TRUE ${PROJECT_SOURCE_DIR}/examples/example-pool.c) + target_link_libraries (example-pool Threads::Threads) +endif () +mongoc_add_example (example-scram TRUE ${PROJECT_SOURCE_DIR}/examples/example-scram.c) +mongoc_add_example (example-sdam-monitoring TRUE ${PROJECT_SOURCE_DIR}/examples/example-sdam-monitoring.c) +mongoc_add_example (example-session TRUE ${PROJECT_SOURCE_DIR}/examples/example-session.c) +mongoc_add_example (example-transaction TRUE ${PROJECT_SOURCE_DIR}/examples/example-transaction.c) +mongoc_add_example (example-update TRUE ${PROJECT_SOURCE_DIR}/examples/example-update.c) +mongoc_add_example (find-and-modify TRUE ${PROJECT_SOURCE_DIR}/examples/find-and-modify.c) +mongoc_add_example (hello_mongoc TRUE ${PROJECT_SOURCE_DIR}/examples/hello_mongoc.c) +mongoc_add_example (mongoc-dump TRUE ${PROJECT_SOURCE_DIR}/examples/mongoc-dump.c) +mongoc_add_example (mongoc-ping TRUE ${PROJECT_SOURCE_DIR}/examples/mongoc-ping.c) +mongoc_add_example (mongoc-tail TRUE ${PROJECT_SOURCE_DIR}/examples/mongoc-tail.c) + +# examples/aggregation/ +mongoc_add_example (aggregation1 TRUE ${PROJECT_SOURCE_DIR}/examples/aggregation/aggregation1.c) + +# examples/basic_aggregation/ +mongoc_add_example (basic-aggregation TRUE ${PROJECT_SOURCE_DIR}/examples/basic_aggregation/basic-aggregation.c) + +# examples/bulk/ +mongoc_add_example (bulk-collation TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk-collation.c) +mongoc_add_example (bulk1 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk1.c) +mongoc_add_example (bulk2 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk2.c) +mongoc_add_example (bulk3 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk3.c) +mongoc_add_example (bulk4 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk4.c) +mongoc_add_example (bulk5 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk5.c) +mongoc_add_example (bulk6 TRUE ${PROJECT_SOURCE_DIR}/examples/bulk/bulk6.c) + +# examples/common_operations/ +mongoc_add_example (common-operations TRUE ${PROJECT_SOURCE_DIR}/examples/common_operations/common-operations.c) + +# examples/find_and_modify_with_opts/ +mongoc_add_example (fam TRUE ${PROJECT_SOURCE_DIR}/examples/find_and_modify_with_opts/fam.c) + +file (COPY ${PROJECT_SOURCE_DIR}/tests/binary DESTINATION ${PROJECT_BINARY_DIR}/tests) +file (COPY ${PROJECT_SOURCE_DIR}/tests/json DESTINATION ${PROJECT_BINARY_DIR}/tests) +file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}/tests) +file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests) + +install ( + TARGETS mongoc_shared ${EXAMPLES} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +if (MONGOC_ENABLE_STATIC) + install ( + TARGETS mongoc_shared mongoc_static ${EXAMPLES} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif () + +set (MONGOC_HEADER_INSTALL_DIR + "${CMAKE_INSTALL_INCLUDEDIR}/libmongoc-${MONGOC_API_VERSION}" +) + +install ( + FILES ${HEADERS} + DESTINATION "${MONGOC_HEADER_INSTALL_DIR}/mongoc" +) + +install ( + FILES ${HEADERS_FORWARDING} + DESTINATION "${MONGOC_HEADER_INSTALL_DIR}" +) + +if (ENABLE_APPLE_FRAMEWORK) + install ( + FILES "${PROJECT_BINARY_DIR}/src/mongoc/modules/module.modulemap" + DESTINATION "${CMAKE_INSTALL_BINDIR}/mongoc.framework/Modules/" + ) +endif () + +# Define pkg-config files +set (VERSION "${MONGOC_VERSION}") +set (prefix "${CMAKE_INSTALL_PREFIX}") +set (libdir "\${prefix}/lib") + +foreach ( + FLAG + ${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES} + ${THREAD_LIB} ${ZLIB_LIBRARIES} ${SNAPPY_LIBRARIES} ${ICU_LIBRARIES}) + + if (IS_ABSOLUTE "${FLAG}") + get_filename_component (FLAG_DIR "${FLAG}" DIRECTORY) + get_filename_component (FLAG_FILE "${FLAG}" NAME_WE) + STRING (REGEX REPLACE "^lib" "" FLAG_FILE "${FLAG_FILE}") + set (MONGOC_LIBRARIES "${MONGOC_LIBRARIES} -L${FLAG_DIR} -l${FLAG_FILE}") + elseif (FLAG MATCHES "^-.*") + # Flag starts with dash, add it as-is. + set (MONGOC_LIBRARIES "${MONGOC_LIBRARIES} ${FLAG}") + else () + # Flag doesn't start with dash, add it with a dash. + set (MONGOC_LIBRARIES "${MONGOC_LIBRARIES} -l${FLAG}") + endif () +endforeach () + +configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-1.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc +@ONLY) +install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) +if (MONGOC_ENABLE_STATIC) + configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-static-1.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-static-1.0.pc + @ONLY) + install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-static-1.0.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif () +# Deprecated alias for libmongoc-1.0.pc, see CDRIVER-2086. +if (MONGOC_ENABLE_SSL) + configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-ssl-1.0.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-ssl-1.0.pc + @ONLY) + install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-ssl-1.0.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif () + +include (../../build/cmake/MongoCPackage.cmake) + +if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) + find_package (Sphinx REQUIRED) + add_subdirectory (doc) + add_custom_target (mongoc-doc + ALL + DEPENDS + $<$:mongoc-man> + $<$:mongoc-html> + ) +endif () + +add_subdirectory (build) +# sub-directory 'doc' was already included above +add_subdirectory (examples) +add_subdirectory (src) +add_subdirectory (tests) + +set_local_dist (src_libmongoc_DIST_local + CMakeLists.txt + THIRD_PARTY_NOTICES +) + +set (src_libmongoc_DIST + ${src_libmongoc_DIST_local} + ${src_libmongoc_build_DIST} + ${src_libmongoc_doc_DIST} + ${src_libmongoc_examples_DIST} + ${src_libmongoc_src_DIST} + ${src_libmongoc_tests_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/THIRD_PARTY_NOTICES b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/THIRD_PARTY_NOTICES new file mode 100644 index 0000000..2bba00a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/THIRD_PARTY_NOTICES @@ -0,0 +1,56 @@ +The MongoDB C Driver uses third-party code distributed under different licenses. + +License notice for mongoc-stream-tls-secure-channel.c +------------------------------------------------------------------------------- + +Curl License + +Significant portions of mongoc-stream-tls-secure-channel.c are from Curl. + +Copyright (C) 2012 - 2015, Marc Hoersken, +Copyright (C) 2012, Mark Salisbury, +Copyright (C) 2012 - 2015, Daniel Stenberg, , et al. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. + + +License notice for utlist.h +------------------------------------------------------------------------------- + +BSD 1-Clause License + +Copyright: 2007-2014, Troy D. Hanson http://troydhanson.github.com/uthash/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/CMakeLists.txt new file mode 100644 index 0000000..25fa7f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/CMakeLists.txt @@ -0,0 +1,41 @@ +include (SphinxBuild) + +if (ENABLE_HTML_DOCS) + sphinx_build_html (mongoc-html mongo-c-driver) + set (src_libmongoc_doc_DIST_htmls ${doc_DIST_htmls}) +endif () + +if (ENABLE_MAN_PAGES) + sphinx_build_man (mongoc-man) + set (src_libmongoc_doc_DIST_mans ${doc_DIST_mans}) +endif () + +add_subdirectory (html) +add_subdirectory (includes) +add_subdirectory (man) +add_subdirectory (static) + +file (GLOB src_libmongoc_doc_DIST_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rst) + +extra_dist_generated ( + ${src_libmongoc_doc_DIST_htmls} + ${src_libmongoc_doc_DIST_mans} +) + +set_local_dist (src_libmongoc_doc_DIST_local + CMakeLists.txt + ${src_libmongoc_doc_DIST_rsts} + conf.py + libbson-objects.inv +) + +set (src_libmongoc_doc_DIST + ${src_libmongoc_doc_DIST_local} + ${src_libmongoc_doc_html_DIST} + ${src_libmongoc_doc_includes_DIST} + ${src_libmongoc_doc_man_DIST} + ${src_libmongoc_doc_mongoc_DIST} + ${src_libmongoc_doc_mongoc-theme_DIST} + ${src_libmongoc_doc_static_DIST} + PARENT_SCOPE +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/advanced-connections.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/advanced-connections.rst new file mode 100644 index 0000000..67a7eb9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/advanced-connections.rst @@ -0,0 +1,196 @@ +:man_page: mongoc_advanced_connections + +Advanced Connections +==================== + +The following guide contains information specific to certain types of MongoDB configurations. + +For an example of connecting to a simple standalone server, see the :ref:`Tutorial `. To establish a connection with authentication options enabled, see the :doc:`Authentication ` page. + +Connecting to a Replica Set +--------------------------- + +Connecting to a `replica set `_ is much like connecting to a standalone MongoDB server. Simply specify the replica set name using the ``?replicaSet=myreplset`` URI option. + +.. code-block:: c + + #include + #include + + int + main (int argc, char *argv[]) + { + mongoc_client_t *client; + + mongoc_init (); + + /* Create our MongoDB Client */ + client = mongoc_client_new ( + "mongodb://host01:27017,host02:27017,host03:27017/?replicaSet=myreplset"); + + /* Do some work */ + /* TODO */ + + /* Clean up */ + mongoc_client_destroy (client); + mongoc_cleanup (); + + return 0; + } + +.. tip:: + + Multiple hostnames can be specified in the MongoDB connection string URI, with a comma separating hosts in the seed list. + + It is recommended to use a seed list of members of the replica set to allow the driver to connect to any node. + +Connecting to a Sharded Cluster +------------------------------- + +To connect to a `sharded cluster `_, specify the ``mongos`` nodes the client should connect to. The C Driver will automatically detect that it has connected to a ``mongos`` sharding server. + +If more than one hostname is specified, a seed list will be created to attempt failover between the ``mongos`` instances. + +.. warning:: + + Specifying the ``replicaSet`` parameter when connecting to a ``mongos`` sharding server is invalid. + +.. code-block:: c + + #include + #include + + int + main (int argc, char *argv[]) + { + mongoc_client_t *client; + + mongoc_init (); + + /* Create our MongoDB Client */ + client = mongoc_client_new ("mongodb://myshard01:27017/"); + + /* Do something with client ... */ + + /* Free the client */ + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return 0; + } + +Connecting to an IPv6 Address +----------------------------- + +The MongoDB C Driver will automatically resolve IPv6 addresses from host names. However, to specify an IPv6 address directly, wrap the address in ``[]``. + +.. code-block:: none + + mongoc_uri_t *uri = mongoc_uri_new ("mongodb://[::1]:27017"); + +Connecting with IPv4 and IPv6 +----------------------------- + +.. include:: includes/ipv4-and-ipv6.txt + +Connecting to a UNIX Domain Socket +---------------------------------- + +On UNIX-like systems, the C Driver can connect directly to a MongoDB server using a UNIX domain socket. Pass the URL-encoded path to the socket, which *must* be suffixed with ``.sock``. For example, to connect to a domain socket at ``/tmp/mongodb-27017.sock``: + +.. code-block:: none + + mongoc_uri_t *uri = mongoc_uri_new ("mongodb://%2Ftmp%2Fmongodb-27017.sock"); + +Include username and password like so: + +.. code-block:: none + + mongoc_uri_t *uri = mongoc_uri_new ("mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock"); + +Connecting to a server over SSL +------------------------------- + +These are instructions for configuring TLS/SSL connections. + +To run a server locally (on port 27017, for example): + +.. code-block:: none + + $ mongod --port 27017 --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem + +Add ``/?ssl=true`` to the end of a client URI. + +.. code-block:: none + + mongoc_client_t *client = NULL; + client = mongoc_client_new ("mongodb://localhost:27017/?ssl=true"); + +MongoDB requires client certificates by default, unless the ``--sslAllowConnectionsWithoutCertificates`` is provided. The C Driver can be configured to present a client certificate using a ``mongoc_ssl_opt_t``: + +.. code-block:: none + + const mongoc_ssl_opt_t *ssl_default = mongoc_ssl_opt_get_default (); + mongoc_ssl_opt_t ssl_opts = { 0 }; + + /* optionally copy in a custom trust directory or file; otherwise the default is used. */ + memcpy (&ssl_opts, ssl_default, sizeof ssl_opts); + ssl_opts.pem_file = "client.pem" + + mongoc_client_set_ssl_opts (client, &ssl_opts); + +The client certificate provided by ``pem_file`` must be issued by one of the server trusted Certificate Authorities listed in ``--sslCAFile``, or issued by a CA in the native certificate store on the server when omitted. + +To verify the server certificate against a specific CA, provide a PEM armored file with a CA certificate, or concatenated list of CA certificates using the ``ca_file`` option, or ``c_rehash`` directory structure of CAs, pointed to using the ``ca_dir`` option. When no ``ca_file`` or ``ca_dir`` is provided, the driver will use CAs provided by the native platform certificate store. + +See :doc:`mongoc_ssl_opt_t` for more information on the various SSL related options. + +Compressing data to and from MongoDB +------------------------------------ + +MongoDB 3.4 added Snappy compression support, and zlib compression in 3.6. +To enable compression support the client must be configured with which compressors to use: + +.. code-block:: none + + mongoc_client_t *client = NULL; + client = mongoc_client_new ("mongodb://localhost:27017/?compressors=snappy,zlib"); + +The ``compressors`` option specifies the priority order of compressors the +client wants to use. Messages are compressed if the client and server share any +compressors in common. + +Note that the compressor used by the server might not be the same compressor as +the client used. For example, if the client uses the connection string +``compressors=zlib,snappy`` the client will use ``zlib`` compression to send +data (if possible), but the server might still reply using ``snappy``, +depending on how the server was configured. + +The driver must be built with zlib and/or snappy support to enable compression +support, any unknown (or not compiled in) compressor value will be ignored. + +Additional Connection Options +----------------------------- + +The full list of connection options can be found in the :symbol:`mongoc_uri_t` docs. + +Certain socket/connection related options are not configurable: + +============== ===================================================== ====================== +Option Description Value +============== ===================================================== ====================== +SO_KEEPALIVE TCP Keep Alive Enabled +-------------- ----------------------------------------------------- ---------------------- +TCP_KEEPIDLE How long a connection needs to remain idle before TCP 300 seconds + starts sending keepalive probes +-------------- ----------------------------------------------------- ---------------------- +TCP_KEEPINTVL The time in seconds between TCP probes 10 seconds +-------------- ----------------------------------------------------- ---------------------- +TCP_KEEPCNT How many probes to send, without acknowledgement, 9 probes + before dropping the connection +-------------- ----------------------------------------------------- ---------------------- +TCP_NODELAY Send packets as soon as possible or buffer small Enabled (no buffering) + packets (Nagle algorithm) +============== ===================================================== ====================== + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/aggregate.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/aggregate.rst new file mode 100644 index 0000000..0103a58 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/aggregate.rst @@ -0,0 +1,138 @@ +:man_page: mongoc_aggregate + +Aggregation Framework Examples +============================== + +This document provides a number of practical examples that display the capabilities of the aggregation framework. + +The `Aggregations using the Zip Codes Data Set `_ examples uses a publicly available data set of all zipcodes and populations in the United States. These data are available at: `zips.json `_. + +Requirements +------------ + +Let's check if everything is installed. + +Use the following command to load zips.json data set into mongod instance: + +.. code-block:: none + + $ mongoimport --drop -d test -c zipcodes zips.json + +Let's use the MongoDB shell to verify that everything was imported successfully. + +.. code-block:: none + + $ mongo test + connecting to: test + > db.zipcodes.count() + 29467 + > db.zipcodes.findOne() + { + "_id" : "35004", + "city" : "ACMAR", + "loc" : [ + -86.51557, + 33.584132 + ], + "pop" : 6055, + "state" : "AL" + } + +Aggregations using the Zip Codes Data Set +----------------------------------------- + +Each document in this collection has the following form: + +.. code-block:: json + + { + "_id" : "35004", + "city" : "Acmar", + "state" : "AL", + "pop" : 6055, + "loc" : [-86.51557, 33.584132] + } + +In these documents: + +* The ``_id`` field holds the zipcode as a string. +* The ``city`` field holds the city name. +* The ``state`` field holds the two letter state abbreviation. +* The ``pop`` field holds the population. +* The ``loc`` field holds the location as a ``[latitude, longitude]`` array. + +States with Populations Over 10 Million +--------------------------------------- + +To get all states with a population greater than 10 million, use the following aggregation pipeline: + +.. literalinclude:: ../examples/aggregation/aggregation1.c + :language: c + :caption: aggregation1.c + +You should see a result like the following: + +.. code-block:: json + + { "_id" : "PA", "total_pop" : 11881643 } + { "_id" : "OH", "total_pop" : 10847115 } + { "_id" : "NY", "total_pop" : 17990455 } + { "_id" : "FL", "total_pop" : 12937284 } + { "_id" : "TX", "total_pop" : 16986510 } + { "_id" : "IL", "total_pop" : 11430472 } + { "_id" : "CA", "total_pop" : 29760021 } + +The above aggregation pipeline is build from two pipeline operators: ``$group`` and ``$match``. + +The ``$group`` pipeline operator requires _id field where we specify grouping; remaining fields specify how to generate composite value and must use one of the group aggregation functions: ``$addToSet``, ``$first``, ``$last``, ``$max``, ``$min``, ``$avg``, ``$push``, ``$sum``. The ``$match`` pipeline operator syntax is the same as the read operation query syntax. + +The ``$group`` process reads all documents and for each state it creates a separate document, for example: + +.. code-block:: json + + { "_id" : "WA", "total_pop" : 4866692 } + +The ``total_pop`` field uses the $sum aggregation function to sum the values of all pop fields in the source documents. + +Documents created by ``$group`` are piped to the ``$match`` pipeline operator. It returns the documents with the value of ``total_pop`` field greater than or equal to 10 million. + +Average City Population by State +-------------------------------- + +To get the first three states with the greatest average population per city, use the following aggregation: + +.. code-block:: c + + pipeline = BCON_NEW ("pipeline", "[", + "{", "$group", "{", "_id", "{", "state", "$state", "city", "$city", "}", "pop", "{", "$sum", "$pop", "}", "}", "}", + "{", "$group", "{", "_id", "$_id.state", "avg_city_pop", "{", "$avg", "$pop", "}", "}", "}", + "{", "$sort", "{", "avg_city_pop", BCON_INT32 (-1), "}", "}", + "{", "$limit", BCON_INT32 (3) "}", + "]"); + +This aggregate pipeline produces: + +.. code-block:: json + + { "_id" : "DC", "avg_city_pop" : 303450.0 } + { "_id" : "FL", "avg_city_pop" : 27942.29805615551 } + { "_id" : "CA", "avg_city_pop" : 27735.341099720412 } + +The above aggregation pipeline is build from three pipeline operators: ``$group``, ``$sort`` and ``$limit``. + +The first ``$group`` operator creates the following documents: + +.. code-block:: json + + { "_id" : { "state" : "WY", "city" : "Smoot" }, "pop" : 414 } + +Note, that the ``$group`` operator can't use nested documents except the ``_id`` field. + +The second ``$group`` uses these documents to create the following documents: + +.. code-block:: json + + { "_id" : "FL", "avg_city_pop" : 27942.29805615551 } + +These documents are sorted by the ``avg_city_pop`` field in descending order. Finally, the ``$limit`` pipeline operator returns the first 3 documents from the sorted set. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/api.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/api.rst new file mode 100644 index 0000000..752e5e5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/api.rst @@ -0,0 +1,54 @@ +API Reference +============= + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + init-cleanup + logging + errors + lifecycle + mongoc_bulk_operation_t + mongoc_change_stream_t + mongoc_client_pool_t + mongoc_client_session_t + mongoc_client_t + mongoc_collection_t + mongoc_cursor_t + mongoc_database_t + mongoc_delete_flags_t + mongoc_find_and_modify_opts_t + mongoc_gridfs_file_list_t + mongoc_gridfs_file_opt_t + mongoc_gridfs_file_t + mongoc_gridfs_t + mongoc_host_list_t + mongoc_index_opt_geo_t + mongoc_index_opt_t + mongoc_index_opt_wt_t + mongoc_insert_flags_t + mongoc_iovec_t + mongoc_matcher_t + mongoc_query_flags_t + mongoc_rand + mongoc_read_concern_t + mongoc_read_mode_t + mongoc_read_prefs_t + mongoc_remove_flags_t + mongoc_reply_flags_t + mongoc_server_description_t + mongoc_session_opt_t + mongoc_socket_t + mongoc_ssl_opt_t + mongoc_stream_buffered_t + mongoc_stream_file_t + mongoc_stream_socket_t + mongoc_stream_t + mongoc_stream_tls_t + mongoc_topology_description_t + mongoc_transaction_opt_t + mongoc_update_flags_t + mongoc_uri_t + mongoc_version + mongoc_write_concern_t diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/application-performance-monitoring.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/application-performance-monitoring.rst new file mode 100644 index 0000000..47f4bb4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/application-performance-monitoring.rst @@ -0,0 +1,160 @@ +:man_page: mongoc_application_performance_monitoring + +Application Performance Monitoring (APM) +======================================== + +The MongoDB C Driver allows you to monitor all the MongoDB operations the driver executes. This event-notification system conforms to two MongoDB driver specs: + +* `Command Monitoring `_: events related to all application operations. +* `SDAM Monitoring `_: events related to the driver's Server Discovery And Monitoring logic. + +To receive notifications, create a ``mongoc_apm_callbacks_t`` with :symbol:`mongoc_apm_callbacks_new`, set callbacks on it, then pass it to :symbol:`mongoc_client_set_apm_callbacks` or :symbol:`mongoc_client_pool_set_apm_callbacks`. + +Command-Monitoring Example +-------------------------- + +.. literalinclude:: ../examples/example-command-monitoring.c + :language: c + :caption: example-command-monitoring.c + +This example program prints: + +.. code-block:: none + + Command drop started on 127.0.0.1: + { "drop" : "test" } + + Command drop succeeded: + { "ns" : "test.test", "nIndexesWas" : 1, "ok" : 1.0 } + + Command insert started on 127.0.0.1: + { + "insert" : "test", + "ordered" : true, + "documents" : [ + { "_id" : 0 }, { "_id" : 1 } + ] + } + + Command insert succeeded: + { "n" : 2, "ok" : 1.0 } + + Command insert started on 127.0.0.1: + { + "insert" : "test", + "ordered" : true, + "documents" : [ + { "_id" : 0 } + ] + } + + Command insert succeeded: + { + "n" : 0, + "writeErrors" : [ + { "index" : 0, "code" : 11000, "errmsg" : "duplicate key" } + ], + "ok" : 1.0 + } + + started: 3 + succeeded: 3 + failed: 0 + +The output has been edited and formatted for clarity. Depending on your server configuration, messages may include metadata like database name, logical session ids, or cluster times that are not shown here. + +The final "insert" command is considered successful, despite the writeError, because the server replied to the overall command with ``"ok": 1``. + +SDAM Monitoring Example +----------------------- + +.. literalinclude:: ../examples/example-sdam-monitoring.c + :language: c + :caption: example-sdam-monitoring.c + +Start a 3-node replica set on localhost with set name "rs" and start the program: + +.. code-block:: none + + ./example-sdam-monitoring "mongodb://localhost:27017,localhost:27018/?replicaSet=rs" + +This example program prints something like: + +.. code-block:: none + + topology opening + topology changed: Unknown -> ReplicaSetNoPrimary + secondary UNAVAILABLE + primary UNAVAILABLE + server opening: localhost:27017 + server opening: localhost:27018 + localhost:27017 heartbeat started + localhost:27018 heartbeat started + localhost:27017 heartbeat succeeded: { ... reply ... } + server changed: localhost:27017 Unknown -> RSPrimary + server opening: localhost:27019 + topology changed: ReplicaSetNoPrimary -> ReplicaSetWithPrimary + new servers: + RSPrimary localhost:27017 + secondary UNAVAILABLE + primary AVAILABLE + localhost:27019 heartbeat started + localhost:27018 heartbeat succeeded: { ... reply ... } + server changed: localhost:27018 Unknown -> RSSecondary + topology changed: ReplicaSetWithPrimary -> ReplicaSetWithPrimary + previous servers: + RSPrimary localhost:27017 + new servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + secondary AVAILABLE + primary AVAILABLE + localhost:27019 heartbeat succeeded: { ... reply ... } + server changed: localhost:27019 Unknown -> RSSecondary + topology changed: ReplicaSetWithPrimary -> ReplicaSetWithPrimary + previous servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + new servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + RSSecondary localhost:27019 + secondary AVAILABLE + primary AVAILABLE + topology closed + + Events: + server changed: 3 + server opening: 3 + server closed: 0 + topology changed: 4 + topology opening: 1 + topology closed: 1 + heartbeat started: 3 + heartbeat succeeded: 3 + heartbeat failed: 0 + +The driver connects to the mongods on ports 27017 and 27018, which were specified in the URI, and determines which is primary. It also discovers the third member, "localhost:27019", and adds it to the topology. + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + mongoc_apm_callbacks_t + mongoc_apm_command_failed_t + mongoc_apm_command_started_t + mongoc_apm_command_succeeded_t + mongoc_apm_server_changed_t + mongoc_apm_server_closed_t + mongoc_apm_server_heartbeat_failed_t + mongoc_apm_server_heartbeat_started_t + mongoc_apm_server_heartbeat_succeeded_t + mongoc_apm_server_opening_t + mongoc_apm_topology_changed_t + mongoc_apm_topology_closed_t + mongoc_apm_topology_opening_t diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/authentication.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/authentication.rst new file mode 100644 index 0000000..2bcefeb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/authentication.rst @@ -0,0 +1,205 @@ +:man_page: mongoc_authentication + +Authentication +============== + +This guide covers the use of authentication options with the MongoDB C Driver. Ensure that the MongoDB server is also properly configured for authentication before making a connection. For more information, see the `MongoDB security documentation `_. + +The MongoDB C driver supports several authentication mechanisms through the use of MongoDB connection URIs. + +By default, if a username and password are provided as part of the connection string (and an optional authentication database), they are used to connect via the default authentication mechanism of the server. + +To select a specific authentication mechanism other than the default, see the list of supported mechanism below. + +.. code-block:: none + + mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb"); + +Currently supported values for the authMechanism connection string option are: + +* :ref:`SCRAM-SHA-1 ` +* :ref:`MONGODB-CR (deprecated) ` +* :ref:`GSSAPI ` +* :ref:`PLAIN ` +* :ref:`X509 ` + +.. _authentication_scram_sha_256: + +Basic Authentication (SCRAM-SHA-256) +------------------------------------ + +MongoDB 4.0 introduces support for authenticating using the SCRAM protocol +with the more secure SHA-256 hash described in `RFC 7677 +`_. Using this authentication mechanism +means that the password is never actually sent over the wire when +authenticating, but rather a computed proof that the client password is the +same as the password the server knows. In MongoDB 4.0, the C driver can +determine the correct default authentication mechanism for users with stored +SCRAM-SHA-1 and SCRAM-SHA-256 credentials: + +.. code-block:: none + + mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb"); + /* the correct authMechanism is negotiated between the driver and server. */ + +Alternatively, SCRAM-SHA-256 can be explicitly specified as an authMechanism. + +.. code-block:: none + + mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256&authSource=mydb"); + +Passwords for SCRAM-SHA-256 undergo the preprocessing step known as SASLPrep +specified in `RFC 4013 `_. SASLPrep will +only be performed for passwords containing non-ASCII characters. SASLPrep +requires libicu. If libicu is not available, attempting to authenticate over +SCRAM-SHA-256 with non-ASCII passwords will result in error. + +Usernames *never* undergo SASLPrep. + +By default, when building the C driver libicu is linked if available. This can +be changed with the ``ENABLE_ICU`` cmake option. To specify an installation +path of libicu, specify ``ICU_ROOT`` as a cmake option. See the +`FindICU `_ documentation +for more information. + + +.. _authentication_scram_sha_1: + +Basic Authentication (SCRAM-SHA-1) +---------------------------------- + +The default authentication mechanism before MongoDB 4.0 is ``SCRAM-SHA-1`` (`RFC 5802 `_). Using this authentication mechanism means that the password is never actually sent over the wire when authenticating, but rather a computed proof that the client password is the same as the password the server knows. + +.. code-block:: none + + mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1&authSource=mydb"); + +.. note:: + + ``SCRAM-SHA-1`` authenticates against the ``admin`` database by default. If the user is created in another database, then specifying the authSource is required. + +.. _authentication_mongodbcr: + +Legacy Authentication (MONGODB-CR) +---------------------------------- + +The MONGODB-CR authMechanism is deprecated and will no longer function in MongoDB 4.0. Instead, specify no authMechanism and the driver +will use an authentication mechanism compatible with your server. + +.. _authentication_kerberos: + +GSSAPI (Kerberos) Authentication +-------------------------------- + +.. note:: + + Kerberos support requires compiling the driver against ``cyrus-sasl`` on UNIX-like environments. On Windows, configure the driver to build against the Windows Native SSPI. + +``GSSAPI`` (Kerberos) authentication is available in the Enterprise Edition of MongoDB. To authenticate using ``GSSAPI``, the MongoDB C driver must be installed with SASL support. + +On UNIX-like environments, run the ``kinit`` command before using the following authentication methods: + +.. code-block:: none + + $ kinit mongodbuser@EXAMPLE.COM + mongodbuser@EXAMPLE.COM's Password: + $ klistCredentials cache: FILE:/tmp/krb5cc_1000 + Principal: mongodbuser@EXAMPLE.COM + + Issued Expires Principal + Feb 9 13:48:51 2013 Feb 9 23:48:51 2013 krbtgt/EXAMPLE.COM@EXAMPLE.COM + +Now authenticate using the MongoDB URI. ``GSSAPI`` authenticates against the ``$external`` virtual database, so a database does not need to be specified in the URI. Note that the Kerberos principal *must* be URL-encoded: + +.. code-block:: none + + mongoc_client_t *client; + + client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo-server.example.com/?authMechanism=GSSAPI"); + +.. note:: + + ``GSSAPI`` authenticates against the ``$external`` database, so specifying the authSource database is not required. + +The driver supports these GSSAPI properties: + +* ``CANONICALIZE_HOST_NAME``: This might be required with Cyrus-SASL when the hosts report different hostnames than what is used in the Kerberos database. The default is "false". +* ``SERVICE_NAME``: Use a different service name than the default, "mongodb". + +Set properties in the URL: + +.. code-block:: none + + mongoc_client_t *client; + + client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo-server.example.com/?authMechanism=GSSAPI&" + "authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true"); + +If you encounter errors such as ``Invalid net address``, check if the application is behind a NAT (Network Address Translation) firewall. If so, create a ticket that uses ``forwardable`` and ``addressless`` Kerberos tickets. This can be done by passing ``-f -A`` to ``kinit``. + +.. code-block:: none + + $ kinit -f -A mongodbuser@EXAMPLE.COM + +.. _authentication_plain: + +SASL Plain Authentication +------------------------- + +.. note:: + + The MongoDB C Driver must be compiled with SASL support in order to use ``SASL PLAIN`` authentication. + +MongoDB Enterprise Edition supports the ``SASL PLAIN`` authentication mechanism, initially intended for delegating authentication to an LDAP server. Using the ``SASL PLAIN`` mechanism is very similar to the challenge response mechanism with usernames and passwords. This authentication mechanism uses the ``$external`` virtual database for ``LDAP`` support: + +.. note:: + + ``SASL PLAIN`` is a clear-text authentication mechanism. It is strongly recommended to connect to MongoDB using SSL with certificate validation when using the ``PLAIN`` mechanism. + +.. code-block:: none + + mongoc_client_t *client; + + client = mongoc_client_new ("mongodb://user:password@example.com/?authMechanism=PLAIN"); + +``PLAIN`` authenticates against the ``$external`` database, so specifying the authSource database is not required. + +.. _authentication_x509: + +X.509 Certificate Authentication +-------------------------------- + +.. note:: + + The MongoDB C Driver must be compiled with SSL support for X.509 authentication support. Once this is done, start a server with the following options: + + .. code-block:: none + + $ mongod --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem + +The ``MONGODB-X509`` mechanism authenticates a username derived from the distinguished subject name of the X.509 certificate presented by the driver during SSL negotiation. This authentication method requires the use of SSL connections with certificate validation. + +.. code-block:: none + + mongoc_client_t *client; + mongoc_ssl_opt_t ssl_opts = { 0 }; + + ssl_opts.pem_file = "mycert.pem"; + ssl_opts.pem_pwd = "mycertpassword"; + ssl_opts.ca_file = "myca.pem"; + ssl_opts.ca_dir = "trust_dir"; + ssl_opts.weak_cert_validation = false; + + client = mongoc_client_new ("mongodb://x509_derived_username@localhost/?authMechanism=MONGODB-X509"); + mongoc_client_set_ssl_opts (client, &ssl_opts); + +``MONGODB-X509`` authenticates against the ``$external`` database, so specifying the authSource database is not required. For more information on the x509_derived_username, see the MongoDB server `x.509 tutorial `_. + +.. note:: + + The MongoDB C Driver will attempt to determine the x509 derived username when none is provided, and as of MongoDB 3.4 providing the username is not required at all. + +.. only:: html + + .. taglist:: See Also: + :tags: authmechanism diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/basic-troubleshooting.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/basic-troubleshooting.rst new file mode 100644 index 0000000..21e53b5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/basic-troubleshooting.rst @@ -0,0 +1,90 @@ +:man_page: mongoc_basic_troubleshooting + +Basic Troubleshooting +===================== + +Troubleshooting Checklist +------------------------- + +The following is a short list of things to check when you have a problem. + +* Did you call ``mongoc_init()`` in ``main()``? If not, you will likely see a segfault. +* Have you leaked any clients or cursors as can be found with ``mongoc-stat ``? +* Have packets been delivered to the server? See egress bytes from ``mongoc-stat ``. +* Does ``valgrind`` show any leaks? Ensure you call ``mongoc_cleanup()`` at the end of your process to cleanup lingering allocations from the MongoDB C driver. +* If compiling your own copy of MongoDB C Driver, consider using the cmake option ``-DENABLE_TRACING=ON`` to enable function tracing and hex dumps of network packets to ``STDERR`` and ``STDOUT``. + +Performance Counters +-------------------- + +The MongoDB C driver comes with an optional unique feature to help developers and sysadmins troubleshoot problems in production. +Performance counters are available for each process using the driver. +If available, the counters can be accessed outside of the application process via a shared memory segment. +This means that you can graph statistics about your application process easily from tools like Munin or Nagios. +Your author often uses ``watch --interval=0.5 -d mongoc-stat $PID`` to monitor an application. + +Performance counters are only available on Linux platforms supporting shared memory segments. +On supported platforms they are enabled by default. +Applications can be built without the counters by specifying the cmake option ``-DENABLE_SHM_COUNTERS=OFF``. Additionally, if +performance counters are already compiled, they can be disabled at runtime by specifying the environment variable ``MONGOC_DISABLE_SHM``. + +Performance counters keep track of the following: + +* Active and Disposed Cursors +* Active and Disposed Clients, Client Pools, and Socket Streams. +* Number of operations sent and received, by type. +* Bytes transferred and received. +* Authentication successes and failures. +* Number of wire protocol errors. + +To access counters for a given process, simply provide the process id to the ``mongoc-stat`` program installed with the MongoDB C Driver. + +.. code-block:: none + + $ mongoc-stat 22203 + Operations : Egress Total : The number of sent operations. : 13247 + Operations : Ingress Total : The number of received operations. : 13246 + Operations : Egress Queries : The number of sent Query operations. : 13247 + Operations : Ingress Queries : The number of received Query operations. : 0 + Operations : Egress GetMore : The number of sent GetMore operations. : 0 + Operations : Ingress GetMore : The number of received GetMore operations. : 0 + Operations : Egress Insert : The number of sent Insert operations. : 0 + Operations : Ingress Insert : The number of received Insert operations. : 0 + Operations : Egress Delete : The number of sent Delete operations. : 0 + Operations : Ingress Delete : The number of received Delete operations. : 0 + Operations : Egress Update : The number of sent Update operations. : 0 + Operations : Ingress Update : The number of received Update operations. : 0 + Operations : Egress KillCursors : The number of sent KillCursors operations. : 0 + Operations : Ingress KillCursors : The number of received KillCursors operations. : 0 + Operations : Egress Msg : The number of sent Msg operations. : 0 + Operations : Ingress Msg : The number of received Msg operations. : 0 + Operations : Egress Reply : The number of sent Reply operations. : 0 + Operations : Ingress Reply : The number of received Reply operations. : 13246 + Cursors : Active : The number of active cursors. : 1 + Cursors : Disposed : The number of disposed cursors. : 13246 + Clients : Active : The number of active clients. : 1 + Clients : Disposed : The number of disposed clients. : 0 + Streams : Active : The number of active streams. : 1 + Streams : Disposed : The number of disposed streams. : 0 + Streams : Egress Bytes : The number of bytes sent. : 794931 + Streams : Ingress Bytes : The number of bytes received. : 589694 + Streams : N Socket Timeouts : The number of socket timeouts. : 0 + Client Pools : Active : The number of active client pools. : 1 + Client Pools : Disposed : The number of disposed client pools. : 0 + Protocol : Ingress Errors : The number of protocol errors on ingress. : 0 + Auth : Failures : The number of failed authentication requests. : 0 + Auth : Success : The number of successful authentication requests. : 0 + +.. _basic-troubleshooting_file_bug: + +Submitting a Bug Report +----------------------- + +Think you've found a bug? Want to see a new feature in the MongoDB C driver? Please open a case in our issue management tool, JIRA: + +* `Create an account and login `_. +* Navigate to `the CDRIVER project `_. +* Click *Create Issue* - Please provide as much information as possible about the issue type and how to reproduce it. + +Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are *public*. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/bulk.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/bulk.rst new file mode 100644 index 0000000..428d211 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/bulk.rst @@ -0,0 +1,210 @@ +:man_page: mongoc_bulk + +Bulk Write Operations +===================== + +This tutorial explains how to take advantage of MongoDB C driver bulk write operation features. Executing write operations in batches reduces the number of network round trips, increasing write throughput. + +Bulk Insert +----------- + +First we need to fetch a bulk operation handle from the :symbol:`mongoc_collection_t`. + +.. code-block:: c + + mongoc_bulk_operation_t *bulk = + mongoc_collection_create_bulk_operation_with_opts (collection, NULL); + +We can now start inserting documents to the bulk operation. These will be buffered until we execute the operation. + +The bulk operation will coalesce insertions as a single batch for each consecutive call to :symbol:`mongoc_bulk_operation_insert()`. This creates a pipelined effect when possible. + +To execute the bulk operation and receive the result we call :symbol:`mongoc_bulk_operation_execute()`. + +.. literalinclude:: ../examples/bulk/bulk1.c + :language: c + :caption: bulk1.c + +Example ``reply`` document: + +.. code-block:: none + + {"nInserted" : 10000, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [] + "writeConcernErrors" : [] } + +Mixed Bulk Write Operations +--------------------------- + +MongoDB C driver also supports executing mixed bulk write operations. A batch of insert, update, and remove operations can be executed together using the bulk write operations API. + +Ordered Bulk Write Operations +----------------------------- + +Ordered bulk write operations are batched and sent to the server in the order provided for serial execution. The ``reply`` document describes the type and count of operations performed. + +.. literalinclude:: ../examples/bulk/bulk2.c + :language: c + :caption: bulk2.c + +Example ``reply`` document: + +.. code-block:: none + + { "nInserted" : 3, + "nMatched" : 2, + "nModified" : 2, + "nRemoved" : 10000, + "nUpserted" : 1, + "upserted" : [{"index" : 5, "_id" : 4}], + "writeErrors" : [] + "writeConcernErrors" : [] } + +The ``index`` field in the ``upserted`` array is the 0-based index of the upsert operation; in this example, the sixth operation of the overall bulk operation was an upsert, so its index is 5. + +Unordered Bulk Write Operations +------------------------------- + +Unordered bulk write operations are batched and sent to the server in *arbitrary order* where they may be executed in parallel. Any errors that occur are reported after all operations are attempted. + +In the next example the first and third operations fail due to the unique constraint on ``_id``. Since we are doing unordered execution the second and fourth operations succeed. + +.. literalinclude:: ../examples/bulk/bulk3.c + :language: c + :caption: bulk3.c + +Example ``reply`` document: + +.. code-block:: none + + { "nInserted" : 0, + "nMatched" : 1, + "nModified" : 1, + "nRemoved" : 1, + "nUpserted" : 0, + "writeErrors" : [ + { "index" : 0, + "code" : 11000, + "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 }" }, + { "index" : 2, + "code" : 11000, + "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 3 }" } ], + "writeConcernErrors" : [] } + + Error: E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 } + +The :symbol:`bson_error_t ` domain is ``MONGOC_ERROR_COMMAND`` and its code is 11000. + +.. _bulk_operation_bypassing_document_validation: + +Bulk Operation Bypassing Document Validation +-------------------------------------------- + +This feature is only available when using MongoDB 3.2 and later. + +By default bulk operations are validated against the schema, if any is defined. In certain cases however it may be necessary to bypass the document validation. + +.. literalinclude:: ../examples/bulk/bulk5.c + :language: c + :caption: bulk5.c + +Running the above example will result in: + +.. code-block:: none + + { "nInserted" : 0, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [ + { "index" : 0, + "code" : 121, + "errmsg" : "Document failed validation" } ] } + + Error: Document failed validation + + { "nInserted" : 2, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [] } + +The :symbol:`bson_error_t ` domain is ``MONGOC_ERROR_COMMAND``. + +Bulk Operation Write Concerns +----------------------------- + +By default bulk operations are executed with the :symbol:`write_concern ` of the collection they are executed against. A custom write concern can be passed to the :symbol:`mongoc_collection_create_bulk_operation_with_opts()` method. Write concern errors (e.g. wtimeout) will be reported after all operations are attempted, regardless of execution order. + +.. literalinclude:: ../examples/bulk/bulk4.c + :language: c + :caption: bulk4.c + +Example ``reply`` document and error message: + +.. code-block:: none + + { "nInserted" : 2, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [], + "writeConcernErrors" : [ + { "code" : 64, + "errmsg" : "waiting for replication timed out" } + ] } + + Error: waiting for replication timed out + +The :symbol:`bson_error_t ` domain is ``MONGOC_ERROR_WRITE_CONCERN`` if there are write concern errors and no write errors. Write errors indicate failed operations, so they take precedence over write concern errors, which mean merely that the write concern is not satisfied *yet*. + +.. _setting_collation_order: + +Setting Collation Order +----------------------- + +This feature is only available when using MongoDB 3.4 and later. + +.. literalinclude:: ../examples/bulk/bulk-collation.c + :language: c + :caption: bulk-collation.c + +Running the above example will result in: + +.. code-block:: none + + { "nInserted" : 2, + "nMatched" : 1, + "nModified" : 1, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [ ] + } + +Unacknowledged Bulk Writes +-------------------------- + +Set "w" to zero for an unacknowledged write. The driver sends unacknowledged writes using the legacy opcodes ``OP_INSERT``, ``OP_UPDATE``, and ``OP_DELETE``. + +.. literalinclude:: ../examples/bulk/bulk6.c + :language: c + :caption: bulk6.c + +The ``reply`` document is empty: + +.. code-block:: none + + { } + +Further Reading +--------------- + +See the `Driver Bulk API Spec `_, which describes bulk write operations for all MongoDB drivers. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/conf.py b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/conf.py new file mode 100644 index 0000000..80cfc4d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/conf.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +import os.path +import sys + +# Ensure we can import "mongoc" and "taglist" extension modules. +this_path = os.path.dirname(__file__) +sys.path.append(this_path) +sys.path.append(os.path.normpath(os.path.join(this_path, '../../../build/sphinx'))) + +from mongoc_common import * + +extensions = [ + 'mongoc', + 'taglist', + 'sphinx.ext.intersphinx', + 'sphinx.ext.extlinks', +] + +# General information about the project. +project = 'MongoDB C Driver' +copyright = '2017-present, MongoDB, Inc' +author = 'MongoDB, Inc' + +version_path = os.path.join( + os.path.dirname(__file__), '../../..', 'VERSION_CURRENT') +version = open(version_path).read().strip() +release_path = os.path.join( + os.path.dirname(__file__), '../../..', 'VERSION_RELEASED') +release = open(release_path).read().strip() +release_major, release_minor, release_patch = release.split('.') +release_download = 'https://github.com/mongodb/mongo-c-driver/releases/download/{0}/mongo-c-driver-{0}.tar.gz'.format(release) +rst_prolog = """ +.. |release_major| replace:: %(release_major)s + +.. |release_minor| replace:: %(release_minor)s + +.. |release_patch| replace:: %(release_patch)s + +.. |release_download| replace:: https://github.com/mongodb/mongo-c-driver/releases/download/%(release)s/mongo-c-driver-%(release)s.tar.gz +""" % locals() + +# The extension requires the "base" to contain '%s' exactly once, but we never intend to use it though +extlinks = {'release': (release_download+'%s', '')} + +language = 'en' +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +master_doc = 'index' + +# don't fetch libbson's inventory from mongoc.org during build - Debian and +# Fedora package builds must work offline - maintain a recent copy here +intersphinx_mapping = { + 'bson': ('http://mongoc.org/libbson/current', 'libbson-objects.inv'), +} + +# -- Options for HTML output ---------------------------------------------- + +html_theme_path = ['../../../build/sphinx'] +html_theme = 'mongoc-theme' +html_title = html_shorttitle = 'MongoDB C Driver %s' % version +# html_favicon = None + +html_sidebars = { + '**': ['globaltoc.html'], + 'errors': [], # Make more room for the big table. + 'mongoc_uri_t': [], # Make more room for the big table. +} + + +def add_canonical_link(app, pagename, templatename, context, doctree): + link = ('' % pagename) + + context['metatags'] = context.get('metatags', '') + link + + +def setup(app): + mongoc_common_setup(app) + app.connect('html-page-context', add_canonical_link) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/connection-pooling.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/connection-pooling.rst new file mode 100644 index 0000000..5b3b50c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/connection-pooling.rst @@ -0,0 +1,54 @@ +:man_page: mongoc_connection_pooling + +Connection Pooling +================== + +The MongoDB C driver has two connection modes: single-threaded and pooled. Single-threaded mode is optimized for embedding the driver within languages like PHP. Multi-threaded programs should use pooled mode: this mode minimizes the total connection count, and in pooled mode a background thread monitors the MongoDB server topology, so the program need not block to scan it. + +Single Mode +----------- + +In single mode, your program creates a :symbol:`mongoc_client_t` directly: + +.. code-block:: c + + mongoc_client_t *client = mongoc_client_new ( + "mongodb://hostA,hostB/?replicaSet=my_rs"); + +The client connects on demand when your program first uses it for a MongoDB operation. Using a non-blocking socket per server, it begins a check on each server concurrently, and uses the asynchronous ``poll`` or ``select`` function to receive events from the sockets, until all have responded or timed out. Put another way, in single-threaded mode the C Driver fans out to begin all checks concurrently, then fans in once all checks have completed or timed out. Once the scan completes, the client executes your program's operation and returns. + +In single mode, the client re-scans the server topology roughly once per minute. If more than a minute has elapsed since the previous scan, the next operation on the client will block while the client completes its scan. This interval is configurable with ``heartbeatFrequencyMS`` in the connection string. (See :symbol:`mongoc_uri_t`.) + +A single client opens one connection per server in your topology: these connections are used both for scanning the topology and performing normal operations. + +Pooled Mode +----------- + +To activate pooled mode, create a :symbol:`mongoc_client_pool_t`: + +.. code-block:: c + + mongoc_uri_t *uri = mongoc_uri_new ( + "mongodb://hostA,hostB/?replicaSet=my_rs"); + + mongoc_client_pool_t *pool = mongoc_client_pool_new (uri); + +When your program first calls :symbol:`mongoc_client_pool_pop`, the pool launches a background thread for monitoring. The thread fans out and connects to all servers in the connection string, using non-blocking sockets and a simple event loop. As it receives ismaster responses from the servers, it updates its view of the server topology. Each time the thread discovers a new server it begins connecting to it, and adds the new socket to the list of non-blocking sockets in the event loop. + +Each thread that executes MongoDB operations must check out a client from the pool: + +.. code-block:: c + + mongoc_client_t *client = mongoc_client_pool_pop (pool); + + /* use the client for operations ... */ + + mongoc_client_pool_push (pool, client); + +The :symbol:`mongoc_client_t` object is not thread-safe, only the :symbol:`mongoc_client_pool_t` is. + +When the driver is in pooled mode, your program's operations are unblocked as soon as monitoring discovers a usable server. For example, if a thread in your program is waiting to execute an "insert" on the primary, it is unblocked as soon as the primary is discovered, rather than waiting for all secondaries to be checked as well. + +The pool opens one connection per server for monitoring, and each client opens its own connection to each server it uses for application operations. The background thread re-scans the server topology roughly every 10 seconds. This interval is configurable with ``heartbeatFrequencyMS`` in the connection string. (See :symbol:`mongoc_uri_t`.) + +See :ref:`connection_pool_options` to configure pool size and behavior, and see :symbol:`mongoc_client_pool_t` for an extended example of a multi-threaded program that uses the driver in pooled mode. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/create-indexes.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/create-indexes.rst new file mode 100644 index 0000000..4bf9f4d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/create-indexes.rst @@ -0,0 +1,17 @@ +:man_page: mongoc_create_indexes + +Creating Indexes +================ + +To create indexes on a MongoDB collection, execute the ``createIndexes`` command +with a command function like :symbol:`mongoc_database_write_command_with_opts` or +:symbol:`mongoc_collection_write_command_with_opts`. See `the MongoDB +Manual entry for the createIndexes command +`_ for details. + +Example +------- + +.. literalinclude:: ../examples/example-create-indexes.c + :language: c + :caption: example-create-indexes.c diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/cursors.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/cursors.rst new file mode 100644 index 0000000..0c9a82e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/cursors.rst @@ -0,0 +1,90 @@ +:man_page: mongoc_cursors + +Cursors +======= + +Handling Cursor Failures +------------------------ + +Cursors exist on a MongoDB server. However, the ``mongoc_cursor_t`` structure gives the local process a handle to the cursor. It is possible for errors to occur on the server while iterating a cursor on the client. Even a network partition may occur. This means that applications should be robust in handling cursor failures. + +While iterating cursors, you should check to see if an error has occurred. See the following example for how to robustly check for errors. + +.. code-block:: c + + static void + print_all_documents (mongoc_collection_t *collection) + { + mongoc_cursor_t *cursor; + const bson_t *doc; + bson_error_t error; + bson_t query = BSON_INITIALIZER; + char *str; + + cursor = mongoc_collection_find_with_opts (collection, query, NULL, NULL); + + while (mongoc_cursor_next (cursor, &doc)) { + str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\n", str); + bson_free (str); + } + + if (mongoc_cursor_error (cursor, &error)) { + fprintf (stderr, "Failed to iterate all documents: %s\n", error.message); + } + + mongoc_cursor_destroy (cursor); + } + +Destroying Server-Side Cursors +------------------------------ + +The MongoDB C driver will automatically destroy a server-side cursor when :symbol:`mongoc_cursor_destroy()` is called. Failure to call this function when done with a cursor will leak memory client side as well as consume extra memory server side. If the cursor was configured to never timeout, it will become a memory leak on the server. + +.. _cursors_tailable: + +Tailable Cursors +---------------- + +Tailable cursors are cursors that remain open even after they've returned a final result. This way, if more documents are added to a collection (i.e., to the cursor's result set), then you can continue to call :symbol:`mongoc_cursor_next()` to retrieve those additional results. + +Here's a complete test case that demonstrates the use of tailable cursors. + +.. note:: + + Tailable cursors are for capped collections only. + +An example to tail the oplog from a replica set. + +.. literalinclude:: ../examples/mongoc-tail.c + :language: c + :caption: mongoc-tail.c + +Let's compile and run this example against a replica set to see updates as they are made. + +.. code-block:: none + + $ gcc -Wall -o mongoc-tail mongoc-tail.c $(pkg-config --cflags --libs libmongoc-1.0) + $ ./mongoc-tail mongodb://example.com/?replicaSet=myReplSet + { + "h" : -8458503739429355503, + "ns" : "test.test", + "o" : { + "_id" : { + "$oid" : "5372ab0a25164be923d10d50" + } + }, + "op" : "i", + "ts" : { + "$timestamp" : { + "i" : 1, + "t" : 1400023818 + } + }, + "v" : 2 + } + +The line of output is a sample from performing ``db.test.insert({})`` from the mongo shell on the replica set. + +See also :symbol:`mongoc_cursor_set_max_await_time_ms`. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/debugging.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/debugging.rst new file mode 100644 index 0000000..8b4e38e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/debugging.rst @@ -0,0 +1,106 @@ +:man_page: mongoc_debugging + +Aids for Debugging +================== + +GDB +--- + +This repository contains a ``.gdbinit`` file that contains helper functions to +aid debugging of data structures. GDB will load this file +`automatically`_ if you have added the directory which contains the `.gdbinit` file to GDB's +`auto-load safe-path`_, *and* you start GDB from the directory which holds the `.gdbinit` file. + +You can see the safe-path with ``show auto-load safe-path`` on a GDB prompt. You +can configure it by setting it in ``~/.gdbinit`` with:: + + add-auto-load-safe-path /path/to/mongo-c-driver + +If you haven't added the path to your auto-load safe-path, or start GDB in +another directory, load the file with:: + + source path/to/mongo-c-driver/.gdbinit + +The ``.gdbinit`` file defines the ``printbson`` function, which shows the contents of a ``bson_t *`` variable. +If you have a local ``bson_t``, then you must prefix the variable with a `&`. + +An example GDB session looks like:: + + (gdb) printbson bson + ALLOC [0x555556cd7310 + 0] (len=475) + { + 'bool' : true, + 'int32' : NumberInt("42"), + 'int64' : NumberLong("3000000042"), + 'string' : "Stŕìñg", + 'objectId' : ObjectID("5A1442F3122D331C3C6757E1"), + 'utcDateTime' : UTCDateTime(1511277299031), + 'arrayOfInts' : [ + '0' : NumberInt("1"), + '1' : NumberInt("2") + ], + 'embeddedDocument' : { + 'arrayOfStrings' : [ + '0' : "one", + '1' : "two" + ], + 'double' : 2.718280, + 'notherDoc' : { + 'true' : NumberInt("1"), + 'false' : false + } + }, + 'binary' : Binary("02", "3031343532333637"), + 'regex' : Regex("@[a-z]+@", "im"), + 'null' : null, + 'js' : JavaScript("print foo"), + 'jsws' : JavaScript("print foo") with scope: { + 'f' : NumberInt("42"), + 'a' : [ + '0' : 3.141593, + '1' : 2.718282 + ] + }, + 'timestamp' : Timestamp(4294967295, 4294967295), + 'double' : 3.141593 + } + +.. _automatically: https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading.html +.. _auto-load safe-path: https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading-safe-path.html + +LLDB +---- + +This repository also includes a script that customizes LLDB's standard ``print`` command to print a ``bson_t`` or ``bson_t *`` as JSON:: + + (lldb) print b + (bson_t) $0 = {"x": 1, "y": 2} + +The custom ``bson`` command provides more options:: + + (lldb) bson --verbose b + len=19 + flags=INLINE|STATIC + { + "x": 1, + "y": 2 + } + (lldb) bson --raw b + '\x13\x00\x00\x00\x10x\x00\x01\x00\x00\x00\x10y\x00\x02\x00\x00\x00\x00' + +Type ``help bson`` for a list of options. + +The script requires a build of libbson with debug symbols, and an installation of `PyMongo`_. Install PyMongo with:: + + python -m pip install pymongo + +If you see "No module named pip" then you must `install pip`_, then run the previous command again. + +Create a file ``~/.lldbinit`` containing:: + + command script import /path/to/mongo-c-driver/lldb_bson.py + +If you see "bson command installed by lldb_bson" at the beginning of your LLDB session, you've installed the script correctly. + +.. _PyMongo: https://pypi.python.org/pypi/pymongo +.. _install pip: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/distinct-mapreduce.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/distinct-mapreduce.rst new file mode 100644 index 0000000..159ada2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/distinct-mapreduce.rst @@ -0,0 +1,90 @@ +:man_page: mongoc_distinct_mapreduce + +"distinct" and "mapReduce" +========================== + +This document provides some practical, simple, examples to demonstrate the ``distinct`` and ``mapReduce`` commands. + +Setup +----- + +First we'll write some code to insert sample data: + +.. literalinclude:: ../examples/doc-common-insert.c + :language: c + :caption: doc-common-insert.c + +"distinct" command +------------------ + +This is how to use the ``distinct`` command to get the distinct values of ``x`` which are greater than ``1``: + +.. literalinclude:: ../examples/basic_aggregation/distinct.c + :language: c + :caption: distinct.c + +"mapReduce" - basic example +--------------------------- + +A simple example using the map reduce framework. It simply adds up the number of occurrences of each "tag". + +First define the ``map`` and ``reduce`` functions: + +.. literalinclude:: ../examples/basic_aggregation/constants.c + :language: c + :caption: constants.c + +Run the ``mapReduce`` command: + +.. literalinclude:: ../examples/basic_aggregation/map-reduce-basic.c + :language: c + :caption: map-reduce-basic.c + +"mapReduce" - more complicated example +-------------------------------------- + +You must have replica set running for this. + +In this example we contact a secondary in the replica set and do an "inline" map reduce, so the results are returned immediately: + +.. literalinclude:: ../examples/basic_aggregation/map-reduce-advanced.c + :language: c + :caption: map-reduce-advanced.c + +Running the Examples +-------------------- + +Here's how to run the example code + +.. literalinclude:: ../examples/basic_aggregation/basic-aggregation.c + :language: c + :caption: basic-aggregation.c + +If you want to try the advanced map reduce example with a secondary, start a replica set (instructions for how to do this can be found `here `_). + +Otherwise, just start an instance of MongoDB: + +.. code-block:: none + + $ mongod + +Now compile and run the example program: + +.. code-block:: none + + $ cd examples/basic_aggregation/ + $ gcc -Wall -o agg-example basic-aggregation.c $(pkg-config --cflags --libs libmongoc-1.0) + $ ./agg-example localhost + + Inserting data + distinct + Next double: 2.000000 + Next double: 3.000000 + map reduce + { "result" : "outCollection", "timeMillis" : 155, "counts" : { "input" : 84, "emit" : 126, "reduce" : 3, "output" : 3 }, "ok" : 1 } + { "_id" : "cat", "value" : 63 } + { "_id" : "dog", "value" : 42 } + { "_id" : "mouse", "value" : 21 } + more complicated map reduce + { "results" : [ { "_id" : "cat", "value" : 63 }, { "_id" : "dog", "value" : 42 }, { "_id" : "mouse", "value" : 21 } ], "timeMillis" : 14, "counts" : { "input" : 84, "emit" : 126, "reduce" : 3, "output" : 3 }, "ok" : 1 } + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/errors.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/errors.rst new file mode 100644 index 0000000..43c7142 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/errors.rst @@ -0,0 +1,168 @@ +:man_page: mongoc_errors + +« :doc:`index` + +Error Reporting +=============== + +Description +----------- + +Many C Driver functions report errors by returning ``false`` or -1 and filling out a :symbol:`bson:bson_error_t` structure with an error domain, error code, and message. Use ``domain`` to determine which subsystem generated the error, and ``code`` for the specific error. ``message`` is a human-readable error description. + +See also: :doc:`Handling Errors in libbson `. + ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|Domain | Code | Description | ++===================================+=================================================================================================================================+============================================================================================================================================================================================================================================================================================================================================+ +| ``MONGOC_ERROR_CLIENT`` | ``MONGOC_ERROR_CLIENT_TOO_BIG`` | You tried to send a message larger than the server's max message size. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_CLIENT_AUTHENTICATE`` | Wrong credentials, or failure sending or receiving authentication messages. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_CLIENT_NO_ACCEPTABLE_PEER`` | You tried an SSL connection but the driver was not built with SSL. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_CLIENT_IN_EXHAUST`` | You began iterating an exhaust cursor, then tried to begin another operation with the same :symbol:`mongoc_client_t`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_CLIENT_SESSION_FAILURE`` | Failure related to creating or using a logical session. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_STREAM`` | ``MONGOC_ERROR_STREAM_NAME_RESOLUTION`` | DNS failure. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_STREAM_SOCKET`` | Timeout communicating with server, or connection closed. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_STREAM_CONNECT`` | Failed to connect to server. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_PROTOCOL`` | ``MONGOC_ERROR_PROTOCOL_INVALID_REPLY`` | Corrupt response from server. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION`` | The server version is too old or too new to communicate with the driver. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_CURSOR`` | ``MONGOC_ERROR_CURSOR_INVALID_CURSOR`` | You passed bad arguments to :symbol:`mongoc_collection_find_with_opts`, or you called :symbol:`mongoc_cursor_next` on a completed or failed cursor, or the cursor timed out on the server. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_CHANGE_STREAM_NO_RESUME_TOKEN`` | A resume token was not returned in a document found with :symbol:`mongoc_change_stream_next` | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_QUERY_FAILURE`` | :ref:`Error API Version 1 `: Server error from command or query. The server error message is in ``message``. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SERVER`` | ``MONGOC_ERROR_QUERY_FAILURE`` | :ref:`Error API Version 2 `: Server error from command or query. The server error message is in ``message``. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SASL`` | A SASL error code. | ``man sasl_errors`` for a list of codes. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_BSON`` | ``MONGOC_ERROR_BSON_INVALID`` | You passed an invalid or oversized BSON document as a parameter, or called :symbol:`mongoc_collection_create_index` with invalid keys, or the server reply was corrupt. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_NAMESPACE`` | ``MONGOC_ERROR_NAMESPACE_INVALID`` | You tried to create a collection with an invalid name. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_COMMAND`` | ``MONGOC_ERROR_COMMAND_INVALID_ARG`` | Many functions set this error code when passed bad parameters. Print the error message for details. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION`` | You tried to use a command option the server does not support. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_DUPLICATE_KEY`` | An insert or update failed because because of a duplicate ``_id`` or other unique-index violation. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_COMMAND`` | `Error code from server `_. | :ref:`Error API Version 1 `: Server error from a command. The server error message is in ``message``. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SERVER`` | `Error code from server `_. | :ref:`Error API Version 2 `: Server error from a command. The server error message is in ``message``. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_COLLECTION`` | ``MONGOC_ERROR_COLLECTION_INSERT_FAILED``, ``MONGOC_ERROR_COLLECTION_UPDATE_FAILED``, ``MONGOC_ERROR_COLLECTION_DELETE_FAILED``.| Invalid or empty input to :symbol:`mongoc_collection_insert_one`, :symbol:`mongoc_collection_insert_bulk`, :symbol:`mongoc_collection_update_one`, :symbol:`mongoc_collection_update_many`, :symbol:`mongoc_collection_replace_one`, :symbol:`mongoc_collection_delete_one`, or :symbol:`mongoc_collection_delete_many`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_COLLECTION`` | `Error code from server `_. | :ref:`Error API Version 1 `: Server error from :symbol:`mongoc_collection_insert_one`, :symbol:`mongoc_collection_insert_bulk`, :symbol:`mongoc_collection_update_one`, :symbol:`mongoc_collection_update_many`, :symbol:`mongoc_collection_replace_one`, | +| | | :symbol:`mongoc_collection_delete_one`, or :symbol:`mongoc_collection_delete_many`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SERVER`` | `Error code from server `_. | :ref:`Error API Version 2 `: Server error from :symbol:`mongoc_collection_insert_one`, :symbol:`mongoc_collection_insert_bulk`, :symbol:`mongoc_collection_update_one`, :symbol:`mongoc_collection_update_many`, :symbol:`mongoc_collection_replace_one`, | +| | | :symbol:`mongoc_collection_delete_one`, or :symbol:`mongoc_collection_delete_many`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_GRIDFS`` | ``MONGOC_ERROR_GRIDFS_CHUNK_MISSING`` | The GridFS file is missing a document in its ``chunks`` collection. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_GRIDFS_CORRUPT`` | A data inconsistency was detected in GridFS. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_GRIDFS_INVALID_FILENAME`` | You passed a NULL filename to :symbol:`mongoc_gridfs_remove_by_filename`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| | ``MONGOC_ERROR_GRIDFS_PROTOCOL_ERROR`` | You called :symbol:`mongoc_gridfs_file_set_id` after :symbol:`mongoc_gridfs_file_save`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SCRAM`` | ``MONGOC_ERROR_SCRAM_PROTOCOL_ERROR`` | Failure in SCRAM-SHA-1 authentication. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_SERVER_SELECTION`` | ``MONGOC_ERROR_SERVER_SELECTION_FAILURE`` | No replica set member or mongos is available, or none matches your :doc:`read preference `, or you supplied an invalid :symbol:`mongoc_read_prefs_t`. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_WRITE_CONCERN`` | `Error code from server `_. | There was a :doc:`write concern ` error or :doc:`timeout ` from the server. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``MONGOC_ERROR_TRANSACTION`` | ``MONGOC_ERROR_TRANSACTION_INVALID`` | You attempted to start a transaction when one is already in progress, or commit or abort when there is no transaction. | ++-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +.. _error_labels: + +Error Labels +------------ + +In some cases your application must make decisions based on what category of error the driver has returned, but these categories do not correspond perfectly to an error domain or code. In such cases, error *labels* provide a reliable way to determine how your application should respond to an error. + +Any C Driver function that has a :symbol:`bson:bson_t` out-parameter named ``reply`` may include error labels to the reply, in the form of a BSON field named "errorLabels" containing an array of strings: + +.. code-block:: none + + { "errorLabels": [ "TransientTransactionError" ] } + +Use :symbol:`mongoc_error_has_label` to test if a reply contains a specific label. See :symbol:`mongoc_client_session_start_transaction` for example code that demonstrates the use of error labels in application logic. + +The following error labels are currently defined. Future versions of MongoDB may introduce new labels. + +TransientTransactionError +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Within a multi-document transaction, certain errors can leave the transaction in an unknown or aborted state. These include write conflicts, primary stepdowns, and network errors. In response, the application should abort the transaction and try the same sequence of operations again in a new transaction. + +UnknownTransactionCommitResult +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When :symbol:`mongoc_client_session_commit_transaction` encounters a network error or certain server errors, it is not known whether the transaction was committed. Applications should attempt to commit the transaction again until: the commit succeeds, the commit fails with an error *not* labeled "UnknownTransactionCommitResult", or the application chooses to give up. + +.. _errors_error_api_version: +.. _error_api_version: + +Setting the Error API Version +----------------------------- + +The driver's error reporting began with a design flaw: when the error *domain* is ``MONGOC_ERROR_COLLECTION``, ``MONGOC_ERROR_QUERY``, or ``MONGOC_ERROR_COMMAND``, the error *code* might originate from the server or the driver. An application cannot always know where an error originated, and therefore cannot tell what the code means. + +For example, if :symbol:`mongoc_collection_update_one` sets the error's domain to ``MONGOC_ERROR_COLLECTION`` and its code to 24, the application cannot know whether 24 is the generic driver error code ``MONGOC_ERROR_COLLECTION_UPDATE_FAILED`` or the specific server error code "LockTimeout". + +To fix this flaw while preserving backward compatibility, the C Driver 1.4 introduces "Error API Versions". Version 1, the default Error API Version, maintains the flawed behavior. Version 2 adds a new error domain, ``MONGOC_ERROR_SERVER``. In Version 2, error codes originating on the server always have error domain ``MONGOC_ERROR_SERVER`` or ``MONGOC_ERROR_WRITE_CONCERN``. When the driver uses Version 2 the application can always determine the origin and meaning of error codes. New applications should use Version 2, and existing applications should be updated to use Version 2 as well. + ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| Error Source | API Version 1 | API Version 2 | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| :symbol:`mongoc_cursor_error` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| :symbol:`mongoc_client_command_with_opts`, | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` | +| :symbol:`mongoc_database_command_with_opts`, and | | | +| other command functions | | | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| :symbol:`mongoc_collection_count_with_opts` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` | +| :symbol:`mongoc_client_get_database_names_with_opts`,| | | +| and other command helper functions | | | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| :symbol:`mongoc_collection_insert_one` | ``MONGOC_ERROR_COMMAND`` | ``MONGOC_ERROR_SERVER`` | +| :symbol:`mongoc_collection_insert_bulk` | | | +| :symbol:`mongoc_collection_update_one` | | | +| :symbol:`mongoc_collection_update_many` | | | +| :symbol:`mongoc_collection_replace_one` | | | +| :symbol:`mongoc_collection_delete_one` | | | +| :symbol:`mongoc_collection_delete_many` | | | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| :symbol:`mongoc_bulk_operation_execute` | ``MONGOC_ERROR_COMMAND`` | ``MONGOC_ERROR_SERVER`` | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ +| Write-concern timeout | ``MONGOC_ERROR_WRITE_CONCERN`` | ``MONGOC_ERROR_WRITE_CONCERN`` | ++------------------------------------------------------+----------------------------------------+----------------------------------------+ + +The Error API Versions are defined with ``MONGOC_ERROR_API_VERSION_LEGACY`` and ``MONGOC_ERROR_API_VERSION_2``. Set the version with :symbol:`mongoc_client_set_error_api` or :symbol:`mongoc_client_pool_set_error_api`. + +See Also +-------- + +`MongoDB Server Error Codes `_ + +.. only:: html + + Functions + --------- + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + mongoc_error_has_label diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/full_index.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/full_index.rst new file mode 100644 index 0000000..72f8447 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/full_index.rst @@ -0,0 +1,15 @@ +:man_page: mongoc_reference +:orphan: + +.. Yes it's confusing: the home page is called "index" so this is "full_index", + and it works by including the complete Table of Contents from the homepage, + i.e., "index". + +Index +===== + +.. toctree:: + :maxdepth: 6 + :titlesonly: + + index diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/guides.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/guides.rst new file mode 100644 index 0000000..e5dac4e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/guides.rst @@ -0,0 +1,19 @@ +:man_page: mongoc_guides + +Guides +====== + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + mongoc-common-task-examples + advanced-connections + connection-pooling + cursors + bulk + aggregate + distinct-mapreduce + visual-studio-guide + create-indexes + debugging diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/.nojekyll b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/.nojekyll new file mode 100644 index 0000000..1910281 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/.nojekyll @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/CMakeLists.txt new file mode 100644 index 0000000..6211f56 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/CMakeLists.txt @@ -0,0 +1,39 @@ +file (GLOB_RECURSE _images_pngs + RELATIVE ${PROJECT_SOURCE_DIR}/doc/static + ${PROJECT_SOURCE_DIR}/doc/static/*.png +) +foreach (png IN LISTS _images_pngs) + extra_dist_generated (_images/${png}) +endforeach () + +# Additional generated static files +extra_dist_generated ( + .nojekyll + objects.inv + _static/ajax-loader.gif + _static/basic.css + _static/comment-bright.png + _static/comment-close.png + _static/comment.png + _static/doctools.js + _static/down-pressed.png + _static/down.png + _static/file.png + _static/jquery.js + _static/minus.png + _static/mongoc.css + _static/plus.png + _static/pygments.css + _static/searchtools.js + _static/underscore.js + _static/up-pressed.png + _static/up.png + _static/websupport.js + genindex.html + search.html + searchindex.js +) + +set_dist_list (src_libmongoc_doc_html_DIST + CMakeLists.txt +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies-static.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies-static.png new file mode 100644 index 0000000..b70984e Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies-static.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies.png new file mode 100644 index 0000000..3fe2c7a Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-dependencies.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-include-directories.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-include-directories.png new file mode 100644 index 0000000..afd1812 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-add-include-directories.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-create-project.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-create-project.png new file mode 100644 index 0000000..8c7f749 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-create-project.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-set-path.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-set-path.png new file mode 100644 index 0000000..c135b1a Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-set-path.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-switch-architecture.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-switch-architecture.png new file mode 100644 index 0000000..fdc52d1 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_images/msvc-switch-architecture.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/ajax-loader.gif b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/ajax-loader.gif new file mode 100644 index 0000000..61faf8c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/ajax-loader.gif differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/basic.css b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/basic.css new file mode 100644 index 0000000..104f076 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/basic.css @@ -0,0 +1,676 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 450px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist td { + vertical-align: top; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-bright.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-bright.png new file mode 100644 index 0000000..15e27ed Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-bright.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-close.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-close.png new file mode 100644 index 0000000..4d91bcf Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment-close.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment.png new file mode 100644 index 0000000..dfbc0cb Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/comment.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/doctools.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/doctools.js new file mode 100644 index 0000000..ffadbec --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/doctools.js @@ -0,0 +1,315 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var bbox = span.getBBox(); + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + var parentOfText = node.parentNode.parentNode; + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { + this.initOnKeyListeners(); + } + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated === 'undefined') + return string; + return (typeof translated === 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated === 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash && $.browser.mozilla) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) === 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this === '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down-pressed.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down-pressed.png new file mode 100644 index 0000000..5756c8c Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down-pressed.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down.png new file mode 100644 index 0000000..1b3bdad Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/down.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/file.png b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/file.png differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/jquery.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/jquery.js new file mode 100644 index 0000000..644d35e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/_static/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S), +a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), +null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Advanced Connections

+

The following guide contains information specific to certain types of MongoDB configurations.

+

For an example of connecting to a simple standalone server, see the Tutorial. To establish a connection with authentication options enabled, see the Authentication page.

+
+

Connecting to a Replica Set

+

Connecting to a replica set is much like connecting to a standalone MongoDB server. Simply specify the replica set name using the ?replicaSet=myreplset URI option.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+
+   mongoc_init ();
+
+   /* Create our MongoDB Client */
+   client = mongoc_client_new (
+      "mongodb://host01:27017,host02:27017,host03:27017/?replicaSet=myreplset");
+
+   /* Do some work */
+   /* TODO */
+
+   /* Clean up */
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
+

Tip

+

Multiple hostnames can be specified in the MongoDB connection string URI, with a comma separating hosts in the seed list.

+

It is recommended to use a seed list of members of the replica set to allow the driver to connect to any node.

+
+
+
+

Connecting to a Sharded Cluster

+

To connect to a sharded cluster, specify the mongos nodes the client should connect to. The C Driver will automatically detect that it has connected to a mongos sharding server.

+

If more than one hostname is specified, a seed list will be created to attempt failover between the mongos instances.

+
+

Warning

+

Specifying the replicaSet parameter when connecting to a mongos sharding server is invalid.

+
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+
+   mongoc_init ();
+
+   /* Create our MongoDB Client */
+   client = mongoc_client_new ("mongodb://myshard01:27017/");
+
+   /* Do something with client ... */
+
+   /* Free the client */
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
+
+

Connecting to an IPv6 Address

+

The MongoDB C Driver will automatically resolve IPv6 addresses from host names. However, to specify an IPv6 address directly, wrap the address in [].

+
mongoc_uri_t *uri = mongoc_uri_new ("mongodb://[::1]:27017");
+
+
+
+
+

Connecting with IPv4 and IPv6

+

If connecting to a hostname that has both IPv4 and IPv6 DNS records, the behavior follows RFC-6555. A connection to the IPv6 address is attempted first. If IPv6 fails, then a connection is attempted to the IPv4 address. If the connection attempt to IPv6 does not complete within 250ms, then IPv4 is tried in parallel. Whichever succeeds connection first cancels the other. The successful DNS result is cached for 10 minutes.

+

As a consequence, attempts to connect to a mongod only listening on IPv4 may be delayed if there are both A (IPv4) and AAAA (IPv6) DNS records associated with the host.

+

To avoid a delay, configure hostnames to match the MongoDB configuration. That is, only create an A record if the mongod is only listening on IPv4.

+
+
+

Connecting to a UNIX Domain Socket

+

On UNIX-like systems, the C Driver can connect directly to a MongoDB server using a UNIX domain socket. Pass the URL-encoded path to the socket, which must be suffixed with .sock. For example, to connect to a domain socket at /tmp/mongodb-27017.sock:

+
mongoc_uri_t *uri = mongoc_uri_new ("mongodb://%2Ftmp%2Fmongodb-27017.sock");
+
+
+

Include username and password like so:

+
mongoc_uri_t *uri = mongoc_uri_new ("mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock");
+
+
+
+
+

Connecting to a server over SSL

+

These are instructions for configuring TLS/SSL connections.

+

To run a server locally (on port 27017, for example):

+
$ mongod --port 27017 --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem
+
+
+

Add /?ssl=true to the end of a client URI.

+
mongoc_client_t *client = NULL;
+client = mongoc_client_new ("mongodb://localhost:27017/?ssl=true");
+
+
+

MongoDB requires client certificates by default, unless the --sslAllowConnectionsWithoutCertificates is provided. The C Driver can be configured to present a client certificate using a mongoc_ssl_opt_t:

+
const mongoc_ssl_opt_t *ssl_default = mongoc_ssl_opt_get_default ();
+mongoc_ssl_opt_t ssl_opts = { 0 };
+
+/* optionally copy in a custom trust directory or file; otherwise the default is used. */
+memcpy (&ssl_opts, ssl_default, sizeof ssl_opts);
+ssl_opts.pem_file = "client.pem"
+
+mongoc_client_set_ssl_opts (client, &ssl_opts);
+
+
+

The client certificate provided by pem_file must be issued by one of the server trusted Certificate Authorities listed in --sslCAFile, or issued by a CA in the native certificate store on the server when omitted.

+

To verify the server certificate against a specific CA, provide a PEM armored file with a CA certificate, or concatenated list of CA certificates using the ca_file option, or c_rehash directory structure of CAs, pointed to using the ca_dir option. When no ca_file or ca_dir is provided, the driver will use CAs provided by the native platform certificate store.

+

See mongoc_ssl_opt_t for more information on the various SSL related options.

+
+
+

Compressing data to and from MongoDB

+

MongoDB 3.4 added Snappy compression support, and zlib compression in 3.6. +To enable compression support the client must be configured with which compressors to use:

+
mongoc_client_t *client = NULL;
+client = mongoc_client_new ("mongodb://localhost:27017/?compressors=snappy,zlib");
+
+
+

The compressors option specifies the priority order of compressors the +client wants to use. Messages are compressed if the client and server share any +compressors in common.

+

Note that the compressor used by the server might not be the same compressor as +the client used. For example, if the client uses the connection string +compressors=zlib,snappy the client will use zlib compression to send +data (if possible), but the server might still reply using snappy, +depending on how the server was configured.

+

The driver must be built with zlib and/or snappy support to enable compression +support, any unknown (or not compiled in) compressor value will be ignored.

+
+
+

Additional Connection Options

+

The full list of connection options can be found in the mongoc_uri_t docs.

+

Certain socket/connection related options are not configurable:

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescriptionValue
SO_KEEPALIVETCP Keep AliveEnabled
TCP_KEEPIDLEHow long a connection needs to remain idle before TCP +starts sending keepalive probes300 seconds
TCP_KEEPINTVLThe time in seconds between TCP probes10 seconds
TCP_KEEPCNTHow many probes to send, without acknowledgement, +before dropping the connection9 probes
TCP_NODELAYSend packets as soon as possible or buffer small +packets (Nagle algorithm)Enabled (no buffering)
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/aggregate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/aggregate.html new file mode 100644 index 0000000..23845e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/aggregate.html @@ -0,0 +1,305 @@ + + + + + + + + Aggregation Framework Examples — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Aggregation Framework Examples

+

This document provides a number of practical examples that display the capabilities of the aggregation framework.

+

The Aggregations using the Zip Codes Data Set examples uses a publicly available data set of all zipcodes and populations in the United States. These data are available at: zips.json.

+
+

Requirements

+

Let’s check if everything is installed.

+

Use the following command to load zips.json data set into mongod instance:

+
$ mongoimport --drop -d test -c zipcodes zips.json
+
+
+

Let’s use the MongoDB shell to verify that everything was imported successfully.

+
$ mongo test
+connecting to: test
+> db.zipcodes.count()
+29467
+> db.zipcodes.findOne()
+{
+      "_id" : "35004",
+      "city" : "ACMAR",
+      "loc" : [
+              -86.51557,
+              33.584132
+      ],
+      "pop" : 6055,
+      "state" : "AL"
+}
+
+
+
+
+

Aggregations using the Zip Codes Data Set

+

Each document in this collection has the following form:

+
{
+  "_id" : "35004",
+  "city" : "Acmar",
+  "state" : "AL",
+  "pop" : 6055,
+  "loc" : [-86.51557, 33.584132]
+}
+
+
+

In these documents:

+
    +
  • The _id field holds the zipcode as a string.
  • +
  • The city field holds the city name.
  • +
  • The state field holds the two letter state abbreviation.
  • +
  • The pop field holds the population.
  • +
  • The loc field holds the location as a [latitude, longitude] array.
  • +
+
+
+

States with Populations Over 10 Million

+

To get all states with a population greater than 10 million, use the following aggregation pipeline:

+
+
aggregation1.c
+
#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_pipeline (mongoc_collection_t *collection)
+{
+   mongoc_cursor_t *cursor;
+   bson_error_t error;
+   const bson_t *doc;
+   bson_t *pipeline;
+   char *str;
+
+   pipeline = BCON_NEW ("pipeline",
+                        "[",
+                        "{",
+                        "$group",
+                        "{",
+                        "_id",
+                        "$state",
+                        "total_pop",
+                        "{",
+                        "$sum",
+                        "$pop",
+                        "}",
+                        "}",
+                        "}",
+                        "{",
+                        "$match",
+                        "{",
+                        "total_pop",
+                        "{",
+                        "$gte",
+                        BCON_INT32 (10000000),
+                        "}",
+                        "}",
+                        "}",
+                        "]");
+
+   cursor = mongoc_collection_aggregate (
+      collection, MONGOC_QUERY_NONE, pipeline, NULL, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Cursor Failure: %s\n", error.message);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   bson_destroy (pipeline);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string =
+      "mongodb://localhost:27017/?appname=aggregation-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "zipcodes");
+
+   print_pipeline (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

You should see a result like the following:

+
{ "_id" : "PA", "total_pop" : 11881643 }
+{ "_id" : "OH", "total_pop" : 10847115 }
+{ "_id" : "NY", "total_pop" : 17990455 }
+{ "_id" : "FL", "total_pop" : 12937284 }
+{ "_id" : "TX", "total_pop" : 16986510 }
+{ "_id" : "IL", "total_pop" : 11430472 }
+{ "_id" : "CA", "total_pop" : 29760021 }
+
+
+

The above aggregation pipeline is build from two pipeline operators: $group and $match.

+

The $group pipeline operator requires _id field where we specify grouping; remaining fields specify how to generate composite value and must use one of the group aggregation functions: $addToSet, $first, $last, $max, $min, $avg, $push, $sum. The $match pipeline operator syntax is the same as the read operation query syntax.

+

The $group process reads all documents and for each state it creates a separate document, for example:

+
{ "_id" : "WA", "total_pop" : 4866692 }
+
+
+

The total_pop field uses the $sum aggregation function to sum the values of all pop fields in the source documents.

+

Documents created by $group are piped to the $match pipeline operator. It returns the documents with the value of total_pop field greater than or equal to 10 million.

+
+
+

Average City Population by State

+

To get the first three states with the greatest average population per city, use the following aggregation:

+
pipeline = BCON_NEW ("pipeline", "[",
+   "{", "$group", "{", "_id", "{", "state", "$state", "city", "$city", "}", "pop", "{", "$sum", "$pop", "}", "}", "}",
+   "{", "$group", "{", "_id", "$_id.state", "avg_city_pop", "{", "$avg", "$pop", "}", "}", "}",
+   "{", "$sort", "{", "avg_city_pop", BCON_INT32 (-1), "}", "}",
+   "{", "$limit", BCON_INT32 (3) "}",
+"]");
+
+
+

This aggregate pipeline produces:

+
{ "_id" : "DC", "avg_city_pop" : 303450.0 }
+{ "_id" : "FL", "avg_city_pop" : 27942.29805615551 }
+{ "_id" : "CA", "avg_city_pop" : 27735.341099720412 }
+
+
+

The above aggregation pipeline is build from three pipeline operators: $group, $sort and $limit.

+

The first $group operator creates the following documents:

+
{ "_id" : { "state" : "WY", "city" : "Smoot" }, "pop" : 414 }
+
+
+

Note, that the $group operator can’t use nested documents except the _id field.

+

The second $group uses these documents to create the following documents:

+
{ "_id" : "FL", "avg_city_pop" : 27942.29805615551 }
+
+
+

These documents are sorted by the avg_city_pop field in descending order. Finally, the $limit pipeline operator returns the first 3 documents from the sorted set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/api.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/api.html new file mode 100644 index 0000000..7a6b802 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/api.html @@ -0,0 +1,191 @@ + + + + + + + + API Reference — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ + +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/application-performance-monitoring.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/application-performance-monitoring.html new file mode 100644 index 0000000..a3106f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/application-performance-monitoring.html @@ -0,0 +1,680 @@ + + + + + + + + Application Performance Monitoring (APM) — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Application Performance Monitoring (APM)

+

The MongoDB C Driver allows you to monitor all the MongoDB operations the driver executes. This event-notification system conforms to two MongoDB driver specs:

+ +

To receive notifications, create a mongoc_apm_callbacks_t with mongoc_apm_callbacks_new(), set callbacks on it, then pass it to mongoc_client_set_apm_callbacks() or mongoc_client_pool_set_apm_callbacks().

+
+

Command-Monitoring Example

+
+
example-command-monitoring.c
+
/* gcc example-command-monitoring.c -o example-command-monitoring \
+ *     $(pkg-config --cflags --libs libmongoc-1.0) */
+
+/* ./example-command-monitoring [CONNECTION_STRING] */
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+
+typedef struct {
+   int started;
+   int succeeded;
+   int failed;
+} stats_t;
+
+
+void
+command_started (const mongoc_apm_command_started_t *event)
+{
+   char *s;
+
+   s = bson_as_relaxed_extended_json (
+      mongoc_apm_command_started_get_command (event), NULL);
+   printf ("Command %s started on %s:\n%s\n\n",
+           mongoc_apm_command_started_get_command_name (event),
+           mongoc_apm_command_started_get_host (event)->host,
+           s);
+
+   ((stats_t *) mongoc_apm_command_started_get_context (event))->started++;
+
+   bson_free (s);
+}
+
+
+void
+command_succeeded (const mongoc_apm_command_succeeded_t *event)
+{
+   char *s;
+
+   s = bson_as_relaxed_extended_json (
+      mongoc_apm_command_succeeded_get_reply (event), NULL);
+   printf ("Command %s succeeded:\n%s\n\n",
+           mongoc_apm_command_succeeded_get_command_name (event),
+           s);
+
+   ((stats_t *) mongoc_apm_command_succeeded_get_context (event))->succeeded++;
+
+   bson_free (s);
+}
+
+
+void
+command_failed (const mongoc_apm_command_failed_t *event)
+{
+   bson_error_t error;
+
+   mongoc_apm_command_failed_get_error (event, &error);
+   printf ("Command %s failed:\n\"%s\"\n\n",
+           mongoc_apm_command_failed_get_command_name (event),
+           error.message);
+
+   ((stats_t *) mongoc_apm_command_failed_get_context (event))->failed++;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_apm_callbacks_t *callbacks;
+   stats_t stats = {0};
+   mongoc_collection_t *collection;
+   bson_error_t error;
+   const char *uri_string =
+      "mongodb://127.0.0.1/?appname=cmd-monitoring-example";
+   mongoc_uri_t *uri;
+   const char *collection_name = "test";
+   bson_t *docs[2];
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   callbacks = mongoc_apm_callbacks_new ();
+   mongoc_apm_set_command_started_cb (callbacks, command_started);
+   mongoc_apm_set_command_succeeded_cb (callbacks, command_succeeded);
+   mongoc_apm_set_command_failed_cb (callbacks, command_failed);
+   mongoc_client_set_apm_callbacks (
+      client, callbacks, (void *) &stats /* context pointer */);
+
+   collection = mongoc_client_get_collection (client, "test", collection_name);
+   mongoc_collection_drop (collection, NULL);
+
+   docs[0] = BCON_NEW ("_id", BCON_INT32 (0));
+   docs[1] = BCON_NEW ("_id", BCON_INT32 (1));
+   mongoc_collection_insert_many (
+      collection, (const bson_t **) docs, 2, NULL, NULL, NULL);
+
+   /* duplicate key error on the second insert */
+   mongoc_collection_insert_one (collection, docs[0], NULL, NULL, NULL);
+
+   mongoc_collection_destroy (collection);
+   mongoc_apm_callbacks_destroy (callbacks);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   printf ("started: %d\nsucceeded: %d\nfailed: %d\n",
+           stats.started,
+           stats.succeeded,
+           stats.failed);
+
+   bson_destroy (docs[0]);
+   bson_destroy (docs[1]);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

This example program prints:

+
Command drop started on 127.0.0.1:
+{ "drop" : "test" }
+
+Command drop succeeded:
+{ "ns" : "test.test", "nIndexesWas" : 1, "ok" : 1.0 }
+
+Command insert started on 127.0.0.1:
+{
+  "insert" : "test",
+  "ordered" : true,
+  "documents" : [
+    { "_id" : 0 }, { "_id" : 1 }
+  ]
+}
+
+Command insert succeeded:
+{ "n" : 2, "ok" : 1.0 }
+
+Command insert started on 127.0.0.1:
+{
+  "insert" : "test",
+  "ordered" : true,
+  "documents" : [
+    { "_id" : 0 }
+  ]
+}
+
+Command insert succeeded:
+{
+  "n" : 0,
+  "writeErrors" : [
+    { "index" : 0, "code" : 11000, "errmsg" : "duplicate key" }
+  ],
+  "ok" : 1.0
+}
+
+started: 3
+succeeded: 3
+failed: 0
+
+
+

The output has been edited and formatted for clarity. Depending on your server configuration, messages may include metadata like database name, logical session ids, or cluster times that are not shown here.

+

The final “insert” command is considered successful, despite the writeError, because the server replied to the overall command with "ok": 1.

+
+
+

SDAM Monitoring Example

+
+
example-sdam-monitoring.c
+
/* gcc example-sdam-monitoring.c -o example-sdam-monitoring \
+ *     $(pkg-config --cflags --libs libmongoc-1.0) */
+
+/* ./example-sdam-monitoring [CONNECTION_STRING] */
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+
+typedef struct {
+   int server_changed_events;
+   int server_opening_events;
+   int server_closed_events;
+   int topology_changed_events;
+   int topology_opening_events;
+   int topology_closed_events;
+   int heartbeat_started_events;
+   int heartbeat_succeeded_events;
+   int heartbeat_failed_events;
+} stats_t;
+
+
+static void
+server_changed (const mongoc_apm_server_changed_t *event)
+{
+   stats_t *context;
+   const mongoc_server_description_t *prev_sd, *new_sd;
+
+   context = (stats_t *) mongoc_apm_server_changed_get_context (event);
+   context->server_changed_events++;
+
+   prev_sd = mongoc_apm_server_changed_get_previous_description (event);
+   new_sd = mongoc_apm_server_changed_get_new_description (event);
+
+   printf ("server changed: %s %s -> %s\n",
+           mongoc_apm_server_changed_get_host (event)->host_and_port,
+           mongoc_server_description_type (prev_sd),
+           mongoc_server_description_type (new_sd));
+}
+
+
+static void
+server_opening (const mongoc_apm_server_opening_t *event)
+{
+   stats_t *context;
+
+   context = (stats_t *) mongoc_apm_server_opening_get_context (event);
+   context->server_opening_events++;
+
+   printf ("server opening: %s\n",
+           mongoc_apm_server_opening_get_host (event)->host_and_port);
+}
+
+
+static void
+server_closed (const mongoc_apm_server_closed_t *event)
+{
+   stats_t *context;
+
+   context = (stats_t *) mongoc_apm_server_closed_get_context (event);
+   context->server_closed_events++;
+
+   printf ("server closed: %s\n",
+           mongoc_apm_server_closed_get_host (event)->host_and_port);
+}
+
+
+static void
+topology_changed (const mongoc_apm_topology_changed_t *event)
+{
+   stats_t *context;
+   const mongoc_topology_description_t *prev_td;
+   const mongoc_topology_description_t *new_td;
+   mongoc_server_description_t **prev_sds;
+   size_t n_prev_sds;
+   mongoc_server_description_t **new_sds;
+   size_t n_new_sds;
+   size_t i;
+   mongoc_read_prefs_t *prefs;
+
+   context = (stats_t *) mongoc_apm_topology_changed_get_context (event);
+   context->topology_changed_events++;
+
+   prev_td = mongoc_apm_topology_changed_get_previous_description (event);
+   prev_sds = mongoc_topology_description_get_servers (prev_td, &n_prev_sds);
+   new_td = mongoc_apm_topology_changed_get_new_description (event);
+   new_sds = mongoc_topology_description_get_servers (new_td, &n_new_sds);
+
+   printf ("topology changed: %s -> %s\n",
+           mongoc_topology_description_type (prev_td),
+           mongoc_topology_description_type (new_td));
+
+   if (n_prev_sds) {
+      printf ("  previous servers:\n");
+      for (i = 0; i < n_prev_sds; i++) {
+         printf ("      %s %s\n",
+                 mongoc_server_description_type (prev_sds[i]),
+                 mongoc_server_description_host (prev_sds[i])->host_and_port);
+      }
+   }
+
+   if (n_new_sds) {
+      printf ("  new servers:\n");
+      for (i = 0; i < n_new_sds; i++) {
+         printf ("      %s %s\n",
+                 mongoc_server_description_type (new_sds[i]),
+                 mongoc_server_description_host (new_sds[i])->host_and_port);
+      }
+   }
+
+   prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+
+   /* it is safe, and unfortunately necessary, to cast away const here */
+   if (mongoc_topology_description_has_readable_server (
+          (mongoc_topology_description_t *) new_td, prefs)) {
+      printf ("  secondary AVAILABLE\n");
+   } else {
+      printf ("  secondary UNAVAILABLE\n");
+   }
+
+   if (mongoc_topology_description_has_writable_server (
+          (mongoc_topology_description_t *) new_td)) {
+      printf ("  primary AVAILABLE\n");
+   } else {
+      printf ("  primary UNAVAILABLE\n");
+   }
+
+   mongoc_read_prefs_destroy (prefs);
+   mongoc_server_descriptions_destroy_all (prev_sds, n_prev_sds);
+   mongoc_server_descriptions_destroy_all (new_sds, n_new_sds);
+}
+
+
+static void
+topology_opening (const mongoc_apm_topology_opening_t *event)
+{
+   stats_t *context;
+
+   context = (stats_t *) mongoc_apm_topology_opening_get_context (event);
+   context->topology_opening_events++;
+
+   printf ("topology opening\n");
+}
+
+
+static void
+topology_closed (const mongoc_apm_topology_closed_t *event)
+{
+   stats_t *context;
+
+   context = (stats_t *) mongoc_apm_topology_closed_get_context (event);
+   context->topology_closed_events++;
+
+   printf ("topology closed\n");
+}
+
+
+static void
+server_heartbeat_started (const mongoc_apm_server_heartbeat_started_t *event)
+{
+   stats_t *context;
+
+   context =
+      (stats_t *) mongoc_apm_server_heartbeat_started_get_context (event);
+   context->heartbeat_started_events++;
+
+   printf ("%s heartbeat started\n",
+           mongoc_apm_server_heartbeat_started_get_host (event)->host_and_port);
+}
+
+
+static void
+server_heartbeat_succeeded (
+   const mongoc_apm_server_heartbeat_succeeded_t *event)
+{
+   stats_t *context;
+   char *reply;
+
+   context =
+      (stats_t *) mongoc_apm_server_heartbeat_succeeded_get_context (event);
+   context->heartbeat_succeeded_events++;
+
+   reply = bson_as_canonical_extended_json (
+      mongoc_apm_server_heartbeat_succeeded_get_reply (event), NULL);
+
+   printf (
+      "%s heartbeat succeeded: %s\n",
+      mongoc_apm_server_heartbeat_succeeded_get_host (event)->host_and_port,
+      reply);
+
+   bson_free (reply);
+}
+
+
+static void
+server_heartbeat_failed (const mongoc_apm_server_heartbeat_failed_t *event)
+{
+   stats_t *context;
+   bson_error_t error;
+
+   context = (stats_t *) mongoc_apm_server_heartbeat_failed_get_context (event);
+   context->heartbeat_failed_events++;
+   mongoc_apm_server_heartbeat_failed_get_error (event, &error);
+
+   printf ("%s heartbeat failed: %s\n",
+           mongoc_apm_server_heartbeat_failed_get_host (event)->host_and_port,
+           error.message);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_apm_callbacks_t *cbs;
+   stats_t stats = {0};
+   const char *uri_string =
+      "mongodb://127.0.0.1/?appname=sdam-monitoring-example";
+   mongoc_uri_t *uri;
+   bson_t cmd = BSON_INITIALIZER;
+   bson_t reply;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   cbs = mongoc_apm_callbacks_new ();
+   mongoc_apm_set_server_changed_cb (cbs, server_changed);
+   mongoc_apm_set_server_opening_cb (cbs, server_opening);
+   mongoc_apm_set_server_closed_cb (cbs, server_closed);
+   mongoc_apm_set_topology_changed_cb (cbs, topology_changed);
+   mongoc_apm_set_topology_opening_cb (cbs, topology_opening);
+   mongoc_apm_set_topology_closed_cb (cbs, topology_closed);
+   mongoc_apm_set_server_heartbeat_started_cb (cbs, server_heartbeat_started);
+   mongoc_apm_set_server_heartbeat_succeeded_cb (cbs,
+                                                 server_heartbeat_succeeded);
+   mongoc_apm_set_server_heartbeat_failed_cb (cbs, server_heartbeat_failed);
+   mongoc_client_set_apm_callbacks (
+      client, cbs, (void *) &stats /* context pointer */);
+
+   /* the driver connects on demand to perform first operation */
+   BSON_APPEND_INT32 (&cmd, "buildinfo", 1);
+   mongoc_client_command_simple (client, "admin", &cmd, NULL, &reply, &error);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   printf ("Events:\n"
+           "   server changed: %d\n"
+           "   server opening: %d\n"
+           "   server closed: %d\n"
+           "   topology changed: %d\n"
+           "   topology opening: %d\n"
+           "   topology closed: %d\n"
+           "   heartbeat started: %d\n"
+           "   heartbeat succeeded: %d\n"
+           "   heartbeat failed: %d\n",
+           stats.server_changed_events,
+           stats.server_opening_events,
+           stats.server_closed_events,
+           stats.topology_changed_events,
+           stats.topology_opening_events,
+           stats.topology_closed_events,
+           stats.heartbeat_started_events,
+           stats.heartbeat_succeeded_events,
+           stats.heartbeat_failed_events);
+
+   bson_destroy (&cmd);
+   bson_destroy (&reply);
+   mongoc_apm_callbacks_destroy (cbs);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Start a 3-node replica set on localhost with set name “rs” and start the program:

+
./example-sdam-monitoring "mongodb://localhost:27017,localhost:27018/?replicaSet=rs"
+
+
+

This example program prints something like:

+
topology opening
+topology changed: Unknown -> ReplicaSetNoPrimary
+  secondary UNAVAILABLE
+  primary UNAVAILABLE
+server opening: localhost:27017
+server opening: localhost:27018
+localhost:27017 heartbeat started
+localhost:27018 heartbeat started
+localhost:27017 heartbeat succeeded: { ... reply ... }
+server changed: localhost:27017 Unknown -> RSPrimary
+server opening: localhost:27019
+topology changed: ReplicaSetNoPrimary -> ReplicaSetWithPrimary
+  new servers:
+      RSPrimary localhost:27017
+  secondary UNAVAILABLE
+  primary AVAILABLE
+localhost:27019 heartbeat started
+localhost:27018 heartbeat succeeded: { ... reply ... }
+server changed: localhost:27018 Unknown -> RSSecondary
+topology changed: ReplicaSetWithPrimary -> ReplicaSetWithPrimary
+  previous servers:
+      RSPrimary localhost:27017
+  new servers:
+      RSPrimary localhost:27017
+      RSSecondary localhost:27018
+  secondary AVAILABLE
+  primary AVAILABLE
+localhost:27019 heartbeat succeeded: { ... reply ... }
+server changed: localhost:27019 Unknown -> RSSecondary
+topology changed: ReplicaSetWithPrimary -> ReplicaSetWithPrimary
+  previous servers:
+      RSPrimary localhost:27017
+      RSSecondary localhost:27018
+  new servers:
+      RSPrimary localhost:27017
+      RSSecondary localhost:27018
+      RSSecondary localhost:27019
+  secondary AVAILABLE
+  primary AVAILABLE
+topology closed
+
+Events:
+   server changed: 3
+   server opening: 3
+   server closed: 0
+   topology changed: 4
+   topology opening: 1
+   topology closed: 1
+   heartbeat started: 3
+   heartbeat succeeded: 3
+   heartbeat failed: 0
+
+
+

The driver connects to the mongods on ports 27017 and 27018, which were specified in the URI, and determines which is primary. It also discovers the third member, “localhost:27019”, and adds it to the topology.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/authentication.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/authentication.html new file mode 100644 index 0000000..c6800b7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/authentication.html @@ -0,0 +1,252 @@ + + + + + + + + Authentication — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Authentication

+

This guide covers the use of authentication options with the MongoDB C Driver. Ensure that the MongoDB server is also properly configured for authentication before making a connection. For more information, see the MongoDB security documentation.

+

The MongoDB C driver supports several authentication mechanisms through the use of MongoDB connection URIs.

+

By default, if a username and password are provided as part of the connection string (and an optional authentication database), they are used to connect via the default authentication mechanism of the server.

+

To select a specific authentication mechanism other than the default, see the list of supported mechanism below.

+
mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb");
+
+
+

Currently supported values for the authMechanism connection string option are:

+ +
+

Basic Authentication (SCRAM-SHA-256)

+

MongoDB 4.0 introduces support for authenticating using the SCRAM protocol +with the more secure SHA-256 hash described in RFC 7677. Using this authentication mechanism +means that the password is never actually sent over the wire when +authenticating, but rather a computed proof that the client password is the +same as the password the server knows. In MongoDB 4.0, the C driver can +determine the correct default authentication mechanism for users with stored +SCRAM-SHA-1 and SCRAM-SHA-256 credentials:

+
mongoc_client_t *client =  mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb");
+/* the correct authMechanism is negotiated between the driver and server. */
+
+
+

Alternatively, SCRAM-SHA-256 can be explicitly specified as an authMechanism.

+
mongoc_client_t *client =  mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256&authSource=mydb");
+
+
+

Passwords for SCRAM-SHA-256 undergo the preprocessing step known as SASLPrep +specified in RFC 4013. SASLPrep will +only be performed for passwords containing non-ASCII characters. SASLPrep +requires libicu. If libicu is not available, attempting to authenticate over +SCRAM-SHA-256 with non-ASCII passwords will result in error.

+

Usernames never undergo SASLPrep.

+

By default, when building the C driver libicu is linked if available. This can +be changed with the ENABLE_ICU cmake option. To specify an installation +path of libicu, specify ICU_ROOT as a cmake option. See the +FindICU documentation +for more information.

+
+
+

Basic Authentication (SCRAM-SHA-1)

+

The default authentication mechanism before MongoDB 4.0 is SCRAM-SHA-1 (RFC 5802). Using this authentication mechanism means that the password is never actually sent over the wire when authenticating, but rather a computed proof that the client password is the same as the password the server knows.

+
mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1&authSource=mydb");
+
+
+
+

Note

+

SCRAM-SHA-1 authenticates against the admin database by default. If the user is created in another database, then specifying the authSource is required.

+
+
+
+

Legacy Authentication (MONGODB-CR)

+

The MONGODB-CR authMechanism is deprecated and will no longer function in MongoDB 4.0. Instead, specify no authMechanism and the driver +will use an authentication mechanism compatible with your server.

+
+
+

GSSAPI (Kerberos) Authentication

+
+

Note

+

Kerberos support requires compiling the driver against cyrus-sasl on UNIX-like environments. On Windows, configure the driver to build against the Windows Native SSPI.

+
+

GSSAPI (Kerberos) authentication is available in the Enterprise Edition of MongoDB. To authenticate using GSSAPI, the MongoDB C driver must be installed with SASL support.

+

On UNIX-like environments, run the kinit command before using the following authentication methods:

+
$ kinit mongodbuser@EXAMPLE.COM
+mongodbuser@EXAMPLE.COM's Password:
+$ klistCredentials cache: FILE:/tmp/krb5cc_1000
+        Principal: mongodbuser@EXAMPLE.COM
+
+  Issued                Expires               Principal
+Feb  9 13:48:51 2013  Feb  9 23:48:51 2013  krbtgt/EXAMPLE.COM@EXAMPLE.COM
+
+
+

Now authenticate using the MongoDB URI. GSSAPI authenticates against the $external virtual database, so a database does not need to be specified in the URI. Note that the Kerberos principal must be URL-encoded:

+
mongoc_client_t *client;
+
+client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo-server.example.com/?authMechanism=GSSAPI");
+
+
+
+

Note

+

GSSAPI authenticates against the $external database, so specifying the authSource database is not required.

+
+

The driver supports these GSSAPI properties:

+
    +
  • CANONICALIZE_HOST_NAME: This might be required with Cyrus-SASL when the hosts report different hostnames than what is used in the Kerberos database. The default is “false”.
  • +
  • SERVICE_NAME: Use a different service name than the default, “mongodb”.
  • +
+

Set properties in the URL:

+
mongoc_client_t *client;
+
+client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo-server.example.com/?authMechanism=GSSAPI&"
+                            "authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
+
+
+

If you encounter errors such as Invalid net address, check if the application is behind a NAT (Network Address Translation) firewall. If so, create a ticket that uses forwardable and addressless Kerberos tickets. This can be done by passing -f -A to kinit.

+
$ kinit -f -A mongodbuser@EXAMPLE.COM
+
+
+
+
+

SASL Plain Authentication

+
+

Note

+

The MongoDB C Driver must be compiled with SASL support in order to use SASL PLAIN authentication.

+
+

MongoDB Enterprise Edition supports the SASL PLAIN authentication mechanism, initially intended for delegating authentication to an LDAP server. Using the SASL PLAIN mechanism is very similar to the challenge response mechanism with usernames and passwords. This authentication mechanism uses the $external virtual database for LDAP support:

+
+

Note

+

SASL PLAIN is a clear-text authentication mechanism. It is strongly recommended to connect to MongoDB using SSL with certificate validation when using the PLAIN mechanism.

+
+
mongoc_client_t *client;
+
+client = mongoc_client_new ("mongodb://user:password@example.com/?authMechanism=PLAIN");
+
+
+

PLAIN authenticates against the $external database, so specifying the authSource database is not required.

+
+
+

X.509 Certificate Authentication

+
+

Note

+

The MongoDB C Driver must be compiled with SSL support for X.509 authentication support. Once this is done, start a server with the following options:

+
$ mongod --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem
+
+
+
+

The MONGODB-X509 mechanism authenticates a username derived from the distinguished subject name of the X.509 certificate presented by the driver during SSL negotiation. This authentication method requires the use of SSL connections with certificate validation.

+
mongoc_client_t *client;
+mongoc_ssl_opt_t ssl_opts = { 0 };
+
+ssl_opts.pem_file = "mycert.pem";
+ssl_opts.pem_pwd = "mycertpassword";
+ssl_opts.ca_file = "myca.pem";
+ssl_opts.ca_dir = "trust_dir";
+ssl_opts.weak_cert_validation = false;
+
+client = mongoc_client_new ("mongodb://x509_derived_username@localhost/?authMechanism=MONGODB-X509");
+mongoc_client_set_ssl_opts (client, &ssl_opts);
+
+
+

MONGODB-X509 authenticates against the $external database, so specifying the authSource database is not required. For more information on the x509_derived_username, see the MongoDB server x.509 tutorial.

+
+

Note

+

The MongoDB C Driver will attempt to determine the x509 derived username when none is provided, and as of MongoDB 3.4 providing the username is not required at all.

+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/basic-troubleshooting.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/basic-troubleshooting.html new file mode 100644 index 0000000..d0cbb16 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/basic-troubleshooting.html @@ -0,0 +1,169 @@ + + + + + + + + Basic Troubleshooting — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Basic Troubleshooting

+
+

Troubleshooting Checklist

+

The following is a short list of things to check when you have a problem.

+
    +
  • Did you call mongoc_init() in main()? If not, you will likely see a segfault.
  • +
  • Have you leaked any clients or cursors as can be found with mongoc-stat <PID>?
  • +
  • Have packets been delivered to the server? See egress bytes from mongoc-stat <PID>.
  • +
  • Does valgrind show any leaks? Ensure you call mongoc_cleanup() at the end of your process to cleanup lingering allocations from the MongoDB C driver.
  • +
  • If compiling your own copy of MongoDB C Driver, consider using the cmake option -DENABLE_TRACING=ON to enable function tracing and hex dumps of network packets to STDERR and STDOUT.
  • +
+
+
+

Performance Counters

+

The MongoDB C driver comes with an optional unique feature to help developers and sysadmins troubleshoot problems in production. +Performance counters are available for each process using the driver. +If available, the counters can be accessed outside of the application process via a shared memory segment. +This means that you can graph statistics about your application process easily from tools like Munin or Nagios. +Your author often uses watch --interval=0.5 -d mongoc-stat $PID to monitor an application.

+

Performance counters are only available on Linux platforms supporting shared memory segments. +On supported platforms they are enabled by default. +Applications can be built without the counters by specifying the cmake option -DENABLE_SHM_COUNTERS=OFF. Additionally, if +performance counters are already compiled, they can be disabled at runtime by specifying the environment variable MONGOC_DISABLE_SHM.

+

Performance counters keep track of the following:

+
    +
  • Active and Disposed Cursors
  • +
  • Active and Disposed Clients, Client Pools, and Socket Streams.
  • +
  • Number of operations sent and received, by type.
  • +
  • Bytes transferred and received.
  • +
  • Authentication successes and failures.
  • +
  • Number of wire protocol errors.
  • +
+

To access counters for a given process, simply provide the process id to the mongoc-stat program installed with the MongoDB C Driver.

+
$ mongoc-stat 22203
+   Operations : Egress Total        : The number of sent operations.                    : 13247
+   Operations : Ingress Total       : The number of received operations.                : 13246
+   Operations : Egress Queries      : The number of sent Query operations.              : 13247
+   Operations : Ingress Queries     : The number of received Query operations.          : 0
+   Operations : Egress GetMore      : The number of sent GetMore operations.            : 0
+   Operations : Ingress GetMore     : The number of received GetMore operations.        : 0
+   Operations : Egress Insert       : The number of sent Insert operations.             : 0
+   Operations : Ingress Insert      : The number of received Insert operations.         : 0
+   Operations : Egress Delete       : The number of sent Delete operations.             : 0
+   Operations : Ingress Delete      : The number of received Delete operations.         : 0
+   Operations : Egress Update       : The number of sent Update operations.             : 0
+   Operations : Ingress Update      : The number of received Update operations.         : 0
+   Operations : Egress KillCursors  : The number of sent KillCursors operations.        : 0
+   Operations : Ingress KillCursors : The number of received KillCursors operations.    : 0
+   Operations : Egress Msg          : The number of sent Msg operations.                : 0
+   Operations : Ingress Msg         : The number of received Msg operations.            : 0
+   Operations : Egress Reply        : The number of sent Reply operations.              : 0
+   Operations : Ingress Reply       : The number of received Reply operations.          : 13246
+      Cursors : Active              : The number of active cursors.                     : 1
+      Cursors : Disposed            : The number of disposed cursors.                   : 13246
+      Clients : Active              : The number of active clients.                     : 1
+      Clients : Disposed            : The number of disposed clients.                   : 0
+      Streams : Active              : The number of active streams.                     : 1
+      Streams : Disposed            : The number of disposed streams.                   : 0
+      Streams : Egress Bytes        : The number of bytes sent.                         : 794931
+      Streams : Ingress Bytes       : The number of bytes received.                     : 589694
+      Streams : N Socket Timeouts   : The number of socket timeouts.                    : 0
+ Client Pools : Active              : The number of active client pools.                : 1
+ Client Pools : Disposed            : The number of disposed client pools.              : 0
+     Protocol : Ingress Errors      : The number of protocol errors on ingress.         : 0
+         Auth : Failures            : The number of failed authentication requests.     : 0
+         Auth : Success             : The number of successful authentication requests. : 0
+
+
+
+
+

Submitting a Bug Report

+

Think you’ve found a bug? Want to see a new feature in the MongoDB C driver? Please open a case in our issue management tool, JIRA:

+ +

Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are public.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/bulk.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/bulk.html new file mode 100644 index 0000000..b2d12e9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/bulk.html @@ -0,0 +1,970 @@ + + + + + + + + Bulk Write Operations — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Bulk Write Operations

+

This tutorial explains how to take advantage of MongoDB C driver bulk write operation features. Executing write operations in batches reduces the number of network round trips, increasing write throughput.

+
+

Bulk Insert

+

First we need to fetch a bulk operation handle from the mongoc_collection_t.

+
mongoc_bulk_operation_t *bulk =
+   mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+
+

We can now start inserting documents to the bulk operation. These will be buffered until we execute the operation.

+

The bulk operation will coalesce insertions as a single batch for each consecutive call to mongoc_bulk_operation_insert(). This creates a pipelined effect when possible.

+

To execute the bulk operation and receive the result we call mongoc_bulk_operation_execute().

+
+
bulk1.c
+
#include <assert.h>
+#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk1 (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *doc;
+   bson_t reply;
+   char *str;
+   bool ret;
+   int i;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   for (i = 0; i < 10000; i++) {
+      doc = BCON_NEW ("i", BCON_INT32 (i));
+      mongoc_bulk_operation_insert (bulk, doc);
+      bson_destroy (doc);
+   }
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      fprintf (stderr, "Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk1-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   bulk1 (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Example reply document:

+
{"nInserted"   : 10000,
+ "nMatched"    : 0,
+ "nModified"   : 0,
+ "nRemoved"    : 0,
+ "nUpserted"   : 0,
+ "writeErrors" : []
+ "writeConcernErrors" : [] }
+
+
+
+
+

Mixed Bulk Write Operations

+

MongoDB C driver also supports executing mixed bulk write operations. A batch of insert, update, and remove operations can be executed together using the bulk write operations API.

+
+
+

Ordered Bulk Write Operations

+

Ordered bulk write operations are batched and sent to the server in the order provided for serial execution. The reply document describes the type and count of operations performed.

+
+
bulk2.c
+
#include <assert.h>
+#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk2 (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *query;
+   bson_t *doc;
+   bson_t *opts;
+   bson_t reply;
+   char *str;
+   bool ret;
+   int i;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   /* Remove everything */
+   query = bson_new ();
+   mongoc_bulk_operation_remove (bulk, query);
+   bson_destroy (query);
+
+   /* Add a few documents */
+   for (i = 1; i < 4; i++) {
+      doc = BCON_NEW ("_id", BCON_INT32 (i));
+      mongoc_bulk_operation_insert (bulk, doc);
+      bson_destroy (doc);
+   }
+
+   /* {_id: 1} => {$set: {foo: "bar"}} */
+   query = BCON_NEW ("_id", BCON_INT32 (1));
+   doc = BCON_NEW ("$set", "{", "foo", BCON_UTF8 ("bar"), "}");
+   mongoc_bulk_operation_update_many_with_opts (bulk, query, doc, NULL, &error);
+   bson_destroy (query);
+   bson_destroy (doc);
+
+   /* {_id: 4} => {'$inc': {'j': 1}} (upsert) */
+   opts = BCON_NEW ("upsert", BCON_BOOL (true));
+   query = BCON_NEW ("_id", BCON_INT32 (4));
+   doc = BCON_NEW ("$inc", "{", "j", BCON_INT32 (1), "}");
+   mongoc_bulk_operation_update_many_with_opts (bulk, query, doc, opts, &error);
+   bson_destroy (query);
+   bson_destroy (doc);
+   bson_destroy (opts);
+
+   /* replace {j:1} with {j:2} */
+   query = BCON_NEW ("j", BCON_INT32 (1));
+   doc = BCON_NEW ("j", BCON_INT32 (2));
+   mongoc_bulk_operation_replace_one_with_opts (bulk, query, doc, NULL, &error);
+   bson_destroy (query);
+   bson_destroy (doc);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk2-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   bulk2 (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Example reply document:

+
{ "nInserted"   : 3,
+  "nMatched"    : 2,
+  "nModified"   : 2,
+  "nRemoved"    : 10000,
+  "nUpserted"   : 1,
+  "upserted"    : [{"index" : 5, "_id" : 4}],
+  "writeErrors" : []
+  "writeConcernErrors" : [] }
+
+
+

The index field in the upserted array is the 0-based index of the upsert operation; in this example, the sixth operation of the overall bulk operation was an upsert, so its index is 5.

+
+
+

Unordered Bulk Write Operations

+

Unordered bulk write operations are batched and sent to the server in arbitrary order where they may be executed in parallel. Any errors that occur are reported after all operations are attempted.

+

In the next example the first and third operations fail due to the unique constraint on _id. Since we are doing unordered execution the second and fourth operations succeed.

+
+
bulk3.c
+
#include <assert.h>
+#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk3 (mongoc_collection_t *collection)
+{
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *query;
+   bson_t *doc;
+   bson_t reply;
+   char *str;
+   bool ret;
+
+   /* false indicates unordered */
+   BSON_APPEND_BOOL (&opts, "ordered", false);
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts);
+   bson_destroy (&opts);
+
+   /* Add a document */
+   doc = BCON_NEW ("_id", BCON_INT32 (1));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   /* remove {_id: 2} */
+   query = BCON_NEW ("_id", BCON_INT32 (2));
+   mongoc_bulk_operation_remove_one (bulk, query);
+   bson_destroy (query);
+
+   /* insert {_id: 3} */
+   doc = BCON_NEW ("_id", BCON_INT32 (3));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   /* replace {_id:4} {'i': 1} */
+   query = BCON_NEW ("_id", BCON_INT32 (4));
+   doc = BCON_NEW ("i", BCON_INT32 (1));
+   mongoc_bulk_operation_replace_one (bulk, query, doc, false);
+   bson_destroy (query);
+   bson_destroy (doc);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+   bson_destroy (&opts);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk3-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   bulk3 (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Example reply document:

+
{ "nInserted"    : 0,
+  "nMatched"     : 1,
+  "nModified"    : 1,
+  "nRemoved"     : 1,
+  "nUpserted"    : 0,
+  "writeErrors"  : [
+    { "index"  : 0,
+      "code"   : 11000,
+      "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 }" },
+    { "index"  : 2,
+      "code"   : 11000,
+      "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 3 }" } ],
+  "writeConcernErrors" : [] }
+
+Error: E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 }
+
+
+

The bson_error_t domain is MONGOC_ERROR_COMMAND and its code is 11000.

+
+
+

Bulk Operation Bypassing Document Validation

+

This feature is only available when using MongoDB 3.2 and later.

+

By default bulk operations are validated against the schema, if any is defined. In certain cases however it may be necessary to bypass the document validation.

+
+
bulk5.c
+
#include <assert.h>
+#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk5_fail (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *doc;
+   bson_t reply;
+   char *str;
+   bool ret;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   /* Two inserts */
+   doc = BCON_NEW ("_id", BCON_INT32 (31));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   doc = BCON_NEW ("_id", BCON_INT32 (32));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   /* The above documents do not comply to the schema validation rules
+    * we created previously, so this will result in an error */
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+}
+
+static void
+bulk5_success (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *doc;
+   bson_t reply;
+   char *str;
+   bool ret;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   /* Allow this document to bypass document validation.
+    * NOTE: When authentication is enabled, the authenticated user must have
+    * either the "dbadmin" or "restore" roles to bypass document validation */
+   mongoc_bulk_operation_set_bypass_document_validation (bulk, true);
+
+   /* Two inserts */
+   doc = BCON_NEW ("_id", BCON_INT32 (31));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   doc = BCON_NEW ("_id", BCON_INT32 (32));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+}
+
+int
+main (int argc, char *argv[])
+{
+   bson_t *options;
+   bson_error_t error;
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_database_t *database;
+   const char *uri_string = "mongodb://localhost/?appname=bulk5-example";
+   mongoc_uri_t *uri;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "testasdf");
+
+   /* Create schema validator */
+   options = BCON_NEW (
+      "validator", "{", "number", "{", "$gte", BCON_INT32 (5), "}", "}");
+   collection =
+      mongoc_database_create_collection (database, "collname", options, &error);
+
+   if (collection) {
+      bulk5_fail (collection);
+      bulk5_success (collection);
+      mongoc_collection_destroy (collection);
+   } else {
+      fprintf (stderr, "Couldn't create collection: '%s'\n", error.message);
+   }
+
+   bson_free (options);
+   mongoc_uri_destroy (uri);
+   mongoc_database_destroy (database);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Running the above example will result in:

+
{ "nInserted" : 0,
+  "nMatched" : 0,
+  "nModified" : 0,
+  "nRemoved" : 0,
+  "nUpserted" : 0,
+  "writeErrors" : [
+    { "index" : 0,
+      "code" : 121,
+      "errmsg" : "Document failed validation" } ] }
+
+Error: Document failed validation
+
+{ "nInserted" : 2,
+  "nMatched" : 0,
+  "nModified" : 0,
+  "nRemoved" : 0,
+  "nUpserted" : 0,
+  "writeErrors" : [] }
+
+
+

The bson_error_t domain is MONGOC_ERROR_COMMAND.

+
+
+

Bulk Operation Write Concerns

+

By default bulk operations are executed with the write_concern of the collection they are executed against. A custom write concern can be passed to the mongoc_collection_create_bulk_operation_with_opts() method. Write concern errors (e.g. wtimeout) will be reported after all operations are attempted, regardless of execution order.

+
+
bulk4.c
+
#include <assert.h>
+#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk4 (mongoc_collection_t *collection)
+{
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_write_concern_t *wc;
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *doc;
+   bson_t reply;
+   char *str;
+   bool ret;
+
+   wc = mongoc_write_concern_new ();
+   mongoc_write_concern_set_w (wc, 4);
+   mongoc_write_concern_set_wtimeout (wc, 100); /* milliseconds */
+   mongoc_write_concern_append (wc, &opts);
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts);
+
+   /* Two inserts */
+   doc = BCON_NEW ("_id", BCON_INT32 (10));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   doc = BCON_NEW ("_id", BCON_INT32 (11));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+   mongoc_write_concern_destroy (wc);
+   bson_destroy (&opts);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk4-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   bulk4 (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Example reply document and error message:

+
{ "nInserted"    : 2,
+  "nMatched"     : 0,
+  "nModified"    : 0,
+  "nRemoved"     : 0,
+  "nUpserted"    : 0,
+  "writeErrors"  : [],
+  "writeConcernErrors" : [
+    { "code"   : 64,
+      "errmsg" : "waiting for replication timed out" }
+] }
+
+Error: waiting for replication timed out
+
+
+

The bson_error_t domain is MONGOC_ERROR_WRITE_CONCERN if there are write concern errors and no write errors. Write errors indicate failed operations, so they take precedence over write concern errors, which mean merely that the write concern is not satisfied yet.

+
+
+

Setting Collation Order

+

This feature is only available when using MongoDB 3.4 and later.

+
+
bulk-collation.c
+
#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk_collation (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   bson_t *opts;
+   bson_t *doc;
+   bson_t *selector;
+   bson_t *update;
+   bson_error_t error;
+   bson_t reply;
+   char *str;
+   uint32_t ret;
+
+   /* insert {_id: "one"} and {_id: "One"} */
+   bulk = mongoc_collection_create_bulk_operation_with_opts (
+      collection, NULL);
+   doc = BCON_NEW ("_id", BCON_UTF8 ("one"));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   doc = BCON_NEW ("_id", BCON_UTF8 ("One"));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   /* "One" normally sorts before "one"; make "one" come first */
+   opts = BCON_NEW ("collation",
+                    "{",
+                    "locale",
+                    BCON_UTF8 ("en_US"),
+                    "caseFirst",
+                    BCON_UTF8 ("lower"),
+                    "}");
+
+   /* set x=1 on the document with _id "One", which now sorts after "one" */
+   update = BCON_NEW ("$set", "{", "x", BCON_INT64 (1), "}");
+   selector = BCON_NEW ("_id", "{", "$gt", BCON_UTF8 ("one"), "}");
+   mongoc_bulk_operation_update_one_with_opts (
+      bulk, selector, update, opts, &error);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (selector);
+   bson_destroy (opts);
+   mongoc_bulk_operation_destroy (bulk);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk-collation";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "db", "collection");
+   bulk_collation (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Running the above example will result in:

+
{ "nInserted" : 2,
+   "nMatched" : 1,
+   "nModified" : 1,
+   "nRemoved" : 0,
+   "nUpserted" : 0,
+   "writeErrors" : [  ]
+}
+
+
+
+
+

Unacknowledged Bulk Writes

+

Set “w” to zero for an unacknowledged write. The driver sends unacknowledged writes using the legacy opcodes OP_INSERT, OP_UPDATE, and OP_DELETE.

+
+
bulk6.c
+
#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+bulk6 (mongoc_collection_t *collection)
+{
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_write_concern_t *wc;
+   mongoc_bulk_operation_t *bulk;
+   bson_error_t error;
+   bson_t *doc;
+   bson_t *selector;
+   bson_t reply;
+   char *str;
+   bool ret;
+
+   wc = mongoc_write_concern_new ();
+   mongoc_write_concern_set_w (wc, 0);
+   mongoc_write_concern_append (wc, &opts);
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts);
+
+   doc = BCON_NEW ("_id", BCON_INT32 (10));
+   mongoc_bulk_operation_insert (bulk, doc);
+   bson_destroy (doc);
+
+   selector = BCON_NEW ("_id", BCON_INT32 (11));
+   mongoc_bulk_operation_remove_one (bulk, selector);
+   bson_destroy (selector);
+
+   ret = mongoc_bulk_operation_execute (bulk, &reply, &error);
+
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   if (!ret) {
+      printf ("Error: %s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   mongoc_bulk_operation_destroy (bulk);
+   mongoc_write_concern_destroy (wc);
+   bson_destroy (&opts);
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   const char *uri_string = "mongodb://localhost/?appname=bulk6-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   bulk6 (collection);
+
+   mongoc_uri_destroy (uri);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

The reply document is empty:

+
{ }
+
+
+
+
+

Further Reading

+

See the Driver Bulk API Spec, which describes bulk write operations for all MongoDB drivers.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/connection-pooling.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/connection-pooling.html new file mode 100644 index 0000000..42c0f84 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/connection-pooling.html @@ -0,0 +1,140 @@ + + + + + + + + Connection Pooling — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Connection Pooling

+

The MongoDB C driver has two connection modes: single-threaded and pooled. Single-threaded mode is optimized for embedding the driver within languages like PHP. Multi-threaded programs should use pooled mode: this mode minimizes the total connection count, and in pooled mode a background thread monitors the MongoDB server topology, so the program need not block to scan it.

+
+

Single Mode

+

In single mode, your program creates a mongoc_client_t directly:

+
mongoc_client_t *client = mongoc_client_new (
+   "mongodb://hostA,hostB/?replicaSet=my_rs");
+
+
+

The client connects on demand when your program first uses it for a MongoDB operation. Using a non-blocking socket per server, it begins a check on each server concurrently, and uses the asynchronous poll or select function to receive events from the sockets, until all have responded or timed out. Put another way, in single-threaded mode the C Driver fans out to begin all checks concurrently, then fans in once all checks have completed or timed out. Once the scan completes, the client executes your program’s operation and returns.

+

In single mode, the client re-scans the server topology roughly once per minute. If more than a minute has elapsed since the previous scan, the next operation on the client will block while the client completes its scan. This interval is configurable with heartbeatFrequencyMS in the connection string. (See mongoc_uri_t.)

+

A single client opens one connection per server in your topology: these connections are used both for scanning the topology and performing normal operations.

+
+
+

Pooled Mode

+

To activate pooled mode, create a mongoc_client_pool_t:

+
mongoc_uri_t *uri = mongoc_uri_new (
+   "mongodb://hostA,hostB/?replicaSet=my_rs");
+
+mongoc_client_pool_t *pool = mongoc_client_pool_new (uri);
+
+
+

When your program first calls mongoc_client_pool_pop(), the pool launches a background thread for monitoring. The thread fans out and connects to all servers in the connection string, using non-blocking sockets and a simple event loop. As it receives ismaster responses from the servers, it updates its view of the server topology. Each time the thread discovers a new server it begins connecting to it, and adds the new socket to the list of non-blocking sockets in the event loop.

+

Each thread that executes MongoDB operations must check out a client from the pool:

+
mongoc_client_t *client = mongoc_client_pool_pop (pool);
+
+/* use the client for operations ... */
+
+mongoc_client_pool_push (pool, client);
+
+
+

The mongoc_client_t object is not thread-safe, only the mongoc_client_pool_t is.

+

When the driver is in pooled mode, your program’s operations are unblocked as soon as monitoring discovers a usable server. For example, if a thread in your program is waiting to execute an “insert” on the primary, it is unblocked as soon as the primary is discovered, rather than waiting for all secondaries to be checked as well.

+

The pool opens one connection per server for monitoring, and each client opens its own connection to each server it uses for application operations. The background thread re-scans the server topology roughly every 10 seconds. This interval is configurable with heartbeatFrequencyMS in the connection string. (See mongoc_uri_t.)

+

See Connection Pool Options to configure pool size and behavior, and see mongoc_client_pool_t for an extended example of a multi-threaded program that uses the driver in pooled mode.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/create-indexes.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/create-indexes.html new file mode 100644 index 0000000..11658c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/create-indexes.html @@ -0,0 +1,209 @@ + + + + + + + + Creating Indexes — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Creating Indexes

+

To create indexes on a MongoDB collection, execute the createIndexes command +with a command function like mongoc_database_write_command_with_opts() or +mongoc_collection_write_command_with_opts(). See the MongoDB +Manual entry for the createIndexes command for details.

+
+

Example

+
+
example-create-indexes.c
+
/* gcc example-create-indexes.c -o example-create-indexes $(pkg-config --cflags
+ * --libs libmongoc-1.0) */
+
+/* ./example-create-indexes [CONNECTION_STRING [COLLECTION_NAME]] */
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   const char *uri_string =
+      "mongodb://127.0.0.1/?appname=create-indexes-example";
+   mongoc_uri_t *uri;
+   mongoc_database_t *db;
+   const char *collection_name = "test";
+   bson_t keys;
+   char *index_name;
+   bson_t *create_indexes;
+   bson_t reply;
+   char *reply_str;
+   bson_error_t error;
+   bool r;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   if (argc > 2) {
+      collection_name = argv[2];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   db = mongoc_client_get_database (client, "test");
+
+   /* ascending index on field "x" */
+   bson_init (&keys);
+   BSON_APPEND_INT32 (&keys, "x", 1);
+   index_name = mongoc_collection_keys_to_index_string (&keys);
+   create_indexes = BCON_NEW ("createIndexes",
+                              BCON_UTF8 (collection_name),
+                              "indexes",
+                              "[",
+                              "{",
+                              "key",
+                              BCON_DOCUMENT (&keys),
+                              "name",
+                              BCON_UTF8 (index_name),
+                              "}",
+                              "]");
+
+   r = mongoc_database_write_command_with_opts (
+      db, create_indexes, NULL /* opts */, &reply, &error);
+
+   reply_str = bson_as_json (&reply, NULL);
+   printf ("%s\n", reply_str);
+
+   if (!r) {
+      fprintf (stderr, "Error in createIndexes: %s\n", error.message);
+   }
+
+   bson_free (index_name);
+   bson_free (reply_str);
+   bson_destroy (&reply);
+   bson_destroy (create_indexes);
+   mongoc_database_destroy (db);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return r ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/cursors.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/cursors.html new file mode 100644 index 0000000..30473b0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/cursors.html @@ -0,0 +1,307 @@ + + + + + + + + Cursors — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Cursors

+
+

Handling Cursor Failures

+

Cursors exist on a MongoDB server. However, the mongoc_cursor_t structure gives the local process a handle to the cursor. It is possible for errors to occur on the server while iterating a cursor on the client. Even a network partition may occur. This means that applications should be robust in handling cursor failures.

+

While iterating cursors, you should check to see if an error has occurred. See the following example for how to robustly check for errors.

+
static void
+print_all_documents (mongoc_collection_t *collection)
+{
+   mongoc_cursor_t *cursor;
+   const bson_t *doc;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   char *str;
+
+   cursor = mongoc_collection_find_with_opts (collection, query, NULL, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Failed to iterate all documents: %s\n", error.message);
+   }
+
+   mongoc_cursor_destroy (cursor);
+}
+
+
+
+
+

Destroying Server-Side Cursors

+

The MongoDB C driver will automatically destroy a server-side cursor when mongoc_cursor_destroy() is called. Failure to call this function when done with a cursor will leak memory client side as well as consume extra memory server side. If the cursor was configured to never timeout, it will become a memory leak on the server.

+
+
+

Tailable Cursors

+

Tailable cursors are cursors that remain open even after they’ve returned a final result. This way, if more documents are added to a collection (i.e., to the cursor’s result set), then you can continue to call mongoc_cursor_next() to retrieve those additional results.

+

Here’s a complete test case that demonstrates the use of tailable cursors.

+
+

Note

+

Tailable cursors are for capped collections only.

+
+

An example to tail the oplog from a replica set.

+
+
mongoc-tail.c
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef _WIN32
+#define sleep(_n) Sleep ((_n) *1000)
+#endif
+
+
+static void
+print_bson (const bson_t *b)
+{
+   char *str;
+
+   str = bson_as_canonical_extended_json (b, NULL);
+   fprintf (stdout, "%s\n", str);
+   bson_free (str);
+}
+
+
+static mongoc_cursor_t *
+query_collection (mongoc_collection_t *collection, uint32_t last_time)
+{
+   mongoc_cursor_t *cursor;
+   bson_t query;
+   bson_t gt;
+   bson_t opts;
+
+   BSON_ASSERT (collection);
+
+   bson_init (&query);
+   BSON_APPEND_DOCUMENT_BEGIN (&query, "ts", &gt);
+   BSON_APPEND_TIMESTAMP (&gt, "$gt", last_time, 0);
+   bson_append_document_end (&query, &gt);
+
+   bson_init (&opts);
+   BSON_APPEND_BOOL (&opts, "tailable", true);
+   BSON_APPEND_BOOL (&opts, "awaitData", true);
+
+   cursor = mongoc_collection_find_with_opts (collection, &query, &opts, NULL);
+
+   bson_destroy (&query);
+   bson_destroy (&opts);
+
+   return cursor;
+}
+
+
+static void
+tail_collection (mongoc_collection_t *collection)
+{
+   mongoc_cursor_t *cursor;
+   uint32_t last_time;
+   const bson_t *doc;
+   bson_error_t error;
+   bson_iter_t iter;
+
+   BSON_ASSERT (collection);
+
+   last_time = (uint32_t) time (NULL);
+
+   while (true) {
+      cursor = query_collection (collection, last_time);
+      while (!mongoc_cursor_error (cursor, &error) &&
+             mongoc_cursor_more (cursor)) {
+         if (mongoc_cursor_next (cursor, &doc)) {
+            if (bson_iter_init_find (&iter, doc, "ts") &&
+                BSON_ITER_HOLDS_TIMESTAMP (&iter)) {
+               bson_iter_timestamp (&iter, &last_time, NULL);
+            }
+            print_bson (doc);
+         }
+      }
+      if (mongoc_cursor_error (cursor, &error)) {
+         if (error.domain == MONGOC_ERROR_SERVER) {
+            fprintf (stderr, "%s\n", error.message);
+            exit (1);
+         }
+      }
+
+      mongoc_cursor_destroy (cursor);
+      sleep (1);
+   }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_collection_t *collection;
+   mongoc_client_t *client;
+   mongoc_uri_t *uri;
+   bson_error_t error;
+
+   if (argc != 2) {
+      fprintf (stderr, "usage: %s MONGO_URI\n", argv[0]);
+      return EXIT_FAILURE;
+   }
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (argv[1], &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               argv[1],
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   collection = mongoc_client_get_collection (client, "local", "oplog.rs");
+
+   tail_collection (collection);
+
+   mongoc_collection_destroy (collection);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   return EXIT_SUCCESS;
+}
+
+
+
+

Let’s compile and run this example against a replica set to see updates as they are made.

+
$ gcc -Wall -o mongoc-tail mongoc-tail.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./mongoc-tail mongodb://example.com/?replicaSet=myReplSet
+{
+    "h" : -8458503739429355503,
+    "ns" : "test.test",
+    "o" : {
+        "_id" : {
+            "$oid" : "5372ab0a25164be923d10d50"
+        }
+    },
+    "op" : "i",
+    "ts" : {
+        "$timestamp" : {
+            "i" : 1,
+            "t" : 1400023818
+        }
+    },
+    "v" : 2
+}
+
+
+

The line of output is a sample from performing db.test.insert({}) from the mongo shell on the replica set.

+

See also mongoc_cursor_set_max_await_time_ms().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/debugging.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/debugging.html new file mode 100644 index 0000000..190e9f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/debugging.html @@ -0,0 +1,196 @@ + + + + + + + + Aids for Debugging — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Aids for Debugging

+
+

GDB

+

This repository contains a .gdbinit file that contains helper functions to +aid debugging of data structures. GDB will load this file +automatically if you have added the directory which contains the .gdbinit file to GDB’s +auto-load safe-path, and you start GDB from the directory which holds the .gdbinit file.

+

You can see the safe-path with show auto-load safe-path on a GDB prompt. You +can configure it by setting it in ~/.gdbinit with:

+
add-auto-load-safe-path /path/to/mongo-c-driver
+
+
+

If you haven’t added the path to your auto-load safe-path, or start GDB in +another directory, load the file with:

+
source path/to/mongo-c-driver/.gdbinit
+
+
+

The .gdbinit file defines the printbson function, which shows the contents of a bson_t * variable. +If you have a local bson_t, then you must prefix the variable with a &.

+

An example GDB session looks like:

+
(gdb) printbson bson
+ALLOC [0x555556cd7310 + 0] (len=475)
+{
+    'bool' : true,
+    'int32' : NumberInt("42"),
+    'int64' : NumberLong("3000000042"),
+    'string' : "Stŕìñg",
+    'objectId' : ObjectID("5A1442F3122D331C3C6757E1"),
+    'utcDateTime' : UTCDateTime(1511277299031),
+    'arrayOfInts' : [
+        '0' : NumberInt("1"),
+        '1' : NumberInt("2")
+    ],
+    'embeddedDocument' : {
+        'arrayOfStrings' : [
+            '0' : "one",
+            '1' : "two"
+        ],
+        'double' : 2.718280,
+        'notherDoc' : {
+            'true' : NumberInt("1"),
+            'false' : false
+        }
+    },
+    'binary' : Binary("02", "3031343532333637"),
+    'regex' : Regex("@[a-z]+@", "im"),
+    'null' : null,
+    'js' : JavaScript("print foo"),
+    'jsws' : JavaScript("print foo") with scope: {
+        'f' : NumberInt("42"),
+        'a' : [
+            '0' : 3.141593,
+            '1' : 2.718282
+        ]
+    },
+    'timestamp' : Timestamp(4294967295, 4294967295),
+    'double' : 3.141593
+}
+
+
+
+
+

LLDB

+

This repository also includes a script that customizes LLDB’s standard print command to print a bson_t or bson_t * as JSON:

+
(lldb) print b
+(bson_t) $0 = {"x": 1, "y": 2}
+
+
+

The custom bson command provides more options:

+
(lldb) bson --verbose b
+len=19
+flags=INLINE|STATIC
+{
+  "x": 1,
+  "y": 2
+}
+(lldb) bson --raw b
+'\x13\x00\x00\x00\x10x\x00\x01\x00\x00\x00\x10y\x00\x02\x00\x00\x00\x00'
+
+
+

Type help bson for a list of options.

+

The script requires a build of libbson with debug symbols, and an installation of PyMongo. Install PyMongo with:

+
python -m pip install pymongo
+
+
+

If you see “No module named pip” then you must install pip, then run the previous command again.

+

Create a file ~/.lldbinit containing:

+
command script import /path/to/mongo-c-driver/lldb_bson.py
+
+
+

If you see “bson command installed by lldb_bson” at the beginning of your LLDB session, you’ve installed the script correctly.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/distinct-mapreduce.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/distinct-mapreduce.html new file mode 100644 index 0000000..0eb1b9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/distinct-mapreduce.html @@ -0,0 +1,547 @@ + + + + + + + + “distinct” and “mapReduce” — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

“distinct” and “mapReduce”

+

This document provides some practical, simple, examples to demonstrate the distinct and mapReduce commands.

+
+

Setup

+

First we’ll write some code to insert sample data:

+
+
doc-common-insert.c
+
/* Don't try to compile this file on its own. It's meant to be #included
+   by example code */
+
+/* Insert some sample data */
+bool
+insert_data (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   enum N { ndocs = 4 };
+   bson_t *docs[ndocs];
+   bson_error_t error;
+   int i = 0;
+   bool ret;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   docs[0] = BCON_NEW ("x", BCON_DOUBLE (1.0), "tags", "[", "dog", "cat", "]");
+   docs[1] = BCON_NEW ("x", BCON_DOUBLE (2.0), "tags", "[", "cat", "]");
+   docs[2] = BCON_NEW (
+      "x", BCON_DOUBLE (2.0), "tags", "[", "mouse", "cat", "dog", "]");
+   docs[3] = BCON_NEW ("x", BCON_DOUBLE (3.0), "tags", "[", "]");
+
+   for (i = 0; i < ndocs; i++) {
+      mongoc_bulk_operation_insert (bulk, docs[i]);
+      bson_destroy (docs[i]);
+      docs[i] = NULL;
+   }
+
+   ret = mongoc_bulk_operation_execute (bulk, NULL, &error);
+
+   if (!ret) {
+      fprintf (stderr, "Error inserting data: %s\n", error.message);
+   }
+
+   mongoc_bulk_operation_destroy (bulk);
+   return ret;
+}
+
+/* A helper which we'll use a lot later on */
+void
+print_res (const bson_t *reply)
+{
+   char *str;
+   BSON_ASSERT (reply);
+   str = bson_as_canonical_extended_json (reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+}
+
+
+
+
+
+

“distinct” command

+

This is how to use the distinct command to get the distinct values of x which are greater than 1:

+
+
distinct.c
+
bool
+distinct (mongoc_database_t *database)
+{
+   bson_t *command;
+   bson_t reply;
+   bson_error_t error;
+   bool res;
+   bson_iter_t iter;
+   bson_iter_t array_iter;
+   double val;
+
+   command = BCON_NEW ("distinct",
+                       BCON_UTF8 (COLLECTION_NAME),
+                       "key",
+                       BCON_UTF8 ("x"),
+                       "query",
+                       "{",
+                       "x",
+                       "{",
+                       "$gt",
+                       BCON_DOUBLE (1.0),
+                       "}",
+                       "}");
+   res =
+      mongoc_database_command_simple (database, command, NULL, &reply, &error);
+   if (!res) {
+      fprintf (stderr, "Error with distinct: %s\n", error.message);
+      goto cleanup;
+   }
+
+   /* Do something with reply (in this case iterate through the values) */
+   if (!(bson_iter_init_find (&iter, &reply, "values") &&
+         BSON_ITER_HOLDS_ARRAY (&iter) &&
+         bson_iter_recurse (&iter, &array_iter))) {
+      fprintf (stderr, "Couldn't extract \"values\" field from response\n");
+      goto cleanup;
+   }
+
+   while (bson_iter_next (&array_iter)) {
+      if (BSON_ITER_HOLDS_DOUBLE (&array_iter)) {
+         val = bson_iter_double (&array_iter);
+         printf ("Next double: %f\n", val);
+      }
+   }
+
+cleanup:
+   /* cleanup */
+   bson_destroy (command);
+   bson_destroy (&reply);
+   return res;
+}
+
+
+
+
+
+

“mapReduce” - basic example

+

A simple example using the map reduce framework. It simply adds up the number of occurrences of each “tag”.

+

First define the map and reduce functions:

+
+
constants.c
+
const char *const COLLECTION_NAME = "things";
+
+/* Our map function just emits a single (key, 1) pair for each tag
+   in the array: */
+const char *const MAPPER = "function () {"
+                           "this.tags.forEach(function(z) {"
+                           "emit(z, 1);"
+                           "});"
+                           "}";
+
+/* The reduce function sums over all of the emitted values for a
+   given key: */
+const char *const REDUCER = "function (key, values) {"
+                            "var total = 0;"
+                            "for (var i = 0; i < values.length; i++) {"
+                            "total += values[i];"
+                            "}"
+                            "return total;"
+                            "}";
+/* Note We can't just return values.length as the reduce function
+   might be called iteratively on the results of other reduce
+   steps. */
+
+
+
+

Run the mapReduce command:

+
+
map-reduce-basic.c
+
bool
+map_reduce_basic (mongoc_database_t *database)
+{
+   bson_t reply;
+   bson_t *command;
+   bool res;
+   bson_error_t error;
+   mongoc_cursor_t *cursor;
+   const bson_t *doc;
+
+   bool query_done = false;
+
+   const char *out_collection_name = "outCollection";
+   mongoc_collection_t *out_collection;
+
+   /* Empty find query */
+   bson_t find_query = BSON_INITIALIZER;
+
+   /* Construct the mapReduce command */
+
+   /* Other arguments can also be specified here, like "query" or
+      "limit" and so on */
+   command = BCON_NEW ("mapReduce",
+                       BCON_UTF8 (COLLECTION_NAME),
+                       "map",
+                       BCON_CODE (MAPPER),
+                       "reduce",
+                       BCON_CODE (REDUCER),
+                       "out",
+                       BCON_UTF8 (out_collection_name));
+   res =
+      mongoc_database_command_simple (database, command, NULL, &reply, &error);
+
+   if (!res) {
+      fprintf (stderr, "MapReduce failed: %s\n", error.message);
+      goto cleanup;
+   }
+
+   /* Do something with the reply (it doesn't contain the mapReduce results) */
+   print_res (&reply);
+
+   /* Now we'll query outCollection to see what the results are */
+   out_collection =
+      mongoc_database_get_collection (database, out_collection_name);
+   cursor = mongoc_collection_find_with_opts (
+      out_collection, &find_query, NULL, NULL);
+   query_done = true;
+
+   /* Do something with the results */
+   while (mongoc_cursor_next (cursor, &doc)) {
+      print_res (doc);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "ERROR: %s\n", error.message);
+      res = false;
+      goto cleanup;
+   }
+
+cleanup:
+   /* cleanup */
+   if (query_done) {
+      mongoc_cursor_destroy (cursor);
+      mongoc_collection_destroy (out_collection);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (command);
+
+   return res;
+}
+
+
+
+
+
+

“mapReduce” - more complicated example

+

You must have replica set running for this.

+

In this example we contact a secondary in the replica set and do an “inline” map reduce, so the results are returned immediately:

+
+
map-reduce-advanced.c
+
bool
+map_reduce_advanced (mongoc_database_t *database)
+{
+   bson_t *command;
+   bson_error_t error;
+   bool res = true;
+   mongoc_cursor_t *cursor;
+   mongoc_read_prefs_t *read_pref;
+   const bson_t *doc;
+
+   /* Construct the mapReduce command */
+   /* Other arguments can also be specified here, like "query" or "limit"
+      and so on */
+
+   /* Read the results inline from a secondary replica */
+   command = BCON_NEW ("mapReduce",
+                       BCON_UTF8 (COLLECTION_NAME),
+                       "map",
+                       BCON_CODE (MAPPER),
+                       "reduce",
+                       BCON_CODE (REDUCER),
+                       "out",
+                       "{",
+                       "inline",
+                       "1",
+                       "}");
+
+   read_pref = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+   cursor = mongoc_database_command (
+      database, MONGOC_QUERY_NONE, 0, 0, 0, command, NULL, read_pref);
+
+   /* Do something with the results */
+   while (mongoc_cursor_next (cursor, &doc)) {
+      print_res (doc);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "ERROR: %s\n", error.message);
+      res = false;
+   }
+
+   mongoc_cursor_destroy (cursor);
+   mongoc_read_prefs_destroy (read_pref);
+   bson_destroy (command);
+
+   return res;
+}
+
+
+
+
+
+

Running the Examples

+

Here’s how to run the example code

+
+
basic-aggregation.c
+
/*
+ * Copyright 2016 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+
+#include "constants.c"
+
+#include "../doc-common-insert.c"
+#include "distinct.c"
+#include "map-reduce-basic.c"
+#include "map-reduce-advanced.c"
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_database_t *database = NULL;
+   mongoc_client_t *client = NULL;
+   mongoc_collection_t *collection = NULL;
+   mongoc_uri_t *uri = NULL;
+   bson_error_t error;
+   char *host_and_port = NULL;
+   int exit_code = EXIT_FAILURE;
+
+   if (argc != 2) {
+      fprintf (stderr, "usage: %s CONNECTION-STRING\n", argv[0]);
+      fprintf (stderr,
+               "the connection string can be of the following forms:\n");
+      fprintf (stderr, "localhost\t\t\t\tlocal machine\n");
+      fprintf (stderr, "localhost:27018\t\t\t\tlocal machine on port 27018\n");
+      fprintf (stderr,
+               "mongodb://user:pass@localhost:27017\t"
+               "local machine on port 27017, and authenticate with username "
+               "user and password pass\n");
+      return exit_code;
+   }
+
+   mongoc_init ();
+
+   if (strncmp (argv[1], "mongodb://", 10) == 0) {
+      host_and_port = bson_strdup (argv[1]);
+   } else {
+      host_and_port = bson_strdup_printf ("mongodb://%s", argv[1]);
+   }
+
+   uri = mongoc_uri_new_with_error (host_and_port, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               host_and_port,
+               error.message);
+      goto cleanup;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto cleanup;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "test");
+   collection = mongoc_database_get_collection (database, COLLECTION_NAME);
+
+   printf ("Inserting data\n");
+   if (!insert_data (collection)) {
+      goto cleanup;
+   }
+
+   printf ("distinct\n");
+   if (!distinct (database)) {
+      goto cleanup;
+   }
+
+   printf ("map reduce\n");
+   if (!map_reduce_basic (database)) {
+      goto cleanup;
+   }
+
+   printf ("more complicated map reduce\n");
+   if (!map_reduce_advanced (database)) {
+      goto cleanup;
+   }
+   
+   exit_code = EXIT_SUCCESS;
+
+cleanup:
+   if (collection) {
+      mongoc_collection_destroy (collection);
+   }
+
+   if (database) {
+      mongoc_database_destroy (database);
+   }
+
+   if (client) {
+      mongoc_client_destroy (client);
+   }
+
+   if (uri) {
+      mongoc_uri_destroy (uri);
+   }
+
+   if (host_and_port) {
+      bson_free (host_and_port);
+   }
+
+   mongoc_cleanup ();
+   return exit_code;
+}
+
+
+
+

If you want to try the advanced map reduce example with a secondary, start a replica set (instructions for how to do this can be found here).

+

Otherwise, just start an instance of MongoDB:

+
$ mongod
+
+
+

Now compile and run the example program:

+
$ cd examples/basic_aggregation/
+$ gcc -Wall -o agg-example basic-aggregation.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./agg-example localhost
+
+Inserting data
+distinct
+Next double: 2.000000
+Next double: 3.000000
+map reduce
+{ "result" : "outCollection", "timeMillis" : 155, "counts" : { "input" : 84, "emit" : 126, "reduce" : 3, "output" : 3 }, "ok" : 1 }
+{ "_id" : "cat", "value" : 63 }
+{ "_id" : "dog", "value" : 42 }
+{ "_id" : "mouse", "value" : 21 }
+more complicated map reduce
+{ "results" : [ { "_id" : "cat", "value" : 63 }, { "_id" : "dog", "value" : 42 }, { "_id" : "mouse", "value" : 21 } ], "timeMillis" : 14, "counts" : { "input" : 84, "emit" : 126, "reduce" : 3, "output" : 3 }, "ok" : 1 }
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/errors.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/errors.html new file mode 100644 index 0000000..c86bf35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/errors.html @@ -0,0 +1,301 @@ + + + + + + + + Error Reporting — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +

« MongoDB C Driver

+
+

Error Reporting

+
+

Description

+

Many C Driver functions report errors by returning false or -1 and filling out a bson_error_t structure with an error domain, error code, and message. Use domain to determine which subsystem generated the error, and code for the specific error. message is a human-readable error description.

+

See also: Handling Errors in libbson.

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DomainCodeDescription
MONGOC_ERROR_CLIENTMONGOC_ERROR_CLIENT_TOO_BIGYou tried to send a message larger than the server’s max message size.
 MONGOC_ERROR_CLIENT_AUTHENTICATEWrong credentials, or failure sending or receiving authentication messages.
 MONGOC_ERROR_CLIENT_NO_ACCEPTABLE_PEERYou tried an SSL connection but the driver was not built with SSL.
 MONGOC_ERROR_CLIENT_IN_EXHAUSTYou began iterating an exhaust cursor, then tried to begin another operation with the same mongoc_client_t.
 MONGOC_ERROR_CLIENT_SESSION_FAILUREFailure related to creating or using a logical session.
MONGOC_ERROR_STREAMMONGOC_ERROR_STREAM_NAME_RESOLUTIONDNS failure.
 MONGOC_ERROR_STREAM_SOCKETTimeout communicating with server, or connection closed.
 MONGOC_ERROR_STREAM_CONNECTFailed to connect to server.
MONGOC_ERROR_PROTOCOLMONGOC_ERROR_PROTOCOL_INVALID_REPLYCorrupt response from server.
 MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSIONThe server version is too old or too new to communicate with the driver.
MONGOC_ERROR_CURSORMONGOC_ERROR_CURSOR_INVALID_CURSORYou passed bad arguments to mongoc_collection_find_with_opts(), or you called mongoc_cursor_next() on a completed or failed cursor, or the cursor timed out on the server.
 MONGOC_ERROR_CHANGE_STREAM_NO_RESUME_TOKENA resume token was not returned in a document found with mongoc_change_stream_next()
MONGOC_ERROR_QUERYMONGOC_ERROR_QUERY_FAILUREError API Version 1: Server error from command or query. The server error message is in message.
MONGOC_ERROR_SERVERMONGOC_ERROR_QUERY_FAILUREError API Version 2: Server error from command or query. The server error message is in message.
MONGOC_ERROR_SASLA SASL error code.man sasl_errors for a list of codes.
MONGOC_ERROR_BSONMONGOC_ERROR_BSON_INVALIDYou passed an invalid or oversized BSON document as a parameter, or called mongoc_collection_create_index() with invalid keys, or the server reply was corrupt.
MONGOC_ERROR_NAMESPACEMONGOC_ERROR_NAMESPACE_INVALIDYou tried to create a collection with an invalid name.
MONGOC_ERROR_COMMANDMONGOC_ERROR_COMMAND_INVALID_ARGMany functions set this error code when passed bad parameters. Print the error message for details.
 MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSIONYou tried to use a command option the server does not support.
 MONGOC_ERROR_DUPLICATE_KEYAn insert or update failed because because of a duplicate _id or other unique-index violation.
MONGOC_ERROR_COMMANDError code from server.Error API Version 1: Server error from a command. The server error message is in message.
MONGOC_ERROR_SERVERError code from server.Error API Version 2: Server error from a command. The server error message is in message.
MONGOC_ERROR_COLLECTIONMONGOC_ERROR_COLLECTION_INSERT_FAILED, MONGOC_ERROR_COLLECTION_UPDATE_FAILED, MONGOC_ERROR_COLLECTION_DELETE_FAILED.Invalid or empty input to mongoc_collection_insert_one(), mongoc_collection_insert_bulk(), mongoc_collection_update_one(), mongoc_collection_update_many(), mongoc_collection_replace_one(), mongoc_collection_delete_one(), or mongoc_collection_delete_many().
MONGOC_ERROR_COLLECTIONError code from server.Error API Version 1: Server error from mongoc_collection_insert_one(), mongoc_collection_insert_bulk(), mongoc_collection_update_one(), mongoc_collection_update_many(), mongoc_collection_replace_one(), +mongoc_collection_delete_one(), or mongoc_collection_delete_many().
MONGOC_ERROR_SERVERError code from server.Error API Version 2: Server error from mongoc_collection_insert_one(), mongoc_collection_insert_bulk(), mongoc_collection_update_one(), mongoc_collection_update_many(), mongoc_collection_replace_one(), +mongoc_collection_delete_one(), or mongoc_collection_delete_many().
MONGOC_ERROR_GRIDFSMONGOC_ERROR_GRIDFS_CHUNK_MISSINGThe GridFS file is missing a document in its chunks collection.
 MONGOC_ERROR_GRIDFS_CORRUPTA data inconsistency was detected in GridFS.
 MONGOC_ERROR_GRIDFS_INVALID_FILENAMEYou passed a NULL filename to mongoc_gridfs_remove_by_filename().
 MONGOC_ERROR_GRIDFS_PROTOCOL_ERRORYou called mongoc_gridfs_file_set_id() after mongoc_gridfs_file_save().
MONGOC_ERROR_SCRAMMONGOC_ERROR_SCRAM_PROTOCOL_ERRORFailure in SCRAM-SHA-1 authentication.
MONGOC_ERROR_SERVER_SELECTIONMONGOC_ERROR_SERVER_SELECTION_FAILURENo replica set member or mongos is available, or none matches your read preference, or you supplied an invalid mongoc_read_prefs_t.
MONGOC_ERROR_WRITE_CONCERNError code from server.There was a write concern error or timeout from the server.
MONGOC_ERROR_TRANSACTIONMONGOC_ERROR_TRANSACTION_INVALIDYou attempted to start a transaction when one is already in progress, or commit or abort when there is no transaction.
+
+
+

Error Labels

+

In some cases your application must make decisions based on what category of error the driver has returned, but these categories do not correspond perfectly to an error domain or code. In such cases, error labels provide a reliable way to determine how your application should respond to an error.

+

Any C Driver function that has a bson_t out-parameter named reply may include error labels to the reply, in the form of a BSON field named “errorLabels” containing an array of strings:

+
{ "errorLabels": [ "TransientTransactionError" ] }
+
+
+

Use mongoc_error_has_label() to test if a reply contains a specific label. See mongoc_client_session_start_transaction() for example code that demonstrates the use of error labels in application logic.

+

The following error labels are currently defined. Future versions of MongoDB may introduce new labels.

+
+

TransientTransactionError

+

Within a multi-document transaction, certain errors can leave the transaction in an unknown or aborted state. These include write conflicts, primary stepdowns, and network errors. In response, the application should abort the transaction and try the same sequence of operations again in a new transaction.

+
+
+

UnknownTransactionCommitResult

+

When mongoc_client_session_commit_transaction() encounters a network error or certain server errors, it is not known whether the transaction was committed. Applications should attempt to commit the transaction again until: the commit succeeds, the commit fails with an error not labeled “UnknownTransactionCommitResult”, or the application chooses to give up.

+
+
+
+

Setting the Error API Version

+

The driver’s error reporting began with a design flaw: when the error domain is MONGOC_ERROR_COLLECTION, MONGOC_ERROR_QUERY, or MONGOC_ERROR_COMMAND, the error code might originate from the server or the driver. An application cannot always know where an error originated, and therefore cannot tell what the code means.

+

For example, if mongoc_collection_update_one() sets the error’s domain to MONGOC_ERROR_COLLECTION and its code to 24, the application cannot know whether 24 is the generic driver error code MONGOC_ERROR_COLLECTION_UPDATE_FAILED or the specific server error code “LockTimeout”.

+

To fix this flaw while preserving backward compatibility, the C Driver 1.4 introduces “Error API Versions”. Version 1, the default Error API Version, maintains the flawed behavior. Version 2 adds a new error domain, MONGOC_ERROR_SERVER. In Version 2, error codes originating on the server always have error domain MONGOC_ERROR_SERVER or MONGOC_ERROR_WRITE_CONCERN. When the driver uses Version 2 the application can always determine the origin and meaning of error codes. New applications should use Version 2, and existing applications should be updated to use Version 2 as well.

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Error SourceAPI Version 1API Version 2
mongoc_cursor_error()MONGOC_ERROR_QUERYMONGOC_ERROR_SERVER
mongoc_client_command_with_opts(), +mongoc_database_command_with_opts(), and +other command functionsMONGOC_ERROR_QUERYMONGOC_ERROR_SERVER
mongoc_collection_count_with_opts() +mongoc_client_get_database_names_with_opts(), +and other command helper functionsMONGOC_ERROR_QUERYMONGOC_ERROR_SERVER
mongoc_collection_insert_one() +mongoc_collection_insert_bulk() +mongoc_collection_update_one() +mongoc_collection_update_many() +mongoc_collection_replace_one() +mongoc_collection_delete_one() +mongoc_collection_delete_many()MONGOC_ERROR_COMMANDMONGOC_ERROR_SERVER
mongoc_bulk_operation_execute()MONGOC_ERROR_COMMANDMONGOC_ERROR_SERVER
Write-concern timeoutMONGOC_ERROR_WRITE_CONCERNMONGOC_ERROR_WRITE_CONCERN
+

The Error API Versions are defined with MONGOC_ERROR_API_VERSION_LEGACY and MONGOC_ERROR_API_VERSION_2. Set the version with mongoc_client_set_error_api() or mongoc_client_pool_set_error_api().

+
+ +
+

Functions

+ +
+
+ + +
+ +
+
+
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/full_index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/full_index.html new file mode 100644 index 0000000..c2989cc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/full_index.html @@ -0,0 +1,745 @@ + + + + + + + + Index — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Index

+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/genindex.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/genindex.html new file mode 100644 index 0000000..cc5da45 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/genindex.html @@ -0,0 +1,91 @@ + + + + + + + + + Index — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/guides.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/guides.html new file mode 100644 index 0000000..9344ff9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/guides.html @@ -0,0 +1,117 @@ + + + + + + + + Guides — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/index.html new file mode 100644 index 0000000..c810635 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/index.html @@ -0,0 +1,233 @@ + + + + + + + + MongoDB C Driver — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + +
+
+
+
+ + +
+

MongoDB C Driver

+

A Cross Platform MongoDB Client Library for C

+
+

Introduction

+

The MongoDB C Driver, also known as “libmongoc”, is a library for using MongoDB from C applications, and for writing MongoDB drivers in higher-level languages.

+

It depends on libbson to generate and parse BSON documents, the native data format of MongoDB.

+ + + + + + + +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/init-cleanup.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/init-cleanup.html new file mode 100644 index 0000000..392e013 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/init-cleanup.html @@ -0,0 +1,161 @@ + + + + + + + + Initialization and cleanup — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Initialization and cleanup

+
+

Synopsis

+

Initialize the MongoDB C Driver by calling mongoc_init() exactly once at the beginning of your program. It is responsible for initializing global state such as process counters, SSL, and threading primitives.

+

Call mongoc_cleanup() exactly once at the end of your program to release all memory and other resources allocated by the driver. You must not call any other MongoDB C Driver functions after mongoc_cleanup(). Note that mongoc_init() does not reinitialize the driver after mongoc_cleanup().

+ +
+
+

Deprecated feature: automatic initialization and cleanup

+

On some platforms the driver can automatically call mongoc_init() before main, and call mongoc_cleanup() as the process exits. This is problematic in situations where related libraries also execute cleanup code on shutdown, and it creates inconsistent rules across platforms. Therefore the automatic initialization and cleanup feature is deprecated, and will be dropped in version 2.0. Meanwhile, for backward compatibility, the feature is enabled by default on platforms where it is available.

+

For portable, future-proof code, always call mongoc_init() and mongoc_cleanup() yourself, and configure the driver like:

+
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=NO
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/installing.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/installing.html new file mode 100644 index 0000000..de9d03b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/installing.html @@ -0,0 +1,303 @@ + + + + + + + + Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Installing the MongoDB C Driver (libmongoc) and BSON library (libbson)

+

The following guide will step you through the process of downloading, building, and installing the current release of the MongoDB C Driver (libmongoc) and BSON library (libbson).

+
+

Supported Platforms

+

The MongoDB C Driver is continuously tested on variety of platforms including:

+
    +
  • Archlinux
  • +
  • Debian 8.1
  • +
  • macOS 10.10
  • +
  • Microsoft Windows Server 2008
  • +
  • RHEL 7.0, 7.1, 7.2
  • +
  • SUSE 12
  • +
  • Ubuntu 12.04, 14.04, 16.04
  • +
  • Clang 3.4, 3.5, 3.7, 3.8
  • +
  • GCC 4.6, 4.8, 4.9, 5.3
  • +
  • MinGW-W64
  • +
  • Visual Studio 2010, 2013, 2015
  • +
  • x86, x86_64, ARM (aarch64), Power8 (ppc64le), zSeries (s390x)
  • +
+
+
+

Install libmongoc with a Package Manager

+

Several Linux distributions provide packages for libmongoc and its dependencies. One advantage of installing libmongoc with a package manager is that its dependencies (including libbson) will be installed automatically.

+

The libmongoc package is available on recent versions of Debian and Ubuntu.

+
$ apt-get install libmongoc-1.0-0
+
+
+

On Fedora, a mongo-c-driver package is available in the default repositories and can be installed with:

+
$ dnf install mongo-c-driver
+
+
+

On recent Red Hat systems, such as CentOS and RHEL 7, a mongo-c-driver package is available in the EPEL repository. To check which version is available, see https://apps.fedoraproject.org/packages/mongo-c-driver. The package can be installed with:

+
$ yum install mongo-c-driver
+
+
+
+
+

Install libbson with a Package Manager

+

The libbson package is available on recent versions of Debian and Ubuntu. If you have installed libmongoc, then libbson will have already been installed as a dependency. It is also possible to install libbson without libmongoc.

+
$ apt-get install libbson-1.0
+
+
+

On Fedora, a libbson package is available in the default repositories and can be installed with:

+
$ dnf install libbson
+
+
+

On recent Red Hat systems, such as CentOS and RHEL 7, a libbson package +is available in the EPEL repository. To check +which version is available, see https://apps.fedoraproject.org/packages/libbson. +The package can be installed with:

+
$ yum install libbson
+
+
+
+
+

Building on Unix

+
+

Prerequisites for libmongoc

+

OpenSSL is required for authentication or for SSL connections to MongoDB. Kerberos or LDAP support requires Cyrus SASL.

+

To install all optional dependencies on RedHat / Fedora:

+
$ sudo yum install cmake openssl-devel cyrus-sasl-devel
+
+
+

On Debian / Ubuntu:

+
$ sudo apt-get install cmake libssl-dev libsasl2-dev
+
+
+

On FreeBSD:

+
$ su -c 'pkg install cmake openssl cyrus-sasl'
+
+
+
+
+

Prerequisites for libbson

+

The only prerequisite for building libbson is cmake. The command lines above can be adjusted to install only cmake.

+
+
+

Building from a release tarball

+

Unless you intend to contribute to mongo-c-driver and/or libbson, you will want to build from a release tarball.

+

The most recent release of libmongoc and libbson, both of which are included in mongo-c-driver, is 1.13.1 and can be downloaded here. The instructions in this document utilize cmake’s out-of-source build feature to keep build artifacts separate from source files.

+

The following snippet will download and extract the driver, and configure it:

+
+$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.13.1/mongo-c-driver-1.13.1.tar.gz
+$ tar xzf mongo-c-driver-1.13.1.tar.gz
+$ cd mongo-c-driver-1.13.1
+$ mkdir cmake-build
+$ cd cmake-build
+$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
+
+

The -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF option is recommended, see Initialization and cleanup. Another useful cmake option is -DCMAKE_BUILD_TYPE=Release for a release optimized build and -DCMAKE_BUILD_TYPE=Debug for a debug build. For a list of all configure options, run cmake -L ...

+

If cmake completed successfully, you will see a considerable amount of output describing your build configuration. The final line of output should look something like this:

+
+-- Build files have been written to: /home/user/mongo-c-driver-1.13.1/cmake-build
+
+

If cmake concludes with anything different, then there is likely an error or some other problem with the build. Review the output to identify and correct the problem.

+

mongo-c-driver contains a copy of libbson, in case your system does not already have libbson installed. The build will detect if libbson is not installed and use the bundled libbson.

+

Additionally, it is possible to build only libbson by setting the -DENABLE_MONGOC=OFF option:

+
$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_MONGOC=OFF ..
+
+
+

A build configuration description similar to the one above will be displayed, though with fewer entries. Once the configuration is complete, the selected items can be built and installed with these commands:

+
$ make
+$ sudo make install
+
+
+

There are two ways to uninstall the components that have been installed. The first is to invoke the uninstall program directly. On Linux/Unix:

+
$ sudo /usr/local/share/mongo-c-driver/uninstall.sh
+
+
+

On Windows:

+
C:\Users\user> C:\mongo-c-driver\share\mongo-c-driver\uninstall.bat
+
+
+

The second way to uninstall is from within the build directory, assuming that it is in the exact same state as when the install command was invoked:

+
$ sudo make uninstall
+
+
+

The second approach simply invokes the uninstall program referenced in the first approach.

+
+
+

Building from git

+

Clone the repository and build the current master or a particular release tag:

+
$ git clone https://github.com/mongodb/mongo-c-driver.git
+$ cd mongo-c-driver
+$ git checkout x.y.z  # To build a particular release
+$ mkdir cmake-build
+$ cd cmake-build
+$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
+$ make
+$ sudo make install
+
+
+
+
+

Generating the documentation

+

Install Sphinx, then:

+
$ cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON ..
+$ make mongoc-doc
+
+
+

To build only the libbson documentation:

+
$ cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON ..
+$ make bson-doc
+
+
+

The -DENABLE_MAN_PAGES=ON and -DENABLE_HTML_DOCS=ON can also be added as options to a normal build from a release tarball or from git so that the documentation is built at the same time as other components.

+
+
+
+

Building on macOS

+

Install the XCode Command Line Tools:

+
$ xcode-select --install
+
+
+

The cmake utility is also required. First install Homebrew according to its instructions, then:

+
$ brew install cmake
+
+
+

Download the latest release tarball:

+
+$ curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.13.1/mongo-c-driver-1.13.1.tar.gz
+$ tar xzf mongo-c-driver-1.13.1.tar.gz
+$ cd mongo-c-driver-1.13.1
+
+

Build and install the driver:

+
$ mkdir cmake-build
+$ cd cmake-build
+$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
+
+
+

All of the same variations described above (e.g., building only libbson, building documentation, etc.) are available when building on macOS.

+
+
+

Building on Windows with Visual Studio

+

Building on Windows requires Windows Vista or newer and Visual Studio 2010 or newer. Additionally, cmake is required to generate Visual Studio project files.

+

Let’s start by generating Visual Studio project files. The following assumes we are compiling for 64-bit Windows using Visual Studio 2015 Express, which can be freely downloaded from Microsoft. We will be utilizing cmake’s out-of-source build feature to keep build artifacts separate from source files.

+
+cd mongo-c-driver-1.13.1
+mkdir cmake-build
+cd cmake-build
+cmake -G "Visual Studio 14 2015 Win64" \
+  "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" \
+  "-DCMAKE_PREFIX_PATH=C:\mongo-c-driver" \
+  ..
+
+

(Run cmake -LH .. for a list of other options.)

+

Now that we have project files generated, we can either open the project in Visual Studio or compile from the command line. Let’s build using the command line program msbuild.exe:

+
msbuild.exe /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj
+
+
+

Visual Studio’s default build type is Debug, but we recommend a release build with debug info for production use. Now that libmongoc and libbson are compiled, let’s install them using msbuild. It will be installed to the path specified by CMAKE_INSTALL_PREFIX.

+
msbuild.exe INSTALL.vcxproj
+
+
+

You should now see libmongoc and libbson installed in C:\mongo-c-driver

+

To use the driver libraries in your program, see Using libmongoc in a Microsoft Visual Studio project.

+
+
+

Building on Windows with MinGW-W64 and MSYS2

+

Install MSYS2 from msys2.github.io. Choose the x86_64 version, not i686.

+

Open c:\msys64\ming64_shell.bat (not the msys2_shell). Install dependencies:

+
pacman --noconfirm -Syu
+pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
+pacman --noconfirm -S mingw-w64-x86_64-extra-cmake-modules make tar
+pacman --noconfirm -S mingw64/mingw-w64-x86_64-cyrus-sasl
+
+
+

Download and untar the latest tarball, enter its directory, and build with CMake:

+
CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="C:/mongo-c-driver" ..
+make
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/lifecycle.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/lifecycle.html new file mode 100644 index 0000000..aaeb4e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/lifecycle.html @@ -0,0 +1,166 @@ + + + + + + + + Object Lifecycle — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Object Lifecycle

+

This page documents the order of creation and destruction for libmongoc’s main struct types.

+
+

Clients and pools

+

Call mongoc_init() once, before calling any other libmongoc functions, and call mongoc_cleanup() once before your program exits.

+

A program that uses libmongoc from multiple threads should create a mongoc_client_pool_t with mongoc_client_pool_new(). Each thread acquires a mongoc_client_t from the pool with mongoc_client_pool_pop() and returns it with mongoc_client_pool_push() when the thread is finished using it. To destroy the pool, first return all clients, then call mongoc_client_pool_destroy().

+

If your program uses libmongoc from only one thread, create a mongoc_client_t directly with mongoc_client_new() or mongoc_client_new_from_uri(). Destroy it with mongoc_client_destroy().

+
+ +
+

GridFS objects

+

You can create a mongoc_gridfs_t from a mongoc_client_t, create a mongoc_gridfs_file_t or mongoc_gridfs_file_list_t from a mongoc_gridfs_t, create a mongoc_gridfs_file_t from a mongoc_gridfs_file_list_t, and create a mongoc_stream_t from a mongoc_gridfs_file_t.

+

Each of these objects depends on the object it was created from. Always destroy GridFS objects in the reverse of the order they were created. The sole exception is that a mongoc_gridfs_file_t need not be destroyed before the mongoc_gridfs_file_list_t it was created from.

+
+
+

Sessions

+

Start a session with mongoc_client_start_session(), use the session for a sequence of operations and multi-document transactions, then free it with mongoc_client_session_destroy(). Any mongoc_cursor_t or mongoc_change_stream_t using a session must be destroyed before the session, and a session must be destroyed before the mongoc_client_t it came from.

+

By default, sessions are causally consistent. To disable causal consistency, before starting a session create a mongoc_session_opt_t with mongoc_session_opts_new() and call mongoc_session_opts_set_causal_consistency(), then free the struct with mongoc_session_opts_destroy().

+

Unacknowledged writes are prohibited with sessions.

+

A mongoc_client_session_t must be used by only one thread at a time. Due to session pooling, mongoc_client_start_session() may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/logging.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/logging.html new file mode 100644 index 0000000..8c381ad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/logging.html @@ -0,0 +1,254 @@ + + + + + + + + Logging — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Logging

+

MongoDB C driver Logging Abstraction

+
+

Synopsis

+
typedef enum {
+   MONGOC_LOG_LEVEL_ERROR,
+   MONGOC_LOG_LEVEL_CRITICAL,
+   MONGOC_LOG_LEVEL_WARNING,
+   MONGOC_LOG_LEVEL_MESSAGE,
+   MONGOC_LOG_LEVEL_INFO,
+   MONGOC_LOG_LEVEL_DEBUG,
+   MONGOC_LOG_LEVEL_TRACE,
+} mongoc_log_level_t;
+
+#define MONGOC_ERROR(...)
+#define MONGOC_CRITICAL(...)
+#define MONGOC_WARNING(...)
+#define MONGOC_MESSAGE(...)
+#define MONGOC_INFO(...)
+#define MONGOC_DEBUG(...)
+
+typedef void (*mongoc_log_func_t) (mongoc_log_level_t log_level,
+                                   const char *log_domain,
+                                   const char *message,
+                                   void *user_data);
+
+void
+mongoc_log_set_handler (mongoc_log_func_t log_func, void *user_data);
+void
+mongoc_log (mongoc_log_level_t log_level,
+            const char *log_domain,
+            const char *format,
+            ...) BSON_GNUC_PRINTF (3, 4);
+const char *
+mongoc_log_level_str (mongoc_log_level_t log_level);
+void
+mongoc_log_default_handler (mongoc_log_level_t log_level,
+                            const char *log_domain,
+                            const char *message,
+                            void *user_data);
+void
+mongoc_log_trace_enable (void);
+void
+mongoc_log_trace_disable (void);
+
+
+

The MongoDB C driver comes with an abstraction for logging that you can use in your application, or integrate with an existing logging system.

+
+
+

Macros

+

To make logging a little less painful, various helper macros are provided. See the following example.

+
#undef MONGOC_LOG_DOMAIN
+#define MONGOC_LOG_DOMAIN "my-custom-domain"
+
+MONGOC_WARNING ("An error occurred: %s", strerror (errno));
+
+
+
+
+

Custom Log Handlers

+
+
The default log handler prints a timestamp and the log message to stdout, or to stderr for warnings, critical messages, and errors.
+
You can override the handler with mongoc_log_set_handler(). +Your handler function is called in a mutex for thread safety.
+
+

For example, you could register a custom handler to suppress messages at INFO level and below:

+
void
+my_logger (mongoc_log_level_t log_level,
+           const char *log_domain,
+           const char *message,
+           void *user_data)
+{
+   /* smaller values are more important */
+   if (log_level < MONGOC_LOG_LEVEL_INFO) {
+      mongoc_log_default_handler (log_level, log_domain, message, user_data);
+   }
+}
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_init ();
+   mongoc_log_set_handler (my_logger, NULL);
+
+   /* ... your code ...  */
+
+   mongoc_cleanup ();
+   return 0;
+}
+
+
+

To restore the default handler:

+
mongoc_log_set_handler (mongoc_log_default_handler, NULL);
+
+
+
+
+

Disable logging

+

To disable all logging, including warnings, critical messages and errors, provide an empty log handler:

+
mongoc_log_set_handler (NULL, NULL);
+
+
+
+
+

Tracing

+

If compiling your own copy of the MongoDB C driver, consider configuring with -DENABLE_TRACING=ON to enable function tracing and hex dumps of network packets to STDERR and STDOUT during development and debugging.

+

This is especially useful when debugging what may be going on internally in the driver.

+

Trace messages can be enabled and disabled by calling mongoc_log_trace_enable() and mongoc_log_trace_disable()

+
+

Note

+

Compiling the driver with -DENABLE_TRACING=ON will affect its performance. Disabling tracing with mongoc_log_trace_disable() significantly reduces the overhead, but cannot remove it completely.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/matcher.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/matcher.html new file mode 100644 index 0000000..b6257a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/matcher.html @@ -0,0 +1,106 @@ + + + + + + + + Client Side Document Matching — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Client Side Document Matching

+
+

Basic Document Matching (Deprecated)

+
+

Warning

+

This feature will be removed in version 2.0.

+
+

The MongoDB C driver supports matching a subset of the MongoDB query specification on the client.

+

Currently, basic numeric, string, subdocument, and array equality, $gt, $gte, $lt, $lte, $in, $nin, $ne, $exists, $type, $and, and $or are supported. As this is not the same implementation as the MongoDB server, some inconsistencies may occur. Please file a bug if you find such a case.

+

To test this, perform a mongodump of a single collection and pipe it to the program.

+
$ echo "db.test.insert({hello:'world'})" | mongo
+connecting to: test
+WriteResult({ "nInserted" : 1 })
+bye
+
+$ mongodump -d test -c test -o - | filter-bsondump
+{ "_id" : { "$oid" : "537afac9a70e5b4d556153bc" }, "hello" : "world" }
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc-common-task-examples.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc-common-task-examples.html new file mode 100644 index 0000000..9c33afb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc-common-task-examples.html @@ -0,0 +1,517 @@ + + + + + + + + Common Tasks — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Common Tasks

+

Drivers for some other languages provide helper functions to perform certain common tasks. In the C Driver we must explicitly build commands to send to the server.

+

This snippet contains example code for the explain, copydb and cloneCollection commands.

+
+

Setup

+

First we’ll write some code to insert sample data:

+
+
doc-common-insert.c
+
/* Don't try to compile this file on its own. It's meant to be #included
+   by example code */
+
+/* Insert some sample data */
+bool
+insert_data (mongoc_collection_t *collection)
+{
+   mongoc_bulk_operation_t *bulk;
+   enum N { ndocs = 4 };
+   bson_t *docs[ndocs];
+   bson_error_t error;
+   int i = 0;
+   bool ret;
+
+   bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL);
+
+   docs[0] = BCON_NEW ("x", BCON_DOUBLE (1.0), "tags", "[", "dog", "cat", "]");
+   docs[1] = BCON_NEW ("x", BCON_DOUBLE (2.0), "tags", "[", "cat", "]");
+   docs[2] = BCON_NEW (
+      "x", BCON_DOUBLE (2.0), "tags", "[", "mouse", "cat", "dog", "]");
+   docs[3] = BCON_NEW ("x", BCON_DOUBLE (3.0), "tags", "[", "]");
+
+   for (i = 0; i < ndocs; i++) {
+      mongoc_bulk_operation_insert (bulk, docs[i]);
+      bson_destroy (docs[i]);
+      docs[i] = NULL;
+   }
+
+   ret = mongoc_bulk_operation_execute (bulk, NULL, &error);
+
+   if (!ret) {
+      fprintf (stderr, "Error inserting data: %s\n", error.message);
+   }
+
+   mongoc_bulk_operation_destroy (bulk);
+   return ret;
+}
+
+/* A helper which we'll use a lot later on */
+void
+print_res (const bson_t *reply)
+{
+   char *str;
+   BSON_ASSERT (reply);
+   str = bson_as_canonical_extended_json (reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+}
+
+
+
+
+
+

“explain” Command

+

This is how to use the explain command in MongoDB 3.2+:

+
+
explain.c
+
bool
+explain (mongoc_collection_t *collection)
+{
+   bson_t *command;
+   bson_t reply;
+   bson_error_t error;
+   bool res;
+
+   command = BCON_NEW ("explain",
+                       "{",
+                       "find",
+                       BCON_UTF8 (COLLECTION_NAME),
+                       "filter",
+                       "{",
+                       "x",
+                       BCON_INT32 (1),
+                       "}",
+                       "}");
+   res = mongoc_collection_command_simple (
+      collection, command, NULL, &reply, &error);
+   if (!res) {
+      fprintf (stderr, "Error with explain: %s\n", error.message);
+      goto cleanup;
+   }
+
+   /* Do something with the reply */
+   print_res (&reply);
+
+cleanup:
+   bson_destroy (&reply);
+   bson_destroy (command);
+   return res;
+}
+
+
+
+
+
+

“copydb” Command

+

This example requires two instances of mongo to be running.

+

Here’s how to use the copydb command to copy a database from another instance of MongoDB:

+
+
copydb.c
+
bool
+copydb (mongoc_client_t *client, const char *other_host_and_port)
+{
+   mongoc_database_t *admindb;
+   bson_t *command;
+   bson_t reply;
+   bson_error_t error;
+   bool res;
+
+   BSON_ASSERT (other_host_and_port);
+   /* Must do this from the admin db */
+   admindb = mongoc_client_get_database (client, "admin");
+
+   command = BCON_NEW ("copydb",
+                       BCON_INT32 (1),
+                       "fromdb",
+                       BCON_UTF8 ("test"),
+                       "todb",
+                       BCON_UTF8 ("test2"),
+
+                       /* If you want from a different host */
+                       "fromhost",
+                       BCON_UTF8 (other_host_and_port));
+   res =
+      mongoc_database_command_simple (admindb, command, NULL, &reply, &error);
+   if (!res) {
+      fprintf (stderr, "Error with copydb: %s\n", error.message);
+      goto cleanup;
+   }
+
+   /* Do something with the reply */
+   print_res (&reply);
+
+cleanup:
+   bson_destroy (&reply);
+   bson_destroy (command);
+   mongoc_database_destroy (admindb);
+
+   return res;
+}
+
+
+
+
+
+

“cloneCollection” Command

+

This example requires two instances of mongo to be running.

+

Here’s an example of the cloneCollection command to clone a collection from another instance of MongoDB:

+
+
clone-collection.c
+
bool
+clone_collection (mongoc_database_t *database, const char *other_host_and_port)
+{
+   bson_t *command;
+   bson_t reply;
+   bson_error_t error;
+   bool res;
+
+   BSON_ASSERT (other_host_and_port);
+   command = BCON_NEW ("cloneCollection",
+                       BCON_UTF8 ("test.remoteThings"),
+                       "from",
+                       BCON_UTF8 (other_host_and_port),
+                       "query",
+                       "{",
+                       "x",
+                       BCON_INT32 (1),
+                       "}");
+   res =
+      mongoc_database_command_simple (database, command, NULL, &reply, &error);
+   if (!res) {
+      fprintf (stderr, "Error with clone: %s\n", error.message);
+      goto cleanup;
+   }
+
+   /* Do something with the reply */
+   print_res (&reply);
+
+cleanup:
+   bson_destroy (&reply);
+   bson_destroy (command);
+
+   return res;
+}
+
+
+
+
+
+

Running the Examples

+
+
common-operations.c
+
/*
+ * Copyright 2016 MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+
+const char *COLLECTION_NAME = "things";
+
+#include "../doc-common-insert.c"
+#include "explain.c"
+#include "copydb.c"
+#include "clone-collection.c"
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_database_t *database = NULL;
+   mongoc_client_t *client = NULL;
+   mongoc_collection_t *collection = NULL;
+   mongoc_uri_t *uri = NULL;
+   bson_error_t error;
+   char *host_and_port;
+   int res = 0;
+   char *other_host_and_port = NULL;
+
+   if (argc < 2 || argc > 3) {
+      fprintf (stderr,
+               "usage: %s MONGOD-1-CONNECTION-STRING "
+               "[MONGOD-2-HOST-NAME:MONGOD-2-PORT]\n",
+               argv[0]);
+      fprintf (stderr,
+               "MONGOD-1-CONNECTION-STRING can be "
+               "of the following forms:\n");
+      fprintf (stderr, "localhost\t\t\t\tlocal machine\n");
+      fprintf (stderr, "localhost:27018\t\t\t\tlocal machine on port 27018\n");
+      fprintf (stderr,
+               "mongodb://user:pass@localhost:27017\t"
+               "local machine on port 27017, and authenticate with username "
+               "user and password pass\n");
+      return EXIT_FAILURE;
+   }
+
+   mongoc_init ();
+
+   if (strncmp (argv[1], "mongodb://", 10) == 0) {
+      host_and_port = bson_strdup (argv[1]);
+   } else {
+      host_and_port = bson_strdup_printf ("mongodb://%s", argv[1]);
+   }
+   other_host_and_port = argc > 2 ? argv[2] : NULL;
+
+   uri = mongoc_uri_new_with_error (host_and_port, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               host_and_port,
+               error.message);
+      res = EXIT_FAILURE;
+      goto cleanup;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      res = EXIT_FAILURE;
+      goto cleanup;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "test");
+   collection = mongoc_database_get_collection (database, COLLECTION_NAME);
+
+   printf ("Inserting data\n");
+   if (!insert_data (collection)) {
+      res = EXIT_FAILURE;
+      goto cleanup;
+   }
+
+   printf ("explain\n");
+   if (!explain (collection)) {
+      res = EXIT_FAILURE;
+      goto cleanup;
+   }
+
+   if (other_host_and_port) {
+      printf ("copydb\n");
+      if (!copydb (client, other_host_and_port)) {
+         res = EXIT_FAILURE;
+         goto cleanup;
+      }
+
+      printf ("clone collection\n");
+      if (!clone_collection (database, other_host_and_port)) {
+         res = EXIT_FAILURE;
+         goto cleanup;
+      }
+   }
+
+cleanup:
+   if (collection) {
+      mongoc_collection_destroy (collection);
+   }
+
+   if (database) {
+      mongoc_database_destroy (database);
+   }
+
+   if (client) {
+      mongoc_client_destroy (client);
+   }
+
+   if (uri) {
+      mongoc_uri_destroy (uri);
+   }
+
+   bson_free (host_and_port);
+   mongoc_cleanup ();
+   return res;
+}
+
+
+
+

First launch two separate instances of mongod (must be done from separate shells):

+
$ mongod
+
+
+
$ mkdir /tmp/db2$ mongod --dbpath /tmp/db2 --port 27018 # second instance
+
+
+

Now compile and run the example program:

+
$ cd examples/common_operations/$ gcc -Wall -o example common-operations.c $(pkg-config --cflags --libs libmongoc-1.0)$ ./example localhost:27017 localhost:27018
+Inserting data
+explain
+{
+   "executionStats" : {
+      "allPlansExecution" : [],
+      "executionStages" : {
+         "advanced" : 19,
+         "direction" : "forward" ,
+         "docsExamined" : 76,
+         "executionTimeMillisEstimate" : 0,
+         "filter" : {
+            "x" : {
+               "$eq" : 1
+            }
+         },
+         "invalidates" : 0,
+         "isEOF" : 1,
+         "nReturned" : 19,
+         "needTime" : 58,
+         "needYield" : 0,
+         "restoreState" : 0,
+         "saveState" : 0,
+         "stage" : "COLLSCAN" ,
+         "works" : 78
+      },
+      "executionSuccess" : true,
+      "executionTimeMillis" : 0,
+      "nReturned" : 19,
+      "totalDocsExamined" : 76,
+      "totalKeysExamined" : 0
+   },
+   "ok" : 1,
+   "queryPlanner" : {
+      "indexFilterSet" : false,
+      "namespace" : "test.things",
+      "parsedQuery" : {
+         "x" : {
+            "$eq" : 1
+         }
+      },
+      "plannerVersion" : 1,
+      "rejectedPlans" : [],
+      "winningPlan" : {
+         "direction" : "forward" ,
+         "filter" : {
+            "x" : {
+               "$eq" : 1
+            }
+         },
+         "stage" : "COLLSCAN"
+      }
+   },
+   "serverInfo" : {
+      "gitVersion" : "05552b562c7a0b3143a729aaa0838e558dc49b25" ,
+      "host" : "MacBook-Pro-57.local",
+      "port" : 27017,
+      "version" : "3.2.6"
+   }
+}
+copydb
+{ "ok" : 1 }
+clone collection
+{ "ok" : 1 }
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_destroy.html new file mode 100644 index 0000000..39129a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_destroy.html @@ -0,0 +1,122 @@ + + + + + + + + mongoc_apm_callbacks_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_new.html new file mode 100644 index 0000000..d6a5a9e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_new.html @@ -0,0 +1,126 @@ + + + + + + + + mongoc_apm_callbacks_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_t.html new file mode 100644 index 0000000..5d32ae0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_callbacks_t.html @@ -0,0 +1,139 @@ + + + + + + + + mongoc_apm_callbacks_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ + +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_command_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_command_name.html new file mode 100644 index 0000000..0c7c264 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_command_name.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_command_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_failed_get_command_name()

+
+

Synopsis

+
const char *
+mongoc_apm_command_failed_get_command_name (
+   const mongoc_apm_command_failed_t *event);
+
+
+

Returns this event’s command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A string that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_context.html new file mode 100644 index 0000000..a076f65 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_duration.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_duration.html new file mode 100644 index 0000000..b1b9d66 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_duration.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_duration() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_error.html new file mode 100644 index 0000000..a97725c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_error.html @@ -0,0 +1,130 @@ + + + + + + + + mongoc_apm_command_failed_get_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_host.html new file mode 100644 index 0000000..6a650ba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_host.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_command_failed_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_failed_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_command_failed_get_host (const mongoc_apm_command_failed_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_operation_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_operation_id.html new file mode 100644 index 0000000..971113f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_operation_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_operation_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_failed_get_operation_id()

+
+

Synopsis

+
int64_t
+mongoc_apm_command_failed_get_operation_id (
+   const mongoc_apm_command_failed_t *event);
+
+
+

Returns this event’s operation id. This number correlates all the commands in a bulk operation, or all the “find” and “getMore” commands required to stream a large query result.

+
+
+

Parameters

+ +
+
+

Returns

+

The event’s operation id.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_reply.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_reply.html new file mode 100644 index 0000000..2c7579a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_reply.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_reply() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_failed_get_reply()

+
+

Synopsis

+
const bson_t *
+mongoc_apm_command_failed_get_reply (
+   const mongoc_apm_command_failed_t *event);
+
+
+

Returns the server’s reply to a command that failed. The reply contains details about why the command failed. If no server reply was received, such as in the event of a network error, then the reply is a valid empty BSON document. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A bson_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_request_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_request_id.html new file mode 100644 index 0000000..58e0601 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_request_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_request_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_server_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_server_id.html new file mode 100644 index 0000000..1cabc44 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_get_server_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_get_server_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_t.html new file mode 100644 index 0000000..6578ba6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_failed_t.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_failed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ + +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command.html new file mode 100644 index 0000000..6ad4554 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_command() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_started_get_command()

+
+

Synopsis

+
const bson_t *
+mongoc_apm_command_started_get_command (
+   const mongoc_apm_command_started_t *event);
+
+
+

Returns this event’s command. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A bson_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command_name.html new file mode 100644 index 0000000..7da4930 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_command_name.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_command_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_started_get_command_name()

+
+

Synopsis

+
const char *
+mongoc_apm_command_started_get_command_name (
+   const mongoc_apm_command_started_t *event);
+
+
+

Returns this event’s command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A string that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_context.html new file mode 100644 index 0000000..0415263 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_database_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_database_name.html new file mode 100644 index 0000000..20c5019 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_database_name.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_database_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_started_get_database_name()

+
+

Synopsis

+
const char *
+mongoc_apm_command_started_get_database_name (
+   const mongoc_apm_command_started_t *event);
+
+
+

Returns this event’s database name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A string that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_host.html new file mode 100644 index 0000000..489e687 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_host.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_command_started_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_started_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_command_started_get_host (const mongoc_apm_command_started_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_operation_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_operation_id.html new file mode 100644 index 0000000..3135c00 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_operation_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_operation_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_started_get_operation_id()

+
+

Synopsis

+
int64_t
+mongoc_apm_command_started_get_operation_id (
+   const mongoc_apm_command_started_t *event);
+
+
+

Returns this event’s operation id. This number correlates all the commands in a bulk operation, or all the “find” and “getMore” commands required to stream a large query result.

+
+
+

Parameters

+ +
+
+

Returns

+

The event’s operation id.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_request_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_request_id.html new file mode 100644 index 0000000..f486582 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_request_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_request_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_server_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_server_id.html new file mode 100644 index 0000000..6235586 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_get_server_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_started_get_server_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_t.html new file mode 100644 index 0000000..fe8fb7f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_started_t.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_command_started_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ + +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_command_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_command_name.html new file mode 100644 index 0000000..3ca7c9d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_command_name.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_command_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_succeeded_get_command_name()

+
+

Synopsis

+
const char *
+mongoc_apm_command_succeeded_get_command_name (
+   const mongoc_apm_command_succeeded_t *event);
+
+
+

Returns this event’s command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A string that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_context.html new file mode 100644 index 0000000..2d1a7a5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_duration.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_duration.html new file mode 100644 index 0000000..4fc907d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_duration.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_duration() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_host.html new file mode 100644 index 0000000..b201379 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_host.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_succeeded_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_command_succeeded_get_host (
+   const mongoc_apm_command_succeeded_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_operation_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_operation_id.html new file mode 100644 index 0000000..00a032f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_operation_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_operation_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_succeeded_get_operation_id()

+
+

Synopsis

+
int64_t
+mongoc_apm_command_succeeded_get_operation_id (
+   const mongoc_apm_command_succeeded_t *event);
+
+
+

Returns this event’s operation id. This number correlates all the commands in a bulk operation, or all the “find” and “getMore” commands required to stream a large query result.

+
+
+

Parameters

+ +
+
+

Returns

+

The event’s operation id.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_reply.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_reply.html new file mode 100644 index 0000000..2fcbe29 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_reply.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_reply() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_command_succeeded_get_reply()

+
+

Synopsis

+
const bson_t *
+mongoc_apm_command_succeeded_get_reply (
+   const mongoc_apm_command_succeeded_t *event);
+
+
+

Returns this event’s reply. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A bson_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_request_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_request_id.html new file mode 100644 index 0000000..70ad64c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_request_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_request_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_server_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_server_id.html new file mode 100644 index 0000000..235a7aa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_get_server_id.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_command_succeeded_get_server_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_t.html new file mode 100644 index 0000000..5299729 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_command_succeeded_t.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_command_succeeded_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ + +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_context.html new file mode 100644 index 0000000..71f99f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_changed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_host.html new file mode 100644 index 0000000..31b98cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_host.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_server_changed_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_changed_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_changed_get_host (const mongoc_apm_server_changed_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_new_description.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_new_description.html new file mode 100644 index 0000000..aeed1c3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_new_description.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_changed_get_new_description() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_changed_get_new_description()

+
+

Synopsis

+
const mongoc_server_description_t *
+mongoc_apm_server_changed_get_new_description (
+   const mongoc_apm_server_changed_t *event);
+
+
+

Returns this event’s new description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_server_description_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_previous_description.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_previous_description.html new file mode 100644 index 0000000..065d216 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_previous_description.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_changed_get_previous_description() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_changed_get_previous_description()

+
+

Synopsis

+
const mongoc_server_description_t *
+mongoc_apm_server_changed_get_previous_description (
+   const mongoc_apm_server_changed_t *event);
+
+
+

Returns this event’s previous description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_server_description_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_topology_id.html new file mode 100644 index 0000000..5ce69d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_get_topology_id.html @@ -0,0 +1,134 @@ + + + + + + + + mongoc_apm_server_changed_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_t.html new file mode 100644 index 0000000..96562c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_changed_t.html @@ -0,0 +1,129 @@ + + + + + + + + mongoc_apm_server_changed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_context.html new file mode 100644 index 0000000..8f89adb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_context.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_server_closed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_host.html new file mode 100644 index 0000000..46cb62a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_host.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_server_closed_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_closed_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_closed_get_host (const mongoc_apm_server_closed_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_topology_id.html new file mode 100644 index 0000000..bd8a198 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_get_topology_id.html @@ -0,0 +1,134 @@ + + + + + + + + mongoc_apm_server_closed_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_t.html new file mode 100644 index 0000000..cce794f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_closed_t.html @@ -0,0 +1,127 @@ + + + + + + + + mongoc_apm_server_closed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_context.html new file mode 100644 index 0000000..c6d772c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_failed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_duration.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_duration.html new file mode 100644 index 0000000..883bd9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_duration.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_failed_get_duration() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_error.html new file mode 100644 index 0000000..8d3ef81 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_error.html @@ -0,0 +1,130 @@ + + + + + + + + mongoc_apm_server_heartbeat_failed_get_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_host.html new file mode 100644 index 0000000..4397f88 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_get_host.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_failed_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_heartbeat_failed_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_heartbeat_failed_get_host (
+   const mongoc_apm_server_heartbeat_failed_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_t.html new file mode 100644 index 0000000..43c427d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_failed_t.html @@ -0,0 +1,128 @@ + + + + + + + + mongoc_apm_server_heartbeat_failed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_context.html new file mode 100644 index 0000000..62b2f3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_started_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_host.html new file mode 100644 index 0000000..6a452ca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_get_host.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_started_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_heartbeat_started_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_heartbeat_started_get_host (
+   const mongoc_apm_server_heartbeat_started_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_t.html new file mode 100644 index 0000000..b1a3395 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_started_t.html @@ -0,0 +1,126 @@ + + + + + + + + mongoc_apm_server_heartbeat_started_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_context.html new file mode 100644 index 0000000..72c828e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_succeeded_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_duration.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_duration.html new file mode 100644 index 0000000..89c8e11 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_duration.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_succeeded_get_duration() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_host.html new file mode 100644 index 0000000..ff860e9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_host.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_succeeded_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_heartbeat_succeeded_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_heartbeat_succeeded_get_host (
+   const mongoc_apm_server_heartbeat_succeeded_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_reply.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_reply.html new file mode 100644 index 0000000..a47a8e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_get_reply.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_heartbeat_succeeded_get_reply() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_heartbeat_succeeded_get_reply()

+
+

Synopsis

+
const bson_t *
+mongoc_apm_server_heartbeat_succeeded_get_reply (
+   const mongoc_apm_server_heartbeat_succeeded_t *event);
+
+
+

Returns this event’s reply. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A bson_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_t.html new file mode 100644 index 0000000..4238079 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_heartbeat_succeeded_t.html @@ -0,0 +1,128 @@ + + + + + + + + mongoc_apm_server_heartbeat_succeeded_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_context.html new file mode 100644 index 0000000..1697767 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_server_opening_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_host.html new file mode 100644 index 0000000..9941827 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_host.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_server_opening_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_server_opening_get_host()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_apm_server_opening_get_host (const mongoc_apm_server_opening_t *event);
+
+
+

Returns this event’s host. This mongoc_host_list_t is not part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_host_list_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_topology_id.html new file mode 100644 index 0000000..6f393e8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_get_topology_id.html @@ -0,0 +1,134 @@ + + + + + + + + mongoc_apm_server_opening_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_t.html new file mode 100644 index 0000000..4af76c1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_server_opening_t.html @@ -0,0 +1,127 @@ + + + + + + + + mongoc_apm_server_opening_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_failed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_failed_cb.html new file mode 100644 index 0000000..37ea51d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_failed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_command_failed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_command_failed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_command_failed_cb_t) (
+   const mongoc_apm_command_failed_t *event);
+
+void
+mongoc_apm_set_command_failed_cb (mongoc_apm_callbacks_t *callbacks,
+                                  mongoc_apm_command_failed_cb_t cb);
+
+
+

Receive an event notification whenever the driver fails to execute a MongoDB operation.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_started_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_started_cb.html new file mode 100644 index 0000000..d4d4aad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_started_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_command_started_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_command_started_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_command_started_cb_t) (
+   const mongoc_apm_command_started_t *event);
+
+void
+mongoc_apm_set_command_started_cb (mongoc_apm_callbacks_t *callbacks,
+                                   mongoc_apm_command_started_cb_t cb);
+
+
+

Receive an event notification whenever the driver starts a MongoDB operation.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_succeeded_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_succeeded_cb.html new file mode 100644 index 0000000..d54676b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_command_succeeded_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_command_succeeded_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_command_succeeded_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_command_succeeded_cb_t) (
+   const mongoc_apm_command_succeeded_t *event);
+
+void
+mongoc_apm_set_command_succeeded_cb (mongoc_apm_callbacks_t *callbacks,
+                                     mongoc_apm_command_succeeded_cb_t cb);
+
+
+

Receive an event notification whenever the driver completes a MongoDB operation.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_changed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_changed_cb.html new file mode 100644 index 0000000..4a4e653 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_changed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_changed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_changed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_changed_cb_t) (
+   const mongoc_apm_server_changed_t *event);
+
+void
+mongoc_apm_set_server_changed_cb (mongoc_apm_callbacks_t *callbacks,
+                                  mongoc_apm_server_changed_cb_t cb);
+
+
+

Receive an event notification whenever the driver observes a change in status of a server it is connected to.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_closed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_closed_cb.html new file mode 100644 index 0000000..9a80053 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_closed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_closed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_closed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_closed_cb_t) (
+   const mongoc_apm_server_closed_t *event);
+
+void
+mongoc_apm_set_server_closed_cb (mongoc_apm_callbacks_t *callbacks,
+                                 mongoc_apm_server_closed_cb_t cb);
+
+
+

Receive an event notification whenever the driver stops monitoring a server and removes its mongoc_server_description_t.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_failed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_failed_cb.html new file mode 100644 index 0000000..0447435 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_failed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_heartbeat_failed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_heartbeat_failed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_heartbeat_failed_cb_t) (
+   const mongoc_apm_server_heartbeat_failed_t *event);
+
+void
+mongoc_apm_set_server_heartbeat_failed_cb (mongoc_apm_callbacks_t *callbacks,
+                                           mongoc_apm_server_heartbeat_failed_cb_t cb);
+
+
+

Receive an event notification whenever the driver fails to send an “isMaster” command to check the status of a server.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_started_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_started_cb.html new file mode 100644 index 0000000..c19fe5f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_started_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_heartbeat_started_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_heartbeat_started_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_heartbeat_started_cb_t) (
+   const mongoc_apm_server_heartbeat_started_t *event);
+
+void
+mongoc_apm_set_server_heartbeat_started_cb (mongoc_apm_callbacks_t *callbacks,
+                                            mongoc_apm_server_heartbeat_started_cb_t cb);
+
+
+

Receive an event notification whenever the driver begins executing an “isMaster” command to check the status of a server.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_succeeded_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_succeeded_cb.html new file mode 100644 index 0000000..cad67c1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_heartbeat_succeeded_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_heartbeat_succeeded_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_heartbeat_succeeded_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_heartbeat_succeeded_cb_t) (
+   const mongoc_apm_server_heartbeat_succeeded_t *event);
+
+void
+mongoc_apm_set_server_heartbeat_succeeded_cb (mongoc_apm_callbacks_t *callbacks,
+                                              mongoc_apm_server_heartbeat_succeeded_cb_t cb);
+
+
+

Receive an event notification whenever the driver completes an “isMaster” command to check the status of a server.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_opening_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_opening_cb.html new file mode 100644 index 0000000..a81d315 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_server_opening_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_server_opening_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_server_opening_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_server_opening_cb_t) (
+   const mongoc_apm_server_opening_t *event);
+
+void
+mongoc_apm_set_server_opening_cb (mongoc_apm_callbacks_t *callbacks,
+                                  mongoc_apm_server_opening_cb_t cb);
+
+
+

Receive an event notification whenever the driver adds a mongoc_server_description_t for a new server it was not monitoring before.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_changed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_changed_cb.html new file mode 100644 index 0000000..e5f372d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_changed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_topology_changed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_topology_changed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_topology_changed_cb_t) (
+   const mongoc_apm_topology_changed_t *event);
+
+void
+mongoc_apm_set_topology_changed_cb (mongoc_apm_callbacks_t *callbacks,
+                                    mongoc_apm_topology_changed_cb_t cb);
+
+
+

Receive an event notification whenever the driver observes a change in any of the servers it is connected to or a change in the overall server topology.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_closed_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_closed_cb.html new file mode 100644 index 0000000..2ba6aa4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_closed_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_topology_closed_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_topology_closed_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_topology_closed_cb_t) (
+   const mongoc_apm_topology_closed_t *event);
+
+void
+mongoc_apm_set_topology_closed_cb (mongoc_apm_callbacks_t *callbacks,
+                                   mongoc_apm_topology_closed_cb_t cb);
+
+
+

Receive an event notification whenever the driver stops monitoring a server topology and destroys its mongoc_topology_description_t.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_opening_cb.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_opening_cb.html new file mode 100644 index 0000000..3daa9ab --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_set_topology_opening_cb.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_set_topology_opening_cb() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_set_topology_opening_cb()

+
+

Synopsis

+
typedef void (*mongoc_apm_topology_opening_cb_t) (
+   const mongoc_apm_topology_opening_t *event);
+
+void
+mongoc_apm_set_topology_opening_cb (mongoc_apm_callbacks_t *callbacks,
+                                    mongoc_apm_topology_opening_cb_t cb);
+
+
+

Receive an event notification whenever the driver initializes a mongoc_topology_description_t.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_context.html new file mode 100644 index 0000000..4490adb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_topology_changed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_new_description.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_new_description.html new file mode 100644 index 0000000..63ded90 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_new_description.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_topology_changed_get_new_description() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_topology_changed_get_new_description()

+
+

Synopsis

+
const mongoc_topology_description_t *
+mongoc_apm_topology_changed_get_new_description (
+   const mongoc_apm_topology_changed_t *event);
+
+
+

Returns this event’s new description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_topology_description_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_previous_description.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_previous_description.html new file mode 100644 index 0000000..542e940 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_previous_description.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_topology_changed_get_previous_description() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_apm_topology_changed_get_previous_description()

+
+

Synopsis

+
const mongoc_topology_description_t *
+mongoc_apm_topology_changed_get_previous_description (
+   const mongoc_apm_topology_changed_t *event);
+
+
+

Returns this event’s previous description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_topology_description_t that should not be modified or freed.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_topology_id.html new file mode 100644 index 0000000..71df6b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_get_topology_id.html @@ -0,0 +1,134 @@ + + + + + + + + mongoc_apm_topology_changed_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_t.html new file mode 100644 index 0000000..6e9aca9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_changed_t.html @@ -0,0 +1,128 @@ + + + + + + + + mongoc_apm_topology_changed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_context.html new file mode 100644 index 0000000..2cb5b6b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_topology_closed_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_topology_id.html new file mode 100644 index 0000000..6dde275 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_get_topology_id.html @@ -0,0 +1,134 @@ + + + + + + + + mongoc_apm_topology_closed_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_t.html new file mode 100644 index 0000000..3930d7b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_closed_t.html @@ -0,0 +1,126 @@ + + + + + + + + mongoc_apm_topology_closed_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_context.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_context.html new file mode 100644 index 0000000..e9e4367 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_context.html @@ -0,0 +1,133 @@ + + + + + + + + mongoc_apm_topology_opening_get_context() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_topology_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_topology_id.html new file mode 100644 index 0000000..1574f58 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_get_topology_id.html @@ -0,0 +1,132 @@ + + + + + + + + mongoc_apm_topology_opening_get_topology_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_t.html new file mode 100644 index 0000000..d85ffb6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_apm_topology_opening_t.html @@ -0,0 +1,126 @@ + + + + + + + + mongoc_apm_topology_opening_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + +
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete.html new file mode 100644 index 0000000..cbcaa0f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_bulk_operation_delete() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_delete()

+
+

Synopsis

+
void
+mongoc_bulk_operation_delete (mongoc_bulk_operation_t *bulk,
+                              const bson_t *selector);
+
+
+

Deletes documents as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+
+
+

Deprecated

+
+

Warning

+

This function is deprecated and should not be used in new code.

+
+

Please use mongoc_bulk_operation_remove() instead.

+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete_one.html new file mode 100644 index 0000000..68189c1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_delete_one.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_bulk_operation_delete_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_delete_one()

+
+

Synopsis

+
void
+mongoc_bulk_operation_delete_one (mongoc_bulk_operation_t *bulk,
+                                  const bson_t *selector);
+
+
+

Delete a single document as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+
+
+

Deprecated

+
+

Warning

+

This function is deprecated and should not be used in new code.

+
+

Please use mongoc_bulk_operation_remove_one() instead.

+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_destroy.html new file mode 100644 index 0000000..a343bc9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_bulk_operation_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_destroy()

+
+

Synopsis

+
void
+mongoc_bulk_operation_destroy (mongoc_bulk_operation_t *bulk);
+
+
+

Destroys a mongoc_bulk_operation_t and frees the structure. Does nothing if bulk is NULL.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_execute.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_execute.html new file mode 100644 index 0000000..604242e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_execute.html @@ -0,0 +1,182 @@ + + + + + + + + mongoc_bulk_operation_execute() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_execute()

+
+

Synopsis

+
uint32_t
+mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk,
+                               bson_t *reply,
+                               bson_error_t *error);
+
+
+

This function executes all operations queued into the bulk operation. Unless ordered: false was specified in the opts passed to mongoc_collection_create_bulk_operation_with_opts(), then forward progress will be stopped upon the first error.

+

It is only valid to call mongoc_bulk_operation_execute() once. The mongoc_bulk_operation_t must be destroyed afterwards.

+
+

Warning

+

reply is always initialized, even upon failure. Callers must call bson_destroy() to release this potential allocation.

+
+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

On success, returns the server id used. On failure, returns 0 and sets error.

+

A write concern timeout or write concern error is considered a failure.

+

The reply document counts operations and collects error information. See Bulk Write Operations for examples.

+

See also mongoc_bulk_operation_get_hint(), which gets the id of the server used even if the operation failed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_hint.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_hint.html new file mode 100644 index 0000000..5805abe --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_hint.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_bulk_operation_get_hint() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_get_hint()

+
+

Synopsis

+
uint32_t
+mongoc_bulk_operation_get_hint (const mongoc_bulk_operation_t *bulk);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieves the opaque id of the server used for the operation.

+

(The function name includes the old term “hint” for the sake of backward compatibility, but we now call this number a “server id”.)

+

This number is zero until the driver actually uses a server in mongoc_bulk_operation_execute(). The server id is the same number as the return value of a successful mongoc_bulk_operation_execute(), so mongoc_bulk_operation_get_hint is useful mainly in case mongoc_bulk_operation_execute() fails and returns zero.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_write_concern.html new file mode 100644 index 0000000..f4f70ba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_get_write_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_bulk_operation_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_get_write_concern()

+
+

Synopsis

+
const mongoc_write_concern_t *
+mongoc_bulk_operation_get_write_concern (const mongoc_bulk_operation_t *bulk);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the write concern to be used for bulk.

+
+
+

Returns

+

A mongoc_write_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert.html new file mode 100644 index 0000000..a99fda6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_bulk_operation_insert() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_insert()

+
+

Synopsis

+
void
+mongoc_bulk_operation_insert (mongoc_bulk_operation_t *bulk,
+                              const bson_t *document);
+
+
+

Queue an insert of a single document into a bulk operation. The insert is not performed until mongoc_bulk_operation_execute() is called.

+

This function is superseded by mongoc_bulk_operation_insert_with_opts().

+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert_with_opts.html new file mode 100644 index 0000000..ec00fa1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_insert_with_opts.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_bulk_operation_insert_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_insert_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_insert_with_opts (mongoc_bulk_operation_t *bulk,
+                                        const bson_t *document,
+                                        const bson_t *opts,
+                                        bson_error_t *error); /* OUT */
+
+
+

Queue an insert of a single document into a bulk operation. The insert is not performed until mongoc_bulk_operation_execute() is called.

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+
    +
  • validate: Construct a bitwise-or of all desired bson_validate_flags_t. Set to false to skip client-side validation of the provided BSON documents.
  • +
+
+
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove.html new file mode 100644 index 0000000..4eb02fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_bulk_operation_remove() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_remove()

+
+

Synopsis

+
void
+mongoc_bulk_operation_remove (mongoc_bulk_operation_t *bulk,
+                              const bson_t *selector);
+
+
+

Remove documents as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+

This function is superseded by mongoc_bulk_operation_remove_one_with_opts() and mongoc_bulk_operation_remove_many_with_opts().

+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_many_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_many_with_opts.html new file mode 100644 index 0000000..dc3f327 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_many_with_opts.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_bulk_operation_remove_many_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_remove_many_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_remove_many_with_opts (mongoc_bulk_operation_t *bulk,
+                                             const bson_t *selector,
+                                             const bson_t *opts,
+                                             bson_error_t *error); /* OUT */
+
+
+

Delete documents as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+ +
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one.html new file mode 100644 index 0000000..f6d36e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_bulk_operation_remove_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_remove_one()

+
+

Synopsis

+
void
+mongoc_bulk_operation_remove_one (mongoc_bulk_operation_t *bulk,
+                                  const bson_t *selector);
+
+
+

Remove a single document as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+

This function is superseded by mongoc_bulk_operation_remove_one_with_opts().

+
+
+

Parameters

+ +
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one_with_opts.html new file mode 100644 index 0000000..e5a474d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_remove_one_with_opts.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_bulk_operation_remove_one_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_remove_one_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_remove_one_with_opts (mongoc_bulk_operation_t *bulk,
+                                            const bson_t *selector,
+                                            const bson_t *opts,
+                                            bson_error_t *error); /* OUT */
+
+
+

Remove a single document as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+ +
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one.html new file mode 100644 index 0000000..5a6f2ca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_bulk_operation_replace_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_replace_one()

+
+

Synopsis

+
void
+mongoc_bulk_operation_replace_one (mongoc_bulk_operation_t *bulk,
+                                   const bson_t *selector,
+                                   const bson_t *document,
+                                   bool upsert);
+
+
+

Replace a single document as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+

This function is superseded by mongoc_bulk_operation_replace_one_with_opts().

+
+
+

Parameters

+
    +
  • bulk: A mongoc_bulk_operation_t.
  • +
  • selector: A bson_t that selects which document to remove.
  • +
  • document: A bson_t containing the replacement document.
  • +
  • upsert: true if this should be an upsert.
  • +
+
+

Warning

+

document may not contain fields with keys containing . or $.

+
+
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one_with_opts.html new file mode 100644 index 0000000..78d6aee --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_replace_one_with_opts.html @@ -0,0 +1,188 @@ + + + + + + + + mongoc_bulk_operation_replace_one_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_replace_one_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_replace_one_with_opts (mongoc_bulk_operation_t *bulk,
+                                             const bson_t *selector,
+                                             const bson_t *document,
+                                             const bson_t *opts,
+                                             bson_error_t *error); /* OUT */
+
+
+

Replace a single document as part of a bulk operation. This only queues the operation. To execute it, call mongoc_bulk_operation_execute().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+

Warning

+

document may not contain fields with keys containing . or $.

+
+
+ +
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_bypass_document_validation.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_bypass_document_validation.html new file mode 100644 index 0000000..546caef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_bypass_document_validation.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_bulk_operation_set_bypass_document_validation() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_set_bypass_document_validation()

+
+

Synopsis

+
void
+mongoc_bulk_operation_set_bypass_document_validation (
+   mongoc_bulk_operation_t *bulk, bool bypass);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Will bypass document validation for all operations part of this bulk.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_hint.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_hint.html new file mode 100644 index 0000000..75b11e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_set_hint.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_bulk_operation_set_hint() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_set_hint()

+
+

Synopsis

+
void
+mongoc_bulk_operation_set_hint (const mongoc_bulk_operation_t *bulk,
+                                uint32_t server_id);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Specifies which server to use for the operation. This function has an effect only if called before mongoc_bulk_operation_execute().

+

(The function name includes the old term “hint” for the sake of backward compatibility, but we now call this number a “server id”.)

+

Use mongoc_bulk_operation_set_hint only for building a language driver that wraps the C Driver. When writing applications in C, leave the server id unset and allow the driver to choose a suitable server for the bulk operation.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_t.html new file mode 100644 index 0000000..30b55b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_t.html @@ -0,0 +1,186 @@ + + + + + + + + mongoc_bulk_operation_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update.html new file mode 100644 index 0000000..e67809b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_bulk_operation_update() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_update()

+
+

Synopsis

+
void
+mongoc_bulk_operation_update (mongoc_bulk_operation_t *bulk,
+                              const bson_t *selector,
+                              const bson_t *document,
+                              bool upsert);
+
+
+

This function queues an update as part of a bulk operation. This does not execute the operation. To execute the entirety of the bulk operation call mongoc_bulk_operation_execute().

+

document MUST only contain fields whose key starts with $. See the update document specification for more details.

+

This function is superseded by mongoc_bulk_operation_update_one_with_opts() and mongoc_bulk_operation_update_many_with_opts().

+
+
+

Parameters

+
    +
  • bulk: A mongoc_bulk_operation_t.
  • +
  • selector: A bson_t that selects which documents to remove.
  • +
  • document: A bson_t containing the update document.
  • +
  • upsert: true if an upsert should be performed.
  • +
+
+ +
+

Errors

+

Errors are propagated via mongoc_bulk_operation_execute().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_many_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_many_with_opts.html new file mode 100644 index 0000000..0fa3282 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_many_with_opts.html @@ -0,0 +1,188 @@ + + + + + + + + mongoc_bulk_operation_update_many_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_update_many_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_update_many_with_opts (mongoc_bulk_operation_t *bulk,
+                                             const bson_t *selector,
+                                             const bson_t *document,
+                                             const bson_t *opts,
+                                             bson_error_t *error); /* OUT */
+
+
+

This function queues an update as part of a bulk operation. This does not execute the operation. To execute the entirety of the bulk operation call mongoc_bulk_operation_execute().

+
+

Warning

+

document MUST only contain fields whose key starts with $. See the update document specification for more details.

+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+
    +
  • validate: Construct a bitwise-or of all desired bson_validate_flags_t. Set to false to skip client-side validation of the provided BSON documents.
  • +
  • collation: Configure textual comparisons. See Setting Collation Order, and the MongoDB Manual entry on Collation. Collation requires MongoDB 3.2 or later, otherwise an error is returned.
  • +
  • upsert: If true, insert a document if none match selector.
  • +
  • arrayFilters: An array of filters specifying to which array elements an update should apply.
  • +
+
+ +
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if there is a server or network error or if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one.html new file mode 100644 index 0000000..3a9a620 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_bulk_operation_update_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_update_one()

+
+

Synopsis

+
void
+mongoc_bulk_operation_update_one (mongoc_bulk_operation_t *bulk,
+                                  const bson_t *selector,
+                                  const bson_t *document,
+                                  bool upsert);
+
+
+

This function queues an update as part of a bulk operation. It will only modify a single document on the MongoDB server. This function does not execute the operation. To execute the entirety of the bulk operation call mongoc_bulk_operation_execute().

+

This function is superseded by mongoc_bulk_operation_update_one_with_opts().

+
+
+

Parameters

+
    +
  • bulk: A mongoc_bulk_operation_t.
  • +
  • selector: A bson_t that selects which document to remove.
  • +
  • document: A bson_t containing the update document.
  • +
  • upsert: true if an upsert should be performed.
  • +
+
+

Warning

+

document must only contain fields whose key starts with $. See the update document specification for more details.

+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one_with_opts.html new file mode 100644 index 0000000..603228c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_bulk_operation_update_one_with_opts.html @@ -0,0 +1,188 @@ + + + + + + + + mongoc_bulk_operation_update_one_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_bulk_operation_update_one_with_opts()

+
+

Synopsis

+
bool
+mongoc_bulk_operation_update_one_with_opts (mongoc_bulk_operation_t *bulk,
+                                            const bson_t *selector,
+                                            const bson_t *document,
+                                            const bson_t *opts,
+                                            bson_error_t *error); /* OUT */
+
+
+

This function queues an update as part of a bulk operation. It will only modify a single document on the MongoDB server. This function does not execute the operation. To execute the entirety of the bulk operation call mongoc_bulk_operation_execute().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+
    +
  • validate: Construct a bitwise-or of all desired bson_validate_flags_t. Set to false to skip client-side validation of the provided BSON documents.
  • +
  • collation: Configure textual comparisons. See Setting Collation Order, and the MongoDB Manual entry on Collation. Collation requires MongoDB 3.2 or later, otherwise an error is returned.
  • +
  • upsert: If true, insert a document if none match selector.
  • +
  • arrayFilters: An array of filters specifying to which array elements an update should apply.
  • +
+
+

Warning

+

document must only contain fields whose key starts with $. See the update document specification for more details.

+
+
+ +
+

Errors

+

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument.

+
+
+

Returns

+

Returns true on success, and false if there is a server or network error or if passed invalid arguments.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_destroy.html new file mode 100644 index 0000000..fbb2891 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_change_stream_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_change_stream_destroy()

+
+

Synopsis

+
void
+mongoc_change_stream_destroy (mongoc_change_stream_t *stream);
+
+
+

Destroys a change stream and associated data.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_error_document.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_error_document.html new file mode 100644 index 0000000..5403e9d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_error_document.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_change_stream_error_document() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_change_stream_error_document()

+
+

Synopsis

+
bool
+mongoc_change_stream_error_document (mongoc_change_stream_t *stream,
+                                     bson_error_t *err,
+                                     const bson_t **reply);
+
+
+

Checks if an error has occurred when creating or iterating over a change stream.

+

Similar to mongoc_cursor_error_document() if the error has occurred +client-side then the reply will be set to an empty BSON document. If the +error occurred server-side, reply is set to the server’s reply document.

+
+
+

Parameters

+ +
+
+

Returns

+

A boolean indicating if there was an error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_next.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_next.html new file mode 100644 index 0000000..0884822 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_next.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_change_stream_next() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_change_stream_next()

+
+

Synopsis

+
bool
+mongoc_change_stream_next (mongoc_change_stream_t *stream,
+                           const bson_t **bson);
+
+
+

This function iterates the underlying cursor, setting bson to the next +document. This will block for a maximum of maxAwaitTimeMS milliseconds as +specified in the options when created, or the default timeout if omitted. Data +may be returned before the timeout. If no data is returned this function returns +false.

+
+
+

Parameters

+ +
+
+

Returns

+

A boolean indicating whether or not there was another document in the stream.

+

Similar to mongoc_cursor_next() the lifetime of bson is until the +next call to mongoc_change_stream_next(), so it needs to be copied to +extend the lifetime.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_t.html new file mode 100644 index 0000000..63a3f69 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_change_stream_t.html @@ -0,0 +1,538 @@ + + + + + + + + mongoc_change_stream_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_change_stream_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_change_stream_t mongoc_change_stream_t;
+
+
+

mongoc_change_stream_t is a handle to a change stream. A collection +change stream can be obtained using mongoc_collection_watch().

+

It is recommended to use a mongoc_change_stream_t and its functions instead of a raw aggregation with a $changeStream stage. For more information see the MongoDB Manual Entry on Change Streams.

+
+
+

Example

+
+
example-collection-watch.c
+
#include <mongoc/mongoc.h>
+
+int
+main ()
+{
+   bson_t empty = BSON_INITIALIZER;
+   const bson_t *doc;
+   bson_t *to_insert = BCON_NEW ("x", BCON_INT32 (1));
+   const bson_t *err_doc;
+   bson_error_t error;
+   const char *uri_string;
+   mongoc_uri_t *uri;
+   mongoc_client_t *client;
+   mongoc_collection_t *coll;
+   mongoc_change_stream_t *stream;
+   mongoc_write_concern_t *wc = mongoc_write_concern_new ();
+   bson_t opts = BSON_INITIALIZER;
+   bool r;
+
+   mongoc_init ();
+
+   uri_string = "mongodb://"
+                "localhost:27017,localhost:27018,localhost:"
+                "27019/db?replicaSet=rs0";
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   coll = mongoc_client_get_collection (client, "db", "coll");
+   stream = mongoc_collection_watch (coll, &empty, NULL);
+
+   mongoc_write_concern_set_wmajority (wc, 10000);
+   mongoc_write_concern_append (wc, &opts);
+   r = mongoc_collection_insert_one (coll, to_insert, &opts, NULL, &error);
+   if (!r) {
+      fprintf (stderr, "Error: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   while (mongoc_change_stream_next (stream, &doc)) {
+      char *as_json = bson_as_relaxed_extended_json (doc, NULL);
+      fprintf (stderr, "Got document: %s\n", as_json);
+      bson_free (as_json);
+   }
+
+   if (mongoc_change_stream_error_document (stream, &error, &err_doc)) {
+      if (!bson_empty (err_doc)) {
+         fprintf (stderr,
+                  "Server Error: %s\n",
+                  bson_as_relaxed_extended_json (err_doc, NULL));
+      } else {
+         fprintf (stderr, "Client Error: %s\n", error.message);
+      }
+      return EXIT_FAILURE;
+   }
+
+   bson_destroy (to_insert);
+   mongoc_write_concern_destroy (wc);
+   bson_destroy (&opts);
+   mongoc_change_stream_destroy (stream);
+   mongoc_collection_destroy (coll);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+

Starting and Resuming

+

All watch functions accept two options to indicate where a change stream should start returning changes from: startAtOperationTime and resumeAfter.

+

All changes returned by mongoc_change_stream_next() include a resume token in the _id field. This resume token is automatically cached in libmongoc. +In the event of an error, libmongoc attempts to recreate the change stream starting where it left off by passing the resume token. +libmongoc only attempts to resume once, but client applications can cache this resume token and use it for their own resume logic by passing it as the option resumeAfter.

+

Additionally, change streams can start returning changes at an operation time by using the startAtOperationTime field. This can be the timestamp returned in the operationTime field of a command reply.

+

startAtOperationTime and resumeAfter are mutually exclusive options. Setting them both will result in a server error.

+

The following example implements custom resuming logic, persisting the resume token in a file.

+
+
example-resume.c
+
#include <mongoc/mongoc.h>
+
+/* An example implementation of custom resume logic in a change stream.
+* example-resume starts a client-wide change stream and persists the resume
+* token in a file "resume-token.json". On restart, if "resume-token.json"
+* exists, the change stream starts watching after the persisted resume token.
+*
+* This behavior allows a user to exit example-resume, and restart it later
+* without missing any change events.
+*/
+#include <unistd.h>
+
+static const char *RESUME_TOKEN_PATH = "resume-token.json";
+
+static bool
+_save_resume_token (const bson_t *doc)
+{
+   FILE *file_stream;
+   bson_iter_t iter;
+   bson_t resume_token_doc;
+   char *as_json = NULL;
+   size_t as_json_len;
+   ssize_t r, n_written;
+   const bson_value_t *resume_token;
+
+   if (!bson_iter_init_find (&iter, doc, "_id")) {
+      fprintf (stderr, "reply does not contain operationTime.");
+      return false;
+   }
+   resume_token = bson_iter_value (&iter);
+   /* store the resume token in a document, { resumeAfter: <resume token> }
+    * which we can later append easily. */
+   file_stream = fopen (RESUME_TOKEN_PATH, "w+");
+   if (!file_stream) {
+      fprintf (stderr, "failed to open %s for writing\n", RESUME_TOKEN_PATH);
+      return false;
+   }
+   bson_init (&resume_token_doc);
+   BSON_APPEND_VALUE (&resume_token_doc, "resumeAfter", resume_token);
+   as_json = bson_as_canonical_extended_json (&resume_token_doc, &as_json_len);
+   bson_destroy (&resume_token_doc);
+   n_written = 0;
+   while (n_written < as_json_len) {
+      r = fwrite ((void *) (as_json + n_written),
+                  sizeof (char),
+                  as_json_len - n_written,
+                  file_stream);
+      if (r == -1) {
+         fprintf (stderr, "failed to write to %s\n", RESUME_TOKEN_PATH);
+         bson_free (as_json);
+         fclose (file_stream);
+         return false;
+      }
+      n_written += r;
+   }
+
+   bson_free (as_json);
+   fclose (file_stream);
+   return true;
+}
+
+bool
+_load_resume_token (bson_t *opts)
+{
+   bson_error_t error;
+   bson_json_reader_t *reader;
+   bson_t doc;
+
+   /* if the file does not exist, skip. */
+   if (-1 == access (RESUME_TOKEN_PATH, R_OK)) {
+      return true;
+   }
+   reader = bson_json_reader_new_from_file (RESUME_TOKEN_PATH, &error);
+   if (!reader) {
+      fprintf (stderr,
+               "failed to open %s for reading: %s\n",
+               RESUME_TOKEN_PATH,
+               error.message);
+      return false;
+   }
+
+   bson_init (&doc);
+   if (-1 == bson_json_reader_read (reader, &doc, &error)) {
+      fprintf (stderr, "failed to read doc from %s\n", RESUME_TOKEN_PATH);
+      bson_destroy (&doc);
+      bson_json_reader_destroy (reader);
+      return false;
+   }
+
+   printf ("found cached resume token in %s, resuming change stream.\n",
+           RESUME_TOKEN_PATH);
+
+   bson_concat (opts, &doc);
+   bson_destroy (&doc);
+   bson_json_reader_destroy (reader);
+   return true;
+}
+
+int
+main ()
+{
+   int exit_code = EXIT_FAILURE;
+   const char *uri_string;
+   mongoc_uri_t *uri = NULL;
+   bson_error_t error;
+   mongoc_client_t *client = NULL;
+   bson_t pipeline = BSON_INITIALIZER;
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_change_stream_t *stream = NULL;
+   const bson_t *doc;
+
+   const int max_time = 30; /* max amount of time, in seconds, that
+                               mongoc_change_stream_next can block. */
+
+   mongoc_init ();
+   uri_string = "mongodb://localhost:27017/db?replicaSet=rs0";
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      goto cleanup;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto cleanup;
+   }
+
+   if (!_load_resume_token (&opts)) {
+      goto cleanup;
+   }
+   BSON_APPEND_INT64 (&opts, "maxAwaitTimeMS", max_time * 1000);
+
+   printf ("listening for changes on the client (max %d seconds).\n", max_time);
+   stream = mongoc_client_watch (client, &pipeline, &opts);
+
+   while (mongoc_change_stream_next (stream, &doc)) {
+      char *as_json;
+
+      as_json = bson_as_canonical_extended_json (doc, NULL);
+      printf ("change received: %s\n", as_json);
+      bson_free (as_json);
+      if (!_save_resume_token (doc)) {
+         goto cleanup;
+      }
+   }
+
+   exit_code = EXIT_SUCCESS;
+
+cleanup:
+   mongoc_uri_destroy (uri);
+   bson_destroy (&pipeline);
+   bson_destroy (&opts);
+   mongoc_change_stream_destroy (stream);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+   return exit_code;
+}
+
+
+
+

The following example shows using startAtOperationTime to synchronize a change stream with another operation.

+
+
example-start-at-optime.c
+
/* An example of starting a change stream with startAtOperationTime. */
+#include <mongoc/mongoc.h>
+
+int
+main ()
+{
+   int exit_code = EXIT_FAILURE;
+   const char *uri_string;
+   mongoc_uri_t *uri = NULL;
+   bson_error_t error;
+   mongoc_client_t *client = NULL;
+   mongoc_collection_t *coll = NULL;
+   bson_t pipeline = BSON_INITIALIZER;
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_change_stream_t *stream = NULL;
+   bson_iter_t iter;
+   const bson_t *doc;
+   bson_value_t cached_operation_time = {0};
+   int i;
+   bool r;
+
+   mongoc_init ();
+   uri_string = "mongodb://localhost:27017/db?replicaSet=rs0";
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      goto cleanup;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto cleanup;
+   }
+
+   /* insert five documents. */
+   coll = mongoc_client_get_collection (client, "db", "coll");
+   for (i = 0; i < 5; i++) {
+      bson_t reply;
+      bson_t *insert_cmd = BCON_NEW ("insert",
+                                     "coll",
+                                     "documents",
+                                     "[",
+                                     "{",
+                                     "x",
+                                     BCON_INT64 (i),
+                                     "}",
+                                     "]");
+
+      r = mongoc_collection_write_command_with_opts (
+         coll, insert_cmd, NULL, &reply, &error);
+      bson_destroy (insert_cmd);
+      if (!r) {
+         bson_destroy (&reply);
+         fprintf (stderr, "failed to insert: %s\n", error.message);
+         goto cleanup;
+      }
+      if (i == 0) {
+         /* cache the operation time in the first reply. */
+         if (bson_iter_init_find (&iter, &reply, "operationTime")) {
+            bson_value_copy (bson_iter_value (&iter), &cached_operation_time);
+         } else {
+            fprintf (stderr, "reply does not contain operationTime.");
+            bson_destroy (&reply);
+            goto cleanup;
+         }
+      }
+      bson_destroy (&reply);
+   }
+
+   /* start a change stream at the first returned operationTime. */
+   BSON_APPEND_VALUE (&opts, "startAtOperationTime", &cached_operation_time);
+   stream = mongoc_collection_watch (coll, &pipeline, &opts);
+
+   /* since the change stream started at the operation time of the first
+    * insert, the five inserts are returned. */
+   printf ("listening for changes on db.coll:\n");
+   while (mongoc_change_stream_next (stream, &doc)) {
+      char *as_json;
+
+      as_json = bson_as_canonical_extended_json (doc, NULL);
+      printf ("change received: %s\n", as_json);
+      bson_free (as_json);
+   }
+
+   exit_code = EXIT_SUCCESS;
+
+cleanup:
+   mongoc_uri_destroy (uri);
+   bson_destroy (&pipeline);
+   bson_destroy (&opts);
+   if (cached_operation_time.value_type) {
+      bson_value_destroy (&cached_operation_time);
+   }
+   mongoc_change_stream_destroy (stream);
+   mongoc_collection_destroy (coll);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+   return exit_code;
+}
+
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_check_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_check_version.html new file mode 100644 index 0000000..96daf67 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_check_version.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_check_version() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_check_version()

+
+

Synopsis

+
bool
+mongoc_check_version (int required_major,
+                      int required_minor,
+                      int required_micro);
+
+
+
+
+

Parameters

+
    +
  • required_major: The minimum major version required.
  • +
  • required_minor: The minimum minor version required.
  • +
  • required_micro: The minimum micro version required.
  • +
+
+
+

Returns

+

True if libmongoc’s version is greater than or equal to the required version.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cleanup.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cleanup.html new file mode 100644 index 0000000..f69dc31 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cleanup.html @@ -0,0 +1,156 @@ + + + + + + + + mongoc_cleanup() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cleanup()

+
+

Synopsis

+
void
+mongoc_cleanup (void);
+
+
+
+
+

Description

+

Initialize the MongoDB C Driver by calling mongoc_init() exactly once at the beginning of your program. It is responsible for initializing global state such as process counters, SSL, and threading primitives.

+

Call mongoc_cleanup() exactly once at the end of your program to release all memory and other resources allocated by the driver. You must not call any other MongoDB C Driver functions after mongoc_cleanup(). Note that mongoc_init() does not reinitialize the driver after mongoc_cleanup().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command.html new file mode 100644 index 0000000..837ba77 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command.html @@ -0,0 +1,184 @@ + + + + + + + + mongoc_client_command() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_command()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_client_command (mongoc_client_t *client,
+                       const char *db_name,
+                       mongoc_query_flags_t flags,
+                       uint32_t skip,
+                       uint32_t limit,
+                       uint32_t batch_size,
+                       const bson_t *query,
+                       const bson_t *fields,
+                       const mongoc_read_prefs_t *read_prefs);
+
+
+

This function is superseded by mongoc_client_command_with_opts(), mongoc_client_read_command_with_opts(), mongoc_client_write_command_with_opts(), and mongoc_client_read_write_command_with_opts().

+
+
+

Description

+

This function creates a cursor which will execute the command when mongoc_cursor_next() is called on it. The client’s read preference, read concern, and write concern are not applied to the command, and mongoc_cursor_next() will not check the server response for a write concern error or write concern timeout.

+

If mongoc_cursor_next() returns false, then retrieve error details with mongoc_cursor_error() or mongoc_cursor_error_document().

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • flags: Unused.
  • +
  • skip: Unused.
  • +
  • limit: Unused.
  • +
  • batch_size: Unused.
  • +
  • query: A bson_t containing the command specification.
  • +
  • fields: Unused.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
+
+
+

Returns

+

A mongoc_cursor_t.

+

The cursor should be freed with mongoc_cursor_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple.html new file mode 100644 index 0000000..e3eb450 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_client_command_simple() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_command_simple()

+
+

Synopsis

+
bool
+mongoc_client_command_simple (mongoc_client_t *client,
+                              const char *db_name,
+                              const bson_t *command,
+                              const mongoc_read_prefs_t *read_prefs,
+                              bson_t *reply,
+                              bson_error_t *error);
+
+
+

This is a simplified interface to mongoc_client_command(). It returns the first document from the result cursor into reply. The client’s read preference, read concern, and write concern are not applied to the command.

+
+

Warning

+

reply is always set, and should be released with bson_destroy().

+
+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

This function does not check the server response for a write concern error or write concern timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple_with_server_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple_with_server_id.html new file mode 100644 index 0000000..d0ec20b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_simple_with_server_id.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_client_command_simple_with_server_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_command_simple_with_server_id()

+
+

Synopsis

+
bool
+mongoc_client_command_simple_with_server_id (
+   mongoc_client_t *client,
+   const char *db_name,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs,
+   uint32_t server_id bson_t *reply,
+   bson_error_t *error);
+
+
+

This function executes a command on a specific server, using the database and command specification provided.

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • read_prefs: An optional mongoc_read_prefs_t.
  • +
  • server_id: An opaque id specifying which server to use.
  • +
  • reply: An optional location for a bson_t which will store the server’s reply.
  • +
  • error: An optional location for a bson_error_t or a NULL.
  • +
+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

This function does not check the server response for a write concern error or write concern timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_with_opts.html new file mode 100644 index 0000000..9b5c440 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_command_with_opts.html @@ -0,0 +1,229 @@ + + + + + + + + mongoc_client_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_client_command_with_opts (
+   mongoc_client_t *client,
+   const char *db_name,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, interpreting opts according to the MongoDB server version. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Read preferences, read and write concern, and collation can be overridden by various sources. The highest-priority sources for these options are listed first:

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernWrite ConcernCollation
read_prefsoptsoptsopts
TransactionTransactionTransaction 
client   
+

In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. +See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: An optional mongoc_read_prefs_t.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

The reply is not parsed for a write concern timeout or write concern error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_destroy.html new file mode 100644 index 0000000..f86f9a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_client_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_destroy()

+
+

Synopsis

+
void
+mongoc_client_destroy (mongoc_client_t *client);
+
+
+

Release all resources associated with client and free the structure. Does nothing if client is NULL.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_find_databases_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_find_databases_with_opts.html new file mode 100644 index 0000000..54fdd9b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_find_databases_with_opts.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_client_find_databases_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_find_databases_with_opts()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_client_find_databases_with_opts (mongoc_client_t *client,
+                                        const bson_t *opts);
+
+
+

Fetches a cursor containing documents, each corresponding to a database on this MongoDB server.

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Errors

+

Use mongoc_cursor_error() on the returned cursor to check for errors.

+
+
+

Returns

+

A cursor where each result corresponds to the server’s representation of a database.

+

The cursor functions mongoc_cursor_set_limit(), mongoc_cursor_set_batch_size(), and mongoc_cursor_set_max_await_time_ms() have no use on the returned cursor.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_collection.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_collection.html new file mode 100644 index 0000000..99c2bb4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_collection.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_client_get_collection() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_collection()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_client_get_collection (mongoc_client_t *client,
+                              const char *db,
+                              const char *collection);
+
+
+

Get a newly allocated mongoc_collection_t for the collection named collection in the database named db.

+
+

Tip

+

Collections are automatically created on the MongoDB server upon insertion of the first document. There is no need to create a collection manually.

+
+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db: The name of the database containing the collection.
  • +
  • collection: The name of the collection.
  • +
+
+
+

Returns

+

A newly allocated mongoc_collection_t that should be freed with mongoc_collection_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database.html new file mode 100644 index 0000000..533e90d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_client_get_database() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_database()

+
+

Synopsis

+
mongoc_database_t *
+mongoc_client_get_database (mongoc_client_t *client, const char *name);
+
+
+

Get a newly allocated mongoc_database_t for the database named name.

+
+

Tip

+

Databases are automatically created on the MongoDB server upon insertion of the first document into a collection. There is no need to create a database manually.

+
+
+
+

Parameters

+ +
+
+

Returns

+

A newly allocated mongoc_database_t that should be freed with mongoc_database_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names.html new file mode 100644 index 0000000..d21fea8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_client_get_database_names() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_database_names()

+
+

Synopsis

+
char **
+mongoc_client_get_database_names (mongoc_client_t *client, bson_error_t *error);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_client_get_database_names_with_opts() instead.

+
+
+

Description

+

This function queries the MongoDB server for a list of known databases.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A NULL terminated vector of NULL-byte terminated strings. The result should be freed with bson_strfreev().

+

NULL is returned upon failure and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names_with_opts.html new file mode 100644 index 0000000..60299c4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_database_names_with_opts.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_client_get_database_names_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_database_names_with_opts()

+
+

Synopsis

+
char **
+mongoc_client_get_database_names_with_opts (mongoc_client_t *client,
+                                            const bson_t *opts,
+                                            bson_error_t *error);
+
+
+

This function queries the MongoDB server for a list of known databases.

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A NULL terminated vector of NULL-byte terminated strings. The result should be freed with bson_strfreev().

+

NULL is returned upon failure and error is set.

+
+
+

Examples

+
{
+   bson_error_t error;
+   char **strv;
+   unsigned i;
+
+   if ((strv = mongoc_client_get_database_names_with_opts (client, NULL, &error))) {
+      for (i = 0; strv[i]; i++)
+         printf ("%s\n", strv[i]);
+      bson_strfreev (strv);
+   } else {
+      fprintf (stderr, "Command failed: %s\n", error.message);
+   }
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_default_database.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_default_database.html new file mode 100644 index 0000000..738eb14 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_default_database.html @@ -0,0 +1,187 @@ + + + + + + + + mongoc_client_get_default_database() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_default_database()

+
+

Synopsis

+
mongoc_database_t *
+mongoc_client_get_default_database (mongoc_client_t *client);
+
+
+

Get the database named in the MongoDB connection URI, or NULL if the URI specifies none.

+

Useful when you want to choose which database to use based only on the URI in a configuration file.

+
+
+

Parameters

+ +
+
+

Returns

+

A newly allocated mongoc_database_t that should be freed with mongoc_database_destroy().

+
+
+

Example

+
+
Default Database Example
+
/* default database is "db_name" */
+mongoc_client_t *client = mongoc_client_new ("mongodb://host/db_name");
+mongoc_database_t *db = mongoc_client_get_default_database (client);
+
+assert (!strcmp ("db_name", mongoc_database_get_name (db)));
+
+mongoc_database_destroy (db);
+mongoc_client_destroy (client);
+
+/* no default database */
+client = mongoc_client_new ("mongodb://host/");
+db = mongoc_client_get_default_database (client);
+
+assert (!db);
+
+mongoc_client_destroy (client);
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_gridfs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_gridfs.html new file mode 100644 index 0000000..86e3a9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_gridfs.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_client_get_gridfs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_gridfs()

+
+

Synopsis

+
mongoc_gridfs_t *
+mongoc_client_get_gridfs (mongoc_client_t *client,
+                          const char *db,
+                          const char *prefix,
+                          bson_error_t *error);
+
+
+

The mongoc_client_get_gridfs() function shall create a new mongoc_gridfs_t. The db parameter is the name of the database which the gridfs instance should exist in. The prefix parameter corresponds to the gridfs collection namespacing; its default is “fs”, thus the default GridFS collection names are “fs.files” and “fs.chunks”.

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db: The database name.
  • +
  • prefix: Optional prefix for gridfs collection names or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

On success, returns a mongoc_gridfs_t you must free with mongoc_gridfs_destroy(). Returns NULL upon failure and sets error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_bson_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_bson_size.html new file mode 100644 index 0000000..cb59430 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_bson_size.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_client_get_max_bson_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_max_bson_size()

+
+

Synopsis

+
int32_t
+mongoc_client_get_max_bson_size (mongoc_client_t *client);
+
+
+

The mongoc_client_get_max_bson_size() returns the maximum bson document size allowed by the cluster. Until a connection has been made, this will be the default of 16Mb.

+
+
+

Deprecated

+
+

Warning

+

This function is deprecated and should not be used in new code.

+
+
+
+

Parameters

+ +
+
+

Returns

+

The server provided max bson size, or 16Mb if no connection has been established.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_message_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_message_size.html new file mode 100644 index 0000000..4ccd608 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_max_message_size.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_client_get_max_message_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_max_message_size()

+
+

Synopsis

+
int32_t
+mongoc_client_get_max_message_size (mongoc_client_t *client);
+
+
+

The mongoc_client_get_max_message_size() returns the maximum message size allowed by the cluster. Until a connection has been made, this will be the default of 40Mb.

+
+
+

Deprecated

+
+

Warning

+

This function is deprecated and should not be used in new code.

+
+
+
+

Parameters

+ +
+
+

Returns

+

The server provided max message size, or 40Mb if no connection has been established.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_concern.html new file mode 100644 index 0000000..4f991d6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_get_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_read_concern()

+
+

Synopsis

+
const mongoc_read_concern_t *
+mongoc_client_get_read_concern (const mongoc_client_t *client);
+
+
+

Retrieve the default read concern configured for the client instance. The result should not be modified or freed.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_read_concern_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_prefs.html new file mode 100644 index 0000000..79836c5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_read_prefs.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_get_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_read_prefs()

+
+

Synopsis

+
const mongoc_read_prefs_t *
+mongoc_client_get_read_prefs (const mongoc_client_t *client);
+
+
+

Retrieves the default read preferences configured for the client instance. The result should not be modified or freed.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_read_prefs_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_description.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_description.html new file mode 100644 index 0000000..6fc4c42 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_description.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_client_get_server_description() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_server_description()

+
+

Synopsis

+
mongoc_server_description_t *
+mongoc_client_get_server_description (mongoc_client_t *client,
+                                      uint32_t server_id);
+
+
+

Get information about the server specified by server_id.

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • server_id: An opaque id specifying the server.
  • +
+
+
+

Returns

+

A mongoc_server_description_t that must be freed with mongoc_server_description_destroy(). If the server is no longer in the topology, returns NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_descriptions.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_descriptions.html new file mode 100644 index 0000000..1bd6cba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_descriptions.html @@ -0,0 +1,191 @@ + + + + + + + + mongoc_client_get_server_descriptions() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_server_descriptions()

+
+

Synopsis

+
mongoc_server_description_t **
+mongoc_client_get_server_descriptions (const mongoc_client_t *client,
+                                       size_t *n);
+
+
+

Fetches an array of mongoc_server_description_t structs for all known servers in the topology. Returns no servers until the client connects. Returns a single server if the client is directly connected, or all members of a replica set if the client’s MongoDB URI includes a “replicaSet” option, or all known mongos servers if the MongoDB URI includes a list of them.

+
void
+show_servers (const mongoc_client_t *client)
+{
+   bson_t *b = BCON_NEW ("ping", BCON_INT32 (1));
+   bson_error_t error;
+   bool r;
+   mongoc_server_description_t **sds;
+   size_t i, n;
+
+   /* ensure client has connected */
+   r = mongoc_client_command_simple (client, "db", b, NULL, NULL, &error);
+   if (!r) {
+      MONGOC_ERROR ("could not connect: %s\n", error.message);
+      return;
+   }
+
+   sds = mongoc_client_get_server_descriptions (client, &n);
+
+   for (i = 0; i < n; ++i) {
+      printf ("%s\n", mongoc_server_description_host (sds[i])->host_and_port);
+   }
+
+   mongoc_server_descriptions_destroy_all (sds, n);
+   bson_destroy (&b);
+}
+
+
+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • n: Receives the length of the descriptions array.
  • +
+
+
+

Returns

+

A newly allocated array that must be freed with mongoc_server_descriptions_destroy_all().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_status.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_status.html new file mode 100644 index 0000000..27d37cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_server_status.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_client_get_server_status() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_server_status()

+
+

Synopsis

+
bool
+mongoc_client_get_server_status (mongoc_client_t *client,
+                                 mongoc_read_prefs_t *read_prefs,
+                                 bson_t *reply,
+                                 bson_error_t *error) BSON_GNUC_DEPRECATED;
+
+
+

Queries the server for the current server status. The result is stored in reply.

+

reply is always initialized, even in the case of failure. Always call bson_destroy() to release it.

+
+
+

Deprecated

+

This helper function is deprecated and should not be used in new code. Run the serverStatus command directly with mongoc_client_read_command_with_opts() instead.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_uri.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_uri.html new file mode 100644 index 0000000..c8ad5cd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_uri.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_get_uri() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_uri()

+
+

Synopsis

+
const mongoc_uri_t *
+mongoc_client_get_uri (const mongoc_client_t *client);
+
+
+

Fetches the mongoc_uri_t used to create the client.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_uri_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_write_concern.html new file mode 100644 index 0000000..8ab2a01 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_get_write_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_get_write_concern()

+
+

Synopsis

+
const mongoc_write_concern_t *
+mongoc_client_get_write_concern (const mongoc_client_t *client);
+
+
+

Retrieve the default write concern configured for the client instance. The result should not be modified or freed.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_write_concern_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new.html new file mode 100644 index 0000000..a79193b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_client_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_new()

+
+

Synopsis

+
mongoc_client_t *
+mongoc_client_new (const char *uri_string);
+
+
+

Creates a new mongoc_client_t using the URI string provided.

+
+
+

Parameters

+
    +
  • uri_string: A string containing the MongoDB connection URI.
  • +
+
+
+

Returns

+

A newly allocated mongoc_client_t if the URI parsed successfully, otherwise NULL.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new_from_uri.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new_from_uri.html new file mode 100644 index 0000000..90d346c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_new_from_uri.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_new_from_uri() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_new_from_uri()

+
+

Synopsis

+
mongoc_client_t *
+mongoc_client_new_from_uri (const mongoc_uri_t *uri);
+
+
+

Creates a new mongoc_client_t using the mongoc_uri_t provided.

+
+
+

Parameters

+ +
+
+

Returns

+

A newly allocated mongoc_client_t that should be freed with mongoc_client_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_destroy.html new file mode 100644 index 0000000..b1c0a0c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_client_pool_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_destroy()

+
+

Synopsis

+
void
+mongoc_client_pool_destroy (mongoc_client_pool_t *pool);
+
+
+

Release all resources associated with pool, including freeing the structure.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_max_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_max_size.html new file mode 100644 index 0000000..91183b6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_max_size.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_client_pool_max_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_max_size()

+
+

Synopsis

+
void
+mongoc_client_pool_min_size (mongoc_client_pool_t *pool,
+                             uint32_t max_pool_size);
+
+
+

This function sets the maximum number of pooled connections available from a mongoc_client_pool_t.

+
+
+

Parameters

+
    +
  • pool: A mongoc_client_pool_t.
  • +
  • max_pool_size: The maximum number of connections which shall be available from the pool.
  • +
+
+
+

Thread Safety

+

This function is safe to call from multiple threads.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_min_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_min_size.html new file mode 100644 index 0000000..901d9d9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_min_size.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_client_pool_min_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_min_size()

+
+

Synopsis

+
void
+mongoc_client_pool_min_size (mongoc_client_pool_t *pool,
+                             uint32_t min_pool_size)
+   BSON_GNUC_DEPRECATED;
+
+
+

This function sets the maximum number of idle clients to be kept in the pool. Any idle clients in excess of the maximum are destroyed. This function is deprecated because its behavior does not match what developers expect from a “minimum pool size”, and its actual behavior is likely to hurt performance.

+

Applications should not call this function, they should instead accept the default behavior, which is to keep all idle clients that are pushed into the pool.

+
+
+

Parameters

+ +
+
+

Thread Safety

+

This function is safe to call from multiple threads.

+

Subsequent calls to mongoc_client_pool_push() respect the new minimum size, and close the least recently used mongoc_client_t if the minimum size is exceeded.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_new.html new file mode 100644 index 0000000..bede727 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_new.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_pool_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_new()

+
+

Synopsis

+
mongoc_client_pool_t *
+mongoc_client_pool_new (const mongoc_uri_t *uri);
+
+
+

This function creates a new mongoc_client_pool_t using the mongoc_uri_t provided.

+
+
+

Parameters

+ +
+
+

Returns

+

A newly allocated mongoc_client_pool_t that should be freed with mongoc_client_pool_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_pop.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_pop.html new file mode 100644 index 0000000..0e03ede --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_pop.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_client_pool_pop() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_pop()

+
+

Synopsis

+
mongoc_client_t *
+mongoc_client_pool_pop (mongoc_client_pool_t *pool);
+
+
+

Retrieve a mongoc_client_t from the client pool, or create one. The total number of clients that can be created from this pool is limited by the URI option “maxPoolSize”, default 100. If this number of clients has been created and all are in use, mongoc_client_pool_pop blocks until another thread returns a client with mongoc_client_pool_push().

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_client_t.

+
+
+

Thread Safety

+

This function is safe to call from multiple threads.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_push.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_push.html new file mode 100644 index 0000000..c422057 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_push.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_client_pool_push() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_push()

+
+

Synopsis

+
void
+mongoc_client_pool_push (mongoc_client_pool_t *pool, mongoc_client_t *client);
+
+
+

This function returns a mongoc_client_t back to the client pool.

+
+
+

Parameters

+ +
+
+

Thread Safety

+

This function is safe to call from multiple threads.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_apm_callbacks.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_apm_callbacks.html new file mode 100644 index 0000000..a5ea40e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_apm_callbacks.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_client_pool_set_apm_callbacks() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_set_apm_callbacks()

+
+

Synopsis

+
bool
+mongoc_client_pool_set_apm_callbacks (mongoc_client_pool_t *pool,
+                                      mongoc_apm_callbacks_t *callbacks,
+                                      void *context);
+
+
+

Register a set of callbacks to receive Application Performance Monitoring events.

+

The callbacks are copied by the pool and may be destroyed at any time after.

+
+
+

Parameters

+ +
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+

Thread Safety

+

This function can only be called once on a pool, and must be called before the first call to mongoc_client_pool_pop().

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_appname.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_appname.html new file mode 100644 index 0000000..248450e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_appname.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_client_pool_set_appname() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_set_appname()

+
+

Synopsis

+
bool
+mongoc_client_pool_set_appname (mongoc_client_pool_t *pool, const char *appname)
+
+
+

This function is identical to mongoc_client_set_appname() except for client pools.

+

Also note that mongoc_client_set_appname() cannot be called on a client retrieved from a client pool.

+
+
+

Parameters

+
    +
  • pool: A mongoc_client_pool_t.
  • +
  • appname: The application name, of length at most MONGOC_HANDSHAKE_APPNAME_MAX.
  • +
+
+
+

Returns

+

Returns true if appname was set. If appname is too long, returns false and logs an error.

+
+
+

Thread Safety

+

This function can only be called once on a pool, and must be called before the first call to mongoc_client_pool_pop().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_error_api.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_error_api.html new file mode 100644 index 0000000..6c72cf1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_error_api.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_client_pool_set_error_api() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_set_error_api()

+
+

Synopsis

+
bool
+mongoc_client_pool_set_error_api (mongoc_client_pool_t *client,
+                                  int32_t version);
+
+
+

Configure how the C Driver reports errors. See Setting the Error API Version.

+
+
+

Parameters

+
    +
  • pool: A mongoc_client_pool_t.
  • +
  • version: The version of the error API, either MONGOC_ERROR_API_VERSION_LEGACY or MONGOC_ERROR_API_VERSION_2.
  • +
+
+
+

Returns

+

Returns true if the error API version was set, or logs an error message and returns false if version is invalid.

+
+
+

Thread Safety

+

This function can only be called once on a pool, and must be called before the first call to mongoc_client_pool_pop().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_ssl_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_ssl_opts.html new file mode 100644 index 0000000..17f180e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_set_ssl_opts.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_client_pool_set_ssl_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_set_ssl_opts()

+
+

Synopsis

+
#ifdef MONGOC_ENABLE_SSL
+void
+mongoc_client_pool_set_ssl_opts (mongoc_client_pool_t *pool,
+                                 const mongoc_ssl_opt_t *opts);
+#endif
+
+
+

This function is identical to mongoc_client_set_ssl_opts() except for +client pools. It ensures that all clients retrieved from +mongoc_client_pool_pop() or mongoc_client_pool_try_pop() +are configured with the same SSL settings.

+

The mongoc_ssl_opt_t struct is copied by the pool along with the strings +it points to (pem_file, pem_pwd, ca_file, ca_dir, and +crl_file) so they don’t have to remain valid after the call to +mongoc_client_pool_set_ssl_opts.

+

A call to mongoc_client_pool_set_ssl_opts overrides all SSL options set +through the connection string with which the mongoc_client_pool_t was +constructed.

+
+
+

Parameters

+ +
+
+

Thread Safety

+

This function can only be called once on a pool, and must be called before the first call to mongoc_client_pool_pop().

+
+
+

Availability

+

This feature requires that the MongoDB C driver was compiled with -DENABLE_SSL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_t.html new file mode 100644 index 0000000..4d33c86 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_t.html @@ -0,0 +1,278 @@ + + + + + + + + mongoc_client_pool_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_t

+

A connection pool for multi-threaded programs. See Connection Pooling.

+
+

Synopsis

+
typedef struct _mongoc_client_pool_t mongoc_client_pool_t
+
+
+

mongoc_client_pool_t is the basis for multi-threading in the MongoDB C driver. Since mongoc_client_t structures are not thread-safe, this structure is used to retrieve a new mongoc_client_t for a given thread. This structure is thread-safe.

+
+
+

Example

+
+
example-pool.c
+
/* gcc example-pool.c -o example-pool $(pkg-config --cflags --libs
+ * libmongoc-1.0) */
+
+/* ./example-pool [CONNECTION_STRING] */
+
+#include <mongoc/mongoc.h>
+#include <pthread.h>
+#include <stdio.h>
+
+static pthread_mutex_t mutex;
+static bool in_shutdown = false;
+
+static void *
+worker (void *data)
+{
+   mongoc_client_pool_t *pool = data;
+   mongoc_client_t *client;
+   bson_t ping = BSON_INITIALIZER;
+   bson_error_t error;
+   bool r;
+
+   BSON_APPEND_INT32 (&ping, "ping", 1);
+
+   while (true) {
+      client = mongoc_client_pool_pop (pool);
+      /* Do something with client. If you are writing an HTTP server, you
+       * probably only want to hold onto the client for the portion of the
+       * request performing database queries.
+       */
+      r = mongoc_client_command_simple (
+         client, "admin", &ping, NULL, NULL, &error);
+
+      if (!r) {
+         fprintf (stderr, "%s\n", error.message);
+      }
+
+      mongoc_client_pool_push (pool, client);
+
+      pthread_mutex_lock (&mutex);
+      if (in_shutdown || !r) {
+         pthread_mutex_unlock (&mutex);
+         break;
+      }
+
+      pthread_mutex_unlock (&mutex);
+   }
+
+   bson_destroy (&ping);
+   return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+   const char *uri_string = "mongodb://127.0.0.1/?appname=pool-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   mongoc_client_pool_t *pool;
+   pthread_t threads[10];
+   unsigned i;
+   void *ret;
+
+   pthread_mutex_init (&mutex, NULL);
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   pool = mongoc_client_pool_new (uri);
+   mongoc_client_pool_set_error_api (pool, 2);
+
+   for (i = 0; i < 10; i++) {
+      pthread_create (&threads[i], NULL, worker, pool);
+   }
+
+   sleep (10);
+   pthread_mutex_lock (&mutex);
+   in_shutdown = true;
+   pthread_mutex_unlock (&mutex);
+
+   for (i = 0; i < 10; i++) {
+      pthread_join (threads[i], &ret);
+   }
+
+   mongoc_client_pool_destroy (pool);
+   mongoc_uri_destroy (uri);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_try_pop.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_try_pop.html new file mode 100644 index 0000000..d1a315c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_pool_try_pop.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_client_pool_try_pop() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_pool_try_pop()

+
+

Synopsis

+
mongoc_client_t *
+mongoc_client_pool_try_pop (mongoc_client_pool_t *pool);
+
+
+

This function is identical to mongoc_client_pool_pop() except it will return NULL instead of blocking for a client to become available.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_client_t if one is immediately available, otherwise NULL.

+
+
+

Thread Safety

+

This function is safe to call from multiple threads.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_command_with_opts.html new file mode 100644 index 0000000..8817481 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_command_with_opts.html @@ -0,0 +1,372 @@ + + + + + + + + mongoc_client_read_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_read_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_client_read_command_with_opts (mongoc_client_t *client,
+                                      const char *db_name,
+                                      const bson_t *command,
+                                      const mongoc_read_prefs_t *read_prefs,
+                                      const bson_t *opts,
+                                      bson_t *reply,
+                                      bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that read, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Use this function for commands that read such as “count” or “distinct”.

+

Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. The highest-priority sources for these options are listed first in the following table. No write concern is applied.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernCollation
read_prefsoptsopts
TransactionTransaction 
client  
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: An optional mongoc_read_prefs_t.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+

Example

+
+
example-command-with-opts.c
+
/*
+
+Demonstrates how to prepare options for mongoc_client_read_command_with_opts and
+mongoc_client_write_command_with_opts. First it calls "cloneCollectionAsCapped"
+command with "writeConcern" option, then "distinct" command with "collation" and
+"readConcern" options,
+
+Start a MongoDB 3.4 replica set with --enableMajorityReadConcern and insert two
+documents:
+
+$ mongo
+MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 1, y: "One"})
+WriteResult({ "nInserted" : 1 })
+MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 2, y: "Two"})
+WriteResult({ "nInserted" : 1 })
+
+Build and run the example:
+
+gcc example-command-with-opts.c -o example-command-with-opts $(pkg-config
+--cflags --libs libmongoc-1.0)
+./example-command-with-opts [CONNECTION_STRING]
+cloneCollectionAsCapped: { "ok" : 1 }
+distinct: { "values" : [ 1, 2 ], "ok" : 1 }
+
+*/
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=client-example";
+   mongoc_uri_t *uri;
+   bson_t *cmd;
+   bson_t *opts;
+   mongoc_write_concern_t *write_concern;
+   mongoc_read_prefs_t *read_prefs;
+   mongoc_read_concern_t *read_concern;
+   bson_t reply;
+   bson_error_t error;
+   char *json;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   cmd = BCON_NEW ("cloneCollectionAsCapped",
+                   BCON_UTF8 ("my_collection"),
+                   "toCollection",
+                   BCON_UTF8 ("my_capped_collection"),
+                   "size",
+                   BCON_INT64 (1024 * 1024));
+
+   /* include write concern "majority" in command options */
+   write_concern = mongoc_write_concern_new ();
+   mongoc_write_concern_set_wmajority (write_concern, 10000 /* wtimeoutMS */);
+   opts = bson_new ();
+   mongoc_write_concern_append (write_concern, opts);
+
+   if (mongoc_client_write_command_with_opts (
+          client, "test", cmd, opts, &reply, &error)) {
+      json = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("cloneCollectionAsCapped: %s\n", json);
+      bson_free (json);
+   } else {
+      fprintf (stderr, "cloneCollectionAsCapped: %s\n", error.message);
+   }
+
+   bson_free (cmd);
+   bson_free (opts);
+
+   /* distinct values of "x" in "my_collection" where "y" sorts after "one" */
+   cmd = BCON_NEW ("distinct",
+                   BCON_UTF8 ("my_collection"),
+                   "key",
+                   BCON_UTF8 ("x"),
+                   "query",
+                   "{",
+                   "y",
+                   "{",
+                   "$gt",
+                   BCON_UTF8 ("one"),
+                   "}",
+                   "}");
+
+   read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+
+   /* "One" normally sorts before "one"; make "One" sort after "one" */
+   opts = BCON_NEW ("collation",
+                    "{",
+                    "locale",
+                    BCON_UTF8 ("en_US"),
+                    "caseFirst",
+                    BCON_UTF8 ("lower"),
+                    "}");
+
+   /* add a read concern to "opts" */
+   read_concern = mongoc_read_concern_new ();
+   mongoc_read_concern_set_level (read_concern,
+                                  MONGOC_READ_CONCERN_LEVEL_MAJORITY);
+
+   mongoc_read_concern_append (read_concern, opts);
+
+   if (mongoc_client_read_command_with_opts (
+          client, "test", cmd, read_prefs, opts, &reply, &error)) {
+      json = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("distinct: %s\n", json);
+      bson_free (json);
+   } else {
+      fprintf (stderr, "distinct: %s\n", error.message);
+   }
+
+   bson_destroy (cmd);
+   bson_destroy (opts);
+   bson_destroy (&reply);
+   mongoc_read_prefs_destroy (read_prefs);
+   mongoc_read_concern_destroy (read_concern);
+   mongoc_write_concern_destroy (write_concern);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_write_command_with_opts.html new file mode 100644 index 0000000..855d376 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_read_write_command_with_opts.html @@ -0,0 +1,225 @@ + + + + + + + + mongoc_client_read_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_read_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_client_read_write_command_with_opts (
+   mongoc_client_t *client,
+   const char *db_name,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs /* UNUSED */,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, applying logic for commands that both read and write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Use this function for commands that both read and write, such as “mapReduce” with an output collection.

+

Read and write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. Read preferences are not applied. The write concern is omitted for MongoDB before 3.4.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read ConcernWrite ConcernCollation
optsoptsopts
TransactionTransaction 
clientclient 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+

(The mongoc_read_prefs_t parameter was included by mistake when this function was introduced in libmongoc 1.5. A command that writes must not obey a read preference.)

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: Ignored.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_select_server.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_select_server.html new file mode 100644 index 0000000..64307f2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_select_server.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_client_select_server() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_select_server()

+
+

Synopsis

+
mongoc_server_description_t *
+mongoc_client_select_server (mongoc_client_t *client,
+                             bool for_writes,
+                             const mongoc_read_prefs_t *prefs,
+                             bson_error_t *error);
+
+
+

Choose a server for an operation, according to the logic described in the Server Selection Spec.

+

Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions automatically select a suitable server.

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • for_writes: Whether to choose a server suitable for writes or reads.
  • +
  • prefs: An optional mongoc_read_prefs_t. If for_writes is true, prefs must be NULL. Otherwise, use prefs to customize server selection, or pass NULL to use the read preference configured on the client.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Returns

+

A mongoc_server_description_t that must be freed with mongoc_server_description_destroy(). If no suitable server is found, returns NULL and error is filled out.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_abort_transaction.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_abort_transaction.html new file mode 100644 index 0000000..54ce34d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_abort_transaction.html @@ -0,0 +1,196 @@ + + + + + + + + mongoc_client_session_abort_transaction() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_abort_transaction()

+
+

Synopsis

+
bool
+mongoc_client_session_abort_transaction (mongoc_client_session_t *session,
+                                         bson_error_t *error);
+
+
+

Abort a multi-document transaction.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_cluster_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_cluster_time.html new file mode 100644 index 0000000..df312fc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_cluster_time.html @@ -0,0 +1,193 @@ + + + + + + + + mongoc_client_session_advance_cluster_time() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_advance_cluster_time()

+
+

Synopsis

+
void
+mongoc_client_session_advance_cluster_time (mongoc_client_session_t *session,
+                                            const bson_t *cluster_time);
+
+
+

Advance the cluster time for a session. Has an effect only if the new cluster time is greater than the session’s current cluster time.

+

Use mongoc_client_session_advance_operation_time() and mongoc_client_session_advance_cluster_time() to copy the operationTime and clusterTime from another session, ensuring subsequent operations in this session are causally consistent with the last operation in the other session

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_operation_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_operation_time.html new file mode 100644 index 0000000..27e8a29 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_advance_operation_time.html @@ -0,0 +1,195 @@ + + + + + + + + mongoc_client_session_advance_operation_time() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_advance_operation_time()

+
+

Synopsis

+
void
+mongoc_client_session_advance_operation_time (mongoc_client_session_t *session,
+                                              uint32_t timestamp,
+                                              uint32_t increment);
+
+
+

Advance the session’s operation time, expressed as a BSON Timestamp with timestamp and increment components. Has an effect only if the new operation time is greater than the session’s current operation time.

+

Use mongoc_client_session_advance_operation_time() and mongoc_client_session_advance_cluster_time() to copy the operationTime and clusterTime from another session, ensuring subsequent operations in this session are causally consistent with the last operation in the other session

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_append.html new file mode 100644 index 0000000..762172c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_append.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_client_session_append() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_append()

+
+

Synopsis

+
bool
+mongoc_client_session_append (const mongoc_client_session_t *client_session,
+                              bson_t *opts,
+                              bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function appends a logical session id to command options. Use it to configure a session for any function that takes an options document, such as mongoc_client_write_command_with_opts().

+

It is an error to use a session for unacknowledged writes.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and fills out error.

+
+
+

Example

+

See the example code for mongoc_client_session_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_commit_transaction.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_commit_transaction.html new file mode 100644 index 0000000..2a0a64a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_commit_transaction.html @@ -0,0 +1,199 @@ + + + + + + + + mongoc_client_session_commit_transaction() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_commit_transaction()

+
+

Synopsis

+
bool
+mongoc_client_session_commit_transaction (mongoc_client_session_t *session,
+                                          bson_t *reply,
+                                          bson_error_t *error);
+
+
+

Commit a multi-document transaction.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_destroy.html new file mode 100644 index 0000000..f06ce05 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_destroy.html @@ -0,0 +1,191 @@ + + + + + + + + mongoc_client_session_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_destroy()

+
+

Synopsis

+
void
+mongoc_client_session_destroy (mongoc_client_session_t *session);
+
+
+

End a session, returning its session id to the pool, and free all client resources associated with the session. If a multi-document transaction is in progress, abort it. Does nothing if session is NULL.

+

See the example code for mongoc_client_session_t.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_client.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_client.html new file mode 100644 index 0000000..f7331dd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_client.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_client_session_get_client() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_cluster_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_cluster_time.html new file mode 100644 index 0000000..476cd54 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_cluster_time.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_client_session_get_cluster_time() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_get_cluster_time()

+
+

Synopsis

+
const bson_t *
+mongoc_client_session_get_cluster_time (const mongoc_client_session_t *session);
+
+
+

Get the session’s clusterTime, as a BSON document.

+
+
+

Parameters

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_lsid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_lsid.html new file mode 100644 index 0000000..f01123f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_lsid.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_client_session_get_lsid() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_operation_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_operation_time.html new file mode 100644 index 0000000..37e7fb5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_operation_time.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_client_session_get_operation_time() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_get_operation_time()

+
+

Synopsis

+
void
+mongoc_client_session_get_operation_time (const mongoc_client_session_t *session,
+                                          uint32_t *timestamp,
+                                          uint32_t *increment);
+
+
+

Get the session’s operationTime, expressed as a BSON Timestamp with timestamp and increment components. If the session has not been used for any operations, the timestamp and increment are 0.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_opts.html new file mode 100644 index 0000000..a434966 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_get_opts.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_client_session_get_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_in_transaction.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_in_transaction.html new file mode 100644 index 0000000..5d99335 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_in_transaction.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_session_in_transaction() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_in_transaction()

+
+

Synopsis

+
bool
+mongoc_client_session_in_transaction (const mongoc_client_session_t *session);
+
+
+

Check whether a multi-document transaction is in progress for this session.

+
+
+

Parameters

+ +
+
+

Return

+

Returns true if a transaction was started and has not been committed or aborted, otherwise false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_start_transaction.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_start_transaction.html new file mode 100644 index 0000000..6b7ee91 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_start_transaction.html @@ -0,0 +1,388 @@ + + + + + + + + mongoc_client_session_start_transaction() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_start_transaction()

+
+

Synopsis

+
bool
+mongoc_client_session_start_transaction (mongoc_client_session_t *session,
+                                         const mongoc_transaction_opt_t *opts,
+                                         bson_error_t *error);
+
+
+

Start a multi-document transaction for all following operations in this session. Any options provided in opts override options passed to mongoc_session_opts_set_default_transaction_opts(), and options inherited from the mongoc_client_t. The opts argument is copied and can be freed after calling this function.

+

The transaction must be completed with mongoc_client_session_commit_transaction() or mongoc_client_session_abort_transaction(). An in-progress transaction is automatically aborted by mongoc_client_session_destroy().

+
+
+

Parameters

+ +
+
+

Return

+

Returns true if the transaction was started. Returns false and sets error if there are invalid arguments, such as a session with a transaction already in progress.

+
+
+

Example

+

The following example demonstrates how to use error labels to reliably execute a multi-document transaction despite network errors and other transient failures.

+
+
example-transaction.c
+
/* gcc example-transaction.c -o example-transaction \
+ *     $(pkg-config --cflags --libs libmongoc-1.0) */
+
+/* ./example-transaction [CONNECTION_STRING] */
+
+#include <stdio.h>
+#include <mongoc/mongoc.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   int exit_code = EXIT_FAILURE;
+
+   mongoc_client_t *client = NULL;
+   mongoc_database_t *database = NULL;
+   mongoc_collection_t *collection = NULL;
+   mongoc_client_session_t *session = NULL;
+   mongoc_session_opt_t *session_opts = NULL;
+   mongoc_transaction_opt_t *default_txn_opts = NULL;
+   mongoc_transaction_opt_t *txn_opts = NULL;
+   mongoc_read_concern_t *read_concern = NULL;
+   mongoc_write_concern_t *write_concern = NULL;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=transaction-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   bson_t *doc = NULL;
+   bson_t *insert_opts = NULL;
+   int32_t i;
+   int64_t start;
+   bson_t reply = BSON_INITIALIZER;
+   char *reply_json;
+   bool r;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      MONGOC_ERROR ("failed to parse URI: %s\n"
+                    "error message:       %s\n",
+                    uri_string,
+                    error.message);
+      goto done;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto done;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "example-transaction");
+
+   /* inserting into a nonexistent collection normally creates it, but a
+    * collection can't be created in a transaction; create it now */
+   collection =
+      mongoc_database_create_collection (database, "collection", NULL, &error);
+
+   if (!collection) {
+      /* code 48 is NamespaceExists, see error_codes.err in mongodb source */
+      if (error.code == 48) {
+         collection = mongoc_database_get_collection (database, "collection");
+      } else {
+         MONGOC_ERROR ("Failed to create collection: %s", error.message);
+         goto done;
+      }
+   }
+
+   /* a transaction's read preferences, read concern, and write concern can be
+    * set on the client, on the default transaction options, or when starting
+    * the transaction. for the sake of this example, set read concern on the
+    * default transaction options. */
+   default_txn_opts = mongoc_transaction_opts_new ();
+   read_concern = mongoc_read_concern_new ();
+   mongoc_read_concern_set_level (read_concern, "snapshot");
+   mongoc_transaction_opts_set_read_concern (default_txn_opts, read_concern);
+   session_opts = mongoc_session_opts_new ();
+   mongoc_session_opts_set_default_transaction_opts (session_opts,
+                                                     default_txn_opts);
+
+   session = mongoc_client_start_session (client, session_opts, &error);
+   if (!session) {
+      MONGOC_ERROR ("Failed to start session: %s", error.message);
+      goto done;
+   }
+
+   /* in this example, set write concern when starting the transaction */
+   txn_opts = mongoc_transaction_opts_new ();
+   write_concern = mongoc_write_concern_new ();
+   mongoc_write_concern_set_wmajority (write_concern, 1000 /* wtimeout */);
+   mongoc_transaction_opts_set_write_concern (txn_opts, write_concern);
+
+   insert_opts = bson_new ();
+   if (!mongoc_client_session_append (session, insert_opts, &error)) {
+      MONGOC_ERROR ("Could not add session to opts: %s", error.message);
+      goto done;
+   }
+
+retry_transaction:
+   r = mongoc_client_session_start_transaction (session, txn_opts, &error);
+   if (!r) {
+      MONGOC_ERROR ("Failed to start transaction: %s", error.message);
+      goto done;
+   }
+
+   /* insert two documents - on error, retry the whole transaction */
+   for (i = 0; i < 2; i++) {
+      doc = BCON_NEW ("_id", BCON_INT32 (i));
+      bson_destroy (&reply);
+      r = mongoc_collection_insert_one (
+         collection, doc, insert_opts, &reply, &error);
+
+      bson_destroy (doc);
+
+      if (!r) {
+         MONGOC_ERROR ("Insert failed: %s", error.message);
+         mongoc_client_session_abort_transaction (session, NULL);
+
+         /* a network error, primary failover, or other temporary error in a
+          * transaction includes {"errorLabels": ["TransientTransactionError"]},
+          * meaning that trying the entire transaction again may succeed
+          */
+         if (mongoc_error_has_label (&reply, "TransientTransactionError")) {
+            goto retry_transaction;
+         }
+
+         goto done;
+      }
+
+      reply_json = bson_as_json (&reply, NULL);
+      printf ("%s\n", reply_json);
+      bson_free (reply_json);
+   }
+
+   /* in case of transient errors, retry for 5 seconds to commit transaction */
+   start = bson_get_monotonic_time ();
+   while (bson_get_monotonic_time () - start < 5 * 1000 * 1000) {
+      bson_destroy (&reply);
+      r = mongoc_client_session_commit_transaction (session, &reply, &error);
+      if (r) {
+         /* success */
+         break;
+      } else {
+         MONGOC_ERROR ("Warning: commit failed: %s", error.message);
+         if (mongoc_error_has_label (&reply, "TransientTransactionError")) {
+            goto retry_transaction;
+         } else if (mongoc_error_has_label (&reply,
+                                            "UnknownTransactionCommitResult")) {
+            /* try again to commit */
+            continue;
+         }
+
+         /* unrecoverable error trying to commit */
+         break;
+      }
+   }
+
+   exit_code = EXIT_SUCCESS;
+
+done:
+   bson_destroy (&reply);
+   bson_destroy (insert_opts);
+   mongoc_write_concern_destroy (write_concern);
+   mongoc_read_concern_destroy (read_concern);
+   mongoc_transaction_opts_destroy (txn_opts);
+   mongoc_transaction_opts_destroy (default_txn_opts);
+   mongoc_client_session_destroy (session);
+   mongoc_collection_destroy (collection);
+   mongoc_database_destroy (database);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return exit_code;
+}
+
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_t.html new file mode 100644 index 0000000..74db8f9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_session_t.html @@ -0,0 +1,323 @@ + + + + + + + + mongoc_client_session_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_session_t

+

Use a session for a sequence of operations, optionally with causal consistency. See the MongoDB Manual Entry for Causal Consistency.

+
+

Synopsis

+

Start a session with mongoc_client_start_session(), use the session for a sequence of operations and multi-document transactions, then free it with mongoc_client_session_destroy(). Any mongoc_cursor_t or mongoc_change_stream_t using a session must be destroyed before the session, and a session must be destroyed before the mongoc_client_t it came from.

+

By default, sessions are causally consistent. To disable causal consistency, before starting a session create a mongoc_session_opt_t with mongoc_session_opts_new() and call mongoc_session_opts_set_causal_consistency(), then free the struct with mongoc_session_opts_destroy().

+

Unacknowledged writes are prohibited with sessions.

+

A mongoc_client_session_t must be used by only one thread at a time. Due to session pooling, mongoc_client_start_session() may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout.

+
+
+

Example

+
+
example-session.c
+
/* gcc example-session.c -o example-session \
+ *     $(pkg-config --cflags --libs libmongoc-1.0) */
+
+/* ./example-session [CONNECTION_STRING] */
+
+#include <stdio.h>
+#include <mongoc/mongoc.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   int exit_code = EXIT_FAILURE;
+
+   mongoc_client_t *client = NULL;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=session-example";
+   mongoc_uri_t *uri = NULL;
+   mongoc_client_session_t *client_session = NULL;
+   mongoc_collection_t *collection = NULL;
+   bson_error_t error;
+   bson_t *selector = NULL;
+   bson_t *update = NULL;
+   bson_t *update_opts = NULL;
+   bson_t *find_opts = NULL;
+   mongoc_read_prefs_t *secondary = NULL;
+   mongoc_cursor_t *cursor = NULL;
+   const bson_t *doc;
+   char *str;
+   bool r;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      goto done;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto done;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   /* pass NULL for options - by default the session is causally consistent */
+   client_session = mongoc_client_start_session (client, NULL, &error);
+   if (!client_session) {
+      fprintf (stderr, "Failed to start session: %s\n", error.message);
+      goto done;
+   }
+
+   collection = mongoc_client_get_collection (client, "test", "collection");
+   selector = BCON_NEW ("_id", BCON_INT32 (1));
+   update = BCON_NEW ("$inc", "{", "x", BCON_INT32 (1), "}");
+   update_opts = bson_new ();
+   if (!mongoc_client_session_append (client_session, update_opts, &error)) {
+      fprintf (stderr, "Could not add session to opts: %s\n", error.message);
+      goto done;
+   }
+
+   r = mongoc_collection_update_one (
+      collection, selector, update, update_opts, NULL /* reply */, &error);
+
+   if (!r) {
+      fprintf (stderr, "Update failed: %s\n", error.message);
+      goto done;
+   }
+
+   bson_destroy (selector);
+   selector = BCON_NEW ("_id", BCON_INT32 (1));
+   secondary = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+
+   find_opts = BCON_NEW ("maxTimeMS", BCON_INT32 (2000));
+   if (!mongoc_client_session_append (client_session, find_opts, &error)) {
+      fprintf (stderr, "Could not add session to opts: %s\n", error.message);
+      goto done;
+   };
+
+   /* read from secondary. since we're in a causally consistent session, the
+    * data is guaranteed to reflect the update we did on the primary. the query
+    * blocks waiting for the secondary to catch up, if necessary, or times out
+    * and fails after 2000 ms.
+    */
+   cursor = mongoc_collection_find_with_opts (
+      collection, selector, find_opts, secondary);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_json (doc, NULL);
+      fprintf (stdout, "%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Cursor Failure: %s\n", error.message);
+      goto done;
+   }
+
+   exit_code = EXIT_SUCCESS;
+
+done:
+   if (find_opts) {
+      bson_destroy (find_opts);
+   }
+   if (update) {
+      bson_destroy (update);
+   }
+   if (selector) {
+      bson_destroy (selector);
+   }
+   if (update_opts) {
+      bson_destroy (update_opts);
+   }
+   if (secondary) {
+      mongoc_read_prefs_destroy (secondary);
+   }
+   /* destroy cursor, collection, session before the client they came from */
+   if (cursor) {
+      mongoc_cursor_destroy (cursor);
+   }
+   if (collection) {
+      mongoc_collection_destroy (collection);
+   }
+   if (client_session) {
+      mongoc_client_session_destroy (client_session);
+   }
+   if (uri) {
+      mongoc_uri_destroy (uri);
+   }
+   if (client) {
+      mongoc_client_destroy (client);
+   }
+
+   mongoc_cleanup ();
+
+   return exit_code;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_apm_callbacks.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_apm_callbacks.html new file mode 100644 index 0000000..f9b81eb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_apm_callbacks.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_client_set_apm_callbacks() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_apm_callbacks()

+
+

Synopsis

+
bool
+mongoc_client_set_apm_callbacks (mongoc_client_t *client,
+                                 mongoc_apm_callbacks_t *callbacks,
+                                 void *context);
+
+
+

Register a set of callbacks to receive Application Performance Monitoring events.

+

The callbacks are copied by the client and may be destroyed at any time after.

+
+
+

Parameters

+ +
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_appname.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_appname.html new file mode 100644 index 0000000..c326428 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_appname.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_client_set_appname() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_appname()

+
+

Synopsis

+
bool
+mongoc_client_set_appname (mongoc_client_t *client, const char *appname)
+
+
+

Sets the application name for this client. This string, along with other internal driver details, is sent to the server as part of the initial connection handshake (“isMaster”).

+

appname is copied, and doesn’t have to remain valid after the call to mongoc_client_set_appname().

+

This function will log an error and return false in the following cases:

+
    +
  • appname is longer than MONGOC_HANDSHAKE_APPNAME_MAX
  • +
  • client has already initiated a handshake
  • +
  • client is from a mongoc_client_pool_t
  • +
+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • appname: The application name, of length at most MONGOC_HANDSHAKE_APPNAME_MAX.
  • +
+
+
+

Returns

+

true if the appname is set successfully. Otherwise, false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_error_api.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_error_api.html new file mode 100644 index 0000000..45464f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_error_api.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_client_set_error_api() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_error_api()

+
+

Synopsis

+
bool
+mongoc_client_set_error_api (mongoc_client_t *client, int32_t version);
+
+
+

Configure how the C Driver reports errors. See Setting the Error API Version.

+

Do not use this function with pooled clients, see mongoc_client_pool_set_error_api().

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • version: The version of the error API, either MONGOC_ERROR_API_VERSION_LEGACY or MONGOC_ERROR_API_VERSION_2.
  • +
+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_concern.html new file mode 100644 index 0000000..99afc21 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_set_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_read_concern()

+
+

Synopsis

+
void
+mongoc_client_set_read_concern (mongoc_client_t *client,
+                                const mongoc_read_concern_t *read_concern);
+
+
+

Sets the read concern for the client. This only affects future operations, collections, and databases inheriting from client.

+

The default read concern is MONGOC_READ_CONCERN_LEVEL_LOCAL. This is the correct read concern for the great majority of applications.

+

It is a programming error to call this function on a client from a mongoc_client_pool_t. For pooled clients, set the read concern with the MongoDB URI instead.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_prefs.html new file mode 100644 index 0000000..b96912a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_read_prefs.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_client_set_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_read_prefs()

+
+

Synopsis

+
void
+mongoc_client_set_read_prefs (mongoc_client_t *client,
+                              const mongoc_read_prefs_t *read_prefs);
+
+
+

Sets the default read preferences to use with future operations upon client.

+

The global default is to read from the replica set primary.

+

It is a programming error to call this function on a client from a mongoc_client_pool_t. For pooled clients, set the read preferences with the MongoDB URI instead.

+

Please see the MongoDB website for a description of Read Preferences.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_ssl_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_ssl_opts.html new file mode 100644 index 0000000..a05531b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_ssl_opts.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_client_set_ssl_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_ssl_opts()

+
+

Synopsis

+
#ifdef MONGOC_ENABLE_SSL
+void
+mongoc_client_set_ssl_opts (mongoc_client_t *client,
+                            const mongoc_ssl_opt_t *opts);
+#endif
+
+
+

Sets the SSL options to use when connecting to SSL enabled MongoDB servers.

+

The mongoc_ssl_opt_t struct is copied by the client along with the strings +it points to (pem_file, pem_pwd, ca_file, ca_dir, and +crl_file) so they don’t have to remain valid after the call to +mongoc_client_set_ssl_opts.

+

A call to mongoc_client_set_ssl_opts overrides all SSL options set through +the connection string with which the mongoc_client_t was constructed.

+

It is a programming error to call this function on a client from a +mongoc_client_pool_t. Instead, call +mongoc_client_pool_set_ssl_opts() on the pool before popping any +clients.

+
+
+

Parameters

+ +
+
+

Availability

+

This feature requires that the MongoDB C driver was compiled with -DENABLE_SSL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_stream_initiator.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_stream_initiator.html new file mode 100644 index 0000000..cd2b5be --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_stream_initiator.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_set_stream_initiator() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_stream_initiator()

+
+

Synopsis

+
void
+mongoc_client_set_stream_initiator (mongoc_client_t *client,
+                                    mongoc_stream_initiator_t initiator,
+                                    void *user_data);
+
+
+

The mongoc_client_set_stream_initiator() function shall associate a given mongoc_client_t with a new stream initiator. This will completely replace the default transport (buffered TCP, possibly with TLS). The initiator should fulfill the mongoc_stream_t contract. user_data is passed through to the initiator callback and may be used for whatever run time customization is necessary.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_write_concern.html new file mode 100644 index 0000000..c187e43 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_set_write_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_client_set_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_set_write_concern()

+
+

Synopsis

+
void
+mongoc_client_set_write_concern (mongoc_client_t *client,
+                                 const mongoc_write_concern_t *write_concern);
+
+
+

Sets the write concern for the client. This only affects future operations, collections, and databases inheriting from client.

+

The default write concern is MONGOC_WRITE_CONCERN_W_DEFAULT: the driver blocks awaiting basic acknowledgement of write operations from MongoDB. This is the correct write concern for the great majority of applications.

+

It is a programming error to call this function on a client from a mongoc_client_pool_t. For pooled clients, set the write concern with the MongoDB URI instead.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_start_session.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_start_session.html new file mode 100644 index 0000000..3538f5e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_start_session.html @@ -0,0 +1,206 @@ + + + + + + + + mongoc_client_start_session() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_start_session()

+
+

Synopsis

+
mongoc_client_session_t *
+mongoc_client_start_session (mongoc_client_t *client,
+                             mongoc_session_opt_t *opts,
+                             bson_error_t *error)
+
+
+

Create a session for a sequence of operations.

+

Start a session with mongoc_client_start_session(), use the session for a sequence of operations and multi-document transactions, then free it with mongoc_client_session_destroy(). Any mongoc_cursor_t or mongoc_change_stream_t using a session must be destroyed before the session, and a session must be destroyed before the mongoc_client_t it came from.

+

By default, sessions are causally consistent. To disable causal consistency, before starting a session create a mongoc_session_opt_t with mongoc_session_opts_new() and call mongoc_session_opts_set_causal_consistency(), then free the struct with mongoc_session_opts_destroy().

+

Unacknowledged writes are prohibited with sessions.

+

A mongoc_client_session_t must be used by only one thread at a time. Due to session pooling, mongoc_client_start_session() may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout.

+
+
+

Parameters

+ +
+
+

Returns

+

If successful, this function returns a newly allocated mongoc_client_session_t that should be freed with mongoc_client_session_destroy() when no longer in use. On error, returns NULL and sets error.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_t.html new file mode 100644 index 0000000..0e56468 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_t.html @@ -0,0 +1,301 @@ + + + + + + + + mongoc_client_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_t

+

A single-threaded MongoDB connection. See Connection Pooling.

+
+

Synopsis

+
typedef struct _mongoc_client_t mongoc_client_t;
+
+typedef mongoc_stream_t *(*mongoc_stream_initiator_t) (
+   const mongoc_uri_t *uri,
+   const mongoc_host_list_t *host,
+   void *user_data,
+   bson_error_t *error);
+
+
+

mongoc_client_t is an opaque type that provides access to a MongoDB server, +replica set, or sharded cluster. It maintains management of underlying sockets +and routing to individual nodes based on mongoc_read_prefs_t or mongoc_write_concern_t.

+
+
+

Streams

+

The underlying transport for a given client can be customized, wrapped or replaced by any implementation that fulfills mongoc_stream_t. A custom transport can be set with mongoc_client_set_stream_initiator().

+
+
+

Thread Safety

+

mongoc_client_t is NOT thread-safe and should only be used from one thread at a time. When used in multi-threaded scenarios, it is recommended that you use the thread-safe mongoc_client_pool_t to retrieve a mongoc_client_t for your thread.

+
+
+

Example

+
+
example-client.c
+
/* gcc example-client.c -o example-client $(pkg-config --cflags --libs
+ * libmongoc-1.0) */
+
+/* ./example-client [CONNECTION_STRING [COLLECTION_NAME]] */
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_cursor_t *cursor;
+   bson_error_t error;
+   const bson_t *doc;
+   const char *collection_name = "test";
+   bson_t query;
+   char *str;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=client-example";
+   mongoc_uri_t *uri;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   if (argc > 2) {
+      collection_name = argv[2];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   bson_init (&query);
+
+#if 0
+   bson_append_utf8 (&query, "hello", -1, "world", -1);
+#endif
+
+   collection = mongoc_client_get_collection (client, "test", collection_name);
+   cursor = mongoc_collection_find_with_opts (
+      collection,
+      &query,
+      NULL,  /* additional options */
+      NULL); /* read prefs, NULL for default */
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      fprintf (stdout, "%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Cursor Failure: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   bson_destroy (&query);
+   mongoc_cursor_destroy (cursor);
+   mongoc_collection_destroy (collection);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_watch.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_watch.html new file mode 100644 index 0000000..9e81ebd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_watch.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_client_watch() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_watch()

+
+

Synopsis

+
mongoc_change_stream_t*
+mongoc_client_watch (mongoc_client_t *client,
+                     const bson_t *pipeline,
+                     const bson_t *opts);
+
+
+

A helper function to create a change stream. It is preferred to call this +function over using a raw aggregation to create a change stream.

+

This function uses the read preference and read concern of the client. If +the change stream needs to re-establish connection, the same read preference +will be used. This may happen if the change stream encounters a resumable error.

+
+

Warning

+

A change stream is only supported with majority read concern.

+
+
+
+

Parameters

+
    +
  • db: A mongoc_client_t specifying the client which the change stream listens to.
  • +
  • pipeline: A bson_t representing an aggregation pipeline appended to the change stream. This may be an empty document.
  • +
  • opts: A bson_t containing change stream options or NULL.
  • +
+

opts may be NULL or a document consisting of any subset of the following +parameters:

+
    +
  • batchSize An int32 representing number of documents requested to be returned on each call to mongoc_change_stream_next()
  • +
  • resumeAfter A Document representing the logical starting point of the change stream. The _id field of any change received from a change stream can be used here.
  • +
  • startAtOperationTime A Timestamp. The change stream only provides changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here.
  • +
  • maxAwaitTimeMS An int64 representing the maximum amount of time a call to mongoc_change_stream_next() will block waiting for data
  • +
  • collation A Collation Document
  • +
+
+
+

Returns

+

A newly allocated mongoc_change_stream_t which must be freed with +mongoc_change_stream_destroy() when no longer in use. The returned +mongoc_change_stream_t is never NULL. If there is an error, it can +be retrieved with mongoc_change_stream_error_document(), and subsequent +calls to mongoc_change_stream_next() will return false.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_write_command_with_opts.html new file mode 100644 index 0000000..7e318b1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_client_write_command_with_opts.html @@ -0,0 +1,369 @@ + + + + + + + + mongoc_client_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_client_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_client_write_command_with_opts (mongoc_client_t *client,
+                                       const char *db_name,
+                                       const bson_t *command,
+                                       const bson_t *opts,
+                                       bson_t *reply,
+                                       bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Use this function for commands that write such as “drop” or “createRole” (but not for “insert”, “update”, or “delete”, see Basic Write Operations). Write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. The write concern is omitted for MongoDB before 3.4.

+ ++++ + + + + + + + + + + + + + + + + +
Write ConcernCollation
optsopts
Transaction 
client 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Basic Write Operations

+

Do not use this function to call the basic write commands “insert”, “update”, and “delete”. Those commands require special logic not implemented in mongoc_client_write_command_with_opts. For basic write operations use CRUD functions such as mongoc_collection_insert_one() and the others described in the CRUD tutorial, or use the Bulk API.

+
+
+

Example

+
+
example-command-with-opts.c
+
/*
+
+Demonstrates how to prepare options for mongoc_client_read_command_with_opts and
+mongoc_client_write_command_with_opts. First it calls "cloneCollectionAsCapped"
+command with "writeConcern" option, then "distinct" command with "collation" and
+"readConcern" options,
+
+Start a MongoDB 3.4 replica set with --enableMajorityReadConcern and insert two
+documents:
+
+$ mongo
+MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 1, y: "One"})
+WriteResult({ "nInserted" : 1 })
+MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 2, y: "Two"})
+WriteResult({ "nInserted" : 1 })
+
+Build and run the example:
+
+gcc example-command-with-opts.c -o example-command-with-opts $(pkg-config
+--cflags --libs libmongoc-1.0)
+./example-command-with-opts [CONNECTION_STRING]
+cloneCollectionAsCapped: { "ok" : 1 }
+distinct: { "values" : [ 1, 2 ], "ok" : 1 }
+
+*/
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=client-example";
+   mongoc_uri_t *uri;
+   bson_t *cmd;
+   bson_t *opts;
+   mongoc_write_concern_t *write_concern;
+   mongoc_read_prefs_t *read_prefs;
+   mongoc_read_concern_t *read_concern;
+   bson_t reply;
+   bson_error_t error;
+   char *json;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   cmd = BCON_NEW ("cloneCollectionAsCapped",
+                   BCON_UTF8 ("my_collection"),
+                   "toCollection",
+                   BCON_UTF8 ("my_capped_collection"),
+                   "size",
+                   BCON_INT64 (1024 * 1024));
+
+   /* include write concern "majority" in command options */
+   write_concern = mongoc_write_concern_new ();
+   mongoc_write_concern_set_wmajority (write_concern, 10000 /* wtimeoutMS */);
+   opts = bson_new ();
+   mongoc_write_concern_append (write_concern, opts);
+
+   if (mongoc_client_write_command_with_opts (
+          client, "test", cmd, opts, &reply, &error)) {
+      json = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("cloneCollectionAsCapped: %s\n", json);
+      bson_free (json);
+   } else {
+      fprintf (stderr, "cloneCollectionAsCapped: %s\n", error.message);
+   }
+
+   bson_free (cmd);
+   bson_free (opts);
+
+   /* distinct values of "x" in "my_collection" where "y" sorts after "one" */
+   cmd = BCON_NEW ("distinct",
+                   BCON_UTF8 ("my_collection"),
+                   "key",
+                   BCON_UTF8 ("x"),
+                   "query",
+                   "{",
+                   "y",
+                   "{",
+                   "$gt",
+                   BCON_UTF8 ("one"),
+                   "}",
+                   "}");
+
+   read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+
+   /* "One" normally sorts before "one"; make "One" sort after "one" */
+   opts = BCON_NEW ("collation",
+                    "{",
+                    "locale",
+                    BCON_UTF8 ("en_US"),
+                    "caseFirst",
+                    BCON_UTF8 ("lower"),
+                    "}");
+
+   /* add a read concern to "opts" */
+   read_concern = mongoc_read_concern_new ();
+   mongoc_read_concern_set_level (read_concern,
+                                  MONGOC_READ_CONCERN_LEVEL_MAJORITY);
+
+   mongoc_read_concern_append (read_concern, opts);
+
+   if (mongoc_client_read_command_with_opts (
+          client, "test", cmd, read_prefs, opts, &reply, &error)) {
+      json = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("distinct: %s\n", json);
+      bson_free (json);
+   } else {
+      fprintf (stderr, "distinct: %s\n", error.message);
+   }
+
+   bson_destroy (cmd);
+   bson_destroy (opts);
+   bson_destroy (&reply);
+   mongoc_read_prefs_destroy (read_prefs);
+   mongoc_read_concern_destroy (read_concern);
+   mongoc_write_concern_destroy (write_concern);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_aggregate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_aggregate.html new file mode 100644 index 0000000..fdf560c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_aggregate.html @@ -0,0 +1,279 @@ + + + + + + + + mongoc_collection_aggregate() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_aggregate()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_aggregate (mongoc_collection_t *collection,
+                             mongoc_query_flags_t flags,
+                             const bson_t *pipeline,
+                             const bson_t *opts,
+                             const mongoc_read_prefs_t *read_prefs)
+   BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

For a list of all options, see the MongoDB Manual entry on the aggregate command.

+
+
+

Description

+

This function shall execute an aggregation query on the underlying collection. For more information on building aggregation pipelines, see the MongoDB Manual entry on the aggregate command.

+

Read preferences, read and write concern, and collation can be overridden by various sources. The highest-priority sources for these options are listed first in the following table. In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. Write concern is applied from opts, or if opts has no write concern and the aggregation pipeline includes “$out”, the write concern is applied from collection. The write concern is omitted for MongoDB before 3.4.

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernWrite ConcernCollation
read_prefsoptsoptsopts
TransactionTransactionTransaction 
collectioncollectioncollection 
+

See the example for transactions and for the “distinct” command with opts.

+
+
+

Returns

+

This function returns a newly allocated mongoc_cursor_t that should be freed with mongoc_cursor_destroy() when no longer in use. The returned mongoc_cursor_t is never NULL; if the parameters are invalid, the bson_error_t in the mongoc_cursor_t is filled out, and the mongoc_cursor_t is returned before the server is selected.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+

Example

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+
+static mongoc_cursor_t *
+pipeline_query (mongoc_collection_t *collection)
+{
+   mongoc_cursor_t *cursor;
+   bson_t *pipeline;
+
+   pipeline = BCON_NEW ("pipeline",
+                        "[",
+                        "{",
+                        "$match",
+                        "{",
+                        "foo",
+                        BCON_UTF8 ("A"),
+                        "}",
+                        "}",
+                        "{",
+                        "$match",
+                        "{",
+                        "bar",
+                        BCON_BOOL (false),
+                        "}",
+                        "}",
+                        "]");
+
+   cursor = mongoc_collection_aggregate (
+      collection, MONGOC_QUERY_NONE, pipeline, NULL, NULL);
+
+   bson_destroy (pipeline);
+
+   return cursor;
+}
+
+
+
+
+

Other Parameters

+

When using $out, the pipeline stage that writes, the write_concern field of the mongoc_cursor_t will be set to the mongoc_write_concern_t parameter, if it is valid, and applied to the write command when mongoc_cursor_next() is called. Pass any other parameters to the aggregate command, besides pipeline, as fields in opts:

+
mongoc_write_concern_t *write_concern = mongoc_write_concern_new ();
+mongoc_write_concern_set_w (write_concern, 3);
+
+pipeline =
+   BCON_NEW ("pipeline", "[", "{", "$out", BCON_UTF8 ("collection2"), "}", "]");
+
+opts = BCON_NEW ("bypassDocumentValidation", BCON_BOOL (true));
+mongoc_write_concern_append (write_concern, opts);
+
+cursor = mongoc_collection_aggregate (
+   collection1, MONGOC_QUERY_NONE, pipeline, opts, NULL);
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command.html new file mode 100644 index 0000000..80cd76f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command.html @@ -0,0 +1,178 @@ + + + + + + + + mongoc_collection_command() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_command()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_command (mongoc_collection_t *collection,
+                           mongoc_query_flags_t flags,
+                           uint32_t skip,
+                           uint32_t limit,
+                           uint32_t batch_size,
+                           const bson_t *command,
+                           const bson_t *fields,
+                           const mongoc_read_prefs_t *read_prefs)
+   BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+

This function is superseded by mongoc_collection_command_with_opts(), mongoc_collection_read_command_with_opts(), mongoc_collection_write_command_with_opts(), and mongoc_collection_read_write_command_with_opts().

+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • flags: A mongoc_query_flags_t.
  • +
  • skip: A uint32_t with the number of documents to skip or zero.
  • +
  • limit: A uint32_t with the max number of documents to return or zero.
  • +
  • batch_size: A uint32_t with the number of documents in each batch or zero. Default is 100.
  • +
  • command: A bson_t containing the command to execute.
  • +
  • fields: A bson_t containing the fields to return or NULL. Not all commands support this option.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
+
+
+

Returns

+

A mongoc_cursor_t.

+

The cursor should be freed with mongoc_cursor_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_simple.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_simple.html new file mode 100644 index 0000000..518d51e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_simple.html @@ -0,0 +1,212 @@ + + + + + + + + mongoc_collection_command_simple() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_command_simple()

+
+

Synopsis

+
bool
+mongoc_collection_command_simple (mongoc_collection_t *collection,
+                                  const bson_t *command,
+                                  const mongoc_read_prefs_t *read_prefs,
+                                  bson_t *reply,
+                                  bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • command: A bson_t containing the command to execute.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
  • reply: A location to initialize a bson_t. This should be on the stack.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

This is a simplified version of mongoc_collection_command() that returns the first result document in reply. The collection’s read preference, read concern, and write concern are not applied to the command. The parameter reply is initialized even upon failure to simplify memory management.

+

This function tries to unwrap an embedded error in the command when possible. The unwrapped error will be propagated via the error parameter. Additionally, the result document is set in reply.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

This function does not check the server response for a write concern error or write concern timeout.

+
+
+

Example

+

The following is an example of executing the collection stats command.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_collection_stats (mongoc_collection_t *collection)
+{
+   bson_error_t error;
+   const char *name;
+   bson_t *cmd;
+   bson_t reply;
+
+   name = mongoc_collection_get_name (collection);
+   cmd = BCON_NEW ("collStats", BCON_UTF8 (name));
+
+   if (mongoc_collection_command_simple (
+          collection, cmd, NULL, &reply, &error)) {
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (stderr, "%s\n", error.message);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (cmd);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_with_opts.html new file mode 100644 index 0000000..eaba5b8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_command_with_opts.html @@ -0,0 +1,227 @@ + + + + + + + + mongoc_collection_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_command_with_opts (
+   mongoc_collection_t *collection,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, interpreting opts according to the MongoDB server version. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Read preferences, read and write concern, and collation can be overridden by various sources. The highest-priority sources for these options are listed first:

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernWrite ConcernCollation
read_prefsoptsoptsopts
TransactionTransactionTransaction 
collection   
+

In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. +See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

The reply is not parsed for a write concern timeout or write concern error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_copy.html new file mode 100644 index 0000000..f043a8e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_copy.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_collection_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_copy()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_collection_copy (mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a deep copy of the collection struct and its configuration. Useful if you intend to call mongoc_collection_set_write_concern(), mongoc_collection_set_read_prefs(), or mongoc_collection_set_read_concern(), and want to preserve an unaltered copy of the struct.

+

This function does not copy the contents of the collection on the MongoDB server; use the cloneCollection command for that purpose.

+
+
+

Returns

+

A newly allocated mongoc_collection_t that should be freed with mongoc_collection_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count.html new file mode 100644 index 0000000..a4fb78c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count.html @@ -0,0 +1,216 @@ + + + + + + + + mongoc_collection_count() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_count()

+
+

Deprecated

+

This function is deprecated and should not be used in new code. +Use mongoc_collection_count_documents() or mongoc_collection_estimated_document_count() instead.

+

mongoc_collection_count_documents() has similar performance to calling mongoc_collection_count() with a non-NULL query, and is guaranteed to retrieve an accurate collection count. See migrating from deprecated count functions for details.

+

mongoc_collection_estimated_document_count() has the same performance as calling mongoc_collection_count() with a NULL query, but is not guaranteed to retrieve an accurate collection count.

+
+
+

Synopsis

+
int64_t
+mongoc_collection_count (mongoc_collection_t *collection,
+                         mongoc_query_flags_t flags,
+                         const bson_t *query,
+                         int64_t skip,
+                         int64_t limit,
+                         const mongoc_read_prefs_t *read_prefs,
+                         bson_error_t *error)
+ BSON_GNUC_DEPRECATED_FOR (mongoc_collection_count_documents or
+                           mongoc_collection_estimated_document_count);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall execute a count query on the underlying ‘collection’. The bson ‘query’ is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

+

For more information, see the query reference at the MongoDB website.

+

The mongoc_read_concern_t specified on the mongoc_collection_t will be used, if any. If read_prefs is NULL, the collection’s read preferences are used.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

-1 on failure, otherwise the number of documents counted.

+
+
+

Example

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_query_count (mongoc_collection_t *collection, bson_t *query)
+{
+   bson_error_t error;
+   int64_t count;
+
+   count = mongoc_collection_count (
+      collection, MONGOC_QUERY_NONE, query, 0, 0, NULL, &error);
+
+   if (count < 0) {
+      fprintf (stderr, "Count failed: %s\n", error.message);
+   } else {
+      printf ("%" PRId64 " documents counted.\n", count);
+   }
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_documents.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_documents.html new file mode 100644 index 0000000..25f5497 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_documents.html @@ -0,0 +1,245 @@ + + + + + + + + mongoc_collection_count_documents() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_count_documents()

+
+

Synopsis

+
int64_t
+mongoc_collection_count_documents (mongoc_collection_t *collection,
+                                   const bson_t *filter,
+                                   const bson_t *opts,
+                                   const mongoc_read_prefs_t *read_prefs,
+                                   bson_t *reply,
+                                   bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • filter: A bson_t containing the filter.
  • +
  • opts: A bson_t, NULL to ignore.
  • +
  • read_prefs: A mongoc_read_prefs_t or NULL.
  • +
  • reply: A location for an uninitialized bson_t to store the command reply, NULL to ignore. If not NULL, reply will be initialized.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This functions executes a count query on collection. In contrast with mongoc_collection_estimated_document_count(), the count returned is guaranteed to be accurate.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

-1 on failure, otherwise the number of documents counted.

+
+
+

Example

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_count (mongoc_collection_t *collection, bson_t *filter)
+{
+   bson_error_t error;
+   int64_t count;
+   bson_t* opts = BCON_NEW ("skip", BCON_INT64(5));
+
+   count = mongoc_collection_count_documents (
+      collection, filter, opts, NULL, NULL, &error);
+   bson_destroy (opts);
+
+   if (count < 0) {
+      fprintf (stderr, "Count failed: %s\n", error.message);
+   } else {
+      printf ("%" PRId64 " documents counted.\n", count);
+   }
+}
+
+
+
+
+

Migrating from deprecated count functions

+

When migrating to mongoc_collection_count_documents() from the deprecated mongoc_collection_count() or mongoc_collection_count_with_opts(), the following query operators in the filter must be replaced:

+ ++++ + + + + + + + + + + + + + + + + +
OperatorReplacement
$where$expr
$near$geoWithin with $center
$nearSphere$geoWithin with $centerSphere
+

$expr requires MongoDB 3.6+

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_with_opts.html new file mode 100644 index 0000000..76ab83f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_count_with_opts.html @@ -0,0 +1,275 @@ + + + + + + + + mongoc_collection_count_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_count_with_opts()

+
+

Deprecated

+

This function is deprecated and should not be used in new code. +Use mongoc_collection_count_documents() or mongoc_collection_estimated_document_count() instead.

+

mongoc_collection_count_documents() has similar performance to calling mongoc_collection_count() with a non-NULL query, and is guaranteed to retrieve an accurate collection count. See migrating from deprecated count functions for details.

+

mongoc_collection_estimated_document_count() has the same performance as calling mongoc_collection_count() with a NULL query, but is not guaranteed to retrieve an accurate collection count.

+
+
+

Synopsis

+
int64_t
+mongoc_collection_count_with_opts (mongoc_collection_t *collection,
+                                   mongoc_query_flags_t flags,
+                                   const bson_t *query,
+                                   int64_t skip,
+                                   int64_t limit,
+                                   const bson_t *opts,
+                                   const mongoc_read_prefs_t *read_prefs,
+                                   bson_error_t *error)
+ BSON_GNUC_DEPRECATED_FOR (mongoc_collection_count_documents or
+                           mongoc_collection_estimated_document_count);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function shall execute a count query on the underlying ‘collection’. The bson ‘query’ is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

+

The mongoc_read_concern_t specified on the mongoc_collection_t will be used, if any. If read_prefs is NULL, the collection’s read preferences are used.

+

In addition to the standard functionality available from mongoc_collection_count, this function allows the user to add arbitrary extra keys to the count. This pass through enables features such as hinting for counts.

+

For more information, see the query reference at the MongoDB website.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

-1 on failure, otherwise the number of documents counted.

+
+
+

Examples

+
+
Basic Counting
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_query_count (mongoc_collection_t *collection, bson_t *query)
+{
+   bson_error_t error;
+   int64_t count;
+   bson_t opts;
+
+   bson_init (&opts);
+   BSON_APPEND_UTF8 (&opts, "hint", "_id_");
+
+   count = mongoc_collection_count_with_opts (
+      collection, MONGOC_QUERY_NONE, query, 0, 0, &opts, NULL, &error);
+
+   bson_destroy (&opts);
+
+   if (count < 0) {
+      fprintf (stderr, "Count failed: %s\n", error.message);
+   } else {
+      printf ("%" PRId64 " documents counted.\n", count);
+   }
+}
+
+
+
+
+
Counting with Collation
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_query_count (mongoc_collection_t *collection, bson_t *query)
+{
+   bson_t *selector;
+   bson_t *opts;
+   bson_error_t error;
+   int64_t count;
+
+   selector = BCON_NEW ("_id", "{", "$gt", BCON_UTF8 ("one"), "}");
+
+   /* "One" normally sorts before "one"; make "one" come first */
+   opts = BCON_NEW ("collation",
+                    "{",
+                    "locale",
+                    BCON_UTF8 ("en_US"),
+                    "caseFirst",
+                    BCON_UTF8 ("lower"),
+                    "}");
+
+   count = mongoc_collection_count_with_opts (
+      collection, MONGOC_QUERY_NONE, query, 0, 0, opts, NULL, &error);
+
+   bson_destroy (selector);
+   bson_destroy (opts);
+
+   if (count < 0) {
+      fprintf (stderr, "Count failed: %s\n", error.message);
+   } else {
+      printf ("%" PRId64 " documents counted.\n", count);
+   }
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation.html new file mode 100644 index 0000000..69dd9b2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation.html @@ -0,0 +1,193 @@ + + + + + + + + mongoc_collection_create_bulk_operation() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_create_bulk_operation()

+
+

Synopsis

+
mongoc_bulk_operation_t *
+mongoc_collection_create_bulk_operation (
+   mongoc_collection_t *collection,
+   bool ordered,
+   const mongoc_write_concern_t *write_concern) BSON_GNUC_WARN_UNUSED_RESULT
+   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_create_bulk_operation_with_opts);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_collection_create_bulk_operation_with_opts() instead.

+
+
+

Parameters

+ +
+
+

Description

+

This function shall begin a new bulk operation. After creating this you may call various functions such as mongoc_bulk_operation_update(), mongoc_bulk_operation_insert() and others.

+

After calling mongoc_bulk_operation_execute() the commands will be executed in as large as batches as reasonable by the client.

+

If ordered is true, then processing will stop at the first error.

+

If ordered is not true, then the bulk operation will attempt to continue processing even after the first failure.

+

write_concern contains the write concern for all operations in the bulk operation. If NULL, the collection’s write concern is used. The global default is acknowledged writes: MONGOC_WRITE_CONCERN_W_DEFAULT.

+
+ +
+

Errors

+

Errors are propagated when executing the bulk operation.

+
+
+

Returns

+

A newly allocated mongoc_bulk_operation_t that should be freed with mongoc_bulk_operation_destroy() when no longer in use.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation_with_opts.html new file mode 100644 index 0000000..5b166bd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_bulk_operation_with_opts.html @@ -0,0 +1,187 @@ + + + + + + + + mongoc_collection_create_bulk_operation_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_create_bulk_operation_with_opts()

+
+

Synopsis

+
mongoc_bulk_operation_t *
+mongoc_collection_create_bulk_operation_with_opts (
+   mongoc_collection_t *collection,
+   const bson_t *opts) BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function shall begin a new bulk operation. After creating this you may call various functions such as mongoc_bulk_operation_update(), mongoc_bulk_operation_insert() and others.

+

After calling mongoc_bulk_operation_execute() the commands will be executed in as large as batches as reasonable by the client.

+
+ +
+

Errors

+

Errors are propagated when executing the bulk operation.

+
+
+

Returns

+

A newly allocated mongoc_bulk_operation_t that should be freed with mongoc_bulk_operation_destroy() when no longer in use.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index.html new file mode 100644 index 0000000..ea4e5a3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_collection_create_index() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_create_index()

+
+

Synopsis

+
bool
+mongoc_collection_create_index (mongoc_collection_t *collection,
+                                const bson_t *keys,
+                                const mongoc_index_opt_t *opt,
+                                bson_error_t *error);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code. See Creating Indexes.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index_with_opts.html new file mode 100644 index 0000000..73a3ae7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_create_index_with_opts.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_collection_create_index_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_create_index_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_create_index_with_opts (mongoc_collection_t *collection,
+                                          const bson_t *keys,
+                                          const mongoc_index_opt_t *index_opts,
+                                          const bson_t *command_opts,
+                                          bson_t *reply,
+                                          bson_error_t *error);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code. See Creating Indexes.

+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • keys: A bson_t.
  • +
  • index_opts: A mongoc_index_opt_t.
  • +
  • reply: An optional location for a bson_t which will store the server’s reply.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

command_opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function will request the creation of a new index.

+

This function will use the createIndexes command. +The server’s reply is stored in reply.

+

If no write concern is provided in command_opts, the collection’s write concern is used.

+

See mongoc_index_opt_t for options on creating indexes.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

reply is always initialized and must be destroyed with bson_destroy(). If the server is running an obsolete version of MongoDB then reply may be empty, though it will still be initialized.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete.html new file mode 100644 index 0000000..1441892 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete.html @@ -0,0 +1,185 @@ + + + + + + + + mongoc_collection_delete() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_delete()

+
+

Synopsis

+
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)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_delete_one or
+                             mongoc_collection_delete_many);
+
+
+
+ +
+

Parameters

+ +
+
+

Description

+

This function shall delete documents in the given collection that match selector. The bson selector is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

+

If you want to limit deletes to a single document, provide MONGOC_DELETE_SINGLE_REMOVE in flags.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_many.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_many.html new file mode 100644 index 0000000..f6311f9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_many.html @@ -0,0 +1,185 @@ + + + + + + + + mongoc_collection_delete_many() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_delete_many()

+
+

Synopsis

+
bool
+mongoc_collection_delete_many (mongoc_collection_t *collection,
+                               const bson_t *selector,
+                               const bson_t *opts,
+                               bson_t *reply,
+                               bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • selector: A bson_t containing the query to match documents.
  • +
  • reply: Optional. An uninitialized bson_t populated with the delete result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function removes all documents in the given collection that match selector.

+

To delete at most one matching document, use mongoc_collection_delete_one().

+

If you pass a non-NULL reply, it is filled out with the field “deletedCount”. If there is a server error then reply contains either a “writeErrors” array with one subdocument or a “writeConcernErrors” array. The reply must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_one.html new file mode 100644 index 0000000..9cf72b1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_delete_one.html @@ -0,0 +1,185 @@ + + + + + + + + mongoc_collection_delete_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_delete_one()

+
+

Synopsis

+
bool
+mongoc_collection_delete_one (mongoc_collection_t *collection,
+                              const bson_t *selector,
+                              const bson_t *opts,
+                              bson_t *reply,
+                              bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • selector: A bson_t containing the query to match documents.
  • +
  • reply: Optional. An uninitialized bson_t populated with the delete result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function removes at most one document in the given collection that matches selector.

+

To delete all matching documents, use mongoc_collection_delete_many().

+

If you pass a non-NULL reply, it is filled out with the field “deletedCount”. If there is a server error then reply contains either a “writeErrors” array with one subdocument or a “writeConcernErrors” array. The reply must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_destroy.html new file mode 100644 index 0000000..09bfd59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_destroy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_destroy()

+
+

Synopsis

+
void
+mongoc_collection_destroy (mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall destroy a mongoc_collection_t and its associated resources. Does nothing if collection is NULL.

+
+

Warning

+

Always destroy a mongoc_cursor_t created from a collection before destroying the collection.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop.html new file mode 100644 index 0000000..77814e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_collection_drop() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_drop()

+
+

Synopsis

+
bool
+mongoc_collection_drop (mongoc_collection_t *collection, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

For more information, see mongoc_collection_drop_with_opts(). This function is a thin wrapper, passing NULL in as bson_t parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index.html new file mode 100644 index 0000000..19a3b27 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_drop_index() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_drop_index()

+
+

Synopsis

+
bool
+mongoc_collection_drop_index (mongoc_collection_t *collection,
+                              const char *index_name,
+                              bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

For more information, see mongoc_collection_drop_with_opts(). This function is a thin wrapper, passing NULL in as bson_t parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index_with_opts.html new file mode 100644 index 0000000..317a276 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_index_with_opts.html @@ -0,0 +1,182 @@ + + + + + + + + mongoc_collection_drop_index_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_drop_index_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_drop_index_with_opts (mongoc_collection_t *collection,
+                                        const char *index_name,
+                                        const bson_t *opts,
+                                        bson_error_t *error);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function requests than an index on collection be dropped.

+

If no write concern is provided in opts, the collection’s write concern is used.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_with_opts.html new file mode 100644 index 0000000..b129ce4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_drop_with_opts.html @@ -0,0 +1,206 @@ + + + + + + + + mongoc_collection_drop_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_drop_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_drop_with_opts (mongoc_collection_t *collection,
+                                  bson_t *opts,
+                                  bson_error_t *error);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function requests that a collection be dropped, including all indexes associated with the collection.

+

If no write concern is provided in opts, the collection’s write concern is used.

+

If the collection does not exist, the server responds with an “ns not found” error. It is safe to ignore this error; set the Error API Version to 2 and ignore server error code 26:

+
mongoc_client_t *client;
+mongoc_collection_t *collection;
+bson_error_t error;
+bool r;
+
+client = mongoc_client_new (NULL);
+mongoc_client_set_error_api (client, 2);
+collection = mongoc_client_get_collection (client, "db", "collection");
+r = mongoc_collection_drop_with_opts (collection, NULL /* opts */, &error);
+if (r) {
+   printf ("Dropped.\n");
+} else {
+   printf ("Error message: %s\n", error.message);
+   if (error.domain == MONGOC_ERROR_SERVER && error.code == 26) {
+      printf ("Ignoring 'ns not found' error\n");
+   } else {
+      fprintf (stderr, "Unrecognized error!\n");
+   }
+}
+
+mongoc_collection_destroy (collection);
+mongoc_client_destroy (client);
+
+
+

In MongoDB 3.0 and older, the “ns not found” error code is the generic MONGOC_ERROR_QUERY_FAILURE; in this case check whether the error message is equal to the string “ns not found”.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if the collection was successfully dropped. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_ensure_index.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_ensure_index.html new file mode 100644 index 0000000..232a6c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_ensure_index.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_collection_ensure_index() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_ensure_index()

+
+

Synopsis

+
bool
+mongoc_collection_ensure_index (mongoc_collection_t *collection,
+                                const bson_t *keys,
+                                const mongoc_index_opt_t *opt,
+                                bson_error_t *error)
+   BSON_GNUC_DEPRECATED;
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code. See Creating Indexes.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_estimated_document_count.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_estimated_document_count.html new file mode 100644 index 0000000..0a31fb4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_estimated_document_count.html @@ -0,0 +1,216 @@ + + + + + + + + mongoc_collection_estimated_document_count() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_estimated_document_count()

+
+

Synopsis

+
int64_t
+mongoc_collection_estimated_document_count (mongoc_collection_t *collection,
+                                            const bson_t *opts,
+                                            const mongoc_read_prefs_t *read_prefs,
+                                            bson_t *reply,
+                                            bson_error_t *error);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This functions executes a count query on collection. In contrast with mongoc_collection_count_documents(), the count returned is not guaranteed to be accurate.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

-1 on failure, otherwise the number of documents counted.

+
+
+

Example

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_count (mongoc_collection_t *collection, bson_t *query)
+{
+   bson_error_t error;
+   int64_t count;
+   bson_t* opts = BCON_NEW ("skip", BCON_INT64(5));
+
+   count = mongoc_collection_estimated_document_count (
+      collection, opts, NULL, NULL, &error);
+   bson_destroy (opts);
+
+   if (count < 0) {
+      fprintf (stderr, "Count failed: %s\n", error.message);
+   } else {
+      printf ("%" PRId64 " documents counted.\n", count);
+   }
+}
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find.html new file mode 100644 index 0000000..00735a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find.html @@ -0,0 +1,307 @@ + + + + + + + + mongoc_collection_find() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find()

+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Use the more convenient mongoc_collection_find_with_opts() instead.

+
+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_find (mongoc_collection_t *collection,
+                        mongoc_query_flags_t flags,
+                        uint32_t skip,
+                        uint32_t limit,
+                        uint32_t batch_size,
+                        const bson_t *query,
+                        const bson_t *fields,
+                        const mongoc_read_prefs_t *read_prefs)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_find_with_opts)
+      BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • flags: A mongoc_query_flags_t.
  • +
  • skip: A uint32_t of number of documents to skip or 0.
  • +
  • limit: A uint32_t of max number of documents to return or 0.
  • +
  • batch_size: A uint32_t containing batch size of document result sets or 0 for default. Default is 100.
  • +
  • query: A bson_t containing the query and options to execute.
  • +
  • fields: A bson_t containing fields to return or NULL.
  • +
  • read_prefs: A mongoc_read_prefs_t or NULL for default read preferences.
  • +
+
+
+

Description

+

This function shall execute a query on the underlying collection.

+

If no options are necessary, query can simply contain a query such as {a:1}. If you would like to specify options such as a sort order, the query must be placed inside of {"$query": {}}. See the example below for how to properly specify additional options to query.

+
+
+

Returns

+

A newly allocated mongoc_cursor_t that should be freed with mongoc_cursor_destroy() when no longer in use.

+
+
+

Example

+
+
Print All Documents in a Collection
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_all_documents (mongoc_collection_t *collection)
+{
+   mongoc_cursor_t *cursor;
+   bson_error_t error;
+   const bson_t *doc;
+   char *str;
+   bson_t *query;
+
+   query = BCON_NEW ("$query",
+                     "{",
+                     "foo",
+                     BCON_INT32 (1),
+                     "}",
+                     "$orderby",
+                     "{",
+                     "bar",
+                     BCON_INT32 (-1),
+                     "}");
+   cursor = mongoc_collection_find (
+      collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "An error occurred: %s\n", error.message);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   bson_destroy (query);
+}
+
+
+
+
+
+

The “find” command

+

Queries have historically been sent as OP_QUERY wire protocol messages, but beginning in MongoDB 3.2 queries use the “find” command instead.

+

The driver automatically converts queries to the new “find” command syntax if needed, so this change is typically invisible to C Driver users. However, an application written exclusively for MongoDB 3.2 and later can choose to use the new syntax directly instead of relying on the driver to convert from the old syntax:

+
/* MongoDB 3.2+ "find" command syntax */
+query = BCON_NEW ("filter",
+                  "{",
+                  "foo",
+                  BCON_INT32 (1),
+                  "}",
+                  "sort",
+                  "{",
+                  "bar",
+                  BCON_INT32 (-1),
+                  "}");
+cursor = mongoc_collection_find (
+   collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
+
+
+

The “find” command takes different options from the traditional OP_QUERY message.

+ +++++ + + + + + + + + + + + + + + + + + + +
Query$queryfilter
Sort$orderbysort
Show record location$showDiskLocshowRecordId
Other $-options$<option name><option name>
+

Most applications should use the OP_QUERY syntax, with “$query”, “$orderby”, and so on, and rely on the driver to convert to the new syntax if needed.

+
+
+

See Also

+

The “find” command in the MongoDB Manual.

+
+
+

The “explain” command

+

With MongoDB before 3.2, a query with option $explain: true returns information about the query plan, instead of the query results. Beginning in MongoDB 3.2, there is a separate “explain” command. The driver will not convert “$explain” queries to “explain” commands, you must call the “explain” command explicitly:

+
/* MongoDB 3.2+, "explain" command syntax */
+command = BCON_NEW ("explain",
+                    "{",
+                    "find",
+                    BCON_UTF8 ("collection_name"),
+                    "filter",
+                    "{",
+                    "foo",
+                    BCON_INT32 (1),
+                    "}",
+                    "}");
+mongoc_collection_command_simple (collection, command, NULL, &reply, &error);
+
+
+
+
+

See Also

+

The “explain” command in the MongoDB Manual.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify.html new file mode 100644 index 0000000..30694fb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify.html @@ -0,0 +1,287 @@ + + + + + + + + mongoc_collection_find_and_modify() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find_and_modify()

+
+

Synopsis

+
bool
+mongoc_collection_find_and_modify (mongoc_collection_t *collection,
+                                   const bson_t *query,
+                                   const bson_t *sort,
+                                   const bson_t *update,
+                                   const bson_t *fields,
+                                   bool _remove,
+                                   bool upsert,
+                                   bool _new,
+                                   bson_t *reply,
+                                   bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • query: A bson_t containing the query to locate target document(s).
  • +
  • sort: A bson_t containing the sort order for query.
  • +
  • update: A bson_t containing an update spec.
  • +
  • fields: An optional bson_t containing the fields to return or NULL.
  • +
  • _remove: If the matching documents should be removed.
  • +
  • upsert: If an upsert should be performed.
  • +
  • _new: If the new version of the document should be returned.
  • +
  • reply: Optional pointer to an uninitialized bson_t that will be initialized with the result.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Update and return an object.

+

This is a thin wrapper around the findAndModify command. Either update or _remove arguments are required.

+

See also: mongoc_collection_find_and_modify_with_opts().

+

As of MongoDB 3.2, the mongoc_write_concern_t specified on the mongoc_collection_t will be used, if any.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns either the document before or after modification based on the _new parameter.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+
+
find-and-modify.c
+
#include <bson/bcon.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_collection_t *collection;
+   mongoc_client_t *client;
+   const char *uri_string =
+      "mongodb://127.0.0.1:27017/?appname=find-and-modify-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   bson_t *query;
+   bson_t *update;
+   bson_t reply;
+   char *str;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   /*
+    * Build our query, {"cmpxchg": 1}
+    */
+   query = BCON_NEW ("cmpxchg", BCON_INT32 (1));
+
+   /*
+    * Build our update. {"$set": {"cmpxchg": 2}}
+    */
+   update = BCON_NEW ("$set", "{", "cmpxchg", BCON_INT32 (2), "}");
+
+   /*
+    * Submit the findAndModify.
+    */
+   if (!mongoc_collection_find_and_modify (collection,
+                                           query,
+                                           NULL,
+                                           update,
+                                           NULL,
+                                           false,
+                                           false,
+                                           true,
+                                           &reply,
+                                           &error)) {
+      fprintf (stderr, "find_and_modify() failure: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   /*
+    * Print the result as JSON.
+    */
+   str = bson_as_canonical_extended_json (&reply, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   /*
+    * Cleanup.
+    */
+   bson_destroy (query);
+   bson_destroy (update);
+   bson_destroy (&reply);
+   mongoc_collection_destroy (collection);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify_with_opts.html new file mode 100644 index 0000000..033dd02 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_and_modify_with_opts.html @@ -0,0 +1,184 @@ + + + + + + + + mongoc_collection_find_and_modify_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find_and_modify_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_find_and_modify_with_opts (
+   mongoc_collection_t *collection,
+   const bson_t *query,
+   const mongoc_find_and_modify_opts_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Update and return an object.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+

See the example code for mongoc_find_and_modify_opts_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes.html new file mode 100644 index 0000000..c19ae97 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_collection_find_indexes() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find_indexes()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_find_indexes (mongoc_collection_t *collection,
+                                bson_error_t *error);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_collection_find_indexes_with_opts() instead.

+

Fetches a cursor containing documents, each corresponding to an index on this collection.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A cursor where each result corresponds to the server’s representation of an index on this collection. If the collection does not exist on the server, the cursor will be empty.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes_with_opts.html new file mode 100644 index 0000000..5b1130a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_indexes_with_opts.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_collection_find_indexes_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find_indexes_with_opts()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_find_indexes_with_opts (mongoc_collection_t *collection,
+                                          const bson_t *opts);
+
+
+

Fetches a cursor containing documents, each corresponding to an index on this collection.

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Errors

+

Use mongoc_cursor_error() on the returned cursor to check for errors.

+
+
+

Returns

+

A cursor where each result corresponds to the server’s representation of an index on this collection. If the collection does not exist on the server, the cursor will be empty.

+

The cursor functions mongoc_cursor_set_limit(), mongoc_cursor_set_batch_size(), and mongoc_cursor_set_max_await_time_ms() have no use on the returned cursor.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_with_opts.html new file mode 100644 index 0000000..c194794 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_find_with_opts.html @@ -0,0 +1,382 @@ + + + + + + + + mongoc_collection_find_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_find_with_opts()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_collection_find_with_opts (mongoc_collection_t *collection,
+                                  const bson_t *filter,
+                                  const bson_t *opts,
+                                  const mongoc_read_prefs_t *read_prefs)
+   BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Query on collection, passing arbitrary query options to the server in opts.

+

To target a specific server, include an integer “serverId” field in opts with an id obtained first by calling mongoc_client_select_server(), then mongoc_server_description_id() on its return value.

+

Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. The highest-priority sources for these options are listed first in the following table. No write concern is applied.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernCollation
read_prefsoptsopts
TransactionTransaction 
collection  
+

See the example for transactions and for the “distinct” command with opts.

+
+
+

Returns

+

A newly allocated mongoc_cursor_t that must be freed with mongoc_cursor_destroy().

+
+
+

Examples

+
+
Print First Ten Documents in a Collection
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+static void
+print_ten_documents (mongoc_collection_t *collection)
+{
+   bson_t *filter;
+   bson_t *opts;
+   mongoc_cursor_t *cursor;
+   bson_error_t error;
+   const bson_t *doc;
+   char *str;
+
+   /* filter by "foo": 1, order by "bar" descending */
+   filter = BCON_NEW ("foo", BCON_INT32 (1));
+   opts = BCON_NEW (
+      "limit", BCON_INT64 (10), "sort", "{", "bar", BCON_INT32 (-1), "}");
+
+   cursor = mongoc_collection_find_with_opts (collection, filter, opts, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "An error occurred: %s\n", error.message);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   bson_destroy (filter);
+   bson_destroy (opts);
+}
+
+
+
+
+
More examples of modifying the query with opts:
+
bson_t *filter;
+bson_t *opts;
+mongoc_read_prefs_t *read_prefs;
+
+filter = BCON_NEW ("foo", BCON_INT32 (1));
+
+/* Include "field_name_one" and "field_name_two" in "projection", omit
+ * others. "_id" must be specifically removed or it is included by default.
+ */
+opts = BCON_NEW ("projection", "{",
+                    "field_name_one", BCON_BOOL (true),
+                    "field_name_two", BCON_BOOL (true),
+                    "_id", BCON_BOOL (false),
+                 "}",
+                 "tailable", BCON_BOOL (true),
+                 "awaitData", BCON_BOOL (true),
+                 "sort", "{", "bar", BCON_INT32 (-1), "}",
+                 "collation", "{",
+                    "locale", BCON_UTF8("en_US"),
+                    "caseFirst", BCON_UTF8 ("lower"),
+                 "}");
+
+read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+
+cursor =
+   mongoc_collection_find_with_opts (collection, filter, opts, read_prefs);
+
+
+
+

The following options are supported.

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionBSON typeOptionBSON type
projectiondocumentmaxdocument
sortdocumentmaxTimeMSnon-negative int64
skipnon-negative int64maxAwaitTimeMSnon-negative int64
limitnon-negative int64mindocument
batchSizenon-negative int64noCursorTimeoutbool
exhaustbooloplogReplaybool
hintstring or documentreadConcerndocument
allowPartialResultsboolreturnKeybool
awaitDataboolsessionId(none)
collationdocumentshowRecordIdbool
commentstringsingleBatchbool
+

All options are documented in the reference page for the “find” command in the MongoDB server manual, except for “maxAwaitTimeMS” and “sessionId”.

+

“maxAwaitTimeMS” is the maximum amount of time for the server to wait on new documents to satisfy a query, if “tailable” and “awaitData” are both true. +If no new documents are found, the tailable cursor receives an empty batch. The “maxAwaitTimeMS” option is ignored for MongoDB older than 3.4.

+

To add a “sessionId”, construct a mongoc_client_session_t with mongoc_client_start_session(). You can begin a transaction with mongoc_client_session_start_transaction(), optionally with a mongoc_transaction_opt_t that overrides the options inherited from collection. Then use mongoc_client_session_append() to add the session to opts. See the example code for mongoc_client_session_t.

+

To add a “readConcern”, construct a mongoc_read_concern_t with mongoc_read_concern_new() and configure it with mongoc_read_concern_set_level(). Then use mongoc_read_concern_append() to add the read concern to opts.

+

For some options like “collation”, the driver returns an error if the server version is too old to support the feature. +Any fields in opts that are not listed here are passed to the server unmodified.

+
+
+

Deprecated Options

+

The snapshot boolean option is removed in MongoDB 4.0. The maxScan option, a non-negative int64, is deprecated in MongoDB 4.0 and will be removed in a future MongoDB version. Both options are supported by the C Driver with older MongoDB versions.

+
+
+

See Also

+

The “find” command in the MongoDB Manual. All options listed there are supported by the C Driver. +For MongoDB servers before 3.2, or for exhaust queries, the driver transparently converts the query to a legacy OP_QUERY message.

+
+
+

The “explain” command

+

With MongoDB before 3.2, a query with option $explain: true returns information about the query plan, instead of the query results. Beginning in MongoDB 3.2, there is a separate “explain” command. The driver will not convert “$explain” queries to “explain” commands, you must call the “explain” command explicitly:

+
/* MongoDB 3.2+, "explain" command syntax */
+command = BCON_NEW ("explain", "{",
+                    "find", BCON_UTF8 ("collection_name"),
+                    "filter", "{", "foo", BCON_INT32 (1), "}",
+                    "}");
+
+mongoc_collection_command_simple (collection, command, NULL, &reply, &error);
+
+
+
+
+

See Also

+

The “explain” command in the MongoDB Manual.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_last_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_last_error.html new file mode 100644 index 0000000..9f9924d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_last_error.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_collection_get_last_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_get_last_error()

+
+

Synopsis

+
const bson_t *
+mongoc_collection_get_last_error (const mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The mongoc_collection_get_last_error() function returns a bulk result. See Bulk Write Operations for examples of bulk results.

+

A write_concern must be at least MONGOC_WRITE_CONCERN_W_DEFAULT in last command execution for this to be available.

+
+
+

Returns

+

A bson_t that should not be modified or NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_name.html new file mode 100644 index 0000000..4548e6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_name.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_get_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_get_name()

+
+

Synopsis

+
const char *
+mongoc_collection_get_name (mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the name of collection.

+
+
+

Returns

+

A string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_concern.html new file mode 100644 index 0000000..f79e0f3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_get_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_get_read_concern()

+
+

Synopsis

+
const mongoc_read_concern_t *
+mongoc_collection_get_read_concern (const mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the default read concern to be used on read operations originating from collection.

+
+
+

Returns

+

A mongoc_read_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_prefs.html new file mode 100644 index 0000000..0824e93 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_read_prefs.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_get_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_get_read_prefs()

+
+

Synopsis

+
const mongoc_read_prefs_t *
+mongoc_collection_get_read_prefs (const mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the default read preferences to use for collection. Operations without specified read-preferences will default to this.

+
+
+

Returns

+

A mongoc_read_prefs_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_write_concern.html new file mode 100644 index 0000000..8b5524e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_get_write_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_get_write_concern()

+
+

Synopsis

+
const mongoc_write_concern_t *
+mongoc_collection_get_write_concern (const mongoc_collection_t *collection);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the default write concern to be used on write operations originating from collection and not specifying a write concern.

+
+
+

Returns

+

A mongoc_write_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert.html new file mode 100644 index 0000000..da91c85 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_collection_insert() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_insert()

+
+

Synopsis

+
bool
+mongoc_collection_insert (mongoc_collection_t *collection,
+                          mongoc_insert_flags_t flags,
+                          const bson_t *document,
+                          const mongoc_write_concern_t *write_concern,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Superseded by mongoc_collection_insert_one() and mongoc_collection_insert_many().

+

This function shall insert document into collection.

+

If no _id element is found in document, then a bson_oid_t will be generated locally and added to the document. If you must know the inserted document’s _id, generate it in your code and include it in the document. The _id you generate can be a bson_oid_t or any other non-array BSON type.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_bulk.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_bulk.html new file mode 100644 index 0000000..6adabb8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_bulk.html @@ -0,0 +1,186 @@ + + + + + + + + mongoc_collection_insert_bulk() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_insert_bulk()

+
+

Synopsis

+
bool
+mongoc_collection_insert_bulk (mongoc_collection_t *collection,
+                               mongoc_insert_flags_t flags,
+                               const bson_t **documents,
+                               uint32_t n_documents,
+                               const mongoc_write_concern_t *write_concern,
+                               bson_error_t *error)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_insert_many);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_collection_insert_many() instead.

+
+
+

Parameters

+ +
+
+

Description

+

This function performs a bulk insert of all of the documents in documents. This function is deprecated as it cannot accurately return which documents may have failed during the bulk insert.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_many.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_many.html new file mode 100644 index 0000000..f2b7425 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_many.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_collection_insert_many() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_insert_many()

+
+

Synopsis

+
bool
+mongoc_collection_insert_many (mongoc_collection_t *collection,
+                               const bson_t **documents,
+                               size_t n_documents,
+                               const bson_t *opts,
+                               bson_t *reply,
+                               bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • documents: An array of pointers to bson_t.
  • +
  • n_documents: The length of documents.
  • +
  • reply: Optional. An uninitialized bson_t populated with the insert result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

Insert documents into collection.

+

To insert a single document, see mongoc_collection_insert_one().

+

For any document that does not have an “_id” field, a bson_oid_t will be generated locally and added to the document. If you must know the inserted document’s _id, generate it in your code and include it in the document. The _id you generate can be a bson_oid_t or any other non-array BSON type.

+

If you pass a non-NULL reply, it is filled out with an “insertedCount” field. If there is a server error then reply may contain a “writeErrors” array and/or a “writeConcernErrors” array (see Bulk Write Operations for examples). The reply must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_one.html new file mode 100644 index 0000000..3f4645e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_insert_one.html @@ -0,0 +1,187 @@ + + + + + + + + mongoc_collection_insert_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_insert_one()

+
+

Synopsis

+
bool
+mongoc_collection_insert_one (mongoc_collection_t *collection,
+                              const bson_t *document,
+                              const bson_t *opts,
+                              bson_t *reply,
+                              bson_error_t *error);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function shall insert document into collection.

+

To insert an array of documents, see mongoc_collection_insert_many().

+

If no _id element is found in document, then a bson_oid_t will be generated locally and added to the document. If you must know the inserted document’s _id, generate it in your code and include it in the document. The _id you generate can be a bson_oid_t or any other non-array BSON type.

+

If you pass a non-NULL reply, it is filled out with an “insertedCount” field. If there is a server error then reply contains either a “writeErrors” array with one subdocument or a “writeConcernErrors” array. The reply must be freed with bson_destroy().

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_keys_to_index_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_keys_to_index_string.html new file mode 100644 index 0000000..191f957 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_keys_to_index_string.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_collection_keys_to_index_string() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_keys_to_index_string()

+
+

Synopsis

+
char *
+mongoc_collection_keys_to_index_string (const bson_t *keys);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function returns the canonical stringification of a given key specification. See Creating Indexes.

+

It is a programming error to call this function on a non-standard index, such one other than a straight index with ascending and descending.

+
+
+

Returns

+

A string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_command_with_opts.html new file mode 100644 index 0000000..f326434 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_command_with_opts.html @@ -0,0 +1,219 @@ + + + + + + + + mongoc_collection_read_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_read_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_read_command_with_opts (mongoc_collection_t *collection,
+                                          const bson_t *command,
+                                          const mongoc_read_prefs_t *read_prefs,
+                                          const bson_t *opts,
+                                          bson_t *reply,
+                                          bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that read, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_collection_command_simple().

+

Use this function for commands that read such as “count” or “distinct”.

+

Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. The highest-priority sources for these options are listed first in the following table. No write concern is applied.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernCollation
read_prefsoptsopts
TransactionTransaction 
collection  
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_write_command_with_opts.html new file mode 100644 index 0000000..e35206a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_read_write_command_with_opts.html @@ -0,0 +1,223 @@ + + + + + + + + mongoc_collection_read_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_read_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_read_write_command_with_opts (
+   mongoc_collection_t *collection,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs /* UNUSED */,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, applying logic for commands that both read and write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_collection_command_simple().

+

Use this function for commands that both read and write, such as “mapReduce” with an output collection.

+

Read and write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. Read preferences are not applied. The write concern is omitted for MongoDB before 3.4.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read ConcernWrite ConcernCollation
optsoptsopts
TransactionTransaction 
collectioncollection 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+

(The mongoc_read_prefs_t parameter was included by mistake when this function was introduced in libmongoc 1.5. A command that writes must not obey a read preference.)

+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: Ignored.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_remove.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_remove.html new file mode 100644 index 0000000..e0bee48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_remove.html @@ -0,0 +1,179 @@ + + + + + + + + mongoc_collection_remove() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_remove()

+
+

Synopsis

+
bool
+mongoc_collection_remove (mongoc_collection_t *collection,
+                          mongoc_remove_flags_t flags,
+                          const bson_t *selector,
+                          const mongoc_write_concern_t *write_concern,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Superseded by mongoc_collection_delete_one() and mongoc_collection_delete_many().

+

This function shall remove documents in the given collection that match selector. The bson selector is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

+

If you want to limit deletes to a single document, provide MONGOC_REMOVE_SINGLE_REMOVE in flags.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename.html new file mode 100644 index 0000000..b981963 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_collection_rename() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_rename()

+
+

Synopsis

+
bool
+mongoc_collection_rename (mongoc_collection_t *collection,
+                          const char *new_db,
+                          const char *new_name,
+                          bool drop_target_before_rename,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • new_db: The name of the new database.
  • +
  • new_name: The new name for the collection.
  • +
  • drop_target_before_rename: If an existing collection matches the new name, drop it before the rename.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

For more information, see mongoc_collection_rename_with_opts(). This function is a thin wrapper, passing NULL in as bson_t parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename_with_opts.html new file mode 100644 index 0000000..5eabbb1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_rename_with_opts.html @@ -0,0 +1,186 @@ + + + + + + + + mongoc_collection_rename_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_rename_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_rename_with_opts (mongoc_collection_t *collection,
+                                    const char *new_db,
+                                    const char *new_name,
+                                    bool drop_target_before_rename,
+                                    const bson_t *opts,
+                                    bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • new_db: The name of the new database.
  • +
  • new_name: The new name for the collection.
  • +
  • drop_target_before_rename: If an existing collection matches the new name, drop it before the rename.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function is a helper to rename an existing collection on a MongoDB server. The name of the collection will also be updated internally so it is safe to continue using this collection after the rename. Additional operations will occur on renamed collection.

+

If no write concern is provided in opts, the collection’s write concern is used.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_replace_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_replace_one.html new file mode 100644 index 0000000..f6528e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_replace_one.html @@ -0,0 +1,195 @@ + + + + + + + + mongoc_collection_replace_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_replace_one()

+
+

Synopsis

+
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);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • selector: A bson_t containing the query to match the document for updating.
  • +
  • replacement: A bson_t containing the replacement document.
  • +
  • reply: Optional. An uninitialized bson_t populated with the update result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function shall replace documents in collection that match selector with replacement.

+

If provided, reply will be initialized and populated with the fields matchedCount, modifiedCount, upsertedCount, and optionally upsertedId if applicable. If there is a server error then reply contains either a writeErrors array with one subdocument or a writeConcernErrors array. The reply must be freed with bson_destroy().

+
+ +
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_save.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_save.html new file mode 100644 index 0000000..45a27aa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_save.html @@ -0,0 +1,184 @@ + + + + + + + + mongoc_collection_save() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_save()

+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_collection_insert_one() or +mongoc_collection_replace_one() with “upsert” instead.

+
+
+

Synopsis

+
bool
+mongoc_collection_save (mongoc_collection_t *collection,
+                        const bson_t *document,
+                        const mongoc_write_concern_t *write_concern,
+                        bson_error_t *error)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_collection_insert_one or
+                             mongoc_collection_replace_one);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall save a document into collection. If the document has an _id field it will be updated. Otherwise it will be inserted.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_concern.html new file mode 100644 index 0000000..0f1fd8e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_concern.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_collection_set_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_set_read_concern()

+
+

Synopsis

+
void
+mongoc_collection_set_read_concern (mongoc_collection_t *collection,
+                                    const mongoc_read_concern_t *read_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the read concern to use for operations on collection.

+

The default read concern is empty: No readConcern is sent to the server unless explicitly configured.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_prefs.html new file mode 100644 index 0000000..1e4c46a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_read_prefs.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_set_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_set_read_prefs()

+
+

Synopsis

+
void
+mongoc_collection_set_read_prefs (mongoc_collection_t *collection,
+                                  const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the default read preferences to use for operations on collection not specifying a read preference.

+

The global default is MONGOC_READ_PRIMARY: if the client is connected to a replica set it reads from the primary, otherwise it reads from the current MongoDB server.

+

Please see the MongoDB website for a description of Read Preferences.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_write_concern.html new file mode 100644 index 0000000..5fb99e6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_set_write_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_collection_set_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_set_write_concern()

+
+

Synopsis

+
void
+mongoc_collection_set_write_concern (
+   mongoc_collection_t *collection,
+   const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the write concern to use for operations on collection.

+

The default write concern is MONGOC_WRITE_CONCERN_W_DEFAULT: the driver blocks awaiting basic acknowledgement of write operations from MongoDB. This is the correct write concern for the great majority of applications.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_stats.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_stats.html new file mode 100644 index 0000000..18afe0f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_stats.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_collection_stats() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_stats()

+
+

Synopsis

+
bool
+mongoc_collection_stats (mongoc_collection_t *collection,
+                         const bson_t *options,
+                         bson_t *reply,
+                         bson_error_t *error) BSON_GNUC_DEPRECATED;
+
+
+
+
+

Deprecated

+

This helper function is deprecated and should not be used in new code. Run the collStats command directly with mongoc_client_read_command_with_opts() instead.

+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • options: An optional bson_t containing extra options to pass to the collStats command.
  • +
  • reply: An uninitialized bson_t to store the result.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Run the collStats command to retrieve statistics about the collection.

+

The command uses the mongoc_read_prefs_t set on collection.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

reply is always initialized and must be freed with bson_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_t.html new file mode 100644 index 0000000..f57caae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_t.html @@ -0,0 +1,216 @@ + + + + + + + + mongoc_collection_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_collection_t mongoc_collection_t;
+
+
+

mongoc_collection_t provides access to a MongoDB collection. This handle is useful for actions for most CRUD operations, I.e. insert, update, delete, find, etc.

+
+
+

Read Preferences and Write Concerns

+

Read preferences and write concerns are inherited from the parent client. They can be overridden by set_* commands if so desired.

+
+
+

Functions

+
+ +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update.html new file mode 100644 index 0000000..602d52f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update.html @@ -0,0 +1,182 @@ + + + + + + + + mongoc_collection_update() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_update()

+
+

Synopsis

+
bool
+mongoc_collection_update (mongoc_collection_t *collection,
+                          mongoc_update_flags_t flags,
+                          const bson_t *selector,
+                          const bson_t *update,
+                          const mongoc_write_concern_t *write_concern,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Superseded by mongoc_collection_update_one(), mongoc_collection_update_many(), and mongoc_collection_replace_one().

+

This function shall update documents in collection that match selector.

+

By default, updates only a single document. Set flags to MONGOC_UPDATE_MULTI_UPDATE to update multiple documents.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_many.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_many.html new file mode 100644 index 0000000..dbeef70 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_many.html @@ -0,0 +1,196 @@ + + + + + + + + mongoc_collection_update_many() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_update_many()

+
+

Synopsis

+
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);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • selector: A bson_t containing the query to match documents for updating.
  • +
  • update: A bson_t containing the update to perform.
  • +
  • reply: Optional. An uninitialized bson_t populated with the update result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function updates all documents in collection that match selector.

+

To update at most one document see mongoc_collection_update_one().

+

If you pass a non-NULL reply, it is filled out with fields matchedCount, modifiedCount, and optionally upsertedId if applicable. If there is a server error then reply contains either a “writeErrors” array with one subdocument or a “writeConcernErrors” array. The reply must be freed with bson_destroy().

+
+
+

See Also

+

MongoDB update command documentation for more information on the update options.

+

mongoc_collection_update_one()

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_one.html new file mode 100644 index 0000000..d016cd5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_update_one.html @@ -0,0 +1,274 @@ + + + + + + + + mongoc_collection_update_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_update_one()

+
+

Synopsis

+
bool
+mongoc_collection_update_one (mongoc_collection_t *collection,
+                              const bson_t *selector,
+                              const bson_t *update,
+                              const bson_t *opts,
+                              bson_t *reply,
+                              bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • selector: A bson_t containing the query to match the document for updating.
  • +
  • update: A bson_t containing the update to perform.
  • +
  • reply: Optional. An uninitialized bson_t populated with the update result, or NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function updates at most one document in collection that matches selector.

+

To update multiple documents see mongoc_collection_update_many().

+

If you pass a non-NULL reply, it is filled out with fields matchedCount, modifiedCount, and optionally upsertedId if applicable. If there is a server error then reply contains either a “writeErrors” array with one subdocument or a “writeConcernErrors” array. The reply must be freed with bson_destroy().

+
+ +
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+
+
example-update.c
+
#include "mongoc/mongoc.h"
+
+int
+main (int argc, char **argv)
+{
+   bson_t *to_insert = BCON_NEW ("_id", BCON_INT32 (1));
+   bson_t *selector = BCON_NEW ("_id", "{", "$gt", BCON_INT32 (0), "}");
+   bson_t *update = BCON_NEW ("$set", "{", "x", BCON_INT32 (1), "}");
+   const bson_t *next_doc;
+   char *to_str;
+   bson_error_t error = {0};
+   mongoc_cursor_t *cursor;
+   mongoc_client_t *client;
+   mongoc_collection_t *coll;
+   const char *uri_string = "mongodb://localhost:27017/?appname=example-update";
+   mongoc_uri_t *uri = mongoc_uri_new_with_error (uri_string, &error);
+
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   coll = mongoc_client_get_collection (client, "db", "example_coll");
+
+   mongoc_client_set_error_api (client, 2);
+   /* insert a document */
+   if (!mongoc_collection_insert_one (coll, to_insert, NULL, NULL, &error)) {
+      fprintf (stderr, "insert failed: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   if (!mongoc_collection_update_one (
+          coll, selector, update, NULL, NULL, &error)) {
+      fprintf (stderr, "update failed: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   to_str = bson_as_relaxed_extended_json (to_insert, NULL);
+   printf ("inserted: %s\n", to_str);
+   bson_free (to_str);
+
+   cursor = mongoc_collection_find_with_opts (coll, selector, NULL, NULL);
+   BSON_ASSERT (mongoc_cursor_next (cursor, &next_doc));
+   printf ("after update, collection has the following document:\n");
+
+   to_str = bson_as_relaxed_extended_json (next_doc, NULL);
+   printf ("%s\n", to_str);
+   bson_free (to_str);
+
+   BSON_ASSERT (mongoc_collection_drop (coll, NULL));
+
+   bson_destroy (to_insert);
+   bson_destroy (update);
+   bson_destroy (selector);
+   mongoc_collection_destroy (coll);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_validate.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_validate.html new file mode 100644 index 0000000..d462d8d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_validate.html @@ -0,0 +1,182 @@ + + + + + + + + mongoc_collection_validate() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_validate()

+
+

Synopsis

+
bool
+mongoc_collection_validate (mongoc_collection_t *collection,
+                            const bson_t *options,
+                            bson_t *reply,
+                            bson_error_t *error);
+
+
+
+
+

Deprecated

+

This helper function is deprecated and should not be used in new code. Run the validate command directly with mongoc_client_read_command_with_opts() instead.

+
+
+

Parameters

+ +
+
+

Description

+

This function is a helper function to execute the validate MongoDB command.

+

Currently, the only supported options are full, which is a boolean and scandata, also a boolean.

+

See the MongoDB documentation for more information on this command.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

reply is always initialized if it’s not NULL and must be destroyed with bson_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_watch.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_watch.html new file mode 100644 index 0000000..4b1cc39 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_watch.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_collection_watch() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_watch()

+
+

Synopsis

+
mongoc_change_stream_t*
+mongoc_collection_watch (const mongoc_collection_t *coll,
+                         const bson_t *pipeline,
+                         const bson_t *opts);
+
+
+

A helper function to create a change stream. It is preferred to call this +function over using a raw aggregation to create a change stream.

+

This function uses the read preference and read concern of the collection. If +the change stream needs to re-establish connection, the same read preference +will be used. This may happen if the change stream encounters a resumable error.

+
+

Warning

+

A change stream is only supported with majority read concern.

+
+
+
+

Parameters

+
    +
  • coll: A mongoc_collection_t specifying the collection which the change stream listens to.
  • +
  • pipeline: A bson_t representing an aggregation pipeline appended to the change stream. This may be an empty document.
  • +
  • opts: A bson_t containing change stream options or NULL.
  • +
+

opts may be NULL or a document consisting of any subset of the following +parameters:

+
    +
  • batchSize An int32 representing number of documents requested to be returned on each call to mongoc_change_stream_next()
  • +
  • resumeAfter A Document representing the logical starting point of the change stream. The _id field of any change received from a change stream can be used here.
  • +
  • startAtOperationTime A Timestamp. The change stream only provides changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here.
  • +
  • maxAwaitTimeMS An int64 representing the maximum amount of time a call to mongoc_change_stream_next() will block waiting for data
  • +
  • collation A Collation Document
  • +
+
+
+

Returns

+

A newly allocated mongoc_change_stream_t which must be freed with +mongoc_change_stream_destroy() when no longer in use. The returned +mongoc_change_stream_t is never NULL. If there is an error, it can +be retrieved with mongoc_change_stream_error_document(), and subsequent +calls to mongoc_change_stream_next() will return false.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_write_command_with_opts.html new file mode 100644 index 0000000..ddeea7b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_collection_write_command_with_opts.html @@ -0,0 +1,216 @@ + + + + + + + + mongoc_collection_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_collection_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_collection_write_command_with_opts (mongoc_collection_t *collection,
+                                           const bson_t *command,
+                                           const bson_t *opts,
+                                           bson_t *reply,
+                                           bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_collection_command_simple().

+

Use this function for commands that write such as “drop” or “createRole” (but not for “insert”, “update”, or “delete”, see Basic Write Operations). Write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. The write concern is omitted for MongoDB before 3.4.

+ ++++ + + + + + + + + + + + + + + + + +
Write ConcernCollation
optsopts
Transaction 
collection 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+
    +
  • collection: A mongoc_collection_t.
  • +
  • command: A bson_t containing the command specification.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Basic Write Operations

+

Do not use this function to call the basic write commands “insert”, “update”, and “delete”. Those commands require special logic not implemented in mongoc_collection_write_command_with_opts. For basic write operations use CRUD functions such as mongoc_collection_insert_one() and the others described in the CRUD tutorial, or use the Bulk API.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_clone.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_clone.html new file mode 100644 index 0000000..51c841b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_clone.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_cursor_clone() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_clone()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_cursor_clone (const mongoc_cursor_t *cursor)
+   BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall create a copy of a mongoc_cursor_t. The cloned cursor will be reset to the beginning of the query, and therefore the query will be re-executed on the MongoDB server when mongoc_cursor_next() is called.

+
+
+

Returns

+

A newly allocated mongoc_cursor_t that should be freed with mongoc_cursor_destroy() when no longer in use.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_current.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_current.html new file mode 100644 index 0000000..1470e26 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_current.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_cursor_current() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_current()

+
+

Synopsis

+
const bson_t *
+mongoc_cursor_current (const mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the cursors current document or NULL if there has been an error.

+
+
+

Returns

+

A bson_t that should not be modified or freed or NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_destroy.html new file mode 100644 index 0000000..1beadfc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_cursor_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_destroy()

+
+

Synopsis

+
void
+mongoc_cursor_destroy (mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees a mongoc_cursor_t and releases all associated resources. If a server-side cursor has been allocated, it will be released as well. Does nothing if cursor is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error.html new file mode 100644 index 0000000..ec4d194 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_cursor_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_error()

+
+

Synopsis

+
bool
+mongoc_cursor_error (mongoc_cursor_t *cursor, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function checks to see if an error has occurred while iterating the cursor.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

false if no error has occurred, otherwise true and error is set.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error_document.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error_document.html new file mode 100644 index 0000000..85e0dd8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_error_document.html @@ -0,0 +1,269 @@ + + + + + + + + mongoc_cursor_error_document() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_error_document()

+
+

Synopsis

+
bool
+mongoc_cursor_error_document (mongoc_cursor_t *cursor,
+                              bson_error_t *error,
+                              const bson_t **reply);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function checks to see if an error has occurred while iterating the cursor.

+

If an error occurred client-side, for example if there was a network error or timeout, or the cursor was created with invalid parameters, then reply is set to an empty BSON document. If an error occurred server-side, reply is set to the server’s reply document with information about the error.

+
+
+

Errors

+

Errors are propagated via the error and reply parameters.

+
+
+

Returns

+

False if no error has occurred, otherwise true and error is set.

+

If the function returns true and reply is not NULL, then reply is set to a pointer to a BSON document, which is either empty or the server’s error response. The document is invalid after the cursor is freed with mongoc_cursor_destroy().

+
+
+

Example

+

This example shows the difference between a client-side and server-side error. If the client cannot connect to the server, for example, the error message includes “No suitable servers found” and reply is set to an empty BSON document.

+

On the other hand, if the client connects to the server successfully and attempts to execute an invalid query, the error message comes from the server and reply is set to the server’s reply document, with fields errmsg and code.

+
void
+run_query (const char *uri_str, const bson_t *query)
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_cursor_t *cursor;
+   const bson_t *doc;
+   bson_error_t error;
+   const bson_t *reply;
+   char *str;
+
+   client = mongoc_client_new (uri_str);
+
+   mongoc_client_set_error_api (client, 2);
+
+   collection = mongoc_client_get_collection (client, "db", "collection");
+   cursor = mongoc_collection_find_with_opts (
+      collection,
+      query,
+      NULL,  /* additional options */
+      NULL); /* read prefs, NULL for default */
+
+   /* this loop is never run: mongoc_cursor_next immediately returns false */
+   while (mongoc_cursor_next (cursor, &doc)) {
+   }
+
+   if (mongoc_cursor_error_document (cursor, &error, &reply)) {
+      str = bson_as_json (reply, NULL);
+      fprintf (stderr, "Cursor Failure: %s\nReply: %s\n", error.message, str);
+      bson_free (str);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+}
+
+int
+main (int argc, char *argv[])
+{
+   bson_t *good_query;
+   bson_t *bad_query;
+
+   mongoc_init ();
+
+   /* find documents matching the query {"x": 1} */
+   good_query = BCON_NEW ("x", BCON_INT64 (1));
+
+   /* Cause a network error. This will print an error and empty reply document:
+    *
+    * Cursor Failure: No suitable servers found (`serverSelectionTryOnce` set):
+    *     [Failed to resolve 'fake-domain']
+    *
+    * Reply: { }
+    *
+    */
+   run_query ("mongodb://fake-domain/?appname=cursor-example", good_query);
+
+   /* invalid: {"x": {"$badOperator": 1}} */
+   bad_query = BCON_NEW ("x", "{", "$badOperator", BCON_INT64 (1), "}");
+
+   /* Cause a server error. This will print an error and server reply document:
+    *
+    * Cursor Failure: unknown operator: $badOperator
+    *
+    * Reply:
+    * {"ok": 0.0,
+    *  "errmsg":"unknown operator: $badOperator",
+    *  "code": 2,
+    *  "codeName":"BadValue"
+    * }
+    *
+    */
+   run_query ("mongodb://localhost/?appname=cursor-example", bad_query);
+
+   bson_destroy (good_query);
+   bson_destroy (bad_query);
+
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
+

See Also:

+

+

mongoc_cursor_error

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_batch_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_batch_size.html new file mode 100644 index 0000000..a9e92f6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_batch_size.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_cursor_get_batch_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_batch_size()

+
+

Synopsis

+
uint32_t
+mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieve the cursor’s batch size, the maximum number of documents returned per round trip to the server. A batch size of zero means the cursor accepts the server’s maximum batch size.

+

See Cursor Batches in the MongoDB Manual.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_hint.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_hint.html new file mode 100644 index 0000000..2369896 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_hint.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_cursor_get_hint() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_hint()

+
+

Synopsis

+
uint32_t
+mongoc_cursor_get_hint (const mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieves the opaque id of the server used for the operation.

+

(The function name includes the old term “hint” for the sake of backward compatibility, but we now call this number a “server id”.)

+

This number is zero until the driver actually uses a server when executing the find operation or mongoc_cursor_set_hint() is called.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_host.html new file mode 100644 index 0000000..c062612 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_host.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_cursor_get_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_host()

+
+

Synopsis

+
void
+mongoc_cursor_get_host (mongoc_cursor_t *cursor, mongoc_host_list_t *host);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the MongoDB host that the cursor is communicating with in the host out parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_id.html new file mode 100644 index 0000000..7e5b801 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_id.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_cursor_get_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_id()

+
+

Synopsis

+
int64_t
+mongoc_cursor_get_id (const mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieves the cursor id used by the server to track the cursor.

+

This number is zero until the driver actually uses a server when executing the query, and after it has fetched all results from the server.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_limit.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_limit.html new file mode 100644 index 0000000..2b74e6f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_limit.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_cursor_get_limit() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_limit()

+
+

Synopsis

+
int64_t
+mongoc_cursor_get_limit (mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Return the value set with mongoc_cursor_set_limit() or mongoc_collection_find().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_max_await_time_ms.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_max_await_time_ms.html new file mode 100644 index 0000000..c5cd071 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_get_max_await_time_ms.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_cursor_get_max_await_time_ms() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_get_max_await_time_ms()

+
+

Synopsis

+
uint32_t
+mongoc_cursor_get_max_await_time_ms (mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieve the value set with mongoc_cursor_set_max_await_time_ms().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_is_alive.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_is_alive.html new file mode 100644 index 0000000..2550cb4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_is_alive.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_cursor_is_alive() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_is_alive()

+
+

Synopsis

+
bool
+mongoc_cursor_is_alive (const mongoc_cursor_t *cursor)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_more);
+
+
+
+
+

Parameters

+ +
+
+

Deprecated

+

This function is superseded by mongoc_cursor_more(), which has equivalent behavior.

+
+
+

Returns

+

See mongoc_cursor_more().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_more.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_more.html new file mode 100644 index 0000000..621cf73 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_more.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_cursor_more() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_more()

+
+

Synopsis

+
bool
+mongoc_cursor_more (mongoc_cursor_t *cursor);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall indicate if there is potentially more data to be read from the cursor. This is only useful with tailable cursors. Use mongoc_cursor_next() for regular cursors.

+

Details: mongoc_cursor_more is unreliable because it does not contact the server to see if there are actually more documents in the result set. It simply returns true if the cursor has not begun, or if it has begun and there are buffered documents in the client-side cursor, or if it has begun and the server has not yet told the cursor it is completely iterated.

+

This is unreliable with regular queries because it returns true for a new cursor before iteration, even if the cursor will match no documents. It is also true if the collection has been dropped on the server since the previous fetch, or if the cursor has finished its final batch and the next batch will be empty.

+
+
+

Returns

+

true if the cursor has locally-buffered documents, or if a round-trip to the server might fetch additional documents.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply.html new file mode 100644 index 0000000..3914f95 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_cursor_new_from_command_reply() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_new_from_command_reply()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
+                                      bson_t *reply,
+                                      uint32_t server_id);
+   BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_cursor_new_from_command_reply_with_opts() instead.

+

When migrating from the deprecated mongoc_cursor_new_from_command_reply() to mongoc_cursor_new_from_command_reply_with_opts(), +note that options previously passed to the reply argument (e.g. “batchSize”) must instead be provided in the opts argument.

+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • reply: The reply to a command, such as “aggregate”, “find”, or “listCollections”, that returns a cursor document. The reply is destroyed by mongoc_cursor_new_from_command_reply and must not be accessed afterward.
  • +
  • server_id: The opaque id of the server used to execute the command.
  • +
+
+
+

Description

+

Some MongoDB commands return a “cursor” document. For example, given an “aggregate” command:

+
{ "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
+
+
+

The server replies:

+
{
+   "cursor" : {
+      "id" : 1234,
+      "ns" : "db.collection",
+      "firstBatch" : [ ]
+   },
+   "ok" : 1
+}
+
+
+

mongoc_cursor_new_from_command_reply is a low-level function that initializes a mongoc_cursor_t from such a reply. Additional options such as “tailable” or “awaitData” can be included in the reply.

+

When synthesizing a completed cursor response that has no more batches (i.e. with cursor id 0), set server_id to 0 as well.

+

Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions such as mongoc_collection_aggregate() are more appropriate, and ensure compatibility with a range of MongoDB versions.

+
+
+

Returns

+

A mongoc_cursor_t. On failure, the cursor’s error is set. Check for failure with mongoc_cursor_error().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply_with_opts.html new file mode 100644 index 0000000..37b92f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_new_from_command_reply_with_opts.html @@ -0,0 +1,196 @@ + + + + + + + + mongoc_cursor_new_from_command_reply_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_new_from_command_reply_with_opts()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_cursor_new_from_command_reply_with_opts (mongoc_client_t *client,
+                                                bson_t *reply,
+                                                const bson_t *opts);
+
+
+
+
+

Parameters

+
    +
  • client: A mongoc_client_t.
  • +
  • reply: The reply to a command, such as “aggregate”, “find”, or “listCollections”, that returns a cursor document. The reply is destroyed by mongoc_cursor_new_from_command_reply_with_opts and must not be accessed afterward.
  • +
  • opts: A bson_t.
  • +
+

opts may be NULL or a BSON document with additional options, which have the same meaning for this function as for mongoc_collection_find_with_opts():

+
    +
  • awaitData
  • +
  • batchSize
  • +
  • limit
  • +
  • maxAwaitTimeMS
  • +
  • serverId
  • +
  • sessionId
  • +
  • skip
  • +
  • tailable
  • +
+
+
+

Description

+

Some MongoDB commands return a “cursor” document. For example, given an “aggregate” command:

+
{ "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
+
+
+

The server replies:

+
{
+   "cursor" : {
+      "id" : 1234,
+      "ns" : "db.collection",
+      "firstBatch" : [ ]
+   },
+   "ok" : 1
+}
+
+
+

mongoc_cursor_new_from_command_reply_with_opts is a low-level function that initializes a mongoc_cursor_t from such a reply.

+

Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions such as mongoc_collection_aggregate() are more appropriate, and ensure compatibility with a range of MongoDB versions.

+
+
+

Returns

+

A mongoc_cursor_t. On failure, the cursor’s error is set. Check for failure with mongoc_cursor_error().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_next.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_next.html new file mode 100644 index 0000000..8be96f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_next.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_cursor_next() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_next()

+
+

Synopsis

+
bool
+mongoc_cursor_next (mongoc_cursor_t *cursor, const bson_t **bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall iterate the underlying cursor, setting bson to the next document.

+

This function is a blocking function.

+
+
+

Returns

+

This function returns true if a valid bson document was read from the cursor. Otherwise, false if there was an error or the cursor was exhausted.

+

Errors can be determined with the mongoc_cursor_error() function.

+
+
+

Lifecycle

+

The bson objects set in this function are ephemeral and good until the next call. This means that you must copy the returned bson if you wish to retain it beyond the lifetime of a single call to mongoc_cursor_next().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_batch_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_batch_size.html new file mode 100644 index 0000000..e931bdc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_batch_size.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_cursor_set_batch_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_set_batch_size()

+
+

Synopsis

+
void
+mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor, uint32_t batch_size);
+
+
+
+
+

Parameters

+
    +
  • cursor: A mongoc_cursor_t.
  • +
  • batch_size: The requested number of documents per batch.
  • +
+
+
+

Description

+

Limits the number of documents returned in one batch. Each batch requires a round trip to the server. If the batch size is zero, the cursor uses the server-defined maximum batch size.

+

See Cursor Batches in the MongoDB Manual.

+

This is not applicable to all cursors. Calling mongoc_cursor_set_batch_size() on a cursor returned by mongoc_client_find_databases_with_opts(), mongoc_database_find_collections_with_opts(), or mongoc_collection_find_indexes_with_opts() will not change the results.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_hint.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_hint.html new file mode 100644 index 0000000..845cecb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_hint.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_cursor_set_hint() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_set_hint()

+
+

Synopsis

+
bool
+mongoc_cursor_set_hint (mongoc_cursor_t *cursor, uint32_t server_id);
+
+
+
+
+

Parameters

+
    +
  • cursor: A mongoc_cursor_t.
  • +
  • server_id: An opaque id identifying the server to use.
  • +
+
+
+

Description

+

Specifies which server to use for the operation. This function has an effect only if called before the find operation is executed.

+

(The function name includes the old term “hint” for the sake of backward compatibility, but we now call this number a “server id”.)

+

Use mongoc_cursor_set_hint only for building a language driver that wraps the C Driver. When writing applications in C, leave the server id unset and allow the driver to choose a suitable server from the find operation’s read preference.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_limit.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_limit.html new file mode 100644 index 0000000..41718af --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_limit.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_cursor_set_limit() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_set_limit()

+
+

Synopsis

+
bool
+mongoc_cursor_set_limit (mongoc_cursor_t *cursor, int64_t limit);
+
+
+
+
+

Parameters

+
    +
  • cursor: A mongoc_cursor_t.
  • +
  • limit: The maximum number of documents to retrieve for this query.
  • +
+
+
+

Description

+

Limits the number of documents in the result set.

+

This function is useful for setting the limit on a cursor after the cursor is created, but before any calls to mongoc_cursor_next(). It can also be used to pass a negative limit: The limit parameter to mongoc_cursor_set_limit is signed, although for backward-compatibility reasons the limit parameter to mongoc_collection_find() is not.

+

Calling this function after mongoc_cursor_next() has no effect.

+

This is not applicable to all cursors. Calling mongoc_cursor_set_limit() on a cursor returned by mongoc_client_find_databases_with_opts(), mongoc_database_find_collections_with_opts(), or mongoc_collection_find_indexes_with_opts() will not change the results.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and leaves the limit unchanged.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_max_await_time_ms.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_max_await_time_ms.html new file mode 100644 index 0000000..be5c3ea --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_set_max_await_time_ms.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_cursor_set_max_await_time_ms() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_set_max_await_time_ms()

+
+

Synopsis

+
void
+mongoc_cursor_set_max_await_time_ms (mongoc_cursor_t *cursor,
+                                     uint32_t max_await_time_ms);
+
+
+
+
+

Parameters

+
    +
  • cursor: A mongoc_cursor_t.
  • +
  • max_await_time_ms: A timeout in milliseconds.
  • +
+
+
+

Description

+

The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. Only applies if the cursor is created from mongoc_collection_find_with_opts() with “tailable” and “awaitData” options, and the server is MongoDB 3.2 or later. See the documentation for maxTimeMS and the “getMore” command.

+

The max_await_time_ms cannot be changed after the first call to mongoc_cursor_next().

+

This is not applicable to all cursors. Calling mongoc_cursor_set_batch_size() on a cursor returned by mongoc_client_find_databases_with_opts(), mongoc_database_find_collections_with_opts(), or mongoc_collection_find_indexes_with_opts() will not change the results.

+

Note: although max_await_time_ms is a uint32_t, it is possible to set it as a uint64_t through the options arguments in some cursor returning functions like mongoc_collection_find_with_opts().

+
+
+

See Also

+

Tailable Cursors.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_t.html new file mode 100644 index 0000000..01a2dac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_cursor_t.html @@ -0,0 +1,281 @@ + + + + + + + + mongoc_cursor_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_cursor_t

+

Client-side cursor abstraction

+
+

Synopsis

+
typedef struct _mongoc_cursor_t mongoc_cursor_t;
+
+
+

mongoc_cursor_t provides access to a MongoDB query cursor. +It wraps up the wire protocol negotiation required to initiate a query and retrieve an unknown number of documents.

+

Common cursor operations include:

+ +

Cursors are lazy, meaning that no connection is established and no network traffic occurs until the first call to mongoc_cursor_next().

+
+
+

Thread Safety

+

mongoc_cursor_t is NOT thread safe. It may only be used from within the thread in which it was created.

+
+
+

Example

+
+
Query MongoDB and iterate results
+
/* gcc example-client.c -o example-client $(pkg-config --cflags --libs
+ * libmongoc-1.0) */
+
+/* ./example-client [CONNECTION_STRING [COLLECTION_NAME]] */
+
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_cursor_t *cursor;
+   bson_error_t error;
+   const bson_t *doc;
+   const char *collection_name = "test";
+   bson_t query;
+   char *str;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=client-example";
+   mongoc_uri_t *uri;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   if (argc > 2) {
+      collection_name = argv[2];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+
+   bson_init (&query);
+
+#if 0
+   bson_append_utf8 (&query, "hello", -1, "world", -1);
+#endif
+
+   collection = mongoc_client_get_collection (client, "test", collection_name);
+   cursor = mongoc_collection_find_with_opts (
+      collection,
+      &query,
+      NULL,  /* additional options */
+      NULL); /* read prefs, NULL for default */
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      fprintf (stdout, "%s\n", str);
+      bson_free (str);
+   }
+
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Cursor Failure: %s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   bson_destroy (&query);
+   mongoc_cursor_destroy (cursor);
+   mongoc_collection_destroy (collection);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_add_user.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_add_user.html new file mode 100644 index 0000000..eed9ad0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_add_user.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_database_add_user() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_add_user()

+
+

Synopsis

+
bool
+mongoc_database_add_user (mongoc_database_t *database,
+                          const char *username,
+                          const char *password,
+                          const bson_t *roles,
+                          const bson_t *custom_data,
+                          bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • username: The name of the user.
  • +
  • password: The cleartext password for the user.
  • +
  • roles: An optional bson_t for roles.
  • +
  • custom_data: A optional bson_t for extra data.
  • +
  • error: A location for a bson_error_t or NULL.
  • +
+

This function shall create a new user with access to database.

+
+

Warning

+

Do not call this function without TLS.

+
+
+
+

Errors

+

Errors are returned through the error parameter and can include socket or other server side failures.

+
+
+

Returns

+

Returns true if the user was successfully added. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command.html new file mode 100644 index 0000000..7c352d5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_database_command() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_command()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_database_command (mongoc_database_t *database,
+                         mongoc_query_flags_t flags,
+                         uint32_t skip,
+                         uint32_t limit,
+                         uint32_t batch_size,
+                         const bson_t *command,
+                         const bson_t *fields,
+                         const mongoc_read_prefs_t *read_prefs);
+
+
+

This function is superseded by mongoc_database_command_with_opts(), mongoc_database_read_command_with_opts(), mongoc_database_write_command_with_opts(), and mongoc_database_read_write_command_with_opts().

+
+
+

Description

+

This function creates a cursor which will execute the command when mongoc_cursor_next() is called on it. The database’s read preference, read concern, and write concern are not applied to the command, and mongoc_cursor_next() will not check the server response for a write concern error or write concern timeout.

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • flags: A mongoc_query_flags_t.
  • +
  • skip: The number of documents to skip on the server.
  • +
  • limit: The maximum number of documents to return from the cursor.
  • +
  • batch_size: Attempt to batch results from the server in groups of batch_size documents.
  • +
  • command: A bson_t containing the command.
  • +
  • fields: An optional bson_t containing the fields to return. NULL for all fields.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
+
+
+

Returns

+

A mongoc_cursor_t.

+

The cursor should be freed with mongoc_cursor_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_simple.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_simple.html new file mode 100644 index 0000000..e8890dd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_simple.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_database_command_simple() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_command_simple()

+
+

Synopsis

+
bool
+mongoc_database_command_simple (mongoc_database_t *database,
+                                const bson_t *command,
+                                const mongoc_read_prefs_t *read_prefs,
+                                bson_t *reply,
+                                bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • command: A bson_t containing the command.
  • +
  • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command uses mode MONGOC_READ_PRIMARY.
  • +
  • reply: A location to store the commands first result document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

This is a simplified interface to mongoc_database_command() that returns the first result document. The database’s read preference, read concern, and write concern are not applied to the command. The parameter reply is initialized even upon failure to simplify memory management.

+
+
+

Errors

+

Errors are propagated through the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

This function does not check the server response for a write concern error or write concern timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_with_opts.html new file mode 100644 index 0000000..17184d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_command_with_opts.html @@ -0,0 +1,227 @@ + + + + + + + + mongoc_database_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_database_command_with_opts (
+   mongoc_database_t *database,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, interpreting opts according to the MongoDB server version. To send a raw command to the server without any of this logic, use mongoc_client_command_simple().

+

Read preferences, read and write concern, and collation can be overridden by various sources. The highest-priority sources for these options are listed first:

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernWrite ConcernCollation
read_prefsoptsoptsopts
TransactionTransactionTransaction 
database   
+

In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. +See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

The reply is not parsed for a write concern timeout or write concern error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_copy.html new file mode 100644 index 0000000..6998850 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_copy.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_database_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_copy()

+
+

Synopsis

+
mongoc_database_t *
+mongoc_database_copy (mongoc_database_t *database);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a deep copy of the database struct and its configuration. Useful if you intend to call mongoc_database_set_write_concern(), mongoc_database_set_read_prefs(), or mongoc_database_set_read_concern(), and want to preserve an unaltered copy of the struct.

+

This function does not copy the contents of the database on the MongoDB server; use the copydb command for that purpose.

+
+
+

Returns

+

A newly allocated mongoc_database_t that should be freed with mongoc_database_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_create_collection.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_create_collection.html new file mode 100644 index 0000000..242a364 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_create_collection.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_database_create_collection() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_create_collection()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_database_create_collection (mongoc_database_t *database,
+                                   const char *name,
+                                   const bson_t *opts,
+                                   bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • name: The name of the new collection.
  • +
  • opts: An optional bson_t for opts to the create command.
  • +
  • error: A location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

This function creates a mongoc_collection_t from the given mongoc_database_t.

+

If no write concern is provided in opts, the database’s write concern is used.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

This function returns a newly allocated mongoc_collection_t upon success, NULL upon failure and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_destroy.html new file mode 100644 index 0000000..afbc49e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_database_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_destroy()

+
+

Synopsis

+
void
+mongoc_database_destroy (mongoc_database_t *database);
+
+
+

Releases all resources associated with database, including freeing the structure. Does nothing if database is NULL.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop.html new file mode 100644 index 0000000..5f4d0a6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_drop() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_drop()

+
+

Synopsis

+
bool
+mongoc_database_drop (mongoc_database_t *database, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

For more information, see mongoc_database_drop_with_opts(). This function is a thin wrapper, passing NULL in as bson_t parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop_with_opts.html new file mode 100644 index 0000000..c44cb3e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_drop_with_opts.html @@ -0,0 +1,180 @@ + + + + + + + + mongoc_database_drop_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_drop_with_opts()

+
+

Synopsis

+
bool
+mongoc_database_drop_with_opts (mongoc_database_t *database,
+                                const bson_t *opts,
+                                bson_error_t *error);
+
+
+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +
+
+

Description

+

This function attempts to drop a database on the MongoDB server.

+

If no write concern is provided in opts, the database’s write concern is used.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections.html new file mode 100644 index 0000000..09014d2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections.html @@ -0,0 +1,179 @@ + + + + + + + + mongoc_database_find_collections() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_find_collections()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_database_find_collections (mongoc_database_t *database,
+                                  const bson_t *filter,
+                                  bson_error_t *error)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_database_find_collections_with_opts);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_database_find_collections_with_opts() instead.

+
+
+

Description

+

Fetches a cursor containing documents, each corresponding to a collection on this database.

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • filter: A matcher used by the server to filter the returned collections. May be NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A cursor where each result corresponds to the server’s representation of a collection in this database.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections_with_opts.html new file mode 100644 index 0000000..4bbc377 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_find_collections_with_opts.html @@ -0,0 +1,210 @@ + + + + + + + + mongoc_database_find_collections_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_find_collections_with_opts()

+
+

Synopsis

+
mongoc_cursor_t *
+mongoc_database_find_collections_with_opts (mongoc_database_t *database,
+                                            const bson_t *opts);
+
+
+

Fetches a cursor containing documents, each corresponding to a collection on this database.

+

To get collection names only, use mongoc_database_get_collection_names_with_opts().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

For a list of all options, see the MongoDB Manual entry on the listCollections command.

+
+
+

Errors

+

Use mongoc_cursor_error() on the returned cursor to check for errors.

+
+
+

Returns

+

A cursor where each result corresponds to the server’s representation of a collection in this database.

+

The cursor functions mongoc_cursor_set_limit(), mongoc_cursor_set_batch_size(), and mongoc_cursor_set_max_await_time_ms() have no use on the returned cursor.

+
+
+

Examples

+
{
+   bson_t opts = BSON_INITIALIZER;
+   bson_t name_filter;
+   const bson_t *doc;
+   bson_iter_t iter;
+   bson_error_t error;
+
+   BSON_APPEND_DOCUMENT_BEGIN (&opts, "filter", &name_filter);
+   /* find collections with names like "abbbbc" */
+   BSON_APPEND_REGEX (&name_filter, "name", "ab+c", NULL);
+   bson_append_document_end (&opts, &name_filter);
+
+   cursor = mongoc_database_find_collections_with_opts (database, &opts);
+   while (mongoc_cursor_next (cursor, &doc)) {
+      bson_iter_init_find (&iter, doc, "name");
+      printf ("found collection: %s\n", bson_iter_utf8 (&iter, NULL));
+   }
+
+   if (mongoc_cursor_error (cursor, &error))
+      fprintf (stderr, "%s\n", error.msg);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   bson_destroy (&opts);
+}
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection.html new file mode 100644 index 0000000..704aa1b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection.html @@ -0,0 +1,156 @@ + + + + + + + + mongoc_database_get_collection() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_collection()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_database_get_collection (mongoc_database_t *database, const char *name);
+
+
+

Allocates a new mongoc_collection_t structure for the collection named name in database.

+
+
+

Returns

+

A newly allocated mongoc_collection_t that should be freed with mongoc_collection_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names.html new file mode 100644 index 0000000..174e3f5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_database_get_collection_names() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_collection_names()

+
+

Synopsis

+
char **
+mongoc_database_get_collection_names (mongoc_database_t *database,
+                                      bson_error_t *error);
+
+
+
+
+

Deprecated

+

This function is deprecated and should not be used in new code.

+

Please use mongoc_database_get_collection_names_with_opts() instead.

+
+
+

Description

+

Fetches a NULL terminated array of NULL-byte terminated char* strings containing the names of all of the collections in database.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A NULL terminated array of NULL terminated char* strings that should be freed with bson_strfreev(). Upon failure, NULL is returned and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names_with_opts.html new file mode 100644 index 0000000..0f9f475 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_collection_names_with_opts.html @@ -0,0 +1,205 @@ + + + + + + + + mongoc_database_get_collection_names_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_collection_names_with_opts()

+
+

Synopsis

+
char **
+mongoc_database_get_collection_names_with_opts (mongoc_database_t *database,
+                                                const bson_t *opts,
+                                                bson_error_t *error);
+
+
+

Fetches a NULL terminated array of NULL-byte terminated char* strings containing the names of all of the collections in database.

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

For a list of all options, see the MongoDB Manual entry on the listCollections command.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A NULL terminated array of NULL terminated char* strings that should be freed with bson_strfreev(). Upon failure, NULL is returned and error is set.

+
+
+

Examples

+
{
+   bson_t opts = BSON_INITIALIZER;
+   mongoc_read_concern_t *rc;
+   bson_error_t error;
+   char **strv;
+   unsigned i;
+
+   rc = mongoc_read_concern_new ();
+   mongoc_read_concern_set_level (rc, MONGOC_READ_CONCERN_LEVEL_MAJORITY);
+   mongoc_read_concern_append (rc, &opts);
+   if ((strv = mongoc_database_get_collection_names_with_opts (
+          database, &opts, &error))) {
+
+      for (i = 0; strv[i]; i++)
+         printf ("%s\n", strv[i]);
+
+      bson_strfreev (strv);
+   } else {
+      fprintf (stderr, "Command failed: %s\n", error.message);
+   }
+
+   mongoc_read_concern_destroy (rc);
+   bson_destroy (&opts);
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_name.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_name.html new file mode 100644 index 0000000..7cc5ae3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_name.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_get_name() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_name()

+
+

Synopsis

+
const char *
+mongoc_database_get_name (mongoc_database_t *database);
+
+
+

Fetches the name of the database.

+
+
+

Parameters

+ +
+
+

Returns

+

A string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_concern.html new file mode 100644 index 0000000..c1b2c21 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_get_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_read_concern()

+
+

Synopsis

+
const mongoc_read_concern_t *
+mongoc_database_get_read_concern (const mongoc_database_t *database);
+
+
+

This function retrieves the default mongoc_read_concern_t to use with database as configured by the client.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_read_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_prefs.html new file mode 100644 index 0000000..545b34b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_read_prefs.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_get_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_read_prefs()

+
+

Synopsis

+
const mongoc_read_prefs_t *
+mongoc_database_get_read_prefs (const mongoc_database_t *database);
+
+
+

Fetches the default read preferences to use with database.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_write_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_write_concern.html new file mode 100644 index 0000000..8e4d089 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_get_write_concern.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_get_write_concern()

+
+

Synopsis

+
const mongoc_write_concern_t *
+mongoc_database_get_write_concern (const mongoc_database_t *database);
+
+
+

This function retrieves the default mongoc_write_concern_t to use with database as configured by the client.

+
+
+

Parameters

+ +
+
+

Returns

+

A mongoc_write_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_has_collection.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_has_collection.html new file mode 100644 index 0000000..a81f1ae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_has_collection.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_database_has_collection() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_has_collection()

+
+

Synopsis

+
bool
+mongoc_database_has_collection (mongoc_database_t *database,
+                                const char *name,
+                                bson_error_t *error);
+
+
+

This function checks to see if a collection exists on the MongoDB server within database.

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • name: A string containing the name of the collection.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

If the function succeeds, it returns true if the collection exists and false if not, and in either case the fields of error are cleared, if error is not NULL.

+

Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_command_with_opts.html new file mode 100644 index 0000000..38d7118 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_command_with_opts.html @@ -0,0 +1,219 @@ + + + + + + + + mongoc_database_read_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_read_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_database_read_command_with_opts (mongoc_database_t *database,
+                                        const bson_t *command,
+                                        const mongoc_read_prefs_t *read_prefs,
+                                        const bson_t *opts,
+                                        bson_t *reply,
+                                        bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that read, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_database_command_simple().

+

Use this function for commands that read such as “count” or “distinct”.

+

Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts and the read preference must be primary or NULL. The highest-priority sources for these options are listed first in the following table. No write concern is applied.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read PreferencesRead ConcernCollation
read_prefsoptsopts
TransactionTransaction 
database  
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+ +

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_write_command_with_opts.html new file mode 100644 index 0000000..36c645e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_read_write_command_with_opts.html @@ -0,0 +1,223 @@ + + + + + + + + mongoc_database_read_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_read_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_database_read_write_command_with_opts (
+   mongoc_database_t *database,
+   const bson_t *command,
+   const mongoc_read_prefs_t *read_prefs /* UNUSED */,
+   const bson_t *opts,
+   bson_t *reply,
+   bson_error_t *error);
+
+
+

Execute a command on the server, applying logic for commands that both read and write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_database_command_simple().

+

Use this function for commands that both read and write, such as “mapReduce” with an output collection.

+

Read and write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. Read preferences are not applied. The write concern is omitted for MongoDB before 3.4.

+ +++++ + + + + + + + + + + + + + + + + + + + + +
Read ConcernWrite ConcernCollation
optsoptsopts
TransactionTransaction 
databasedatabase 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+

(The mongoc_read_prefs_t parameter was included by mistake when this function was introduced in libmongoc 1.5. A command that writes must not obey a read preference.)

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • command: A bson_t containing the command specification.
  • +
  • read_prefs: Ignored.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_all_users.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_all_users.html new file mode 100644 index 0000000..b7d8b60 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_all_users.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_database_remove_all_users() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_remove_all_users()

+
+

Synopsis

+
bool
+mongoc_database_remove_all_users (mongoc_database_t *database,
+                                  bson_error_t *error);
+
+
+

This function will remove all users configured to access database.

+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter. This may fail if there are socket errors or the current user is not authorized to perform the given command.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_user.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_user.html new file mode 100644 index 0000000..b12a01e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_remove_user.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_database_remove_user() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_remove_user()

+
+

Synopsis

+
bool
+mongoc_database_remove_user (mongoc_database_t *database,
+                             const char *username,
+                             bson_error_t *error);
+
+
+

This function removes the user named username from database.

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • username: A string containing the username of the user to remove.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Errors

+

Errors are propagated via the error parameter. This could include socket errors or others if the current user is not authorized to perform the command.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_concern.html new file mode 100644 index 0000000..e176581 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_concern.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_database_set_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_set_read_concern()

+
+

Synopsis

+
void
+mongoc_database_set_read_concern (mongoc_database_t *database,
+                                  const mongoc_read_concern_t *read_concern);
+
+
+

This function sets the read concern to use on operations performed with database. Collections created with mongoc_database_get_collection() after this call will inherit this read concern.

+

The default read concern is empty: No readConcern is sent to the server unless explicitly configured.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_prefs.html new file mode 100644 index 0000000..e55f366 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_read_prefs.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_database_set_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_set_read_prefs()

+
+

Synopsis

+
void
+mongoc_database_set_read_prefs (mongoc_database_t *database,
+                                const mongoc_read_prefs_t *read_prefs);
+
+
+

This function sets the default read preferences to use on operations performed with database. Collections created with mongoc_database_get_collection() after this call will inherit these read preferences.

+

The global default is MONGOC_READ_PRIMARY: if the client is connected to a replica set it reads from the primary, otherwise it reads from the current MongoDB server.

+

Please see the MongoDB website for a description of Read Preferences.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_write_concern.html new file mode 100644 index 0000000..ecded9c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_set_write_concern.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_database_set_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_set_write_concern()

+
+

Synopsis

+
void
+mongoc_database_set_write_concern (mongoc_database_t *database,
+                                   const mongoc_write_concern_t *write_concern);
+
+
+

This function sets the write concern to use on operations performed with database. Collections created with mongoc_database_get_collection() after this call will inherit this write concern.

+

The default write concern is MONGOC_WRITE_CONCERN_W_DEFAULT: the driver blocks awaiting basic acknowledgement of write operations from MongoDB. This is the correct write concern for the great majority of applications.

+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_t.html new file mode 100644 index 0000000..b572a40 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_t.html @@ -0,0 +1,211 @@ + + + + + + + + mongoc_database_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_t

+

MongoDB Database Abstraction

+
+

Synopsis

+
typedef struct _mongoc_database_t mongoc_database_t;
+
+
+

mongoc_database_t provides access to a MongoDB database. This handle is useful for actions a particular database object. It is not a container for mongoc_collection_t structures.

+

Read preferences and write concerns are inherited from the parent client. They can be overridden with mongoc_database_set_read_prefs() and mongoc_database_set_write_concern().

+
+ +
+

Examples

+
#include <mongoc/mongoc.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_database_t *database;
+   mongoc_client_t *client;
+
+   mongoc_init ();
+
+   client = mongoc_client_new ("mongodb://localhost/");
+   database = mongoc_client_get_database (client, "test");
+
+   mongoc_database_destroy (database);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_watch.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_watch.html new file mode 100644 index 0000000..426e3cc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_watch.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_database_watch() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_watch()

+
+

Synopsis

+
mongoc_change_stream_t*
+mongoc_database_watch (const mongoc_database_t *db,
+                       const bson_t *pipeline,
+                       const bson_t *opts);
+
+
+

A helper function to create a change stream. It is preferred to call this +function over using a raw aggregation to create a change stream.

+

This function uses the read preference and read concern of the database. If +the change stream needs to re-establish connection, the same read preference +will be used. This may happen if the change stream encounters a resumable error.

+
+

Warning

+

A change stream is only supported with majority read concern.

+
+
+
+

Parameters

+
    +
  • db: A mongoc_database_t specifying the database which the change stream listens to.
  • +
  • pipeline: A bson_t representing an aggregation pipeline appended to the change stream. This may be an empty document.
  • +
  • opts: A bson_t containing change stream options or NULL.
  • +
+

opts may be NULL or a document consisting of any subset of the following +parameters:

+
    +
  • batchSize An int32 representing number of documents requested to be returned on each call to mongoc_change_stream_next()
  • +
  • resumeAfter A Document representing the logical starting point of the change stream. The _id field of any change received from a change stream can be used here.
  • +
  • startAtOperationTime A Timestamp. The change stream only provides changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here.
  • +
  • maxAwaitTimeMS An int64 representing the maximum amount of time a call to mongoc_change_stream_next() will block waiting for data
  • +
  • collation A Collation Document
  • +
+
+
+

Returns

+

A newly allocated mongoc_change_stream_t which must be freed with +mongoc_change_stream_destroy() when no longer in use. The returned +mongoc_change_stream_t is never NULL. If there is an error, it can +be retrieved with mongoc_change_stream_error_document(), and subsequent +calls to mongoc_change_stream_next() will return false.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_write_command_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_write_command_with_opts.html new file mode 100644 index 0000000..d78d628 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_database_write_command_with_opts.html @@ -0,0 +1,217 @@ + + + + + + + + mongoc_database_write_command_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_database_write_command_with_opts()

+
+

Synopsis

+
bool
+mongoc_database_write_command_with_opts (mongoc_database_t *database,
+                                         const bson_t *command,
+                                         const bson_t *opts,
+                                         bson_t *reply,
+                                         bson_error_t *error);
+
+
+

Execute a command on the server, applying logic that is specific to commands that write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use mongoc_database_command_simple().

+

Use this function for commands that write such as “drop” or “createRole” (but not for “insert”, “update”, or “delete”, see Basic Write Operations). Write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in opts. The highest-priority sources for these options are listed first in the following table. The write concern is omitted for MongoDB before 3.4.

+ ++++ + + + + + + + + + + + + + + + + +
Write ConcernCollation
optsopts
Transaction 
database 
+

See the example for transactions and for the “distinct” command with opts.

+

reply is always initialized, and must be freed with bson_destroy().

+
+
+

Parameters

+
    +
  • database: A mongoc_database_t.
  • +
  • db_name: The name of the database to run the command on.
  • +
  • command: A bson_t containing the command specification.
  • +
  • opts: A bson_t containing additional options.
  • +
  • reply: A location for the resulting document.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+

opts may be NULL or a BSON document with additional command options:

+ +

Consult the MongoDB Manual entry on Database Commands for each command’s arguments.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+

A write concern timeout or write concern error is considered a failure.

+
+
+

Basic Write Operations

+

Do not use this function to call the basic write commands “insert”, “update”, and “delete”. Those commands require special logic not implemented in mongoc_database_write_command_with_opts. For basic write operations use CRUD functions such as mongoc_collection_insert_one() and the others described in the CRUD tutorial, or use the Bulk API.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_delete_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_delete_flags_t.html new file mode 100644 index 0000000..08d3e85 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_delete_flags_t.html @@ -0,0 +1,160 @@ + + + + + + + + mongoc_delete_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_delete_flags_t

+

Flags for deletion operations

+
+

Synopsis

+
typedef enum {
+   MONGOC_DELETE_NONE = 0,
+   MONGOC_DELETE_SINGLE_REMOVE = 1 << 0,
+} mongoc_delete_flags_t;
+
+
+
+
+

Deprecated

+
+

Warning

+

These flags are deprecated and should not be used in new code.

+
+

Please use mongoc_collection_delete_one() or mongoc_collection_delete_many() instead.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_error_has_label.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_error_has_label.html new file mode 100644 index 0000000..edc04b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_error_has_label.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_error_has_label() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_error_has_label()

+
+

Synopsis

+
bool
+mongoc_error_has_label (const bson_t *reply, const char *label);
+
+
+

Test whether a reply from a failed operation includes a specific error label. See Error Labels for details, and see mongoc_client_session_start_transaction() for example code that demonstrates their use.

+
+
+

Parameters

+
    +
  • reply: A bson_t, the reply to a failed operation.
  • +
  • label: The label to test for, such as “TransientTransactionError” or “UnknownTransactionCommitResult”.
  • +
+
+
+

Returns

+

Returns true if reply contains the error label.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_append.html new file mode 100644 index 0000000..e3ea068 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_append.html @@ -0,0 +1,234 @@ + + + + + + + + mongoc_find_and_modify_opts_append() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_append()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_append (mongoc_find_and_modify_opts_t *opts,
+                                    const bson_t *extra);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Adds arbitrary options to a findAndModify command.

+

extra does not have to remain valid after calling this function.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+

Appending options to findAndModify

+
+
opts.c
+
void
+fam_opts (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_t *update;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   mongoc_write_concern_t *wc;
+   bson_t extra = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+
+   /* Bump his age */
+   update = BCON_NEW ("$inc", "{", "age", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   /* Abort if the operation takes too long. */
+   mongoc_find_and_modify_opts_set_max_time_ms (opts, 100);
+
+   /* Set write concern w: 2 */
+   wc = mongoc_write_concern_new ();
+   mongoc_write_concern_set_w (wc, 2);
+   mongoc_write_concern_append (wc, &extra);
+
+   /* Some future findAndModify option the driver doesn't support conveniently
+    */
+   BSON_APPEND_INT32 (&extra, "futureOption", 42);
+   mongoc_find_and_modify_opts_append (opts, &extra);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (&extra);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_write_concern_destroy (wc);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_destroy.html new file mode 100644 index 0000000..3dd10b5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_destroy.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_find_and_modify_opts_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_destroy()

+
+

Synopsis

+
void
+mongoc_find_and_modify_opts_destroy (
+   mongoc_find_and_modify_opts_t *find_and_modify_opts);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees all resources associated with the find and modify builder structure. Does nothing if find_and_modify_opts is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_bypass_document_validation.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_bypass_document_validation.html new file mode 100644 index 0000000..b95c3be --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_bypass_document_validation.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_find_and_modify_opts_get_bypass_document_validation() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_bypass_document_validation()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_get_bypass_document_validation (
+   const mongoc_find_and_modify_opts_t *opts);
+
+
+
+
+

Parameters

+ +
+
+

Returns

+

Returns true if mongoc_find_and_modify_opts_set_bypass_document_validation() was called previously on opts.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_fields.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_fields.html new file mode 100644 index 0000000..ec63445 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_fields.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_find_and_modify_opts_get_fields() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_fields()

+
+

Synopsis

+
void
+mongoc_find_and_modify_opts_get_fields (
+   const mongoc_find_and_modify_opts_t *opts, bson_t *fields);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Copy to fields the BSON document that was set with mongoc_find_and_modify_opts_set_fields(), or initializes fields with an empty BSON document.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_flags.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_flags.html new file mode 100644 index 0000000..e3f288d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_flags.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_find_and_modify_opts_get_flags() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_flags()

+
+

Synopsis

+
mongoc_find_and_modify_flags_t
+mongoc_find_and_modify_opts_get_flags (
+   const mongoc_find_and_modify_opts_t *opts);
+
+
+
+
+

Parameters

+ +
+
+

Returns

+

Returns the flags set with mongoc_find_and_modify_opts_set_flags().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_max_time_ms.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_max_time_ms.html new file mode 100644 index 0000000..3c5e246 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_max_time_ms.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_find_and_modify_opts_get_max_time_ms() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_max_time_ms()

+
+

Synopsis

+
uint32_t
+mongoc_find_and_modify_opts_get_max_time_ms (
+   const mongoc_find_and_modify_opts_t *opts);
+
+
+
+
+

Parameters

+ +
+
+

Returns

+

Returns the “maxTimeMS” value set with mongoc_find_and_modify_opts_set_max_time_ms().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_sort.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_sort.html new file mode 100644 index 0000000..3fa7c4a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_sort.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_find_and_modify_opts_get_sort() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_sort()

+
+

Synopsis

+
void
+mongoc_find_and_modify_opts_get_sort (const mongoc_find_and_modify_opts_t *opts,
+                                      bson_t *sort);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Copies the sort document set with mongoc_find_and_modify_opts_set_sort(), or initializes sort with an empty BSON document.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_update.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_update.html new file mode 100644 index 0000000..495dba3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_get_update.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_find_and_modify_opts_get_update() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_get_update()

+
+

Synopsis

+
void
+mongoc_find_and_modify_opts_get_update (
+   const mongoc_find_and_modify_opts_t *opts, bson_t *update);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Copies the update document set with mongoc_find_and_modify_opts_set_update(), or initializes update with an empty BSON document.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_new.html new file mode 100644 index 0000000..ee1640c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_new.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_find_and_modify_opts_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_new()

+
+

Synopsis

+
mongoc_find_and_modify_opts_t *
+mongoc_find_and_modify_opts_new (void);
+
+
+
+
+

Returns

+

Creates a newly allocated find and modify builder structure that is used to create a findAndModify command. This should be freed with mongoc_find_and_modify_opts_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_bypass_document_validation.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_bypass_document_validation.html new file mode 100644 index 0000000..55f718a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_bypass_document_validation.html @@ -0,0 +1,236 @@ + + + + + + + + mongoc_find_and_modify_opts_set_bypass_document_validation() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_bypass_document_validation()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_bypass_document_validation (
+   mongoc_find_and_modify_opts_t *opts, bool bypass);
+
+
+

This option is only available when talking to MongoDB 3.2 and later.

+
+
+

Parameters

+ +
+
+

Description

+

Adds bypassDocumentValidation argument to the builder.

+

When authentication is enabled, the authenticated user must have either the “dbadmin” or “restore” roles to bypass document validation.

+
+
+

Returns

+

Returns true if it successfully added the option to the builder, otherwise false and logs an error.

+
+
+

Setting bypassDocumentValidation

+
+
bypass.c
+
void
+fam_bypass (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_t *update;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+
+   /* Bump his age */
+   update = BCON_NEW ("$inc", "{", "age", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   /* He can still play, even though he is pretty old. */
+   mongoc_find_and_modify_opts_set_bypass_document_validation (opts, true);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+

Outputs:

+
{
+   "lastErrorObject" : {"updatedExisting" : true, "n" : 1},
+                       "value" : {
+                          "_id" : {"$oid" : "56562a99d13e6d86239c7b00"},
+                          "age" : 34,
+                          "firstname" : "Zlatan",
+                          "goals" : 342,
+                          "lastname" : "Ibrahimovic",
+                          "profession" : "Football player",
+                          "position" : "striker"
+                       },
+                                 "ok" : 1
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_fields.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_fields.html new file mode 100644 index 0000000..1f9ab6d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_fields.html @@ -0,0 +1,235 @@ + + + + + + + + mongoc_find_and_modify_opts_set_fields() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_fields()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_fields (mongoc_find_and_modify_opts_t *opts,
+                                        const bson_t *fields);
+
+
+
+
+

Parameters

+
    +
  • opts: A mongoc_find_and_modify_opts_t.
  • +
  • fields: A subset of fields to return. Choose which fields to include by appending {fieldname: 1} for each fieldname, or excluding it with {fieldname: 0}.
  • +
+
+
+

Description

+

Adds fields argument to the builder.

+

fields does not have to remain valid after calling this function.

+
+
+

Returns

+

Returns true if it successfully added the option to the builder, otherwise false.

+
+
+

Setting fields

+
+
fields.c
+
void
+fam_fields (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t fields = BSON_INITIALIZER;
+   bson_t *update;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+
+   /* Return his goal tally */
+   BSON_APPEND_INT32 (&fields, "goals", 1);
+
+   /* Bump his goal tally */
+   update = BCON_NEW ("$inc", "{", "goals", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   mongoc_find_and_modify_opts_set_fields (opts, &fields);
+   /* Return the new tally */
+   mongoc_find_and_modify_opts_set_flags (opts,
+                                          MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&fields);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+

Outputs:

+
{
+   "lastErrorObject"
+      : {"updatedExisting" : true, "n" : 1},
+        "value"
+        : {"_id" : {"$oid" : "56562a99d13e6d86239c7b00"}, "goals" : 343},
+          "ok" : 1
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_flags.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_flags.html new file mode 100644 index 0000000..1e724ae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_flags.html @@ -0,0 +1,265 @@ + + + + + + + + mongoc_find_and_modify_opts_set_flags() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_flags()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_flags (
+   mongoc_find_and_modify_opts_t *opts,
+   const mongoc_find_and_modify_flags_t flags);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Adds one or more flags to the builder.

+ ++++ + + + + + + + + + + + + + + +
MONGOC_FIND_AND_MODIFY_NONEDefault. Doesn’t add anything to the builder.
MONGOC_FIND_AND_MODIFY_REMOVEWill instruct find_and_modify to remove the matching document.
MONGOC_FIND_AND_MODIFY_UPSERTUpdate the matching document or, if no document matches, insert the document.
MONGOC_FIND_AND_MODIFY_RETURN_NEWReturn the resulting document.
+
+
+

Returns

+

Returns Returns true if it successfully added the option to the builder, otherwise false and logs an error.

+
+
+

Setting flags

+
+
flags.c
+
void
+fam_flags (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bson_t *update;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+   BSON_APPEND_INT32 (&query, "age", 34);
+   BSON_APPEND_INT32 (
+      &query, "goals", (16 + 35 + 23 + 57 + 16 + 14 + 28 + 84) + (1 + 6 + 62));
+
+   /* Add his football position */
+   update = BCON_NEW ("$set", "{", "position", BCON_UTF8 ("striker"), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   /* Create the document if it didn't exist, and return the updated document */
+   mongoc_find_and_modify_opts_set_flags (
+      opts, MONGOC_FIND_AND_MODIFY_UPSERT | MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+

Outputs:

+
{
+   "lastErrorObject" : {
+      "updatedExisting" : false,
+      "n" : 1,
+      "upserted" : {"$oid" : "56562a99d13e6d86239c7b00"}
+   },
+                       "value" : {
+                          "_id" : {"$oid" : "56562a99d13e6d86239c7b00"},
+                          "age" : 34,
+                          "firstname" : "Zlatan",
+                          "goals" : 342,
+                          "lastname" : "Ibrahimovic",
+                          "profession" : "Football player",
+                          "position" : "striker"
+                       },
+                                 "ok" : 1
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_max_time_ms.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_max_time_ms.html new file mode 100644 index 0000000..2ed7816 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_max_time_ms.html @@ -0,0 +1,234 @@ + + + + + + + + mongoc_find_and_modify_opts_set_max_time_ms() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_max_time_ms()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_max_time_ms (
+   mongoc_find_and_modify_opts_t *opts, uint32_t max_time_ms);
+
+
+
+
+

Parameters

+
    +
  • opts: A mongoc_find_and_modify_opts_t.
  • +
  • max_time_ms: The maximum server-side execution time permitted, in milliseconds, or 0 to specify no maximum time (the default setting).
  • +
+
+
+

Description

+

Adds a maxTimeMS argument to the builder.

+
+
+

Returns

+

Returns true if it successfully added the option to the builder, otherwise false and logs an error.

+

Note: although max_time_ms is a uint32_t, it is possible to set it as a uint64_t through the options arguments in some cursor returning functions like mongoc_collection_find_with_opts().

+
+
+

Setting maxTimeMS

+
+
opts.c
+
void
+fam_opts (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_t *update;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   mongoc_write_concern_t *wc;
+   bson_t extra = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+
+   /* Bump his age */
+   update = BCON_NEW ("$inc", "{", "age", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   /* Abort if the operation takes too long. */
+   mongoc_find_and_modify_opts_set_max_time_ms (opts, 100);
+
+   /* Set write concern w: 2 */
+   wc = mongoc_write_concern_new ();
+   mongoc_write_concern_set_w (wc, 2);
+   mongoc_write_concern_append (wc, &extra);
+
+   /* Some future findAndModify option the driver doesn't support conveniently
+    */
+   BSON_APPEND_INT32 (&extra, "futureOption", 42);
+   mongoc_find_and_modify_opts_append (opts, &extra);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (&extra);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_write_concern_destroy (wc);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_sort.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_sort.html new file mode 100644 index 0000000..5bc1c8d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_sort.html @@ -0,0 +1,238 @@ + + + + + + + + mongoc_find_and_modify_opts_set_sort() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_sort()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_sort (mongoc_find_and_modify_opts_t *opts,
+                                      const bson_t *sort);
+
+
+
+
+

Parameters

+
    +
  • opts: A mongoc_find_and_modify_opts_t.
  • +
  • sort: Determines which document the operation modifies if the query selects multiple documents. findAndModify modifies the first document in the sort order specified by this argument.
  • +
+
+
+

Description

+

Adds sort argument to the builder.

+

sort does not have to remain valid after calling this function.

+
+
+

Returns

+

Returns true if it successfully added the option to the builder, otherwise false.

+
+
+

Setting sort

+
+
sort.c
+
void
+fam_sort (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t *update;
+   bson_t sort = BSON_INITIALIZER;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find all users with the lastname Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+
+   /* Sort by age (descending) */
+   BSON_APPEND_INT32 (&sort, "age", -1);
+
+   /* Bump his goal tally */
+   update = BCON_NEW ("$set", "{", "oldest", BCON_BOOL (true), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   mongoc_find_and_modify_opts_set_sort (opts, &sort);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&sort);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+

Outputs:

+
{
+   "lastErrorObject" : {"updatedExisting" : true, "n" : 1},
+                       "value" : {
+                          "_id" : {"$oid" : "56562a99d13e6d86239c7b00"},
+                          "age" : 35,
+                          "firstname" : "Zlatan",
+                          "goals" : 343,
+                          "lastname" : "Ibrahimovic",
+                          "profession" : "Football player",
+                          "position" : "striker",
+                          "author" : true
+                       },
+                                 "ok" : 1
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_update.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_update.html new file mode 100644 index 0000000..54a86ea --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_set_update.html @@ -0,0 +1,237 @@ + + + + + + + + mongoc_find_and_modify_opts_set_update() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_set_update()

+
+

Synopsis

+
bool
+mongoc_find_and_modify_opts_set_update (mongoc_find_and_modify_opts_t *opts,
+                                        const bson_t *update);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Adds update argument to the builder.

+

update does not have to remain valid after calling this function.

+
+
+

Returns

+

Returns true if it successfully added the option to the builder, otherwise false.

+
+
+

Setting update

+
+
update.c
+
void
+fam_update (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t *update;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+
+   /* Make him a book author */
+   update = BCON_NEW ("$set", "{", "author", BCON_BOOL (true), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   /* Note that the document returned is the _previous_ version of the document
+    * To fetch the modified new version, use
+    * mongoc_find_and_modify_opts_set_flags (opts,
+    * MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+    */
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+

Outputs:

+
{
+   "lastErrorObject" : {"updatedExisting" : true, "n" : 1},
+                       "value" : {
+                          "_id" : {"$oid" : "56562a99d13e6d86239c7b00"},
+                          "age" : 35,
+                          "firstname" : "Zlatan",
+                          "goals" : 342,
+                          "lastname" : "Ibrahimovic",
+                          "profession" : "Football player",
+                          "position" : "striker"
+                       },
+                                 "ok" : 1
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_t.html new file mode 100644 index 0000000..5cff4b0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_find_and_modify_opts_t.html @@ -0,0 +1,660 @@ + + + + + + + + mongoc_find_and_modify_opts_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_find_and_modify_opts_t

+

find_and_modify abstraction

+
+

Synopsis

+

mongoc_find_and_modify_opts_t is a builder interface to construct a find_and_modify command.

+

It was created to be able to accommodate new arguments to the MongoDB find_and_modify command.

+

As of MongoDB 3.2, the mongoc_write_concern_t specified on the mongoc_collection_t will be used, if any.

+
+
+

Example

+
+
flags.c
+
void
+fam_flags (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bson_t *update;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+   BSON_APPEND_INT32 (&query, "age", 34);
+   BSON_APPEND_INT32 (
+      &query, "goals", (16 + 35 + 23 + 57 + 16 + 14 + 28 + 84) + (1 + 6 + 62));
+
+   /* Add his football position */
+   update = BCON_NEW ("$set", "{", "position", BCON_UTF8 ("striker"), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   /* Create the document if it didn't exist, and return the updated document */
+   mongoc_find_and_modify_opts_set_flags (
+      opts, MONGOC_FIND_AND_MODIFY_UPSERT | MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
bypass.c
+
void
+fam_bypass (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_t *update;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+
+   /* Bump his age */
+   update = BCON_NEW ("$inc", "{", "age", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   /* He can still play, even though he is pretty old. */
+   mongoc_find_and_modify_opts_set_bypass_document_validation (opts, true);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
update.c
+
void
+fam_update (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t *update;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+
+   /* Make him a book author */
+   update = BCON_NEW ("$set", "{", "author", BCON_BOOL (true), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   /* Note that the document returned is the _previous_ version of the document
+    * To fetch the modified new version, use
+    * mongoc_find_and_modify_opts_set_flags (opts,
+    * MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+    */
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
fields.c
+
void
+fam_fields (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t fields = BSON_INITIALIZER;
+   bson_t *update;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+
+   /* Return his goal tally */
+   BSON_APPEND_INT32 (&fields, "goals", 1);
+
+   /* Bump his goal tally */
+   update = BCON_NEW ("$inc", "{", "goals", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   mongoc_find_and_modify_opts_set_fields (opts, &fields);
+   /* Return the new tally */
+   mongoc_find_and_modify_opts_set_flags (opts,
+                                          MONGOC_FIND_AND_MODIFY_RETURN_NEW);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&fields);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
sort.c
+
void
+fam_sort (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t *update;
+   bson_t sort = BSON_INITIALIZER;
+   bson_t reply;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find all users with the lastname Ibrahimovic */
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+
+   /* Sort by age (descending) */
+   BSON_APPEND_INT32 (&sort, "age", -1);
+
+   /* Bump his goal tally */
+   update = BCON_NEW ("$set", "{", "oldest", BCON_BOOL (true), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+   mongoc_find_and_modify_opts_set_sort (opts, &sort);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (update);
+   bson_destroy (&sort);
+   bson_destroy (&query);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
opts.c
+
void
+fam_opts (mongoc_collection_t *collection)
+{
+   mongoc_find_and_modify_opts_t *opts;
+   bson_t reply;
+   bson_t *update;
+   bson_error_t error;
+   bson_t query = BSON_INITIALIZER;
+   mongoc_write_concern_t *wc;
+   bson_t extra = BSON_INITIALIZER;
+   bool success;
+
+
+   /* Find Zlatan Ibrahimovic, the striker */
+   BSON_APPEND_UTF8 (&query, "firstname", "Zlatan");
+   BSON_APPEND_UTF8 (&query, "lastname", "Ibrahimovic");
+   BSON_APPEND_UTF8 (&query, "profession", "Football player");
+
+   /* Bump his age */
+   update = BCON_NEW ("$inc", "{", "age", BCON_INT32 (1), "}");
+
+   opts = mongoc_find_and_modify_opts_new ();
+   mongoc_find_and_modify_opts_set_update (opts, update);
+
+   /* Abort if the operation takes too long. */
+   mongoc_find_and_modify_opts_set_max_time_ms (opts, 100);
+
+   /* Set write concern w: 2 */
+   wc = mongoc_write_concern_new ();
+   mongoc_write_concern_set_w (wc, 2);
+   mongoc_write_concern_append (wc, &extra);
+
+   /* Some future findAndModify option the driver doesn't support conveniently
+    */
+   BSON_APPEND_INT32 (&extra, "futureOption", 42);
+   mongoc_find_and_modify_opts_append (opts, &extra);
+
+   success = mongoc_collection_find_and_modify_with_opts (
+      collection, &query, opts, &reply, &error);
+
+   if (success) {
+      char *str;
+
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+   }
+
+   bson_destroy (&reply);
+   bson_destroy (&extra);
+   bson_destroy (update);
+   bson_destroy (&query);
+   mongoc_write_concern_destroy (wc);
+   mongoc_find_and_modify_opts_destroy (opts);
+}
+
+
+
+
+
fam.c
+
int
+main (void)
+{
+   mongoc_collection_t *collection;
+   mongoc_database_t *database;
+   mongoc_client_t *client;
+   const char *uri_string =
+      "mongodb://localhost:27017/admin?appname=find-and-modify-opts-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   bson_t *options;
+
+   mongoc_init ();
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "databaseName");
+
+   options = BCON_NEW ("validator",
+                       "{",
+                       "age",
+                       "{",
+                       "$lte",
+                       BCON_INT32 (34),
+                       "}",
+                       "}",
+                       "validationAction",
+                       BCON_UTF8 ("error"),
+                       "validationLevel",
+                       BCON_UTF8 ("moderate"));
+
+   collection = mongoc_database_create_collection (
+      database, "collectionName", options, &error);
+   if (!collection) {
+      fprintf (
+         stderr, "Got error: \"%s\" on line %d\n", error.message, __LINE__);
+      return EXIT_FAILURE;
+   }
+
+   fam_flags (collection);
+   fam_bypass (collection);
+   fam_update (collection);
+   fam_fields (collection);
+   fam_opts (collection);
+   fam_sort (collection);
+
+   mongoc_collection_drop (collection, NULL);
+   bson_destroy (options);
+   mongoc_uri_destroy (uri);
+   mongoc_database_destroy (database);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+   return EXIT_SUCCESS;
+}
+
+
+
+

Outputs:

+
{
+    "lastErrorObject": {
+        "updatedExisting": false,
+        "n": 1,
+        "upserted": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        }
+    },
+    "value": {
+        "_id": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        },
+        "age": 34,
+        "firstname": "Zlatan",
+        "goals": 342,
+        "lastname": "Ibrahimovic",
+        "profession": "Football player",
+        "position": "striker"
+    },
+    "ok": 1
+}
+{
+    "lastErrorObject": {
+        "updatedExisting": true,
+        "n": 1
+    },
+    "value": {
+        "_id": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        },
+        "age": 34,
+        "firstname": "Zlatan",
+        "goals": 342,
+        "lastname": "Ibrahimovic",
+        "profession": "Football player",
+        "position": "striker"
+    },
+    "ok": 1
+}
+{
+    "lastErrorObject": {
+        "updatedExisting": true,
+        "n": 1
+    },
+    "value": {
+        "_id": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        },
+        "age": 35,
+        "firstname": "Zlatan",
+        "goals": 342,
+        "lastname": "Ibrahimovic",
+        "profession": "Football player",
+        "position": "striker"
+    },
+    "ok": 1
+}
+{
+    "lastErrorObject": {
+        "updatedExisting": true,
+        "n": 1
+    },
+    "value": {
+        "_id": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        },
+        "goals": 343
+    },
+    "ok": 1
+}
+{
+    "lastErrorObject": {
+        "updatedExisting": true,
+        "n": 1
+    },
+    "value": {
+        "_id": {
+            "$oid": "56562a99d13e6d86239c7b00"
+        },
+        "age": 35,
+        "firstname": "Zlatan",
+        "goals": 343,
+        "lastname": "Ibrahimovic",
+        "profession": "Football player",
+        "position": "striker",
+        "author": true
+    },
+    "ok": 1
+}
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_major_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_major_version.html new file mode 100644 index 0000000..c444286 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_major_version.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_get_major_version() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_get_major_version()

+
+

Synopsis

+
int
+mongoc_get_major_version (void);
+
+
+
+
+

Returns

+

The value of MONGOC_MAJOR_VERSION when libmongoc was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_micro_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_micro_version.html new file mode 100644 index 0000000..96e7de9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_micro_version.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_get_micro_version() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_get_micro_version()

+
+

Synopsis

+
int
+mongoc_get_micro_version (void);
+
+
+
+
+

Returns

+

The value of MONGOC_MICRO_VERSION when libmongoc was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_minor_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_minor_version.html new file mode 100644 index 0000000..4115669 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_minor_version.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_get_minor_version() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_get_minor_version()

+
+

Synopsis

+
int
+mongoc_get_minor_version (void);
+
+
+
+
+

Returns

+

The value of MONGOC_MINOR_VERSION when libmongoc was compiled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_version.html new file mode 100644 index 0000000..5a3752e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_get_version.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_get_version() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_get_version()

+
+

Synopsis

+
const char *
+mongoc_get_version (void);
+
+
+
+
+

Returns

+

A string representation of libmongoc’s version, formatted something like “1.2.3” or “1.2.3-dev”.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file.html new file mode 100644 index 0000000..4cdfd56 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_gridfs_create_file() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_create_file()

+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_create_file (mongoc_gridfs_t *gridfs,
+                           mongoc_gridfs_file_opt_t *opt);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall create a new mongoc_gridfs_file_t.

+

Use mongoc_gridfs_file_writev() to write to the file.

+
+
+

Returns

+

Returns a newly allocated mongoc_gridfs_file_t that should be freed with mongoc_gridfs_file_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file_from_stream.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file_from_stream.html new file mode 100644 index 0000000..c300281 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_create_file_from_stream.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_create_file_from_stream() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_create_file_from_stream()

+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_create_file_from_stream (mongoc_gridfs_t *gridfs,
+                                       mongoc_stream_t *stream,
+                                       mongoc_gridfs_file_opt_t *opt);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall create a new mongoc_gridfs_file_t and fill it with the contents of stream. Note that this function will read from stream until End of File, making it best suited for file-backed streams.

+
+
+

Returns

+

A newly allocated mongoc_gridfs_file_t that should be freed with mongoc_gridfs_file_destroy() when no longer in use. +Returns NULL and logs an error message if there is a network or server error writing data to the MongoDB server.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_destroy.html new file mode 100644 index 0000000..e458782 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_gridfs_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_destroy()

+
+

Synopsis

+
void
+mongoc_gridfs_destroy (mongoc_gridfs_t *gridfs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall destroy the gridfs structure referenced by gridfs and any resources associated with the gridfs. Does nothing if gridfs is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_drop.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_drop.html new file mode 100644 index 0000000..b3594f1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_drop.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_drop() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_drop()

+
+

Synopsis

+
bool
+mongoc_gridfs_drop (mongoc_gridfs_t *gridfs, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Requests that an entire GridFS be dropped, including all files associated with it.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_destroy.html new file mode 100644 index 0000000..c190d27 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_gridfs_file_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_destroy()

+
+

Synopsis

+
void
+mongoc_gridfs_file_destroy (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Destroys the mongoc_gridfs_file_t instance and any resources associated with it. Does nothing if file is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_error.html new file mode 100644 index 0000000..f12a302 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_error.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_file_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_error()

+
+

Synopsis

+
bool
+mongoc_gridfs_file_error (mongoc_gridfs_file_t *file, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function checks to see if there has been an error associated with the last operation upon file.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns false if there has been no registered error, otherwise true and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_aliases.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_aliases.html new file mode 100644 index 0000000..d67db67 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_aliases.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_aliases() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_aliases()

+
+

Synopsis

+
const bson_t *
+mongoc_gridfs_file_get_aliases (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the aliases associated with a gridfs file.

+
+
+

Returns

+

Returns a bson_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_chunk_size.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_chunk_size.html new file mode 100644 index 0000000..ef050a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_chunk_size.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_chunk_size() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_chunk_size()

+
+

Synopsis

+
int32_t
+mongoc_gridfs_file_get_chunk_size (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the chunk size used with the underlying gridfs file.

+
+
+

Returns

+

A signed 32-bit integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_content_type.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_content_type.html new file mode 100644 index 0000000..e911679 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_content_type.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_content_type() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_content_type()

+
+

Synopsis

+
const char *
+mongoc_gridfs_file_get_content_type (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the content type specified for the underlying file.

+
+
+

Returns

+

Returns a string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_filename.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_filename.html new file mode 100644 index 0000000..e3ec0a5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_filename.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_filename() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_filename()

+
+

Synopsis

+
const char *
+mongoc_gridfs_file_get_filename (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the filename for the given gridfs file.

+
+
+

Returns

+

A string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_id.html new file mode 100644 index 0000000..b30fd1f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_id.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_gridfs_file_get_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_id()

+
+

Synopsis

+
const bson_value_t *
+mongoc_gridfs_file_get_id (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the id of a gridfs file.

+

The C Driver always uses an ObjectId for _id, but files created by other drivers may have any type of _id.

+
+
+

Returns

+

Returns a bson_value_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_length.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_length.html new file mode 100644 index 0000000..174b57b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_length.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_length() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_length()

+
+

Synopsis

+
int64_t
+mongoc_gridfs_file_get_length (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the length of the gridfs file in bytes.

+
+
+

Returns

+

A 64-bit signed integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_md5.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_md5.html new file mode 100644 index 0000000..149661a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_md5.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_md5() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_md5()

+
+

Synopsis

+
const char *
+mongoc_gridfs_file_get_md5 (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the pre-computed MD5 for the underlying gridfs file.

+
+
+

Returns

+

Returns a string that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_metadata.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_metadata.html new file mode 100644 index 0000000..ce68554 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_metadata.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_metadata() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_metadata()

+
+

Synopsis

+
const bson_t *
+mongoc_gridfs_file_get_metadata (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a bson document containing the metadata for the gridfs file.

+
+
+

Returns

+

Returns a bson_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_upload_date.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_upload_date.html new file mode 100644 index 0000000..6721640 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_get_upload_date.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_get_upload_date() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_get_upload_date()

+
+

Synopsis

+
int64_t
+mongoc_gridfs_file_get_upload_date (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the specified upload date of the gridfs file in milliseconds since the UNIX epoch.

+
+
+

Returns

+

A signed int64 with the upload date in milliseconds since the UNIX epoch.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_destroy.html new file mode 100644 index 0000000..96a4934 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_gridfs_file_list_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_list_destroy()

+
+

Synopsis

+
void
+mongoc_gridfs_file_list_destroy (mongoc_gridfs_file_list_t *list);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees a mongoc_gridfs_file_list_t and releases any associated resources. Does nothing if list is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_error.html new file mode 100644 index 0000000..a869b20 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_error.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_gridfs_file_list_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_list_error()

+
+

Synopsis

+
bool
+mongoc_gridfs_file_list_error (mongoc_gridfs_file_list_t *list,
+                               bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches any error that has occurred while trying to retrieve the file list.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

false if no error has been registered, otherwise true and error is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_next.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_next.html new file mode 100644 index 0000000..dcc864f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_next.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_list_next() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_list_next()

+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_file_list_next (mongoc_gridfs_file_list_t *list);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall iterate the underlying gridfs file list, returning the next file each iteration. This is a blocking function.

+
+
+

Returns

+

A newly allocated mongoc_gridfs_file_t that should be freed with mongoc_gridfs_file_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_t.html new file mode 100644 index 0000000..f4014ef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_list_t.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_gridfs_file_list_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_list_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_gridfs_file_list_t mongoc_gridfs_file_list_t;
+
+
+
+
+

Description

+

mongoc_gridfs_file_list_t provides a gridfs file list abstraction. It provides iteration and basic marshalling on top of a regular mongoc_collection_find_with_opts() style query. In interface, it’s styled after mongoc_cursor_t.

+
+
+

Example

+
mongoc_gridfs_file_list_t *list;
+mongoc_gridfs_file_t *file;
+
+list = mongoc_gridfs_find (gridfs, query);
+
+while ((file = mongoc_gridfs_file_list_next (list))) {
+   do_something (file);
+
+   mongoc_gridfs_file_destroy (file);
+}
+
+mongoc_gridfs_file_list_destroy (list);
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_opt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_opt_t.html new file mode 100644 index 0000000..414d7b0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_opt_t.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_gridfs_file_opt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_opt_t

+
+

Synopsis

+
typedef struct {
+   const char *md5;
+   const char *filename;
+   const char *content_type;
+   const bson_t *aliases;
+   const bson_t *metadata;
+   uint32_t chunk_size;
+} mongoc_gridfs_file_opt_t;
+
+
+
+
+

Description

+

This structure contains options that can be set on a mongoc_gridfs_file_t. It can be used by various functions when creating a new gridfs file.

+
+
+

Functions

+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_readv.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_readv.html new file mode 100644 index 0000000..1750926 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_readv.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_gridfs_file_readv() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_readv()

+
+

Synopsis

+
ssize_t
+mongoc_gridfs_file_readv (mongoc_gridfs_file_t *file,
+                          mongoc_iovec_t *iov,
+                          size_t iovcnt,
+                          size_t min_bytes,
+                          uint32_t timeout_msec);
+
+
+
+
+

Parameters

+
    +
  • file: A mongoc_gridfs_file_t.
  • +
  • iov: An array of mongoc_iovec_t.
  • +
  • iovcnt: The number of elements in iov.
  • +
  • min_bytes: The minimum number of bytes that must be read or an error will be synthesized.
  • +
  • timeout_msec: Unused.
  • +
+
+
+

Description

+

This function performs a scattered read from file, potentially blocking to read from the MongoDB server.

+

The timeout_msec parameter is unused.

+
+
+

Returns

+

Returns the number of bytes read, or -1 on failure. Use mongoc_gridfs_file_error() to retrieve error details.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_remove.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_remove.html new file mode 100644 index 0000000..b9bdfd1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_remove.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_file_remove() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_remove()

+
+

Synopsis

+
bool
+mongoc_gridfs_file_remove (mongoc_gridfs_file_t *file, bson_error_t *error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Removes file and its data chunks from the MongoDB server.

+
+
+

Returns

+

Returns true if successful. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_save.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_save.html new file mode 100644 index 0000000..7de6635 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_save.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_gridfs_file_save() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_save()

+
+

Synopsis

+
bool
+mongoc_gridfs_file_save (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Saves modifications to file to the MongoDB server.

+

If an error occurred, false is returned and the error can be retrieved with mongoc_gridfs_file_error().

+

Modifying GridFS files is NOT thread-safe. Only one thread or process can access a GridFS file while it is being modified.

+
+
+

Returns

+

Returns true if successful, otherwise false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_seek.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_seek.html new file mode 100644 index 0000000..eecb457 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_seek.html @@ -0,0 +1,202 @@ + + + + + + + + mongoc_gridfs_file_seek() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_seek()

+
+

Synopsis

+
int
+mongoc_gridfs_file_seek (mongoc_gridfs_file_t *file, int64_t delta, int whence);
+
+
+
+
+

Parameters

+
    +
  • file: A mongoc_gridfs_file_t.
  • +
  • delta: The amount to move the file position. May be positive or negative.
  • +
  • whence: One of SEEK_SET, SEEK_CUR or SEEK_END.
  • +
+
+
+

Description

+

Adjust the file position pointer in the given file by delta, starting from the position whence. The whence argument is interpreted as in fseek(2):

+ ++++ + + + + + + + + + + + +
SEEK_SETSet the position relative to the start of the file.
SEEK_CURMove delta relative to the current file position.
SEEK_ENDMove delta relative to the end of the file.
+

On success, the file’s underlying position pointer is set appropriately. On failure, the file position is NOT changed and errno is set to indicate the error.

+
+
+

Errors

+ ++++ + + + + + + + + +
EINVALwhence is not one of SEEK_SET, SEEK_CUR or SEEK_END.
EINVALThe resulting file position would be negative.
+
+
+

Returns

+

Returns 0 if successful; otherwise -1 and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_aliases.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_aliases.html new file mode 100644 index 0000000..84c03f1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_aliases.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_gridfs_file_set_aliases() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_aliases()

+
+

Synopsis

+
void
+mongoc_gridfs_file_set_aliases (mongoc_gridfs_file_t *file, const bson_t *bson);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the aliases for a gridfs file.

+

You need to call mongoc_gridfs_file_save() to persist this change.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_content_type.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_content_type.html new file mode 100644 index 0000000..500ca9e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_content_type.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_gridfs_file_set_content_type() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_content_type()

+
+

Synopsis

+
void
+mongoc_gridfs_file_set_content_type (mongoc_gridfs_file_t *file,
+                                     const char *content_type);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the content type for the gridfs file. This should be something like "text/plain".

+

You need to call mongoc_gridfs_file_save() to persist this change.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_filename.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_filename.html new file mode 100644 index 0000000..b2ce3dc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_filename.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_gridfs_file_set_filename() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_filename()

+
+

Synopsis

+
void
+mongoc_gridfs_file_set_filename (mongoc_gridfs_file_t *file,
+                                 const char *filename);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the filename for file.

+

You need to call mongoc_gridfs_file_save() to persist this change.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_id.html new file mode 100644 index 0000000..4e23292 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_id.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_file_set_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_id()

+
+

Synopsis

+
bool
+mongoc_gridfs_file_set_id (mongoc_gridfs_file_t *file,
+                           const bson_value_t *id,
+                           bson_error_t error);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the id of file to any BSON type.

+

If an error occurred, false is returned.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_md5.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_md5.html new file mode 100644 index 0000000..d0e4d39 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_md5.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_gridfs_file_set_md5() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_md5()

+
+

Synopsis

+
void
+mongoc_gridfs_file_set_md5 (mongoc_gridfs_file_t *file, const char *md5);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the MD5 checksum for file.

+

You need to call mongoc_gridfs_file_save() to persist this change.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_metadata.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_metadata.html new file mode 100644 index 0000000..d1252c7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_set_metadata.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_gridfs_file_set_metadata() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_set_metadata()

+
+

Synopsis

+
void
+mongoc_gridfs_file_set_metadata (mongoc_gridfs_file_t *file,
+                                 const bson_t *metadata);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the metadata associated with file.

+

You need to call mongoc_gridfs_file_save() to persist this change.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_t.html new file mode 100644 index 0000000..f89b5a7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_t.html @@ -0,0 +1,201 @@ + + + + + + + + mongoc_gridfs_file_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_t

+
+

Synopsis

+
typedef struct _mongoc_gridfs_file_t mongoc_gridfs_file_t;
+
+
+
+
+

Description

+

This structure provides a MongoDB GridFS file abstraction. It provides several APIs.

+
    +
  • readv, writev, seek, and tell.
  • +
  • General file metadata such as filename and length.
  • +
  • GridFS metadata such as md5, filename, content_type, aliases, metadata, chunk_size, and upload_date.
  • +
+
+
+

Thread Safety

+

This structure is NOT thread-safe and should only be used from one thread at a time.

+
+ + +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_tell.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_tell.html new file mode 100644 index 0000000..408ade7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_tell.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_file_tell() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_tell()

+
+

Synopsis

+
uint64_t
+mongoc_gridfs_file_tell (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function returns the current position indicator within file.

+
+
+

Returns

+

Returns a file position as an unsigned 64-bit integer.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_writev.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_writev.html new file mode 100644 index 0000000..573e598 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_file_writev.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_gridfs_file_writev() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_file_writev()

+
+

Synopsis

+
ssize_t
+mongoc_gridfs_file_writev (mongoc_gridfs_file_t *file,
+                           const mongoc_iovec_t *iov,
+                           size_t iovcnt,
+                           uint32_t timeout_msec);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a gathered write to the underlying gridfs file.

+

The timeout_msec parameter is unused.

+

Modifying GridFS files is NOT thread-safe. Only one thread or process can access a GridFS file while it is being modified.

+
+
+

Returns

+

Returns the number of bytes written, or -1 on failure. Use mongoc_gridfs_file_error() to retrieve error details.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find.html new file mode 100644 index 0000000..4e1522d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_gridfs_find() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_find()

+
+

Deprecated

+

This function is deprecated, use mongoc_gridfs_find_with_opts() instead.

+
+
+

Synopsis

+
mongoc_gridfs_file_list_t *
+mongoc_gridfs_find (mongoc_gridfs_t *gridfs, const bson_t *query)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_gridfs_find_with_opts);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Finds all gridfs files matching query. You can iterate the matched gridfs files with the resulting file list.

+
+
+

Returns

+

A newly allocated mongoc_gridfs_file_list_t that should be freed with mongoc_gridfs_file_list_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one.html new file mode 100644 index 0000000..b670b8c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one.html @@ -0,0 +1,178 @@ + + + + + + + + mongoc_gridfs_find_one() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_find_one()

+
+

Deprecated

+

This function is deprecated, use mongoc_gridfs_find_one_with_opts() instead.

+
+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_find_one (mongoc_gridfs_t *gridfs,
+                        const bson_t *query,
+                        bson_error_t *error)
+   BSON_GNUC_DEPRECATED_FOR (mongoc_gridfs_find_one_with_opts);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall execute a query on the underlying gridfs implementation. The first file matching query will be returned. If there is an error, NULL is returned and error is filled out; if there is no error but no matching file is found, NULL is returned and the error code and domain are 0.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A newly allocated mongoc_gridfs_file_t or NULL if no file could be found. You must free the resulting file with mongoc_gridfs_file_destroy() if non-NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_by_filename.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_by_filename.html new file mode 100644 index 0000000..4ffd5d1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_by_filename.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_gridfs_find_one_by_filename() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_find_one_by_filename()

+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_find_one_by_filename (mongoc_gridfs_t *gridfs,
+                                    const char *filename,
+                                    bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • gridfs: A mongoc_gridfs_t.
  • +
  • filename: A UTF-8 encoded string containing the filename.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Finds the first file matching the filename specified. If there is an error, NULL is returned and error is filled out; if there is no error but no matching file is found, NULL is returned and the error code and domain are 0.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns a newly allocated mongoc_gridfs_file_t if successful. You must free the resulting file with mongoc_gridfs_file_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_with_opts.html new file mode 100644 index 0000000..f3ae82c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_one_with_opts.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_gridfs_find_one_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_find_one_with_opts()

+
+

Synopsis

+
mongoc_gridfs_file_t *
+mongoc_gridfs_find_one_with_opts (mongoc_gridfs_t *gridfs,
+                                  const bson_t *filter,
+                                  const bson_t *opts,
+                                  bson_error_t *error)
+   BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+
    +
  • gridfs: A mongoc_gridfs_t.
  • +
  • filter: A bson_t containing the query to execute.
  • +
  • opts: A bson_t query options, including sort order and which fields to return. Can be NULL.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Find the first GridFS file matching filter. If there is an error, NULL is returned and error is filled out; if there is no error but no matching file is found, NULL is returned and the error code and domain are 0.

+

See mongoc_collection_find_with_opts() for a description of the filter and opts parameters.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

Returns a newly allocated mongoc_gridfs_file_t if successful. You must free the resulting file with mongoc_gridfs_file_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_with_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_with_opts.html new file mode 100644 index 0000000..766e681 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_find_with_opts.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_gridfs_find_with_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_find_with_opts()

+
+

Synopsis

+
mongoc_gridfs_file_list_t *
+mongoc_gridfs_find_with_opts (mongoc_gridfs_t *gridfs,
+                              const bson_t *filter,
+                              const bson_t *opts) BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+
    +
  • gridfs: A mongoc_gridfs_t.
  • +
  • filter: A bson_t containing the query to execute.
  • +
  • opts: A bson_t query options, including sort order and which fields to return. Can be NULL.
  • +
+
+
+

Description

+

Finds all gridfs files matching filter. You can iterate the matched gridfs files with the resulting file list.

+

See mongoc_collection_find_with_opts() for a description of the filter and opts parameters.

+
+
+

Returns

+

A newly allocated mongoc_gridfs_file_list_t that should be freed with mongoc_gridfs_file_list_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_chunks.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_chunks.html new file mode 100644 index 0000000..019ff1a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_chunks.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_get_chunks() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_get_chunks()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_gridfs_get_chunks (mongoc_gridfs_t *gridfs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns a mongoc_collection_t that contains the chunks for files. This instance is owned by the mongoc_gridfs_t instance and should not be modified or freed.

+
+
+

Returns

+

Returns a mongoc_collection_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_files.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_files.html new file mode 100644 index 0000000..cf21ef1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_get_files.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_gridfs_get_files() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_get_files()

+
+

Synopsis

+
mongoc_collection_t *
+mongoc_gridfs_get_files (mongoc_gridfs_t *gridfs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Retrieves the mongoc_collection_t containing the file metadata for GridFS. This instance is owned by the mongoc_gridfs_t and should not be modified or freed.

+
+
+

Returns

+

Returns a mongoc_collection_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_remove_by_filename.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_remove_by_filename.html new file mode 100644 index 0000000..aa7f91d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_remove_by_filename.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_gridfs_remove_by_filename() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_remove_by_filename()

+
+

Synopsis

+
bool
+mongoc_gridfs_remove_by_filename (mongoc_gridfs_t *gridfs,
+                                  const char *filename,
+                                  bson_error_t *error);
+
+
+
+
+

Parameters

+
    +
  • gridfs: A mongoc_gridfs_t.
  • +
  • filename: A UTF-8 encoded string containing the filename.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Removes all files matching filename and their data chunks from the MongoDB server.

+
+
+

Returns

+

Returns true if successful, including when no files match. Returns false and sets error if there are invalid arguments or a server or network error.

+
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_t.html new file mode 100644 index 0000000..242daf7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_gridfs_t.html @@ -0,0 +1,349 @@ + + + + + + + + mongoc_gridfs_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_gridfs_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_gridfs_t mongoc_gridfs_t;
+
+
+
+
+

Description

+

mongoc_gridfs_t provides a MongoDB gridfs implementation. The system as a whole is made up of gridfs objects, which contain gridfs_files and gridfs_file_lists. Essentially, a basic file system API.

+

There are extensive caveats about the kind of use cases gridfs is practical for. In particular, any writing after initial file creation is likely to both break any concurrent readers and be quite expensive. That said, this implementation does allow for arbitrary writes to existing gridfs object, just use them with caution.

+

mongoc_gridfs also integrates tightly with the mongoc_stream_t abstraction, which provides some convenient wrapping for file creation and reading/writing. It can be used without, but its worth looking to see if your problem can fit that model.

+
+

Warning

+

mongoc_gridfs_t does not support read preferences. In a replica set, GridFS queries are always routed to the primary.

+
+
+
+

Thread Safety

+

mongoc_gridfs_t is NOT thread-safe and should only be used in the same thread as the owning mongoc_client_t.

+
+
+

Lifecycle

+

It is an error to free a mongoc_gridfs_t before freeing all related instances of mongoc_gridfs_file_t and mongoc_gridfs_file_list_t.

+
+
+

Example

+
+
example-gridfs.c
+
#include <assert.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_gridfs_t *gridfs;
+   mongoc_gridfs_file_t *file;
+   mongoc_gridfs_file_list_t *list;
+   mongoc_gridfs_file_opt_t opt = {0};
+   mongoc_client_t *client;
+   const char *uri_string = "mongodb://127.0.0.1:27017/?appname=gridfs-example";
+   mongoc_uri_t *uri;
+   mongoc_stream_t *stream;
+   bson_t filter;
+   bson_t opts;
+   bson_t child;
+   bson_error_t error;
+   ssize_t r;
+   char buf[4096];
+   mongoc_iovec_t iov;
+   const char *filename;
+   const char *command;
+   bson_value_t id;
+
+   if (argc < 2) {
+      fprintf (stderr, "usage - %s command ...\n", argv[0]);
+      return EXIT_FAILURE;
+   }
+
+   mongoc_init ();
+
+   iov.iov_base = (void *) buf;
+   iov.iov_len = sizeof buf;
+
+   /* connect to localhost client */
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   assert (client);
+   mongoc_client_set_error_api (client, 2);
+
+   /* grab a gridfs handle in test prefixed by fs */
+   gridfs = mongoc_client_get_gridfs (client, "test", "fs", &error);
+   assert (gridfs);
+
+   command = argv[1];
+   filename = argv[2];
+
+   if (strcmp (command, "read") == 0) {
+      if (argc != 3) {
+         fprintf (stderr, "usage - %s read filename\n", argv[0]);
+         return EXIT_FAILURE;
+      }
+      file = mongoc_gridfs_find_one_by_filename (gridfs, filename, &error);
+      assert (file);
+
+      stream = mongoc_stream_gridfs_new (file);
+      assert (stream);
+
+      for (;;) {
+         r = mongoc_stream_readv (stream, &iov, 1, -1, 0);
+
+         assert (r >= 0);
+
+         if (r == 0) {
+            break;
+         }
+
+         if (fwrite (iov.iov_base, 1, r, stdout) != r) {
+            MONGOC_ERROR ("Failed to write to stdout. Exiting.\n");
+            exit (1);
+         }
+      }
+
+      mongoc_stream_destroy (stream);
+      mongoc_gridfs_file_destroy (file);
+   } else if (strcmp (command, "list") == 0) {
+      bson_init (&filter);
+
+      bson_init (&opts);
+      bson_append_document_begin (&opts, "sort", -1, &child);
+      BSON_APPEND_INT32 (&child, "filename", 1);
+      bson_append_document_end (&opts, &child);
+
+      list = mongoc_gridfs_find_with_opts (gridfs, &filter, &opts);
+
+      bson_destroy (&filter);
+      bson_destroy (&opts);
+
+      while ((file = mongoc_gridfs_file_list_next (list))) {
+         const char *name = mongoc_gridfs_file_get_filename (file);
+         printf ("%s\n", name ? name : "?");
+
+         mongoc_gridfs_file_destroy (file);
+      }
+
+      mongoc_gridfs_file_list_destroy (list);
+   } else if (strcmp (command, "write") == 0) {
+      if (argc != 4) {
+         fprintf (stderr, "usage - %s write filename input_file\n", argv[0]);
+         return EXIT_FAILURE;
+      }
+
+      stream = mongoc_stream_file_new_for_path (argv[3], O_RDONLY, 0);
+      assert (stream);
+
+      opt.filename = filename;
+
+      /* the driver generates a file_id for you */
+      file = mongoc_gridfs_create_file_from_stream (gridfs, stream, &opt);
+      assert (file);
+
+      id.value_type = BSON_TYPE_INT32;
+      id.value.v_int32 = 1;
+
+      /* optional: the following method specifies a file_id of any
+         BSON type */
+      if (!mongoc_gridfs_file_set_id (file, &id, &error)) {
+         fprintf (stderr, "%s\n", error.message);
+         return EXIT_FAILURE;
+      }
+
+      if (!mongoc_gridfs_file_save (file)) {
+         mongoc_gridfs_file_error (file, &error);
+         fprintf (stderr, "Could not save: %s\n", error.message);
+         return EXIT_FAILURE;
+      }
+
+      mongoc_gridfs_file_destroy (file);
+   } else {
+      fprintf (stderr, "Unknown command");
+      return EXIT_FAILURE;
+   }
+
+   mongoc_gridfs_destroy (gridfs);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_host_list_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_host_list_t.html new file mode 100644 index 0000000..48a5b77 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_host_list_t.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_host_list_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_host_list_t

+
+

Synopsis

+
typedef struct {
+   mongoc_host_list_t *next;
+   char host[BSON_HOST_NAME_MAX + 1];
+   char host_and_port[BSON_HOST_NAME_MAX + 7];
+   uint16_t port;
+   int family;
+   void *padding[4];
+} mongoc_host_list_t;
+
+
+
+
+

Description

+

The host and port of a MongoDB server. Can be part of a linked list: for example the return value of mongoc_uri_get_hosts() when multiple hosts are provided in the MongoDB URI.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_get_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_get_default.html new file mode 100644 index 0000000..4d9d471 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_get_default.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_index_opt_geo_get_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_geo_get_default()

+
+

Synopsis

+
const mongoc_index_opt_geo_t *
+mongoc_index_opt_geo_get_default (void) BSON_GNUC_PURE;
+
+
+
+
+

Returns

+

Returns a pointer to the default GEO index creation options.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_init.html new file mode 100644 index 0000000..7c205e0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_init.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_index_opt_geo_init() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_geo_init()

+
+

Synopsis

+
void
+mongoc_index_opt_geo_init (mongoc_index_opt_geo_t *opt);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function will initialize opt to the default values. It should be called before modifying any fields within the structure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_t.html new file mode 100644 index 0000000..6fca362 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_geo_t.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_index_opt_geo_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_geo_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct {
+   uint8_t twod_sphere_version;
+   uint8_t twod_bits_precision;
+   double twod_location_min;
+   double twod_location_max;
+   double haystack_bucket_size;
+   uint8_t *padding[32];
+} mongoc_index_opt_geo_t;
+
+
+
+
+

Description

+

This structure contains the options that may be used for tuning a GEO index.

+
+ + +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_get_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_get_default.html new file mode 100644 index 0000000..7230c7f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_get_default.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_index_opt_get_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_get_default()

+
+

Synopsis

+
const mongoc_index_opt_t *
+mongoc_index_opt_get_default (void) BSON_GNUC_PURE;
+
+
+
+
+

Returns

+

Returns a pointer to the default index creation options.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_init.html new file mode 100644 index 0000000..dab4e13 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_init.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_index_opt_init() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_init()

+
+

Synopsis

+
void
+mongoc_index_opt_init (mongoc_index_opt_t *opt);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function will initialize opt to the default values. It should be called before modifying any fields within the structure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_t.html new file mode 100644 index 0000000..31dcb0c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_t.html @@ -0,0 +1,223 @@ + + + + + + + + mongoc_index_opt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct {
+   bool is_initialized;
+   bool background;
+   bool unique;
+   const char *name;
+   bool drop_dups;
+   bool sparse;
+   int32_t expire_after_seconds;
+   int32_t v;
+   const bson_t *weights;
+   const char *default_language;
+   const char *language_override;
+   mongoc_index_opt_geo_t *geo_options;
+   mongoc_index_opt_storage_t *storage_options;
+   const bson_t *partial_filter_expression;
+   const bson_t *collation;
+   void *padding[4];
+} mongoc_index_opt_t;
+
+
+
+
+

Deprecated

+

This structure is deprecated and should not be used in new code. See Creating Indexes.

+
+
+

Description

+

This structure contains the options that may be used for tuning a specific index.

+

See the createIndexes documentations in the MongoDB manual for descriptions of individual options.

+
+

Note

+

dropDups is deprecated as of MongoDB version 3.0.0. This option is silently ignored by the server and unique index builds using this option will fail if a duplicate value is detected.

+
+
+
+

Example

+
{
+   bson_t keys;
+   bson_error_t error;
+   mongoc_index_opt_t opt;
+   mongoc_index_opt_geo_t geo_opt;
+
+   mongoc_index_opt_init (&opt);
+   mongoc_index_opt_geo_init (&geo_opt);
+
+   bson_init (&keys);
+   BSON_APPEND_UTF8 (&keys, "location", "2d");
+
+   geo_opt.twod_location_min = -123;
+   geo_opt.twod_location_max = +123;
+   geo_opt.twod_bits_precision = 30;
+   opt.geo_options = &geo_opt;
+
+   collection = mongoc_client_get_collection (client, "test", "geo_test");
+   if (mongoc_collection_create_index (collection, &keys, &opt, &error)) {
+      /* Successfully created the geo index */
+   }
+   bson_destroy (&keys);
+   mongoc_collection_destroy (&collection);
+}
+
+
+
+ + +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_get_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_get_default.html new file mode 100644 index 0000000..324194b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_get_default.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_index_opt_wt_get_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_wt_get_default()

+
+

Synopsis

+
const mongoc_index_opt_wt_t *
+mongoc_index_opt_wt_get_default (void) BSON_GNUC_PURE;
+
+
+
+
+

Returns

+

Returns a pointer to the default WiredTiger index creation options.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_init.html new file mode 100644 index 0000000..35a7000 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_init.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_index_opt_wt_init() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_wt_init()

+
+

Synopsis

+
void
+mongoc_index_opt_wt_init (mongoc_index_opt_wt_t *opt);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function will initialize opt to the default values. It should be called before modifying any fields within the structure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_t.html new file mode 100644 index 0000000..c465562 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_index_opt_wt_t.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_index_opt_wt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_index_opt_wt_t

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct {
+   mongoc_index_opt_storage_t base;
+   const char *config_str;
+   void *padding[8];
+} mongoc_index_opt_wt_t;
+
+
+
+
+

Description

+

This structure contains the options that may be used for tuning a WiredTiger specific index.

+
+ + +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_init.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_init.html new file mode 100644 index 0000000..85db5eb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_init.html @@ -0,0 +1,156 @@ + + + + + + + + mongoc_init() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_init()

+
+

Synopsis

+
void
+mongoc_init (void);
+
+
+
+
+

Description

+

Initialize the MongoDB C Driver by calling mongoc_init() exactly once at the beginning of your program. It is responsible for initializing global state such as process counters, SSL, and threading primitives.

+

Call mongoc_cleanup() exactly once at the end of your program to release all memory and other resources allocated by the driver. You must not call any other MongoDB C Driver functions after mongoc_cleanup(). Note that mongoc_init() does not reinitialize the driver after mongoc_cleanup().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_insert_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_insert_flags_t.html new file mode 100644 index 0000000..7eef49b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_insert_flags_t.html @@ -0,0 +1,178 @@ + + + + + + + + mongoc_insert_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_insert_flags_t

+

Flags for insert operations

+
+

Synopsis

+
typedef enum {
+   MONGOC_INSERT_NONE = 0,
+   MONGOC_INSERT_CONTINUE_ON_ERROR = 1 << 0,
+} mongoc_insert_flags_t;
+
+#define MONGOC_INSERT_NO_VALIDATE (1U << 31)
+
+
+
+
+

Description

+

These flags correspond to the MongoDB wire protocol. They may be bitwise or’d together. They may modify how an insert happens on the MongoDB server.

+
+
+

Flag Values

+ ++++ + + + + + + + + + + + +
MONGOC_INSERT_NONESpecify no insert flags.
MONGOC_INSERT_CONTINUE_ON_ERRORContinue inserting documents from the insertion set even if one insert fails.
MONGOC_INSERT_NO_VALIDATEDo not validate insertion documents before performing an insert. Validation can be expensive, so this can save some time if you know your documents are already valid.
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_iovec_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_iovec_t.html new file mode 100644 index 0000000..292a61d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_iovec_t.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_iovec_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_iovec_t

+
+

Synopsis

+
+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+#ifdef _WIN32
+typedef struct {
+   u_long iov_len;
+   char *iov_base;
+} mongoc_iovec_t;
+#else
+typedef struct iovec mongoc_iovec_t;
+#endif
+
+
+

The mongoc_iovec_t structure is a portability abstraction for consumers of the mongoc_stream_t interfaces. It allows for scatter/gather I/O through the socket subsystem.

+
+

Warning

+

When writing portable code, beware of the ordering of iov_len and iov_base as they are different on various platforms. Therefore, you should not use C initializers for initialization.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_destroy.html new file mode 100644 index 0000000..60af6d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_destroy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_matcher_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_matcher_destroy()

+
+

Synopsis

+
void
+mongoc_matcher_destroy (mongoc_matcher_t *matcher);
+
+
+

Release all resources associated with matcher including freeing the structure.

+
+
+

Deprecated

+
+

Warning

+

mongoc_matcher_t is deprecated and will be removed in version 2.0.

+
+
+
+

Parameters

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_match.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_match.html new file mode 100644 index 0000000..1975f43 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_match.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_matcher_match() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_matcher_match()

+
+

Synopsis

+
bool
+mongoc_matcher_match (const mongoc_matcher_t *matcher, const bson_t *document);
+
+
+

This function will check to see if the query compiled in matcher matches document.

+
+
+

Deprecated

+
+

Warning

+

mongoc_matcher_t is deprecated and will be removed in version 2.0.

+
+
+
+

Parameters

+ +
+
+

Returns

+

true if document matches the query specification provided to mongoc_matcher_new(). Otherwise, false.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_new.html new file mode 100644 index 0000000..7a0e554 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_new.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_matcher_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_matcher_new()

+
+

Synopsis

+
mongoc_matcher_t *
+mongoc_matcher_new (const bson_t *query, bson_error_t *error);
+
+
+

Create a new mongoc_matcher_t using the query specification provided.

+
+
+

Deprecated

+
+

Warning

+

mongoc_matcher_t is deprecated and will be removed in version 2.0.

+
+
+
+

Parameters

+ +
+
+

Errors

+

Errors are propagated via the error parameter.

+
+
+

Returns

+

A newly allocated mongoc_matcher_t that should be freed with mongoc_matcher_destroy() when no longer in use. Upon failure, NULL is returned and error is set. This could happen if query contains an invalid query specification.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_t.html new file mode 100644 index 0000000..da9501c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_matcher_t.html @@ -0,0 +1,222 @@ + + + + + + + + mongoc_matcher_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_matcher_t

+

Client-side document matching abstraction

+
+

Synopsis

+
typedef struct _mongoc_matcher_t mongoc_matcher_t;
+
+
+

mongoc_matcher_t provides a reduced-interface for client-side matching of BSON documents.

+

It can perform the basics such as $in, $nin, $eq, $neq, $gt, $gte, $lt, and $lte.

+
+

Warning

+

mongoc_matcher_t does not currently support the full spectrum of query operations that the MongoDB server supports.

+
+
+
+

Deprecated

+
+

Warning

+

mongoc_matcher_t is deprecated and will be removed in version 2.0.

+
+
+ +
+

Example

+
+
Filter a sequence of BSON documents from STDIN based on a query
+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_matcher_t *matcher;
+   bson_reader_t *reader;
+   const bson_t *bson;
+   bson_t *spec;
+   char *str;
+   int fd;
+
+   mongoc_init ();
+
+#ifdef _WIN32
+   fd = fileno (stdin);
+#else
+   fd = STDIN_FILENO;
+#endif
+
+   reader = bson_reader_new_from_fd (fd, false);
+
+   spec = BCON_NEW ("hello", "world");
+   matcher = mongoc_matcher_new (spec, NULL);
+
+   while ((bson = bson_reader_read (reader, NULL))) {
+      if (mongoc_matcher_match (matcher, bson)) {
+         str = bson_as_canonical_extended_json (bson, NULL);
+         printf ("%s\n", str);
+         bson_free (str);
+      }
+   }
+
+   bson_reader_destroy (reader);
+   bson_destroy (spec);
+
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_query_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_query_flags_t.html new file mode 100644 index 0000000..489aa24 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_query_flags_t.html @@ -0,0 +1,197 @@ + + + + + + + + mongoc_query_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_query_flags_t

+

Flags for query operations

+
+

Synopsis

+
typedef enum {
+   MONGOC_QUERY_NONE = 0,
+   MONGOC_QUERY_TAILABLE_CURSOR = 1 << 1,
+   MONGOC_QUERY_SLAVE_OK = 1 << 2,
+   MONGOC_QUERY_OPLOG_REPLAY = 1 << 3,
+   MONGOC_QUERY_NO_CURSOR_TIMEOUT = 1 << 4,
+   MONGOC_QUERY_AWAIT_DATA = 1 << 5,
+   MONGOC_QUERY_EXHAUST = 1 << 6,
+   MONGOC_QUERY_PARTIAL = 1 << 7,
+} mongoc_query_flags_t;
+
+
+
+
+

Description

+

These flags correspond to the MongoDB wire protocol. They may be bitwise or’d together. They may modify how a query is performed in the MongoDB server.

+
+
+

Flag Values

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +
MONGOC_QUERY_NONESpecify no query flags.
MONGOC_QUERY_TAILABLE_CURSORCursor will not be closed when the last data is retrieved. You can resume this cursor later.
MONGOC_QUERY_SLAVE_OKAllow query of replica set secondaries.
MONGOC_QUERY_OPLOG_REPLAYUsed internally by MongoDB.
MONGOC_QUERY_NO_CURSOR_TIMEOUTThe server normally times out an idle cursor after an inactivity period (10 minutes). This prevents that.
MONGOC_QUERY_AWAIT_DATAUse with MONGOC_QUERY_TAILABLE_CURSOR. Block rather than returning no data. After a period, time out.
MONGOC_QUERY_EXHAUSTStream the data down full blast in multiple “reply” packets. Faster when you are pulling down a lot of data and you know you want to retrieve it all.
MONGOC_QUERY_PARTIALGet partial results from mongos if some shards are down (instead of throwing an error).
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand.html new file mode 100644 index 0000000..5f8c8a5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand.html @@ -0,0 +1,179 @@ + + + + + + + + mongoc_rand — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_rand

+

MongoDB Random Number Generator

+
+

Synopsis

+
void
+mongoc_rand_add (const void *buf, int num, doubel entropy);
+
+void
+mongoc_rand_seed (const void *buf, int num);
+
+int
+mongoc_rand_status (void);
+
+
+
+
+

Description

+

The mongoc_rand family of functions provide access to the low level randomness primitives used by the MongoDB C Driver. In particular, they control the creation of cryptographically strong pseudo-random bytes required by some security mechanisms.

+

While we can usually pull enough entropy from the environment, you may be required to seed the PRNG manually depending on your OS, hardware and other entropy consumers running on the same system.

+
+
+

Entropy

+

mongoc_rand_add and mongoc_rand_seed allow the user to directly provide entropy. They differ insofar as mongoc_rand_seed requires that each bit provided is fully random. mongoc_rand_add allows the user to specify the degree of randomness in the provided bytes as well.

+
+
+

Status

+

The mongoc_rand_status function allows the user to check the status of the mongoc PRNG. This can be used to guarantee sufficient entropy at program startup, rather than waiting for runtime errors to occur.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_add.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_add.html new file mode 100644 index 0000000..ffe71c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_add.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_rand_add() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_rand_add()

+
+

Synopsis

+
void
+mongoc_rand_add (const void *buf, int num, double entropy);
+
+
+
+
+

Description

+

Mixes num bytes of data into the mongoc random number generator. Entropy specifies a lower bound estimate of the randomness contained in buf.

+
+
+

Parameters

+
    +
  • buf: A buffer.
  • +
  • num: An int of number of bytes in buf.
  • +
  • entropy: A double of randomness estimate in buf.
  • +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_seed.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_seed.html new file mode 100644 index 0000000..8ccc307 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_seed.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_rand_seed() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_rand_seed()

+
+

Synopsis

+
void
+mongoc_rand_seed (const void *buf, int num);
+
+
+
+
+

Description

+

Seeds the mongoc random number generator with num bytes of entropy.

+
+
+

Parameters

+
    +
  • buf: A buffer.
  • +
  • num: An int of number of bytes in buf.
  • +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_status.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_status.html new file mode 100644 index 0000000..cfbdacb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_rand_status.html @@ -0,0 +1,159 @@ + + + + + + + + mongoc_rand_status() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_rand_status()

+
+

Synopsis

+
int
+mongoc_rand_status (void);
+
+
+
+
+

Description

+

The status of the mongoc random number generator.

+
+
+

Returns

+

Returns 1 if the PRNG has been seeded with enough data, 0 otherwise.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_append.html new file mode 100644 index 0000000..9c4b8c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_append.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_read_concern_append() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_append()

+
+

Synopsis

+
bool
+mongoc_read_concern_append (mongoc_read_concern_t *read_concern, bson_t *opts);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function appends a read concern to command options. It is useful for appending a read concern to command options before passing them to mongoc_client_read_command_with_opts() or a related function that takes an options document.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+

Example

+

See the example code for mongoc_client_read_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_copy.html new file mode 100644 index 0000000..3a42803 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_copy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_concern_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_copy()

+
+

Synopsis

+
mongoc_read_concern_t *
+mongoc_read_concern_copy (const mongoc_read_concern_t *read_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a deep copy of read_concern.

+
+
+

Returns

+

Returns a newly allocated copy of read_concern that should be freed with mongoc_read_concern_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_destroy.html new file mode 100644 index 0000000..87e0710 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_read_concern_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_destroy()

+
+

Synopsis

+
void
+mongoc_read_concern_destroy (mongoc_read_concern_t *read_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees all resources associated with the read concern structure. Does nothing if read_concern is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_get_level.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_get_level.html new file mode 100644 index 0000000..e773078 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_get_level.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_concern_get_level() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_get_level()

+
+

Synopsis

+
const char *
+mongoc_read_concern_get_level (const mongoc_read_concern_t *read_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns the currently set read concern.

+
+
+

Returns

+

Returns the current readConcern. If none is set, returns NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_is_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_is_default.html new file mode 100644 index 0000000..90ce283 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_is_default.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_read_concern_is_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_is_default()

+
+

Synopsis

+
bool
+mongoc_read_concern_is_default (mongoc_read_concern_t *read_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns true if read_concern has not been modified from the default. For example, if no “readConcern” option is set in the MongoDB URI and you have not called mongoc_client_set_read_concern(), then mongoc_read_concern_is_default() is true for the read concern returned by mongoc_client_get_read_concern().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_new.html new file mode 100644 index 0000000..405955b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_new.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_read_concern_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_new()

+
+

Synopsis

+
mongoc_read_concern_t *
+mongoc_read_concern_new (void);
+
+
+
+
+

Returns

+

Creates a newly allocated read concern that can be configured based on user preference. This should be freed with mongoc_read_concern_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_set_level.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_set_level.html new file mode 100644 index 0000000..68cb6b7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_set_level.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_read_concern_set_level() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_set_level()

+
+

Synopsis

+
bool
+mongoc_read_concern_set_level (mongoc_read_concern_t *read_concern,
+                               const char *level);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the read concern level. See mongoc_read_concern_t for details.

+

Beginning in version 1.9.0, this function can now alter the read concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would return false +instead of altering the read concern.

+
+
+

Returns

+

Returns true if the read concern level was set, or false otherwise.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_t.html new file mode 100644 index 0000000..cc1d563 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_concern_t.html @@ -0,0 +1,205 @@ + + + + + + + + mongoc_read_concern_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_concern_t

+

Read Concern abstraction

+
+

Synopsis

+

New in MongoDB 3.2.

+

The mongoc_read_concern_t allows clients to choose a level of isolation for their reads. The default, MONGOC_READ_CONCERN_LEVEL_LOCAL, is right for the great majority of applications.

+

You can specify a read concern on connection objects, database objects, or collection objects.

+

See readConcern on the MongoDB website for more information.

+

Read Concern is only sent to MongoDB when it has explicitly been set by mongoc_read_concern_set_level() to anything other than NULL.

+
+
+

Read Concern Levels

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MacroDescriptionFirst MongoDB version
MONGOC_READ_CONCERN_LEVEL_LOCALLevel “local”, the default.3.2
MONGOC_READ_CONCERN_LEVEL_MAJORITYLevel “majority”.3.2
MONGOC_READ_CONCERN_LEVEL_LINEARIZABLELevel “linearizable”.3.4
MONGOC_READ_CONCERN_LEVEL_AVAILABLELevel “available”.3.6
MONGOC_READ_CONCERN_LEVEL_SNAPSHOTLevel “snapshot”.4.0
+

For the sake of compatibility with future versions of MongoDB, mongoc_read_concern_set_level() allows any string, not just this list of known read concern levels.

+

See Read Concern Levels in the MongoDB manual for more information about the individual read concern levels.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_mode_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_mode_t.html new file mode 100644 index 0000000..6039691 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_mode_t.html @@ -0,0 +1,160 @@ + + + + + + + + mongoc_read_mode_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_mode_t

+

Read Preference Modes

+
+

Synopsis

+
typedef enum {
+   MONGOC_READ_PRIMARY = (1 << 0),
+   MONGOC_READ_SECONDARY = (1 << 1),
+   MONGOC_READ_PRIMARY_PREFERRED = (1 << 2) | MONGOC_READ_PRIMARY,
+   MONGOC_READ_SECONDARY_PREFERRED = (1 << 2) | MONGOC_READ_SECONDARY,
+   MONGOC_READ_NEAREST = (1 << 3) | MONGOC_READ_SECONDARY,
+} mongoc_read_mode_t;
+
+
+
+
+

Description

+

This enum describes how reads should be dispatched. The default is MONGOC_READ_PRIMARY.

+

Please see the MongoDB website for a description of Read Preferences.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_add_tag.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_add_tag.html new file mode 100644 index 0000000..08ed1bc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_add_tag.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_read_prefs_add_tag() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_add_tag()

+
+

Synopsis

+
void
+mongoc_read_prefs_add_tag (mongoc_read_prefs_t *read_prefs, const bson_t *tag);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall add a tag to a read preference.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_copy.html new file mode 100644 index 0000000..e9a3d90 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_copy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_prefs_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_copy()

+
+

Synopsis

+
mongoc_read_prefs_t *
+mongoc_read_prefs_copy (const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function shall deep copy a read preference.

+
+
+

Returns

+

Returns a newly allocated read preference that should be freed with mongoc_read_prefs_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_destroy.html new file mode 100644 index 0000000..e62354a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_read_prefs_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_destroy()

+
+

Synopsis

+
void
+mongoc_read_prefs_destroy (mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees a read preference and all associated resources. Does nothing if read_prefs is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_max_staleness_seconds.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_max_staleness_seconds.html new file mode 100644 index 0000000..c2aa34e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_max_staleness_seconds.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_read_prefs_get_max_staleness_seconds() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_get_max_staleness_seconds()

+
+

Synopsis

+
int64_t
+mongoc_read_prefs_get_max_staleness_seconds (
+   const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Clients estimate the staleness of each secondary, and select for reads only those secondaries whose estimated staleness is less than or equal to maxStalenessSeconds. The default is MONGOC_NO_MAX_STALENESS.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_mode.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_mode.html new file mode 100644 index 0000000..4c3e1bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_mode.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_prefs_get_mode() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_get_mode()

+
+

Synopsis

+
mongoc_read_mode_t
+mongoc_read_prefs_get_mode (const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the mongoc_read_mode_t for the read preference.

+
+
+

Returns

+

Returns the read preference mode.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_tags.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_tags.html new file mode 100644 index 0000000..8d3e502 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_get_tags.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_prefs_get_tags() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_get_tags()

+
+

Synopsis

+
const bson_t *
+mongoc_read_prefs_get_tags (const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches any read preference tags that have been registered.

+
+
+

Returns

+

Returns a bson_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_is_valid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_is_valid.html new file mode 100644 index 0000000..81d8467 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_is_valid.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_read_prefs_is_valid() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_is_valid()

+
+

Synopsis

+
bool
+mongoc_read_prefs_is_valid (const mongoc_read_prefs_t *read_prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a consistency check of read_prefs to ensure it makes sense and can be satisfied.

+

This only performs local consistency checks.

+
+
+

Returns

+

Returns true if the read pref is valid.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_new.html new file mode 100644 index 0000000..b2deed9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_new.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_read_prefs_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_new()

+
+

Synopsis

+
mongoc_read_prefs_t *
+mongoc_read_prefs_new (mongoc_read_mode_t read_mode);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Creates a new mongoc_read_prefs_t using the mode specified.

+
+
+

Returns

+

Returns a newly allocated mongoc_read_prefs_t that should be freed with mongoc_read_prefs_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_max_staleness_seconds.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_max_staleness_seconds.html new file mode 100644 index 0000000..ee9f024 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_max_staleness_seconds.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_read_prefs_set_max_staleness_seconds() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_set_max_staleness_seconds()

+
+

Synopsis

+
void
+mongoc_read_prefs_set_max_staleness_seconds (mongoc_read_prefs_t *read_prefs,
+                                             int64_t max_staleness_seconds);
+
+
+
+
+

Parameters

+
    +
  • read_prefs: A mongoc_read_prefs_t.
  • +
  • max_staleness_seconds: A positive integer or MONGOC_NO_MAX_STALENESS.
  • +
+
+
+

Description

+

Sets the maxStalenessSeconds to be used for the read preference. Clients estimate the staleness of each secondary, and select for reads only those secondaries whose estimated staleness is less than or equal to maxStalenessSeconds.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_mode.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_mode.html new file mode 100644 index 0000000..c6b4f28 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_mode.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_read_prefs_set_mode() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_set_mode()

+
+

Synopsis

+
void
+mongoc_read_prefs_set_mode (mongoc_read_prefs_t *read_prefs,
+                            mongoc_read_mode_t mode);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the read preference mode. See the MongoDB website for more information on Read Preferences.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_tags.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_tags.html new file mode 100644 index 0000000..2c518a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_set_tags.html @@ -0,0 +1,232 @@ + + + + + + + + mongoc_read_prefs_set_tags() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_set_tags()

+
+

Synopsis

+
void
+mongoc_read_prefs_set_tags (mongoc_read_prefs_t *read_prefs,
+                            const bson_t *tags);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the tags to be used for the read preference. Only mongod instances matching these tags will be suitable for handling the request.

+
+
+

Examples

+
#include <mongoc/mongoc.h>
+
+static void
+run_query_with_read_prefs_tags (mongoc_collection_t *collection)
+{
+   char *str;
+   const bson_t *doc;
+   bson_t filter = BSON_INITIALIZER;
+   bson_error_t error;
+   mongoc_cursor_t *cursor;
+   mongoc_read_prefs_t *read_prefs;
+   /*  Create a tagset representing
+    *  [
+    *    {"dc": "ny", "rack": "1" }, // Any node in rack1 in the ny datacenter
+    *    {"dc": "ny", "rack": "2" }, // Any node in rack2 in the ny datacenter
+    *    {"dc": "ny" },              // Any node in the ny datacenter
+    *    {}                          // If all else fails, just any available node
+    * ]
+    */
+   bson_t *tags = BCON_NEW (
+      "0", "{", "dc", BCON_UTF8("ny"), "rack", BCON_UTF8("1"), "}",
+      "1", "{", "dc", BCON_UTF8("ny"), "rack", BCON_UTF8("2"), "}",
+      "2", "{", "dc", BCON_UTF8("ny"), "}",
+      "3", "{", "}"
+   );
+
+   read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY);
+   mongoc_read_prefs_set_tags (read_prefs, tags);
+   bson_destroy (tags);
+
+   cursor =
+      mongoc_collection_find_with_opts (collection, &filter, NULL, read_prefs);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+   if (mongoc_cursor_error (cursor, &error)) {
+      fprintf (stderr, "Cursor error: %s\n", error.message);
+   }
+
+   mongoc_cursor_destroy (cursor);
+   mongoc_read_prefs_destroy (read_prefs);
+   bson_destroy (doc);
+}
+
+int main (void)
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+
+   mongoc_init ();
+
+   client =
+      mongoc_client_new ("mongodb://localhost/?appname=rp_tags&replicaSet=foo");
+   mongoc_client_set_error_api (client, 2);
+   collection = mongoc_client_get_collection (client, "dbname", "collname");
+   run_query_with_read_prefs_tags (collection);
+
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup();
+}
+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_t.html new file mode 100644 index 0000000..3d438db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_read_prefs_t.html @@ -0,0 +1,222 @@ + + + + + + + + mongoc_read_prefs_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_read_prefs_t

+

A read preference abstraction

+
+

Synopsis

+

mongoc_read_prefs_t provides an abstraction on top of the MongoDB connection read prefences. It allows for hinting to the driver which nodes in a replica set should be accessed first.

+

You can specify a read preference mode on connection objects, database objects, collection objects, or per-operation. Generally, it makes the most sense to stick with the global default, MONGOC_READ_PRIMARY. All of the other modes come with caveats that won’t be covered in great detail here.

+
+
+

Read Modes

+ ++++ + + + + + + + + + + + + + + + + + +
MONGOC_READ_PRIMARYDefault mode. All operations read from the current replica set primary.
MONGOC_READ_SECONDARYAll operations read from among the nearest secondary members of the replica set.
MONGOC_READ_PRIMARY_PREFERREDIn most situations, operations read from the primary but if it is unavailable, operations read from secondary members.
MONGOC_READ_SECONDARY_PREFERREDIn most situations, operations read from among the nearest secondary members, but if no secondaries are available, operations read from the primary.
MONGOC_READ_NEARESTOperations read from among the nearest members of the replica set, irrespective of the member’s type.
+
+
+

Tag Sets

+

Tag sets allow you to specify custom read preferences and write concerns so that your application can target operations to specific members.

+

Custom read preferences and write concerns evaluate tags sets in different ways: read preferences consider the value of a tag when selecting a member to read from. while write concerns ignore the value of a tag to when selecting a member except to consider whether or not the value is unique.

+

You can specify tag sets with the following read preference modes:

+
    +
  • primaryPreferred
  • +
  • secondary
  • +
  • secondaryPreferred
  • +
  • nearest
  • +
+

Tags are not compatible with MONGOC_READ_PRIMARY and, in general, only apply when selecting a secondary member of a set for a read operation. However, the nearest read mode, when combined with a tag set will select the nearest member that matches the specified tag set, which may be a primary or secondary.

+

Tag sets are represented as a comma-separated list of colon-separated key-value +pairs when provided as a connection string, e.g. dc:ny,rack:1.

+

To specify a list of tag sets, using multiple readPreferenceTags, e.g.

+
readPreferenceTags=dc:ny,rack:1;readPreferenceTags=dc:ny;readPreferenceTags=
+
+
+

Note the empty value for the last one, which means match any secondary as a +last resort.

+

Order matters when using multiple readPreferenceTags.

+

Tag Sets can also be configured using mongoc_read_prefs_set_tags().

+

All interfaces use the same member selection logic to choose the member to which to direct read operations, basing the choice on read preference mode and tag sets.

+
+
+

Max Staleness

+

When connected to replica set running MongoDB 3.4 or later, the driver estimates the staleness of each secondary based on lastWriteDate values provided in server isMaster responses.

+

Max Staleness is the maximum replication lag in seconds (wall clock time) that a secondary can suffer and still be eligible for reads. The default is MONGOC_NO_MAX_STALENESS, which disables staleness checks. Otherwise, it must be a positive integer at least MONGOC_SMALLEST_MAX_STALENESS_SECONDS (90 seconds).

+

Max Staleness is also supported by sharded clusters of replica sets if all servers run MongoDB 3.4 or later.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_remove_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_remove_flags_t.html new file mode 100644 index 0000000..98aa4a2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_remove_flags_t.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_remove_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_remove_flags_t

+

Flags for deletion operations

+
+

Synopsis

+
typedef enum {
+   MONGOC_REMOVE_NONE = 0,
+   MONGOC_REMOVE_SINGLE_REMOVE = 1 << 0,
+} mongoc_remove_flags_t;
+
+
+
+
+

Description

+

These flags correspond to the MongoDB wire protocol. They may be bitwise or’d together. They may change the number of documents that are removed during a remove command.

+
+
+

Flag Values

+ ++++ + + + + + + + + +
MONGOC_REMOVE_NONESpecify no removal flags. All matching documents will be removed.
MONGOC_REMOVE_SINGLE_REMOVEOnly remove the first matching document from the selector.
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_reply_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_reply_flags_t.html new file mode 100644 index 0000000..26bb571 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_reply_flags_t.html @@ -0,0 +1,185 @@ + + + + + + + + mongoc_reply_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_reply_flags_t

+

Flags from server replies

+
+

Synopsis

+
typedef enum {
+   MONGOC_REPLY_NONE = 0,
+   MONGOC_REPLY_CURSOR_NOT_FOUND = 1 << 0,
+   MONGOC_REPLY_QUERY_FAILURE = 1 << 1,
+   MONGOC_REPLY_SHARD_CONFIG_STALE = 1 << 2,
+   MONGOC_REPLY_AWAIT_CAPABLE = 1 << 3,
+} mongoc_reply_flags_t;
+
+
+
+
+

Description

+

These flags correspond to the wire protocol. They may be bitwise or’d together.

+
+
+

Flag Values

+ ++++ + + + + + + + + + + + + + + + + + +
MONGOC_REPLY_NONENo flags set.
MONGOC_REPLY_CURSOR_NOT_FOUNDNo matching cursor was found on the server.
MONGOC_REPLY_QUERY_FAILUREThe query failed or was invalid. Error document has been provided.
MONGOC_REPLY_SHARD_CONFIG_STALEShard config is stale.
MONGOC_REPLY_AWAIT_CAPABLEIf the returned cursor is capable of MONGOC_QUERY_AWAIT_DATA.
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_destroy.html new file mode 100644 index 0000000..130f3bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_server_description_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_destroy()

+
+

Synopsis

+
void
+mongoc_server_description_destroy (mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Clean up all memory associated with the server description. Does nothing if description is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_host.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_host.html new file mode 100644 index 0000000..5d74421 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_host.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_server_description_host() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_host()

+
+

Synopsis

+
mongoc_host_list_t *
+mongoc_server_description_host (const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Return the server’s host and port. This object is owned by the server description.

+
+
+

Returns

+

A reference to the server description’s mongoc_host_list_t, which you must not modify or free.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_id.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_id.html new file mode 100644 index 0000000..4486e7b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_id.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_server_description_id() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_id()

+
+

Synopsis

+
uint32_t
+mongoc_server_description_id (const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Get the server’s id, an opaque identifier generated by the client or client pool.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_ismaster.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_ismaster.html new file mode 100644 index 0000000..aa1ca2a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_ismaster.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_server_description_ismaster() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_ismaster()

+
+

Synopsis

+
const bson_t *
+mongoc_server_description_ismaster (
+   const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

The client or client pool periodically runs an “isMaster” command on each server, to update its view of the MongoDB deployment. Use mongoc_client_get_server_descriptions() and mongoc_server_description_ismaster() to get the most recent “isMaster” response.

+
+
+

Returns

+

A reference to a BSON document, owned by the server description. The document is empty if the driver is not connected to the server.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_new_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_new_copy.html new file mode 100644 index 0000000..5aaf3e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_new_copy.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_server_description_new_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_new_copy()

+
+

Synopsis

+
mongoc_server_description_t *
+mongoc_server_description_new_copy (
+   const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function copies the given server description and returns a new server description object. The caller is responsible for destroying the new copy.

+
+
+

Returns

+

A copy of the original server description.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_round_trip_time.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_round_trip_time.html new file mode 100644 index 0000000..7f366e2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_round_trip_time.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_server_description_round_trip_time() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_round_trip_time()

+
+

Synopsis

+
int64_t
+mongoc_server_description_round_trip_time (
+   const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Get the server’s round trip time in milliseconds. This is the client’s measurement of the duration of an “ismaster” command.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_t.html new file mode 100644 index 0000000..9038a35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_t.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_server_description_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_t

+

Server description

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+typedef struct _mongoc_server_description_t mongoc_server_description_t
+
+
+

mongoc_server_description_t holds information about a mongod or mongos the driver is connected to.

+

See also mongoc_client_get_server_descriptions().

+
+
+

Lifecycle

+

Clean up with mongoc_server_description_destroy().

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_type.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_type.html new file mode 100644 index 0000000..0caddcb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_description_type.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_server_description_type() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_description_type()

+
+

Synopsis

+
const char *
+mongoc_server_description_type (const mongoc_server_description_t *description);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function returns a string, one of the server types defined in the Server Discovery And Monitoring Spec:

+
    +
  • Standalone
  • +
  • Mongos
  • +
  • PossiblePrimary
  • +
  • RSPrimary
  • +
  • RSSecondary
  • +
  • RSArbiter
  • +
  • RSOther
  • +
  • RSGhost
  • +
  • Unknown
  • +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_descriptions_destroy_all.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_descriptions_destroy_all.html new file mode 100644 index 0000000..e433b7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_server_descriptions_destroy_all.html @@ -0,0 +1,160 @@ + + + + + + + + mongoc_server_descriptions_destroy_all() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_server_descriptions_destroy_all()

+
+

Synopsis

+
void
+mongoc_server_descriptions_destroy_all (mongoc_server_description_t **sds,
+                                        size_t n);
+
+
+

Frees the array of mongoc_server_description_t structs returned by mongoc_client_get_server_descriptions().

+
+
+

Parameters

+
    +
  • sds: The array of server descriptions.
  • +
  • n: The number of elements in sds.
  • +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opt_t.html new file mode 100644 index 0000000..754708c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opt_t.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_session_opt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_session_opt_t

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_session_opt_t mongoc_session_opt_t;
+
+
+
+

Synopsis

+

Start a session with mongoc_client_start_session(), use the session for a sequence of operations and multi-document transactions, then free it with mongoc_client_session_destroy(). Any mongoc_cursor_t or mongoc_change_stream_t using a session must be destroyed before the session, and a session must be destroyed before the mongoc_client_t it came from.

+

By default, sessions are causally consistent. To disable causal consistency, before starting a session create a mongoc_session_opt_t with mongoc_session_opts_new() and call mongoc_session_opts_set_causal_consistency(), then free the struct with mongoc_session_opts_destroy().

+

Unacknowledged writes are prohibited with sessions.

+

A mongoc_client_session_t must be used by only one thread at a time. Due to session pooling, mongoc_client_start_session() may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout.

+

See the example code for mongoc_session_opts_set_causal_consistency().

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_clone.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_clone.html new file mode 100644 index 0000000..3c74af9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_clone.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_session_opts_clone() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_destroy.html new file mode 100644 index 0000000..aa8b317 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_destroy.html @@ -0,0 +1,194 @@ + + + + + + + + mongoc_session_opts_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_causal_consistency.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_causal_consistency.html new file mode 100644 index 0000000..b8abd11 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_causal_consistency.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_session_opts_get_causal_consistency() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_default_transaction_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_default_transaction_opts.html new file mode 100644 index 0000000..e20d0d2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_get_default_transaction_opts.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_session_opts_get_default_transaction_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_new.html new file mode 100644 index 0000000..9181127 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_new.html @@ -0,0 +1,188 @@ + + + + + + + + mongoc_session_opts_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_session_opts_new()

+
+

Synopsis

+
mongoc_session_opt_t *
+mongoc_session_opts_new (void);
+
+
+

Start a session with mongoc_client_start_session(), use the session for a sequence of operations and multi-document transactions, then free it with mongoc_client_session_destroy(). Any mongoc_cursor_t or mongoc_change_stream_t using a session must be destroyed before the session, and a session must be destroyed before the mongoc_client_t it came from.

+

By default, sessions are causally consistent. To disable causal consistency, before starting a session create a mongoc_session_opt_t with mongoc_session_opts_new() and call mongoc_session_opts_set_causal_consistency(), then free the struct with mongoc_session_opts_destroy().

+

Unacknowledged writes are prohibited with sessions.

+

A mongoc_client_session_t must be used by only one thread at a time. Due to session pooling, mongoc_client_start_session() may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout.

+

See the example code for mongoc_session_opts_set_causal_consistency().

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_causal_consistency.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_causal_consistency.html new file mode 100644 index 0000000..b8b73b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_causal_consistency.html @@ -0,0 +1,235 @@ + + + + + + + + mongoc_session_opts_set_causal_consistency() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_session_opts_set_causal_consistency()

+
+

Synopsis

+
void
+mongoc_session_opts_set_causal_consistency (mongoc_session_opt_t *opts,
+                                            bool causal_consistency);
+
+
+

Configure causal consistency in a session. If true (the default), each operation in the session will be causally ordered after the previous read or write operation. Set to false to disable causal consistency. See the MongoDB Manual Entry for Causal Consistency.

+

Unacknowledged writes are not causally consistent. If you execute a write operation with a mongoc_write_concern_t on which you have called mongoc_write_concern_set_w() with a value of 0, the write does not participate in causal consistency.

+
+
+

Parameters

+ +
+
+

Example

+
mongoc_client_t *client;
+mongoc_session_opt_t *session_opts;
+mongoc_client_session_t *client_session;
+mongoc_collection_t *collection;
+bson_t insert_opts = BSON_INITIALIZER;
+bson_t *doc;
+bson_error_t error;
+bool r;
+
+client = mongoc_client_new ("mongodb://example/?appname=session-opts-example");
+mongoc_client_set_error_api (client, 2);
+
+session_opts = mongoc_session_opts_new ();
+mongoc_session_opts_set_causal_consistency (session_opts, false);
+client_session = mongoc_client_start_session (client, session_opts, &error);
+mongoc_session_opts_destroy (session_opts);
+
+if (!client_session) {
+   fprintf (stderr, "Failed to start session: %s\n", error.message);
+   abort ();
+}
+
+collection = mongoc_client_get_collection (client, "test", "collection");
+doc = BCON_NEW ("_id", BCON_INT32 (1));
+r = mongoc_client_session_append (client_session, &insert_opts, NULL);
+if (!r) {
+   fprintf (stderr, "mongoc_client_session_append failed: %s\n", error.message);
+   abort ();
+}
+
+r = mongoc_collection_insert_one (
+   collection, doc, &insert_opts, NULL /* reply */, &error);
+
+if (!r) {
+   fprintf (stderr, "Insert failed: %s\n", error.message);
+   abort ();
+}
+
+
+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_default_transaction_opts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_default_transaction_opts.html new file mode 100644 index 0000000..5925b11 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_session_opts_set_default_transaction_opts.html @@ -0,0 +1,199 @@ + + + + + + + + mongoc_session_opts_set_default_transaction_opts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_session_opts_set_default_transaction_opts()

+
+

Synopsis

+
void
+mongoc_session_opts_set_default_transaction_opts (
+   mongoc_session_opt_t *opts, const mongoc_transaction_opt_t *txn_opts);
+
+
+

Set the default options for transactions started with this session. The txn_opts argument is copied and can be freed after calling this function.

+

When a session is first created with mongoc_client_start_session(), it inherits from the client the read concern, write concern, and read preference with which to start transactions. Each of these fields can be overridden independently. Create a mongoc_transaction_opt_t with mongoc_transaction_opts_new(), and pass a non-NULL option to any of the mongoc_transaction_opt_t setter functions:

+ +

Pass the resulting transaction options to mongoc_session_opts_set_default_transaction_opts(). Each field set in the transaction options overrides the inherited client configuration. There is an opportunity to override each one of these fields again by passing a mongoc_transaction_opt_t to mongoc_client_session_start_transaction().

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_accept.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_accept.html new file mode 100644 index 0000000..f0748d8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_accept.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_socket_accept() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_accept()

+
+

Synopsis

+
mongoc_socket_t *
+mongoc_socket_accept (mongoc_socket_t *sock, int64_t expire_at);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • expire_at: An int64_t containing a timeout in milliseconds.
  • +
+
+
+

Description

+

This function is a wrapper around the BSD socket accept() interface. It allows for more portability between UNIX-like and Microsoft Windows platforms.

+
+
+

Returns

+

NULL upon failure to accept or timeout. A newly allocated mongoc_socket_t that should be released with mongoc_socket_destroy() on success.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_bind.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_bind.html new file mode 100644 index 0000000..5f9b063 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_bind.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_socket_bind() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_bind()

+
+

Synopsis

+
int
+mongoc_socket_bind (mongoc_socket_t *sock,
+                    const struct sockaddr *addr,
+                    mongoc_socklen_t addrlen);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • addr: A struct sockaddr.
  • +
  • addrlen: A mongoc_socklen_t.
  • +
+
+
+

Description

+

This function is a wrapper around the BSD socket bind() interface. It provides better portability between UNIX-like and Microsoft Windows platforms.

+
+
+

Returns

+

0 on success, -1 on failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_close.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_close.html new file mode 100644 index 0000000..211b898 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_close.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_socket_close() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_close()

+
+

Synopsis

+
int
+mongoc_socket_close (mongoc_socket_t *socket);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function is a wrapper around the BSD socket shutdown() and close() functions, and their Windows equivalents. The socket is shut down only if the current process is the same as the process that opened the socket. Regardless, the socket is then closed.

+
+
+

Returns

+

0 on success, -1 on failure to close the socket. On failure, the socket’s errno is set; retrieve it with mongoc_socket_errno().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_connect.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_connect.html new file mode 100644 index 0000000..db56b02 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_connect.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_socket_connect() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_connect()

+
+

Synopsis

+
int
+mongoc_socket_connect (mongoc_socket_t *sock,
+                       const struct sockaddr *addr,
+                       mongoc_socklen_t addrlen,
+                       int64_t expire_at);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • addr: A struct sockaddr.
  • +
  • addrlen: A mongoc_socklen_t.
  • +
  • expire_at: A int64_t containing the absolute timeout using the monotonic clock.
  • +
+
+
+

Description

+

This function is a wrapper around the BSD socket connect() interface. It provides better portability between UNIX-like and Microsoft Windows platforms.

+

This function performs a socket connection but will fail if expire_at has been reached by the monotonic clock. Keep in mind that this is an absolute timeout in milliseconds. You should add your desired timeout to System Clock.

+
+
+

Returns

+

0 if successful, -1 on failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_destroy.html new file mode 100644 index 0000000..eecdf4b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_socket_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_destroy()

+
+

Synopsis

+
void
+mongoc_socket_destroy (mongoc_socket_t *sock);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function releases all resources associated with a mongoc_socket_t. This should be called when you are no longer using the socket. Does nothing if sock is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_errno.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_errno.html new file mode 100644 index 0000000..92c69d2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_errno.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_socket_errno() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_errno()

+
+

Synopsis

+
int
+mongoc_socket_errno (mongoc_socket_t *sock);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function returns the currently captured errno for a socket. This may be useful to check was the last errno was after another function call has been made that clears the threads errno variable.

+
+
+

Returns

+

0 if there is no error, otherwise a specific errno.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getnameinfo.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getnameinfo.html new file mode 100644 index 0000000..a727b35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getnameinfo.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_socket_getnameinfo() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_getnameinfo()

+
+

Synopsis

+
char *
+mongoc_socket_getnameinfo (mongoc_socket_t *sock);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This is a helper around getting the local name of a socket. It is a wrapper around getpeername() and getnameinfo().

+
+
+

Returns

+

A newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getsockname.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getsockname.html new file mode 100644 index 0000000..daf7512 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_getsockname.html @@ -0,0 +1,169 @@ + + + + + + + + mongoc_socket_getsockname() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_getsockname()

+
+

Synopsis

+
int
+mongoc_socket_getsockname (mongoc_socket_t *sock,
+                           struct sockaddr *addr,
+                           mongoc_socklen_t *addrlen);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • addr: A struct sockaddr.
  • +
  • addrlen: A mongoc_socklen_t.
  • +
+
+
+

Description

+

Retrieves the socket name for sock. The result is stored in addr. addrlen should be the size of the addr when calling this.

+
+
+

Returns

+

0 if successful, otherwise -1 and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_listen.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_listen.html new file mode 100644 index 0000000..cfaee2e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_listen.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_socket_listen() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_listen()

+
+

Synopsis

+
int
+mongoc_socket_listen (mongoc_socket_t *sock, unsigned int backlog);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function is similar to the BSD sockets listen() function. It is meant for socket servers.

+
+
+

Returns

+

0 on success, -1 on failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_new.html new file mode 100644 index 0000000..ba17ebb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_new.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_socket_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_new()

+
+

Synopsis

+
mongoc_socket_t *
+mongoc_socket_new (int domain, int type, int protocol);
+
+
+
+
+

Parameters

+
    +
  • domain: An int containing the address family such as AF_INET.
  • +
  • type: An int containing the socket type such as SOCK_STREAM.
  • +
  • protocol: A protocol subset, typically 0.
  • +
+
+
+

Description

+

Creates a new mongoc_socket_t structure. This calls socket() underneath to create a network socket.

+
+
+

Returns

+

A new socket if successful, otherwise NULL and errno is set. The result should be freed with mongoc_socket_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_recv.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_recv.html new file mode 100644 index 0000000..8c9ad67 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_recv.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_socket_recv() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_recv()

+
+

Synopsis

+
ssize_t
+mongoc_socket_recv (mongoc_socket_t *sock,
+                    void *buf,
+                    size_t buflen,
+                    int flags,
+                    int64_t expire_at);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • buf: A buffer to read into.
  • +
  • buflen: A size_t with the number of bytes to receive.
  • +
  • flags: flags for recv().
  • +
  • expire_at: A int64_t with the time to expire in monotonic time using System Clock, which is in microseconds.
  • +
+
+
+

Description

+

This function performs a recv() on the underlying socket.

+
+
+

Returns

+

The number of bytes received on success, 0 on stream closed, and -1 if there was a failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_send.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_send.html new file mode 100644 index 0000000..0685424 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_send.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_socket_send() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_send()

+
+

Synopsis

+
ssize_t
+mongoc_socket_send (mongoc_socket_t *sock,
+                    const void *buf,
+                    size_t buflen,
+                    int64_t expire_at);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • buf: A buffer to send.
  • +
  • buflen: A size_t with the number of bytes in buf.
  • +
  • expire_at: A int64_t with an absolute timeout for the operation or 0. The timeout is in monotonic time using microseconds. You can retrieve the current monotonic time with System Clock.
  • +
+
+
+

Description

+

Sends buflen bytes in buf to the destination. If a timeout expired, the number of bytes sent will be returned or -1 if no bytes were sent.

+
+
+

Returns

+

-1 on failure and errno is set, or the number of bytes sent.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_sendv.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_sendv.html new file mode 100644 index 0000000..428f808 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_sendv.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_socket_sendv() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_sendv()

+
+

Synopsis

+
ssize_t
+mongoc_socket_sendv (mongoc_socket_t *sock,
+                     mongoc_iovec_t *iov,
+                     size_t iovcnt,
+                     int64_t expire_at);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • iov: A mongoc_iovec_t.
  • +
  • iovcnt: A size_t containing the number of elements in iov.
  • +
  • expire_at: A int64_t with absolute timeout in monotonic time. The monotonic clock is in microseconds and can be fetched using System Clock.
  • +
+
+
+

Description

+

Sends a vector of buffers to the destination. This uses sendmsg() when available to perform a gathered write. If IOV_MAX is reached, a fallback will be used.

+
+
+

Returns

+

the number of bytes sent on success, or -1 on failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_setsockopt.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_setsockopt.html new file mode 100644 index 0000000..03e4abb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_setsockopt.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_socket_setsockopt() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_setsockopt()

+
+

Synopsis

+
int
+mongoc_socket_setsockopt (mongoc_socket_t *sock,
+                          int level,
+                          int optname,
+                          const void *optval,
+                          mongoc_socklen_t optlen);
+
+
+
+
+

Parameters

+
    +
  • sock: A mongoc_socket_t.
  • +
  • level: A sockopt level.
  • +
  • optname: A sockopt name.
  • +
  • optval: A the value for the sockopt.
  • +
  • optlen: A mongoc_socklen_t that contains the length of optval.
  • +
+
+
+

Description

+

This is a helper function for setsockopt().

+
+
+

Returns

+

0 on success, -1 on failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_t.html new file mode 100644 index 0000000..4456ced --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_socket_t.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_socket_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_socket_t

+

Portable socket abstraction

+
+

Synopsis

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_socket_t mongoc_socket_t
+
+
+
+
+

Synopsis

+

This structure provides a socket abstraction that is friendlier for portability than BSD sockets directly. Inconsistencies between Linux, various BSDs, Solaris, and Windows are handled here.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_get_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_get_default.html new file mode 100644 index 0000000..b517d74 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_get_default.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_ssl_opt_get_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_ssl_opt_get_default()

+
+

Synopsis

+
const mongoc_ssl_opt_t *
+mongoc_ssl_opt_get_default (void) BSON_GNUC_PURE;
+
+
+
+
+

Returns

+

Returns the default SSL options for the process. This should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_t.html new file mode 100644 index 0000000..dababea --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_ssl_opt_t.html @@ -0,0 +1,261 @@ + + + + + + + + mongoc_ssl_opt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_ssl_opt_t

+
+

Synopsis

+
typedef struct {
+   const char *pem_file;
+   const char *pem_pwd;
+   const char *ca_file;
+   const char *ca_dir;
+   const char *crl_file;
+   bool weak_cert_validation;
+   bool allow_invalid_hostname;
+   void *padding[7];
+} mongoc_ssl_opt_t;
+
+
+
+
+

Description

+

This structure is used to set the SSL options for a mongoc_client_t or mongoc_client_pool_t.

+

Beginning in version 1.2.0, once a pool or client has any SSL options set, all connections use SSL, even if ssl=true is omitted from the MongoDB URI. Before, SSL options were ignored unless ssl=true was included in the URI.

+

As of 1.4.0, the mongoc_client_pool_set_ssl_opts() and mongoc_client_set_ssl_opts() will not only shallow copy the struct, but will also copy the const char*. It is therefore no longer needed to make sure the values remain valid after setting them.

+
+
+

Configuration through URI Options

+

Most of the configurable options can be using the Connection URI.

+ ++++ + + + + + + + + + + + + + + + + + + + + + + +
mongoc_ssl_opt_t keyURI key
pem_filesslClientCertificateKeyFile
pem_pwdsslClientCertificateKeyPassword
ca_filesslCertificateAuthorityFile
weak_cert_validationsslAllowInvalidCertificates
allow_invalid_hostnamesslAllowInvalidHostnames
+
+
+

Client Authentication

+

When MongoDB is started with SSL enabled, it will by default require the client to provide a client certificate issued by a certificate authority specified by --sslCAFile, or an authority trusted by the native certificate store in use on the server.

+

To provide the client certificate, the user must configure the pem_file to point at a PEM armored certificate.

+
mongoc_ssl_opt_t ssl_opts = {0};
+
+ssl_opts.pem_file = "/path/to/client-certificate.pem"
+
+/* Then set the client ssl_opts, when using a single client mongoc_client_t */
+mongoc_client_pool_set_ssl_opts (pool, &ssl_opts);
+
+/* or, set the pool ssl_opts, when using a the thread safe mongoc_client_pool_t */
+mongoc_client_set_ssl_opts (client, &ssl_opts);
+
+
+
+
+

Server Certificate Verification

+

The MongoDB C Driver will automatically verify the validity of the server certificate, such as issued by configured Certificate Authority, hostname validation, and expiration.

+

To overwrite this behaviour, it is possible to disable hostname validation, and/or allow otherwise invalid certificates. This behaviour is controlled using the allow_invalid_hostname and weak_cert_validation fields. By default, both are set to false. It is not recommended to change these defaults as it exposes the client to Man In The Middle attacks (when allow_invalid_hostname is set) and otherwise invalid certificates when weak_cert_validation is set to true.

+
+
+

OpenSSL

+

The MongoDB C Driver uses OpenSSL, if available, on Linux and Unix platforms (besides macOS). Industry best practices and some regulations require the use of TLS 1.1 or newer, which requires at least OpenSSL 1.0.1. Check your OpenSSL version like so:

+
$ openssl version
+
+
+

Ensure your system’s OpenSSL is a recent version (at least 1.0.1), or install a recent version in a non-system path and build against it with:

+
cmake -DOPENSSL_ROOT_DIR=/absolute/path/to/openssl
+
+
+

When compiled against OpenSSL, the driver will attempt to load the system default certificate store, as configured by the distribution, if the ca_file and ca_dir are not set.

+
+
+

LibreSSL / libtls

+

The MongoDB C Driver supports LibreSSL through the use of OpenSSL compatibility checks when configured to compile against openssl. It also supports the new libtls library when configured to build against libressl.

+
+
+

Native TLS Support on Windows (Secure Channel)

+

The MongoDB C Driver supports the Windows native TLS library (Secure Channel, or SChannel), and its native crypto library (Cryptography API: Next Generation, or CNG).

+

When compiled against the Windows native libraries, the ca_dir option is not supported, and will issue an error if used.

+

Encrypted PEM files (e.g., requiring pem_pwd) are also not supported, and will result in error when attempting to load them.

+

When ca_file is provided, the driver will only allow server certificates issued by the authority (or authorities) provided. When no ca_file is provided, the driver will look up the Certificate Authority using the System Local Machine Root certificate store to confirm the provided certificate.

+

When crl_file is provided, the driver will import the revocation list to the System Local Machine Root certificate store.

+
+
+

Native TLS Support on macOS / Darwin (Secure Transport)

+

The MongoDB C Driver supports the Darwin (OS X, macOS, iOS, etc.) native TLS library (Secure Transport), and its native crypto library (Common Crypto, or CC).

+

When compiled against Secure Transport, the ca_dir option is not supported, and will issue an error if used.

+

When ca_file is provided, the driver will only allow server certificates issued by the authority (or authorities) provided. When no ca_file is provided, the driver will use the Certificate Authorities in the currently unlocked keychains.

+
+
+

Functions

+ +
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_new.html new file mode 100644 index 0000000..7f0ee23 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_new.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_stream_buffered_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_buffered_new()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_buffered_new (mongoc_stream_t *base_stream, size_t buffer_size);
+
+
+
+
+

Parameters

+
    +
  • base_stream: A mongoc_stream_t to buffer.
  • +
  • buffer_size: A size_t containing the desired buffer size.
  • +
+

This function shall create a new mongoc_stream_t that buffers bytes to and from the underlying base_stream.

+

buffer_size will be used as the initial buffer size. It may grow past this size.

+
+
+

Returns

+

A newly allocated mongoc_stream_buffered_t on success, otherwise NULL. This should be freed with mongoc_stream_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_t.html new file mode 100644 index 0000000..1b9fde5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_buffered_t.html @@ -0,0 +1,157 @@ + + + + + + + + mongoc_stream_buffered_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_buffered_t

+
+

Synopsis

+
typedef struct _mongoc_stream_buffered_t mongoc_stream_buffered_t;
+
+
+
+
+

Description

+

mongoc_stream_buffered_t should be considered a subclass of mongoc_stream_t. It performs buffering on an underlying stream.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_close.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_close.html new file mode 100644 index 0000000..b9798d7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_close.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_stream_close() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_close()

+
+

Synopsis

+
int
+mongoc_stream_close (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall close underlying file-descriptors of stream.

+
+
+

Returns

+

0 on success, otherwise -1 and errno is set.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_cork.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_cork.html new file mode 100644 index 0000000..f7c9d34 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_cork.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_stream_cork() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_cork()

+
+

Synopsis

+
int
+mongoc_stream_cork (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall prevent the writing of bytes to the underlying socket.

+
+

Note

+

Not all streams implement this function. Buffering generally works better.

+
+
+
+

Returns

+

0 on success, -1 on failure and errno is set.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_destroy.html new file mode 100644 index 0000000..bf2f61c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_destroy.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_stream_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_destroy()

+
+

Synopsis

+
void
+mongoc_stream_destroy (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall release all resources associated with a mongoc_stream_t, including freeing the structure. It is invalid to use stream after calling this function. Does nothing if stream is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_get_fd.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_get_fd.html new file mode 100644 index 0000000..3e73827 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_get_fd.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_stream_file_get_fd() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_file_get_fd()

+
+

Synopsis

+
int
+mongoc_stream_file_get_fd (mongoc_stream_file_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall return the underlying file-descriptor of a mongoc_stream_file_t.

+
+

Warning

+

Performing operations on the underlying file-descriptor may not be safe if used in conjunction with buffering. Avoid reading or writing from this file-descriptor.

+
+
+
+

Returns

+

A file-descriptor that should not be modified by the caller.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new.html new file mode 100644 index 0000000..dffbaf8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_stream_file_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_file_new()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_file_new (int fd);
+
+
+
+
+

Parameters

+
    +
  • fd: A UNIX style file-descriptor.
  • +
+

Creates a new mongoc_stream_file_t using the file-descriptor provided.

+
+
+

Returns

+

NULL upon failure, otherwise a newly allocated mongoc_stream_file_t that should be freed with mongoc_stream_destroy() when no longer in use.

+

errno is set upon failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new_for_path.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new_for_path.html new file mode 100644 index 0000000..c26b2ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_new_for_path.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_stream_file_new_for_path() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_file_new_for_path()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_file_new_for_path (const char *path, int flags, int mode);
+
+
+
+
+

Parameters

+
    +
  • path: The path of the target file.
  • +
  • flags: Flags to be passed to open().
  • +
  • mode: An optional mode to be passed to open() when creating a file.
  • +
+

This function shall create a new mongoc_stream_file_t after opening the underlying file with open() or the platform equivalent.

+
+
+

Returns

+

NULL on failure, otherwise a newly allocated mongoc_stream_file_t that should be freed with mongoc_stream_destroy() when no longer in use.

+

errno is set upon failure.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_t.html new file mode 100644 index 0000000..c709805 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_file_t.html @@ -0,0 +1,159 @@ + + + + + + + + mongoc_stream_file_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_file_t

+
+

Synopsis

+
typedef struct _mongoc_stream_file_t mongoc_stream_file_t
+
+
+

mongoc_stream_file_t is a mongoc_stream_t subclass for working with standard UNIX style file-descriptors.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_flush.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_flush.html new file mode 100644 index 0000000..d368b01 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_flush.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_stream_flush() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_flush()

+
+

Synopsis

+
int
+mongoc_stream_flush (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall flush any buffered bytes in the underlying stream to the physical transport. It mimics the API and semantics of fflush(), forcing a write of user space buffered data.

+

Not all stream implementations may implement this feature.

+
+
+

Returns

+

0 is returned on success, otherwise -1 and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_get_base_stream.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_get_base_stream.html new file mode 100644 index 0000000..0f174b2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_get_base_stream.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_stream_get_base_stream() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_get_base_stream()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_get_base_stream (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall fetch the underlying stream for streams that wrap a base stream. Such implementations include mongoc_stream_buffered_t and mongoc_stream_tls_t.

+
+
+

Returns

+

A mongoc_stream_t or NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_gridfs_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_gridfs_new.html new file mode 100644 index 0000000..2c35270 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_gridfs_new.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_stream_gridfs_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_gridfs_new()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_gridfs_new (mongoc_gridfs_file_t *file);
+
+
+
+
+

Parameters

+ +

This function shall create a new mongoc_stream_t to read from and write to a GridFS file. GridFS files are created with mongoc_gridfs_create_file() or mongoc_gridfs_create_file_from_stream().

+

This function does not transfer ownership of file. Therefore, file must remain valid for the lifetime of this stream.

+
+
+

Returns

+

A newly allocated mongoc_stream_t if successful, otherwise NULL.

+

Note, the returned stream ignores read and write timeouts passed to mongoc_stream_readv(), mongoc_stream_writev(), and so on. It uses the “socketTimeoutMS” and “connectTimeoutMS” values from the MongoDB URI.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_read.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_read.html new file mode 100644 index 0000000..519151d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_read.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_stream_read() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_read()

+
+

Synopsis

+
ssize_t
+mongoc_stream_read (mongoc_stream_t *stream,
+                    void *buf,
+                    size_t count,
+                    size_t min_bytes,
+                    int32_t timeout_msec);
+
+
+
+
+

Parameters

+
    +
  • stream: A mongoc_stream_t.
  • +
  • buf: The buffer to read into.
  • +
  • count: The number of bytes to read.
  • +
  • min_bytes: The minimum number of bytes to read, or else indicate failure.
  • +
  • timeout_msec: The number of milliseconds to wait before failure, a timeout of 0 will not block. If negative, use the default timeout.
  • +
+

The mongoc_stream_read() function shall perform a read from a mongoc_stream_t. It’s modeled on the API and semantics of read(), though the parameters map only loosely.

+
+
+

Returns

+

The mongoc_stream_read() function returns the number of bytes read on success. It returns >= 0 and < min_bytes when end-of-file is encountered and -1 on failure. errno is set upon failure.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_readv.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_readv.html new file mode 100644 index 0000000..2410f83 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_readv.html @@ -0,0 +1,176 @@ + + + + + + + + mongoc_stream_readv() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_readv()

+
+

Synopsis

+
ssize_t
+mongoc_stream_readv (mongoc_stream_t *stream,
+                     mongoc_iovec_t *iov,
+                     size_t iovcnt,
+                     size_t min_bytes,
+                     int32_t timeout_msec);
+
+
+
+
+

Parameters

+
    +
  • stream: A mongoc_stream_t.
  • +
  • iov: A vector of mongoc_iovec_t.
  • +
  • iovcnt: The number of items in iov.
  • +
  • min_bytes: The minimum number of bytes to read or failure will be indicated.
  • +
  • timeout_msec: A timeout in milliseconds, or 0 to indicate non-blocking. A negative value with use the default timeout.
  • +
+

This function is identical to mongoc_stream_read() except that it takes a mongoc_iovec_t to perform gathered I/O.

+
+
+

Returns

+

>= 0 on success, -1 on failure and errno is set.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_setsockopt.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_setsockopt.html new file mode 100644 index 0000000..617ee9b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_setsockopt.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_stream_setsockopt() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_setsockopt()

+
+

Synopsis

+
int
+mongoc_stream_setsockopt (mongoc_stream_t *stream,
+                          int level,
+                          int optname,
+                          void *optval,
+                          mongoc_socklen_t optlen);
+
+
+
+
+

Parameters

+
    +
  • stream: A mongoc_stream_t.
  • +
  • level: The level to pass to setsockopt().
  • +
  • optname: The optname to pass to setsockopt().
  • +
  • optval: The optval to pass to setsockopt().
  • +
  • optlen: The optlen to pass to setsockopt().
  • +
+

This function is a wrapper around setsockopt() for streams that wrap sockets.

+
+
+

Returns

+

0 on success, otherwise -1 and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_get_socket.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_get_socket.html new file mode 100644 index 0000000..efa4126 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_get_socket.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_stream_socket_get_socket() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_socket_get_socket()

+
+

Synopsis

+
mongoc_socket_t *
+mongoc_stream_socket_get_socket (mongoc_stream_socket_t *stream);
+
+
+
+
+

Parameters

+ +

Retrieves the underlying mongoc_socket_t for a mongoc_stream_socket_t.

+
+
+

Returns

+

A mongoc_stream_socket_t.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_new.html new file mode 100644 index 0000000..986becf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_new.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_stream_socket_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_socket_new()

+
+

Synopsis

+
mongoc_stream_t *
+mongoc_stream_socket_new (mongoc_socket_t *socket);
+
+
+
+
+

Parameters

+ +

Creates a new mongoc_stream_socket_t using the mongoc_socket_t provided.

+
+

Warning

+

This function transfers ownership of socket to the newly allocated stream.

+
+
+
+

Returns

+

A newly allocated mongoc_stream_socket_t that should be freed with mongoc_stream_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_t.html new file mode 100644 index 0000000..2cf839d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_socket_t.html @@ -0,0 +1,158 @@ + + + + + + + + mongoc_stream_socket_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_socket_t

+
+

Synopsis

+
typedef struct _mongoc_stream_socket_t mongoc_stream_socket_t
+
+
+

mongoc_stream_socket_t should be considered a subclass of mongoc_stream_t that works upon socket streams.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_t.html new file mode 100644 index 0000000..c4edfb5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_t.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_stream_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_t

+
+

Synopsis

+
typedef struct _mongoc_stream_t mongoc_stream_t
+
+
+

mongoc_stream_t provides a generic streaming IO abstraction based on a struct of pointers interface. The idea is to allow wrappers, perhaps other language drivers, to easily shim their IO system on top of mongoc_stream_t.

+

The API for the stream abstraction is currently private and non-extensible.

+
+
+

Stream Types

+

There are a number of built in stream types that come with mongoc. The default configuration is a buffered unix stream. If SSL is in use, that in turn is wrapped in a tls stream.

+
+ + +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_timed_out.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_timed_out.html new file mode 100644 index 0000000..7bbee7c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_timed_out.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_stream_timed_out() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_timed_out()

+
+

Synopsis

+
bool
+mongoc_stream_timed_out (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +
+
+

Returns

+

True if there has been a network timeout error on this stream.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_tls_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_tls_t.html new file mode 100644 index 0000000..59707db --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_tls_t.html @@ -0,0 +1,154 @@ + + + + + + + + mongoc_stream_tls_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_tls_t

+
+

Synopsis

+
typedef struct _mongoc_stream_tls_t mongoc_stream_tls_t
+
+
+

mongoc_stream_tls_t is a mongoc_stream_t subclass for working with OpenSSL TLS streams.

+
+
+

Functions

+
+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_uncork.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_uncork.html new file mode 100644 index 0000000..1a73404 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_uncork.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_stream_uncork() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_uncork()

+
+

Synopsis

+
int
+mongoc_stream_uncork (mongoc_stream_t *stream);
+
+
+
+
+

Parameters

+ +

This function shall allow a previously corked socket to pass bytes to the underlying socket.

+
+

Note

+

Not all streams implement this function. Buffering generally works better.

+
+
+
+

Returns

+

0 on success, -1 on failure and errno is set.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_write.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_write.html new file mode 100644 index 0000000..26af2e9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_write.html @@ -0,0 +1,174 @@ + + + + + + + + mongoc_stream_write() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_write()

+
+

Synopsis

+
ssize_t
+mongoc_stream_write (mongoc_stream_t *stream,
+                     void *buf,
+                     size_t count,
+                     int32_t timeout_msec);
+
+
+
+
+

Parameters

+
    +
  • stream: A mongoc_stream_t.
  • +
  • buf: The buffer to write.
  • +
  • count: The number of bytes to write.
  • +
  • timeout_msec: The number of milliseconds to wait before failure, a timeout of 0 will not block. If negative, use the default timeout.
  • +
+

The mongoc_stream_write() function shall perform a write to a mongoc_stream_t. It’s modeled on the API and semantics of write(), though the parameters map only loosely.

+
+
+

Returns

+

The mongoc_stream_write() function returns the number of bytes written on success. It returns >= 0 and < min_bytes when end-of-file is encountered and -1 on failure. errno is set upon failure.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_writev.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_writev.html new file mode 100644 index 0000000..98e5908 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_stream_writev.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_stream_writev() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_stream_writev()

+
+

Synopsis

+
ssize_t
+mongoc_stream_writev (mongoc_stream_t *stream,
+                      mongoc_iovec_t *iov,
+                      size_t iovcnt,
+                      int32_t timeout_msec);
+
+
+
+
+

Parameters

+
    +
  • stream: A mongoc_stream_t.
  • +
  • iov: A vector of mongoc_iovec_t.
  • +
  • iovcnt: The number of items in iov.
  • +
  • timeout_msec: The number of milliseconds to block before indicating failure, or 0 for non-blocking. Negative values indicate the default timeout.
  • +
+

The mongoc_stream_writev() function shall perform a write +to a mongoc_stream_t. It’s modeled on the +API and semantics of writev(), though the parameters map only +loosely.

+
+
+

Returns

+

The number of bytes written on success, or -1 upon failure and errno is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_get_servers.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_get_servers.html new file mode 100644 index 0000000..71fe83c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_get_servers.html @@ -0,0 +1,164 @@ + + + + + + + + mongoc_topology_description_get_servers() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_topology_description_get_servers()

+
+

Synopsis

+
mongoc_server_description_t **
+mongoc_topology_description_get_servers (
+   const mongoc_topology_description_t *td, size_t *n);
+
+
+

Fetches an array of mongoc_server_description_t structs for all known servers in the topology.

+
+
+

Parameters

+ +
+
+

Returns

+

A newly allocated array that must be freed with mongoc_server_descriptions_destroy_all().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_readable_server.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_readable_server.html new file mode 100644 index 0000000..532cef8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_readable_server.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_topology_description_has_readable_server() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_topology_description_has_readable_server()

+
+

Synopsis

+
bool
+mongoc_topology_description_has_readable_server (
+   mongoc_topology_description_t *td, const mongoc_read_prefs_t *prefs);
+
+
+

Determines if the topology has a readable server available. +Servers are filtered by the given read preferences only if the driver is connected to a replica set, otherwise the read preferences are ignored. +This function uses the driver’s current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O and it does not block.

+

Use this function in a topology-changed callback registered with mongoc_apm_set_topology_changed_cb(). For historical reasons, the mongoc_topology_description_t passed to the callback is a const pointer, you must cast away const to pass the pointer to mongoc_topology_description_has_readable_server.

+
+
+

Parameters

+ +
+
+

Returns

+

True if there is a known server matching prefs.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_writable_server.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_writable_server.html new file mode 100644 index 0000000..3564459 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_has_writable_server.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_topology_description_has_writable_server() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_topology_description_has_writable_server()

+
+

Synopsis

+
bool
+mongoc_topology_description_has_writable_server (
+   mongoc_topology_description_t *td);
+
+
+

Determines if the topology has a writable server available, such as a primary, mongos, or standalone. This function uses the driver’s current knowledge of the state of the MongoDB server or servers it is connected to; it does no I/O and it does not block.

+

Use this function in a topology-changed callback registered with mongoc_apm_set_topology_changed_cb(). For historical reasons, the mongoc_topology_description_t passed to the callback is a const pointer, you must cast away const to pass the pointer to mongoc_topology_description_has_writable_server.

+
+
+

Parameters

+ +
+
+

Returns

+

True if there is a known writable server.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_t.html new file mode 100644 index 0000000..5659f7d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_t.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_topology_description_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_topology_description_t

+

Status of MongoDB Servers

+
+

Synopsis

+
typedef struct _mongoc_topology_description_t mongoc_topology_description_t;
+
+
+

mongoc_topology_description_t is an opaque type representing the driver’s knowledge of the MongoDB server or servers it is connected to. +Its API conforms to the SDAM Monitoring Specification.

+

Applications receive a temporary reference to a mongoc_topology_description_t as a parameter to an SDAM Monitoring callback. See Introduction to Application Performance Monitoring.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_type.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_type.html new file mode 100644 index 0000000..7ca2e18 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_topology_description_type.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_topology_description_type() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_topology_description_type()

+
+

Synopsis

+
const char *
+mongoc_topology_description_type (const mongoc_topology_description_t *td);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function returns a string, one of the topology types defined in the Server Discovery And Monitoring Spec:

+
    +
  • Unknown
  • +
  • Single
  • +
  • Sharded
  • +
  • ReplicaSetNoPrimary
  • +
  • ReplicaSetWithPrimary
  • +
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opt_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opt_t.html new file mode 100644 index 0000000..45b00cb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opt_t.html @@ -0,0 +1,362 @@ + + + + + + + + mongoc_transaction_opt_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_transaction_opt_t

+
#include <mongoc/mongoc.h>
+
+typedef struct _mongoc_transaction_opt_t mongoc_transaction_opt_t;
+
+
+
+

Synopsis

+

Options for starting a multi-document transaction.

+

When a session is first created with mongoc_client_start_session(), it inherits from the client the read concern, write concern, and read preference with which to start transactions. Each of these fields can be overridden independently. Create a mongoc_transaction_opt_t with mongoc_transaction_opts_new(), and pass a non-NULL option to any of the mongoc_transaction_opt_t setter functions:

+ +

Pass the resulting transaction options to mongoc_client_session_start_transaction(). Each field set in the transaction options overrides the inherited client configuration.

+
+
+

Example

+
+
example-transaction.c
+
/* gcc example-transaction.c -o example-transaction \
+ *     $(pkg-config --cflags --libs libmongoc-1.0) */
+
+/* ./example-transaction [CONNECTION_STRING] */
+
+#include <stdio.h>
+#include <mongoc/mongoc.h>
+
+
+int
+main (int argc, char *argv[])
+{
+   int exit_code = EXIT_FAILURE;
+
+   mongoc_client_t *client = NULL;
+   mongoc_database_t *database = NULL;
+   mongoc_collection_t *collection = NULL;
+   mongoc_client_session_t *session = NULL;
+   mongoc_session_opt_t *session_opts = NULL;
+   mongoc_transaction_opt_t *default_txn_opts = NULL;
+   mongoc_transaction_opt_t *txn_opts = NULL;
+   mongoc_read_concern_t *read_concern = NULL;
+   mongoc_write_concern_t *write_concern = NULL;
+   const char *uri_string = "mongodb://127.0.0.1/?appname=transaction-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   bson_t *doc = NULL;
+   bson_t *insert_opts = NULL;
+   int32_t i;
+   int64_t start;
+   bson_t reply = BSON_INITIALIZER;
+   char *reply_json;
+   bool r;
+
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      MONGOC_ERROR ("failed to parse URI: %s\n"
+                    "error message:       %s\n",
+                    uri_string,
+                    error.message);
+      goto done;
+   }
+
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      goto done;
+   }
+
+   mongoc_client_set_error_api (client, 2);
+   database = mongoc_client_get_database (client, "example-transaction");
+
+   /* inserting into a nonexistent collection normally creates it, but a
+    * collection can't be created in a transaction; create it now */
+   collection =
+      mongoc_database_create_collection (database, "collection", NULL, &error);
+
+   if (!collection) {
+      /* code 48 is NamespaceExists, see error_codes.err in mongodb source */
+      if (error.code == 48) {
+         collection = mongoc_database_get_collection (database, "collection");
+      } else {
+         MONGOC_ERROR ("Failed to create collection: %s", error.message);
+         goto done;
+      }
+   }
+
+   /* a transaction's read preferences, read concern, and write concern can be
+    * set on the client, on the default transaction options, or when starting
+    * the transaction. for the sake of this example, set read concern on the
+    * default transaction options. */
+   default_txn_opts = mongoc_transaction_opts_new ();
+   read_concern = mongoc_read_concern_new ();
+   mongoc_read_concern_set_level (read_concern, "snapshot");
+   mongoc_transaction_opts_set_read_concern (default_txn_opts, read_concern);
+   session_opts = mongoc_session_opts_new ();
+   mongoc_session_opts_set_default_transaction_opts (session_opts,
+                                                     default_txn_opts);
+
+   session = mongoc_client_start_session (client, session_opts, &error);
+   if (!session) {
+      MONGOC_ERROR ("Failed to start session: %s", error.message);
+      goto done;
+   }
+
+   /* in this example, set write concern when starting the transaction */
+   txn_opts = mongoc_transaction_opts_new ();
+   write_concern = mongoc_write_concern_new ();
+   mongoc_write_concern_set_wmajority (write_concern, 1000 /* wtimeout */);
+   mongoc_transaction_opts_set_write_concern (txn_opts, write_concern);
+
+   insert_opts = bson_new ();
+   if (!mongoc_client_session_append (session, insert_opts, &error)) {
+      MONGOC_ERROR ("Could not add session to opts: %s", error.message);
+      goto done;
+   }
+
+retry_transaction:
+   r = mongoc_client_session_start_transaction (session, txn_opts, &error);
+   if (!r) {
+      MONGOC_ERROR ("Failed to start transaction: %s", error.message);
+      goto done;
+   }
+
+   /* insert two documents - on error, retry the whole transaction */
+   for (i = 0; i < 2; i++) {
+      doc = BCON_NEW ("_id", BCON_INT32 (i));
+      bson_destroy (&reply);
+      r = mongoc_collection_insert_one (
+         collection, doc, insert_opts, &reply, &error);
+
+      bson_destroy (doc);
+
+      if (!r) {
+         MONGOC_ERROR ("Insert failed: %s", error.message);
+         mongoc_client_session_abort_transaction (session, NULL);
+
+         /* a network error, primary failover, or other temporary error in a
+          * transaction includes {"errorLabels": ["TransientTransactionError"]},
+          * meaning that trying the entire transaction again may succeed
+          */
+         if (mongoc_error_has_label (&reply, "TransientTransactionError")) {
+            goto retry_transaction;
+         }
+
+         goto done;
+      }
+
+      reply_json = bson_as_json (&reply, NULL);
+      printf ("%s\n", reply_json);
+      bson_free (reply_json);
+   }
+
+   /* in case of transient errors, retry for 5 seconds to commit transaction */
+   start = bson_get_monotonic_time ();
+   while (bson_get_monotonic_time () - start < 5 * 1000 * 1000) {
+      bson_destroy (&reply);
+      r = mongoc_client_session_commit_transaction (session, &reply, &error);
+      if (r) {
+         /* success */
+         break;
+      } else {
+         MONGOC_ERROR ("Warning: commit failed: %s", error.message);
+         if (mongoc_error_has_label (&reply, "TransientTransactionError")) {
+            goto retry_transaction;
+         } else if (mongoc_error_has_label (&reply,
+                                            "UnknownTransactionCommitResult")) {
+            /* try again to commit */
+            continue;
+         }
+
+         /* unrecoverable error trying to commit */
+         break;
+      }
+   }
+
+   exit_code = EXIT_SUCCESS;
+
+done:
+   bson_destroy (&reply);
+   bson_destroy (insert_opts);
+   mongoc_write_concern_destroy (write_concern);
+   mongoc_read_concern_destroy (read_concern);
+   mongoc_transaction_opts_destroy (txn_opts);
+   mongoc_transaction_opts_destroy (default_txn_opts);
+   mongoc_client_session_destroy (session);
+   mongoc_collection_destroy (collection);
+   mongoc_database_destroy (database);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+
+   mongoc_cleanup ();
+
+   return exit_code;
+}
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_clone.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_clone.html new file mode 100644 index 0000000..7ef203e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_clone.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_transaction_opts_clone() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_destroy.html new file mode 100644 index 0000000..d2b17a5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_destroy.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_transaction_opts_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_concern.html new file mode 100644 index 0000000..bef9fb3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_concern.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_transaction_opts_get_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_prefs.html new file mode 100644 index 0000000..1016bcf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_read_prefs.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_transaction_opts_get_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_write_concern.html new file mode 100644 index 0000000..bba2980 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_get_write_concern.html @@ -0,0 +1,190 @@ + + + + + + + + mongoc_transaction_opts_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_new.html new file mode 100644 index 0000000..e3e3b47 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_new.html @@ -0,0 +1,184 @@ + + + + + + + + mongoc_transaction_opts_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_concern.html new file mode 100644 index 0000000..8817da6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_concern.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_transaction_opts_set_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_prefs.html new file mode 100644 index 0000000..f3aa897 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_read_prefs.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_transaction_opts_set_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_write_concern.html new file mode 100644 index 0000000..280c1ba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_transaction_opts_set_write_concern.html @@ -0,0 +1,192 @@ + + + + + + + + mongoc_transaction_opts_set_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_update_flags_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_update_flags_t.html new file mode 100644 index 0000000..3c41255 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_update_flags_t.html @@ -0,0 +1,182 @@ + + + + + + + + mongoc_update_flags_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_update_flags_t

+

Flags for update operations

+
+

Synopsis

+
typedef enum {
+   MONGOC_UPDATE_NONE = 0,
+   MONGOC_UPDATE_UPSERT = 1 << 0,
+   MONGOC_UPDATE_MULTI_UPDATE = 1 << 1,
+} mongoc_update_flags_t;
+
+#define MONGOC_UPDATE_NO_VALIDATE (1U << 31)
+
+
+
+
+

Description

+

These flags correspond to the MongoDB wire protocol. They may be bitwise or’d together. The allow for modifying the way an update is performed in the MongoDB server.

+
+
+

Flag Values

+ ++++ + + + + + + + + + + + + + + +
MONGOC_UPDATE_NONENo update flags set.
MONGOC_UPDATE_UPSERTIf an upsert should be performed.
MONGOC_UPDATE_MULTI_UPDATEIf more than a single matching document should be updated. By default only the first document is updated.
MONGOC_UPDATE_NO_VALIDATEDo not perform client side BSON validations when performing an update. This is useful if you already know your BSON documents are valid.
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_copy.html new file mode 100644 index 0000000..2f8c711 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_copy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_copy()

+
+

Synopsis

+
mongoc_uri_t *
+mongoc_uri_copy (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Copies the entire contents of a URI.

+
+
+

Returns

+

A newly allocated mongoc_uri_t that should be freed with mongoc_uri_destroy().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_destroy.html new file mode 100644 index 0000000..028d1a7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_uri_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_destroy()

+
+

Synopsis

+
void
+mongoc_uri_destroy (mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees all resources associated with a uri. Does nothing if uri is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_mechanism.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_mechanism.html new file mode 100644 index 0000000..f3b818e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_mechanism.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_uri_get_auth_mechanism() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_auth_mechanism()

+
+

Synopsis

+
const char *
+mongoc_uri_get_auth_mechanism (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the authMechanism parameter to an URI if provided.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_source.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_source.html new file mode 100644 index 0000000..fd2e83e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_auth_source.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_uri_get_auth_source() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_auth_source()

+
+

Synopsis

+
const char *
+mongoc_uri_get_auth_source (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the authSource parameter of an URI if provided.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_compressors.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_compressors.html new file mode 100644 index 0000000..9c4e8fe --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_compressors.html @@ -0,0 +1,178 @@ + + + + + + + + mongoc_uri_get_compressors() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_compressors()

+
+

Synopsis

+
const bson_t *
+mongoc_uri_get_compressors (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns a bson document with the enabled compressors as the keys.

+
+
+

Example

+
mongoc_client_t *client;
+mongoc_uri_t *uri;
+
+uri = mongoc_uri_new ("mongodb://localhost/?compressors=zlib,snappy");
+
+if (bson_has_field (mongoc_uri_get_compressors (uri), "snappy")) {
+   /* snappy enabled */
+}
+
+
+
+
+

Returns

+

A bson_t * which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_database.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_database.html new file mode 100644 index 0000000..d34b8d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_database.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_database() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_database()

+
+

Synopsis

+
const char *
+mongoc_uri_get_database (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the database portion of an URI if provided. This is the portion after the / but before the ?.

+
+
+

Returns

+

A string which should not be modified or freed or NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_hosts.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_hosts.html new file mode 100644 index 0000000..432a38c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_hosts.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_hosts() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_hosts()

+
+

Synopsis

+
const mongoc_host_list_t *
+mongoc_uri_get_hosts (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a linked list of hosts that were defined in the URI (the comma-separated host section).

+
+
+

Returns

+

A linked list of mongoc_host_list_t structures that should not be modified or freed. Returns NULL if this URI’s scheme is “mongodb+srv://”.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_mechanism_properties.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_mechanism_properties.html new file mode 100644 index 0000000..6280721 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_mechanism_properties.html @@ -0,0 +1,203 @@ + + + + + + + + mongoc_uri_get_mechanism_properties() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_mechanism_properties()

+
+

Synopsis

+
bool
+mongoc_uri_get_mechanism_properties (const mongoc_uri_t *uri,
+                                     bson_t *properties /* OUT */);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the “authMechanismProperties” options set on this mongoc_uri_t. The out-parameter properties should be an uninitialized, stack-allocated bson_t. It is statically initialized with bson_init_static() to point to the internal data of uri, so its contents must not be modified and it becomes invalid after uri is destroyed.

+
+
+

Returns

+

If no “authMechanismProperties” have been set on uri, this functions returns false and properties remains uninitialized.

+
+
+

Example

+
mongoc_uri_t *uri;
+bson_t props;
+
+uri = mongoc_uri_new (
+   "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI"
+   "&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
+
+if (mongoc_uri_get_mechanism_properties (uri, &props)) {
+   char *json = bson_as_canonical_extended_json (&props, NULL);
+   printf ("%s\n", json);
+   bson_free (json);
+} else {
+   printf ("No authMechanismProperties.\n");
+}
+
+
+

This code produces the output:

+
{ "SERVICE_NAME" : "other", "CANONICALIZE_HOST_NAME" : "true" }
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_bool.html new file mode 100644 index 0000000..bc4c108 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_bool.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_option_as_bool() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_option_as_bool()

+
+

Synopsis

+
bool
+mongoc_uri_get_option_as_bool (const mongoc_uri_t *uri,
+                               const char *option,
+                               bool fallback);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • fallback: A default value to return.
  • +
+
+
+

Description

+

Returns the value of the URI option if it is set and of the correct type (bool). If not set, or set to an invalid type, returns fallback.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_int32.html new file mode 100644 index 0000000..af5c431 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_int32.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_uri_get_option_as_int32() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_option_as_int32()

+
+

Synopsis

+
int32
+mongoc_uri_get_option_as_int32 (const mongoc_uri_t *uri,
+                                const char *option,
+                                int32 fallback);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • fallback: A default value to return.
  • +
+
+
+

Description

+

Returns the value of the URI option if it is set and of the correct type (int32). Returns fallback if the option is not set, set to an invalid type, or zero.

+

Zero is considered “unset”, so URIs can be constructed like so, and still accept default values:

+
bson_strdup_printf ("mongodb://localhost/?connectTimeoutMS=%d", myvalue)
+
+
+

If myvalue is non-zero it is the connection timeout; if it is zero the driver uses the default timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_utf8.html new file mode 100644 index 0000000..f3ce3ac --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_option_as_utf8.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_option_as_utf8() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_option_as_utf8()

+
+

Synopsis

+
const char *
+mongoc_uri_get_option_as_utf8 (const mongoc_uri_t *uri,
+                               const char *option,
+                               const char *fallback);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • fallback: A default value to return.
  • +
+
+
+

Description

+

Returns the value of the URI option if it is set and of the correct type (string). This value is a pointer into the URI’s internal buffer, and is only valid until the URI is modified or freed. If the option is not set, or set to an invalid type, returns fallback.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_options.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_options.html new file mode 100644 index 0000000..212695b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_options.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_options() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_options()

+
+

Synopsis

+
const bson_t *
+mongoc_uri_get_options (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a bson document containing all of the options provided after the ? of a URI.

+
+
+

Returns

+

A bson_t which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_password.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_password.html new file mode 100644 index 0000000..87f5c99 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_password.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_password() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_password()

+
+

Synopsis

+
const char *
+mongoc_uri_get_password (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the password portion of an URI.

+
+
+

Returns

+

A string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_concern.html new file mode 100644 index 0000000..475b33c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_read_concern()

+
+

Synopsis

+
const mongoc_read_concern_t *
+mongoc_uri_get_read_concern (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a read concern that is owned by the URI instance. This read concern is configured based on URI parameters.

+
+
+

Returns

+

Returns a mongoc_read_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs.html new file mode 100644 index 0000000..4a9d51c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs.html @@ -0,0 +1,173 @@ + + + + + + + + mongoc_uri_get_read_prefs() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_read_prefs()

+
+

Synopsis

+
const bson_t *
+mongoc_uri_get_read_prefs (const mongoc_uri_t *uri);
+
+
+
+
+

Deprecated

+
+

Warning

+

This function is deprecated and should not be used in new code.

+
+

Please use mongoc_uri_get_read_prefs_t() instead.

+
+
+

Parameters

+ +
+
+

Description

+

Fetches a bson document containing read preference tag information from a URI. Note that this does not include the read preference mode.

+
+
+

Returns

+

Returns a bson document that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs_t.html new file mode 100644 index 0000000..3392230 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_read_prefs_t.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_read_prefs_t() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_read_prefs_t()

+
+

Synopsis

+
const mongoc_read_prefs_t *
+mongoc_uri_get_read_prefs_t (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a read preference that is owned by the URI instance. This read preference concern is configured based on URI parameters.

+
+
+

Returns

+

Returns a mongoc_read_prefs_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_replica_set.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_replica_set.html new file mode 100644 index 0000000..31121e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_replica_set.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_replica_set() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_replica_set()

+
+

Synopsis

+
const char *
+mongoc_uri_get_replica_set (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the replicaSet parameter of an URI.

+
+
+

Returns

+

Returns a string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_service.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_service.html new file mode 100644 index 0000000..8073f99 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_service.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_service() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_service()

+
+

Synopsis

+
const char *
+mongoc_uri_get_service (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns the SRV service name of a MongoDB URI.

+
+
+

Returns

+

A string if this URI’s scheme is “mongodb+srv://”, or NULL if the scheme is “mongodb://”.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_ssl.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_ssl.html new file mode 100644 index 0000000..63f2c55 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_ssl.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_ssl() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_ssl()

+
+

Synopsis

+
bool
+mongoc_uri_get_ssl (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a boolean indicating if SSL was specified for use in the URI.

+
+
+

Returns

+

Returns a boolean, true indicating that SSL should be used.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_string.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_string.html new file mode 100644 index 0000000..6d9a3ae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_string.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_string() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_string()

+
+

Synopsis

+
const char *
+mongoc_uri_get_string (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the URI as a string.

+
+
+

Returns

+

Returns a string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_username.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_username.html new file mode 100644 index 0000000..841d415 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_username.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_username() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_username()

+
+

Synopsis

+
const char *
+mongoc_uri_get_username (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the username portion of a URI.

+
+
+

Returns

+

Returns a string which should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_write_concern.html new file mode 100644 index 0000000..945d578 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_get_write_concern.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_get_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_get_write_concern()

+
+

Synopsis

+
const mongoc_write_concern_t *
+mongoc_uri_get_write_concern (const mongoc_uri_t *uri);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches a write concern that is owned by the URI instance. This write concern is configured based on URI parameters.

+
+
+

Returns

+

Returns a mongoc_write_concern_t that should not be modified or freed.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new.html new file mode 100644 index 0000000..2f9ca8e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new.html @@ -0,0 +1,170 @@ + + + + + + + + mongoc_uri_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_new()

+
+

Synopsis

+
mongoc_uri_t *
+mongoc_uri_new (const char *uri_string) BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+
    +
  • uri_string: A string containing a URI.
  • +
+
+
+

Description

+

Calls mongoc_uri_new_with_error().

+
+
+

Returns

+

A newly allocated mongoc_uri_t if successful. Otherwise NULL, using +MONGOC_WARNING on error.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_for_host_port.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_for_host_port.html new file mode 100644 index 0000000..52115c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_for_host_port.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_uri_new_for_host_port() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_new_for_host_port()

+
+

Synopsis

+
mongoc_uri_t *
+mongoc_uri_new_for_host_port (const char *hostname, uint16_t port);
+
+
+
+
+

Parameters

+
    +
  • hostname: A string containing the hostname.
  • +
  • port: A uint16_t.
  • +
+
+
+

Description

+

Creates a new mongoc_uri_t based on the hostname and port provided.

+
+
+

Returns

+

Returns a newly allocated mongoc_uri_t that should be freed with mongoc_uri_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_with_error.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_with_error.html new file mode 100644 index 0000000..953ebcf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_new_with_error.html @@ -0,0 +1,185 @@ + + + + + + + + mongoc_uri_new_with_error() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_new_with_error()

+
+

Synopsis

+
mongoc_uri_t *
+mongoc_uri_new_with_error (const char *uri_string,
+                           bson_error_t *error) BSON_GNUC_WARN_UNUSED_RESULT;
+
+
+
+
+

Parameters

+
    +
  • uri_string: A string containing a URI.
  • +
  • error: An optional location for a bson_error_t or NULL.
  • +
+
+
+

Description

+

Parses a string containing a MongoDB style URI connection string.

+
+
+

Returns

+

A newly allocated mongoc_uri_t if successful. Otherwise NULL +populating error with the error description.

+
+

Warning

+

Failure to handle the result of this function is a programming error.

+
+
+
+

Examples

+

Examples of some valid MongoDB connection strings can be seen below.

+

"mongodb://localhost/"

+

"mongodb://localhost/?replicaSet=myreplset"

+

"mongodb://myuser:mypass@localhost/"

+

"mongodb://kerberosuser%40EXAMPLE.COM@example.com/?authMechanism=GSSAPI"

+

"mongodb://[::1]:27017/"

+

"mongodb://10.0.0.1:27017,10.0.0.1:27018,[::1]:27019/?ssl=true"

+

"mongodb://%2Ftmp%2Fmongodb-27017.sock"

+

"mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock"

+

"mongodb://localhost,[::1]/mydb?authSource=mydb"

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_bool.html new file mode 100644 index 0000000..31eaa2f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_bool.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_uri_option_is_bool() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_option_is_bool()

+
+

Synopsis

+
bool
+mongoc_uri_option_is_bool (const char *option);
+
+
+
+
+

Parameters

+
    +
  • option: The name of an option, case insensitive.
  • +
+
+
+

Description

+

Returns true if the option is a known MongoDB URI option of boolean type. For example, “ssl=false” is a valid MongoDB URI option, so mongoc_uri_option_is_bool ("ssl") is true.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_int32.html new file mode 100644 index 0000000..c30100f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_int32.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_uri_option_is_int32() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_option_is_int32()

+
+

Synopsis

+
bool
+mongoc_uri_option_is_int32 (const char *option);
+
+
+
+
+

Parameters

+
    +
  • option: The name of an option, case insensitive.
  • +
+
+
+

Description

+

Returns true if the option is a known MongoDB URI option of integer type. For example, “socketTimeoutMS=100” is a valid MongoDB URI option, so mongoc_uri_option_is_int32 ("connectTimeoutMS") is true.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_utf8.html new file mode 100644 index 0000000..6b054cd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_option_is_utf8.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_uri_option_is_utf8() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_option_is_utf8()

+
+

Synopsis

+
bool
+mongoc_uri_option_is_utf8 (const char *option);
+
+
+
+
+

Parameters

+
    +
  • option: The name of an option, case insensitive.
  • +
+
+
+

Description

+

Returns true if the option is a known MongoDB URI option of string type. For example, “replicaSet=my_rs” is a valid MongoDB URI option, so mongoc_uri_option_is_utf8 ("replicaSet") is true.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_mechanism.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_mechanism.html new file mode 100644 index 0000000..b0496c7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_mechanism.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_uri_set_auth_mechanism() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_auth_mechanism()

+
+

Synopsis

+
bool
+mongoc_uri_set_auth_mechanism (mongoc_uri_t *uri, const char *value);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • value: The new “authMechanism” value.
  • +
+
+
+

Description

+

Sets the “authMechanism” URI option, such as “SCRAM-SHA-1” or “GSSAPI”, after the URI has been parsed from a string.

+

Updates the option in-place if already set, otherwise appends it to the URI’s bson_t of options.

+
+
+

Returns

+

Returns false if the option cannot be set, for example if value is not valid UTF-8.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_source.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_source.html new file mode 100644 index 0000000..c6f081c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_auth_source.html @@ -0,0 +1,177 @@ + + + + + + + + mongoc_uri_set_auth_source() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_auth_source()

+
+

Synopsis

+
bool
+mongoc_uri_set_auth_source (mongoc_uri_t *uri, const char *value);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • value: The new “authSource” value.
  • +
+
+
+

Description

+

Sets the “authSource” URI option, after the URI has been parsed from a string.

+

Updates the option in-place if already set, otherwise appends it to the URI’s bson_t of options.

+
+
+

Returns

+

Returns false if the option cannot be set, for example if value is not valid UTF-8.

+ +
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_compressors.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_compressors.html new file mode 100644 index 0000000..d040891 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_compressors.html @@ -0,0 +1,181 @@ + + + + + + + + mongoc_uri_set_compressors() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_compressors()

+
+

Synopsis

+
bool
+mongoc_uri_set_compressors (mongoc_uri_t *uri, const char *compressors);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • compressors: One or more comma (,) separated compressors.
  • +
+
+
+

Description

+

Sets the URI’s compressors, after the URI has been parsed from a string. +Will overwrite any previously set value.

+
+
+

Example

+
mongoc_client_t *client;
+mongoc_uri_t *uri;
+
+uri = mongoc_uri_new ("mongodb://localhost/");
+mongoc_uri_set_compressors (uri, "snappy,zlib");
+mongoc_client_new_from_uri (uri);
+/* Snappy & zlib compressors are enabled */
+
+
+
+
+

Returns

+

Returns false if the option cannot be set, for example if compressors is not valid UTF-8. +Logs a warning to stderr with the MONGOC_WARNING macro +if compressor is not available.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_database.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_database.html new file mode 100644 index 0000000..2f712e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_database.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_uri_set_database() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_database()

+
+

Synopsis

+
bool
+mongoc_uri_set_database (mongoc_uri_t *uri, const char *database);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the URI’s database, after the URI has been parsed from a string.

+

The driver authenticates to this database if the connection string includes authentication credentials. This database is also the return value of mongoc_client_get_default_database().

+
+
+

Returns

+

Returns false if the option cannot be set, for example if database is not valid UTF-8.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_mechanism_properties.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_mechanism_properties.html new file mode 100644 index 0000000..ca7e625 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_mechanism_properties.html @@ -0,0 +1,200 @@ + + + + + + + + mongoc_uri_set_mechanism_properties() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_mechanism_properties()

+
+

Synopsis

+
bool
+mongoc_uri_set_mechanism_properties (mongoc_uri_t *uri,
+                                     const bson_t *properties);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Replaces all the options in URI’s “authMechanismProperties” after the URI has been parsed from a string.

+
+
+

Returns

+

Returns false if the option cannot be set, for example if properties is not valid BSON data.

+
+
+

Example

+
mongoc_uri_t *uri;
+bson_t props = BSON_INITIALIZER;
+
+uri = mongoc_uri_new (
+   "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI"
+   "&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
+
+/* replace all options: replace service name "other" with "my_service", unset
+ * "CANONICALIZE_HOST_NAME" and accept its default.
+ */
+BSON_APPEND_UTF8 (&props, "SERVICE_NAME", "my_service");
+mongoc_uri_set_mechanism_properties (uri, &props);
+
+bson_destroy (&props);
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_bool.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_bool.html new file mode 100644 index 0000000..59c3a10 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_bool.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_uri_set_option_as_bool() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_option_as_bool()

+
+

Synopsis

+
bool
+mongoc_uri_set_option_as_bool (const mongoc_uri_t *uri,
+                               const char *option,
+                               bool value);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • value: The new value.
  • +
+
+
+

Description

+

Sets an individual URI option, after the URI has been parsed from a string.

+

Only known options of type bool can be set.

+

Updates the option in-place if already set, otherwise appends it to the URI’s bson_t of options.

+
+
+

Returns

+

True if successfully set (the named option is a known option of type bool).

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_int32.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_int32.html new file mode 100644 index 0000000..c242aca --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_int32.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_uri_set_option_as_int32() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_option_as_int32()

+
+

Synopsis

+
bool
+mongoc_uri_set_option_as_int32 (const mongoc_uri_t *uri,
+                                const char *option,
+                                int32 value);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • value: The new value.
  • +
+
+
+

Description

+

Sets an individual URI option, after the URI has been parsed from a string.

+

Only known options of type int32 can be set. Some int32 options, such as minHeartbeatFrequencyMS, have additional constraints.

+

Updates the option in-place if already set, otherwise appends it to the URI’s bson_t of options.

+
+
+

Returns

+

True if successfully set (the named option is a known option of type int32).

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_utf8.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_utf8.html new file mode 100644 index 0000000..4de0246 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_option_as_utf8.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_uri_set_option_as_utf8() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_option_as_utf8()

+
+

Synopsis

+
bool
+mongoc_uri_set_option_as_utf8 (const mongoc_uri_t *uri,
+                               const char *option,
+                               utf8 value);
+
+
+
+
+

Parameters

+
    +
  • uri: A mongoc_uri_t.
  • +
  • option: The name of an option, case insensitive.
  • +
  • value: The new value.
  • +
+
+
+

Description

+

Sets an individual URI option, after the URI has been parsed from a string.

+

Only known string-type options can be set.

+

Updates the option in-place if already set, otherwise appends it to the URI’s bson_t of options.

+
+
+

Returns

+

True if successfully set (the named option is a known option of string type).

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_password.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_password.html new file mode 100644 index 0000000..f08e94e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_password.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_uri_set_password() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_password()

+
+

Synopsis

+
bool
+mongoc_uri_set_password (mongoc_uri_t *uri, const char *password);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the URI’s password, after the URI has been parsed from a string. The driver authenticates with this password if the username is also set.

+
+
+

Returns

+

Returns false if the option cannot be set, for example if password is not valid UTF-8.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_concern.html new file mode 100644 index 0000000..90af716 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_concern.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_uri_set_read_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_read_concern()

+
+

Synopsis

+
void
+mongoc_uri_set_read_concern (mongoc_uri_t *uri,
+                             const mongoc_read_concern_t *rc);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets a MongoDB URI’s read concern option, after the URI has been parsed from a string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_prefs_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_prefs_t.html new file mode 100644 index 0000000..a7466ed --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_read_prefs_t.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_uri_set_read_prefs_t() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_read_prefs_t()

+
+

Synopsis

+
void
+mongoc_uri_set_read_prefs_t (mongoc_uri_t *uri,
+                             const mongoc_read_prefs_t *prefs);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets a MongoDB URI’s read preferences, after the URI has been parsed from a string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_username.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_username.html new file mode 100644 index 0000000..9e2bea4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_username.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_uri_set_username() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_username()

+
+

Synopsis

+
bool
+mongoc_uri_set_username (mongoc_uri_t *uri, const char *username);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the URI’s username, after the URI has been parsed from a string. The driver authenticates with this username if the password is also set.

+
+
+

Returns

+

Returns false if the option cannot be set, for example if username is not valid UTF-8.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_write_concern.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_write_concern.html new file mode 100644 index 0000000..b387b97 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_set_write_concern.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_uri_set_write_concern() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_set_write_concern()

+
+

Synopsis

+
void
+mongoc_uri_set_write_concern (mongoc_uri_t *uri,
+                              const mongoc_write_concern_t *wc);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets a MongoDB URI’s write concern option, after the URI has been parsed from a string.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_t.html new file mode 100644 index 0000000..08fcc97 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_t.html @@ -0,0 +1,551 @@ + + + + + + + + mongoc_uri_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_t

+
+

Synopsis

+
typedef struct _mongoc_uri_t mongoc_uri_t;
+
+
+
+
+

Description

+

mongoc_uri_t provides an abstraction on top of the MongoDB connection URI format. It provides standardized parsing as well as convenience methods for extracting useful information such as replica hosts or authorization information.

+

See Connection String URI Reference on the MongoDB website for more information.

+
+
+

Format

+
mongodb[+srv]://                             <1>
+   [username:password@]                      <2>
+   host1                                     <3>
+   [:port1]                                  <4>
+   [,host2[:port2],...[,hostN[:portN]]]      <5>
+   [/[database]                              <6>
+   [?options]]                               <7>
+
+
+
    +
  1. “mongodb” is the specifier of the MongoDB protocol. Use “mongodb+srv” with a single service name in place of “host1” to specify the initial list of servers with an SRV record.
  2. +
  3. An optional username and password.
  4. +
  5. The only required part of the uri. This specifies either a hostname, IPv4 address, IPv6 address enclosed in “[” and “]”, or UNIX domain socket.
  6. +
  7. An optional port number. Defaults to :27017.
  8. +
  9. Extra optional hosts and ports. You would specify multiple hosts, for example, for connections to replica sets.
  10. +
  11. The name of the database to authenticate if the connection string includes authentication credentials. If /database is not specified and the connection string includes credentials, defaults to the ‘admin’ database.
  12. +
  13. Connection specific options.
  14. +
+
+

Note

+

Option names are case-insensitive

+
+

The MongoDB C Driver exposes constants for each supported connection option. These constants make it easier to discover connection options, but their string values can be used as well.

+

For example, the following calls are equal.

+
uri = mongoc_uri_new ("mongodb://localhost/?" MONGOC_URI_APPNAME "=applicationName");
+uri = mongoc_uri_new ("mongodb://localhost/?appname=applicationName");
+uri = mongoc_uri_new ("mongodb://localhost/?appName=applicationName");
+
+
+
+
+

Replica Set Example

+

To describe a connection to a replica set named ‘test’ with the following mongod hosts:

+
    +
  • db1.example.com on port 27017
  • +
  • db2.example.com on port 2500
  • +
+

You would use a connection string that resembles the following.

+
mongodb://db1.example.com,db2.example.com:2500/?replicaSet=test
+
+
+
+
+

SRV Example

+

If you have configured an SRV record with a name like “_mongodb._tcp.server.example.com” whose records are a list of one or more MongoDB server hostnames, use a connection string like this:

+
uri = mongoc_uri_new ("mongodb+srv://server.example.com/?replicaSet=rs&appName=applicationName");
+
+
+

The driver prefixes the service name with “_mongodb._tcp.”, then performs a DNS SRV query to resolve the service name to one or more hostnames. If this query succeeds, the driver performs a DNS TXT query on the service name (without the “_mongodb._tcp” prefix) for additional URI options configured as TXT records.

+

On Unix, the MongoDB C Driver relies on libresolv to look up SRV and TXT records. If libresolv is unavailable, then using a “mongodb+srv” URI will cause an error. If your libresolv lacks res_nsearch then the driver will fall back to res_search, which is not thread-safe.

+
+
+

IPv4 and IPv6

+

If connecting to a hostname that has both IPv4 and IPv6 DNS records, the behavior follows RFC-6555. A connection to the IPv6 address is attempted first. If IPv6 fails, then a connection is attempted to the IPv4 address. If the connection attempt to IPv6 does not complete within 250ms, then IPv4 is tried in parallel. Whichever succeeds connection first cancels the other. The successful DNS result is cached for 10 minutes.

+

As a consequence, attempts to connect to a mongod only listening on IPv4 may be delayed if there are both A (IPv4) and AAAA (IPv6) DNS records associated with the host.

+

To avoid a delay, configure hostnames to match the MongoDB configuration. That is, only create an A record if the mongod is only listening on IPv4.

+
+
+

Connection Options

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_RETRYWRITESretrywritesIf “true” and the server is a MongoDB 3.6+ replica set or sharded cluster, the driver safely retries a write that failed due to a network error or replica set failover. Only inserts, updates of single documents, or deletes of single +documents are retried.
MONGOC_URI_APPNAMEappnameThe client application name. This value is used by MongoDB when it logs connection information and profile information, such as slow queries.
MONGOC_URI_SSLssl{true|false}, indicating if SSL must be used. (See also mongoc_client_set_ssl_opts() and mongoc_client_pool_set_ssl_opts().)
MONGOC_URI_COMPRESSORScompressorsComma separated list of compressors, if any, to use to compress the wire protocol messages. Snappy are Zlib are optional build time dependencies, and enable the “snappy” and “zlib” values respectively. Defaults to empty (no compressors).
MONGOC_URI_CONNECTTIMEOUTMSconnecttimeoutmsThis setting applies to new server connections. It is also used as the socket timeout for server discovery and monitoring operations. The default is 10,000 ms (10 seconds).
MONGOC_URI_SOCKETTIMEOUTMSsockettimeoutmsThe time in milliseconds to attempt to send or receive on a socket before the attempt times out. The default is 300,000 (5 minutes).
MONGOC_URI_REPLICASETreplicasetThe name of the Replica Set that the driver should connect to.
MONGOC_URI_ZLIBCOMPRESSIONLEVELzlibcompressionlevelWhen the MONGOC_URI_COMPRESSORS includes “zlib” this options configures the zlib compression level, when the zlib compressor is used to compress client data.
+

Setting any of the *timeoutMS options above to 0 will be interpreted as “use the default value”.

+
+
+

Authentication Options

+ +++++ + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_AUTHMECHANISMauthmechanismSpecifies the mechanism to use when authenticating as the provided user. See Authentication for supported values.
MONGOC_URI_AUTHMECHANISMPROPERTIESauthmechanismpropertiesCertain authentication mechanisms have additional options that can be configured. These options should be provided as comma separated option_key:option_value pair and provided as authMechanismProperties.
MONGOC_URI_AUTHSOURCEauthsourceThe authSource defines the database that should be used to authenticate to. It is unnecessary to provide this option the database name is the same as the database used in the URI.
+
+

Mechanism Properties

+ +++++ + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_CANONICALIZEHOSTNAMEcanonicalizehostnameUse the canonical hostname of the service, rather than its configured alias, when authenticating with Cyrus-SASL Kerberos.
MONGOC_URI_GSSAPISERVICENAMEgssapiservicenameUse alternative service name. The default is mongodb.
+
+
+
+

SSL Options

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_SSLCLIENTCERTIFICATEKEYFILEsslclientcertificatekeyfilePath to PEM formatted Private Key, with its Public Certificate concatenated at the end.
MONGOC_URI_SSLCLIENTCERTIFICATEKEYPASSWORDsslclientcertificatekeypasswordThe password, if any, to use to unlock encrypted Private Key.
MONGOC_URI_SSLCERTIFICATEAUTHORITYFILEsslcertificateauthorityfileOne, or a bundle of, Certificate Authorities whom should be considered to be trusted.
MONGOC_URI_SSLALLOWINVALIDCERTIFICATESsslallowinvalidcertificatesAccept and ignore certificate verification errors (e.g. untrusted issuer, expired, etc etc)
MONGOC_URI_SSLALLOWINVALIDHOSTNAMESsslallowinvalidhostnamesIgnore hostname verification of the certificate (e.g. Man In The Middle, using valid certificate, but issued for another hostname)
+

See mongoc_ssl_opt_t for details about these options and about building libmongoc with SSL support.

+
+
+

Server Discovery, Monitoring, and Selection Options

+

Clients in a mongoc_client_pool_t share a topology scanner that runs on a background thread. The thread wakes every heartbeatFrequencyMS (default 10 seconds) to scan all MongoDB servers in parallel. Whenever an application operation requires a server that is not known–for example, if there is no known primary and your application attempts an insert–the thread rescans all servers every half-second. In this situation the pooled client waits up to serverSelectionTimeoutMS (default 30 seconds) for the thread to find a server suitable for the operation, then returns an error with domain MONGOC_ERROR_SERVER_SELECTION.

+

Technically, the total time an operation may wait while a pooled client scans the topology is controlled both by serverSelectionTimeoutMS and connectTimeoutMS. The longest wait occurs if the last scan begins just at the end of the selection timeout, and a slow or down server requires the full connection timeout before the client gives up.

+

A non-pooled client is single-threaded. Every heartbeatFrequencyMS, it blocks the next application operation while it does a parallel scan. This scan takes as long as needed to check the slowest server: roughly connectTimeoutMS. Therefore the default heartbeatFrequencyMS for single-threaded clients is greater than for pooled clients: 60 seconds.

+

By default, single-threaded (non-pooled) clients scan only once when an operation requires a server that is not known. If you attempt an insert and there is no known primary, the client checks all servers once trying to find it, then succeeds or returns an error with domain MONGOC_ERROR_SERVER_SELECTION. But if you set serverSelectionTryOnce to “false”, the single-threaded client loops, checking all servers every half-second, until serverSelectionTimeoutMS.

+

The total time an operation may wait for a single-threaded client to scan the topology is determined by connectTimeoutMS in the try-once case, or serverSelectionTimeoutMS and connectTimeoutMS if serverSelectionTryOnce is set “false”.

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_HEARTBEATFREQUENCYMSheartbeatfrequencymsThe interval between server monitoring checks. Defaults to 10,000ms (10 seconds) in pooled (multi-threaded) mode, 60,000ms (60 seconds) in non-pooled mode (single-threaded).
MONGOC_URI_SERVERSELECTIONTIMEOUTMSserverselectiontimeoutmsA timeout in milliseconds to block for server selection before throwing an exception. The default is 30,0000ms (30 seconds).
MONGOC_URI_SERVERSELECTIONTRYONCEserverselectiontryonceIf “true”, the driver scans the topology exactly once after server selection fails, then either selects a server or returns an error. If it is false, then the driver repeatedly searches for a suitable server for up to serverSelectionTimeoutMS milliseconds (pausing a half second between attempts). The default for serverSelectionTryOnce is “false” for pooled clients, otherwise “true”. Pooled clients ignore serverSelectionTryOnce; they signal the thread to rescan the topology every half-second until serverSelectionTimeoutMS expires.
MONGOC_URI_SOCKETCHECKINTERVALMSsocketcheckintervalmsOnly applies to single threaded clients. If a socket has not been used within this time, its connection is checked with a quick “isMaster” call before it is used again. Defaults to 5,000ms (5 seconds).
+

Setting any of the *TimeoutMS options above to 0 will be interpreted as “use the default value”.

+
+
+

Connection Pool Options

+

These options govern the behavior of a mongoc_client_pool_t. They are ignored by a non-pooled mongoc_client_t.

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_MAXPOOLSIZEmaxpoolsizeThe maximum number of clients created by a mongoc_client_pool_t total (both in the pool and checked out). The default value is 100. Once it is reached, mongoc_client_pool_pop() blocks until another thread pushes a client.
MONGOC_URI_MINPOOLSIZEminpoolsizeDeprecated. This option’s behavior does not match its name, and its actual behavior will likely hurt performance.
MONGOC_URI_MAXIDLETIMEMSmaxidletimemsNot implemented.
MONGOC_URI_WAITQUEUEMULTIPLEwaitqueuemultipleNot implemented.
MONGOC_URI_WAITQUEUETIMEOUTMSwaitqueuetimeoutmsNot implemented.
+
+
+

Write Concern Options

+ +++++ + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_Ww

Determines the write concern (guarantee). Valid values:

+
    +
  • 0 = The driver will not acknowledge write operations but will pass or handle any network and socket errors that it receives to the client. If you disable write concern but enable the getLastError command’s w option, w overrides the w option.
  • +
  • 1 = Provides basic acknowledgement of write operations. By specifying 1, you require that a standalone mongod instance, or the primary for replica sets, acknowledge all write operations. For drivers released after the default write concern change, this is the default write concern setting.
  • +
  • majority = For replica sets, if you specify the special majority value to w option, write operations will only return successfully after a majority of the configured replica set members have acknowledged the write operation.
  • +
  • n = For replica sets, if you specify a number n greater than 1, operations with this write concern return only after n members of the set have acknowledged the write. If you set n to a number that is greater than the number of available set members or members that hold data, MongoDB will wait, potentially indefinitely, for these members to become available.
  • +
  • tags = For replica sets, you can specify a tag set to require that all members of the set that have these tags configured return confirmation of the write operation.
  • +
+
MONGOC_URI_WTIMEOUTMSwtimeoutmsThe time in milliseconds to wait for replication to succeed, as specified in the w option, before timing out. When wtimeoutMS is 0, write operations will never time out.
MONGOC_URI_JOURNALjournal

Controls whether write operations will wait until the mongod acknowledges the write operations and commits the data to the on disk journal.

+
    +
  • true = Enables journal commit acknowledgement write concern. Equivalent to specifying the getLastError command with the j option enabled.
  • +
  • false = Does not require that mongod commit write operations to the journal before acknowledging the write operation. This is the default option for the journal parameter.
  • +
+
+
+
+

Read Concern Options

+ +++++ + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_READCONCERNLEVELreadconcernlevelThe level of isolation for read operations. If the level is left unspecified, the server default will be used. See readConcern in the MongoDB Manual for details.
+
+
+

Read Preference Options

+

When connected to a replica set, the driver chooses which member to query using the read preference:

+
    +
  1. Choose members whose type matches “readPreference”.
  2. +
  3. From these, if there are any tags sets configured, choose members matching the first tag set. If there are none, fall back to the next tag set and so on, until some members are chosen or the tag sets are exhausted.
  4. +
  5. From the chosen servers, distribute queries randomly among the server with the fastest round-trip times. These include the server with the fastest time and any whose round-trip time is no more than “localThresholdMS” slower.
  6. +
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_READPREFERENCEreadpreference

Specifies the replica set read preference for this connection. This setting overrides any slaveOk value. The read preference values are the following:

+
    +
  • primary (default)
  • +
  • primaryPreferred
  • +
  • secondary
  • +
  • secondaryPreferred
  • +
  • nearest
  • +
+
MONGOC_URI_READPREFERENCETAGSreadpreferencetagsA representation of a tag set. See also Tag Sets.
MONGOC_URI_LOCALTHRESHOLDMSlocalthresholdmsHow far to distribute queries, beyond the server with the fastest round-trip time. By default, only servers within 15ms of the fastest round-trip time receive queries.
MONGOC_URI_MAXSTALENESSSECONDSmaxstalenesssecondsThe maximum replication lag, in wall clock time, that a secondary can suffer and still be eligible. The smallest allowed value for maxStalenessSeconds is 90 seconds.
+
+

Note

+

When connecting to more than one mongos, libmongoc’s localThresholdMS applies only to the selection of mongos servers. The threshold for selecting among replica set members in shards is controlled by the mongos’s localThreshold command line option.

+
+
+
+

Legacy Options

+

For historical reasons, the following options are available. They should however not be used.

+ +++++ + + + + + + + + + + + + + + + + +
ConstantKeyDescription
MONGOC_URI_SAFEsafe{true|false} Same as w={1|0}
MONGOC_URI_SLAVEOKslaveokWhen set, same as readPreference=secondaryPreferred
+
+ +
+ + +
+ +
+
+
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_unescape.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_unescape.html new file mode 100644 index 0000000..f7d0122 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_uri_unescape.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_uri_unescape() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_uri_unescape()

+
+

Synopsis

+
char *
+mongoc_uri_unescape (const char *escaped_string);
+
+
+
+
+

Parameters

+
    +
  • escaped_string: A utf8 encoded string.
  • +
+
+
+

Description

+

Unescapes an URI encoded string. For example, “%40” would become “@”.

+
+
+

Returns

+

Returns a newly allocated string that should be freed with bson_free().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_version.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_version.html new file mode 100644 index 0000000..50757fa --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_version.html @@ -0,0 +1,179 @@ + + + + + + + + Version Checks — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Version Checks

+

Conditional compilation based on mongoc version

+
+

Description

+

The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against. +This may be useful if you only want to enable a feature on a certain version of the library.

+
+#include <mongoc/mongoc.h>
+
+#define MONGOC_MAJOR_VERSION (1)
+#define MONGOC_MINOR_VERSION (13)
+#define MONGOC_MICRO_VERSION (1)
+#define MONGOC_VERSION_S     "1.13.1"
+#define MONGOC_VERSION_HEX   ((1 << 24) | (0 << 16) | (0 << 8) | 0)
+#define MONGOC_CHECK_VERSION(major, minor, micro)
+
+

Only compile a block on MongoDB C Driver 1.1.0 and newer.

+
#if MONGOC_CHECK_VERSION(1, 1, 0)
+static void
+do_something (void)
+{
+}
+#endif
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_append.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_append.html new file mode 100644 index 0000000..731af00 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_append.html @@ -0,0 +1,171 @@ + + + + + + + + mongoc_write_concern_append() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_append()

+
+

Synopsis

+
bool
+mongoc_write_concern_append (mongoc_write_concern_t *write_concern,
+                             bson_t *command);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

This function appends a write concern to command options. It is useful for appending a write concern to command options before passing them to mongoc_client_write_command_with_opts() or a related function that takes an options document.

+
+
+

Returns

+

Returns true on success. If any arguments are invalid, returns false and logs an error.

+
+
+

Example

+

See the example code for mongoc_client_write_command_with_opts().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_copy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_copy.html new file mode 100644 index 0000000..1b36cc0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_copy.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_write_concern_copy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_copy()

+
+

Synopsis

+
mongoc_write_concern_t *
+mongoc_write_concern_copy (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Performs a deep copy of write_concern.

+
+
+

Returns

+

Returns a newly allocated copy of write_concern that should be freed with mongoc_write_concern_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_destroy.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_destroy.html new file mode 100644 index 0000000..c292f6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_destroy.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_write_concern_destroy() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_destroy()

+
+

Synopsis

+
void
+mongoc_write_concern_destroy (mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Frees all resources associated with the write concern structure. Does nothing if write_concern is NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_fsync.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_fsync.html new file mode 100644 index 0000000..d4da953 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_fsync.html @@ -0,0 +1,172 @@ + + + + + + + + mongoc_write_concern_get_fsync() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_fsync()

+
+

Synopsis

+
bool
+mongoc_write_concern_get_fsync (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches if an fsync should be performed before returning success on a write operation.

+
+
+

Returns

+

Returns true if fsync is set as part of the write concern.

+
+
+

Deprecated

+
+

Warning

+

The fsync write concern is deprecated; use journal instead.

+
+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_journal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_journal.html new file mode 100644 index 0000000..6ce556a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_journal.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_write_concern_get_journal() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_journal()

+
+

Synopsis

+
bool
+mongoc_write_concern_get_journal (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches if the write should be journaled before indicating success.

+
+
+

Returns

+

Returns true if the write should be journaled.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_w.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_w.html new file mode 100644 index 0000000..467a9a4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_w.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_write_concern_get_w() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_w()

+
+

Synopsis

+
int32_t
+mongoc_write_concern_get_w (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches the w parameter of the write concern.

+
+
+

Returns

+

Returns an integer containing the w value. If wmajority is set, this would be MONGOC_WRITE_CONCERN_W_MAJORITY.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wmajority.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wmajority.html new file mode 100644 index 0000000..15a5cb4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wmajority.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_write_concern_get_wmajority() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_wmajority()

+
+

Synopsis

+
bool
+mongoc_write_concern_get_wmajority (
+   const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Fetches if the write should be written to a majority of nodes before indicating success.

+
+
+

Returns

+

Returns true if wmajority is set.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtag.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtag.html new file mode 100644 index 0000000..a636d6f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtag.html @@ -0,0 +1,165 @@ + + + + + + + + mongoc_write_concern_get_wtag() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_wtag()

+
+

Synopsis

+
const char *
+mongoc_write_concern_get_wtag (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

A string containing the wtag setting if it has been set. Otherwise returns NULL.

+
+
+

Returns

+

Returns a string which should not be modified or freed, or NULL.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtimeout.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtimeout.html new file mode 100644 index 0000000..2ebd924 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_get_wtimeout.html @@ -0,0 +1,166 @@ + + + + + + + + mongoc_write_concern_get_wtimeout() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_get_wtimeout()

+
+

Synopsis

+
int32_t
+mongoc_write_concern_get_wtimeout (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Get the timeout in milliseconds that the server should wait before returning with a write concern timeout.

+

A value of 0 indicates no write timeout.

+
+
+

Returns

+

Returns an 32-bit signed integer containing the timeout.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_acknowledged.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_acknowledged.html new file mode 100644 index 0000000..88bf710 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_acknowledged.html @@ -0,0 +1,163 @@ + + + + + + + + mongoc_write_concern_is_acknowledged() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_is_acknowledged()

+
+

Synopsis

+
bool
+mongoc_write_concern_is_acknowledged (
+   const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Test if this is an acknowledged or unacknowledged write concern.

+

If write_concern is NULL, returns true. (In other words, writes are acknowledged by default.)

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_default.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_default.html new file mode 100644 index 0000000..7e8334a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_default.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_write_concern_is_default() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_is_default()

+
+

Synopsis

+
bool
+mongoc_write_concern_is_default (mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Returns true if write_concern has not been modified from the default. For example, if no “w” option is set in the MongoDB URI and you have not called mongoc_client_set_write_concern(), then +mongoc_write_concern_is_default() is true for the write concern returned by mongoc_client_get_write_concern().

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_valid.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_valid.html new file mode 100644 index 0000000..f59444f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_is_valid.html @@ -0,0 +1,161 @@ + + + + + + + + mongoc_write_concern_is_valid() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_is_valid()

+
+

Synopsis

+
bool
+mongoc_write_concern_is_valid (const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Test if this write concern uses an invalid combination of options.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_journal_is_set.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_journal_is_set.html new file mode 100644 index 0000000..16cf4f2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_journal_is_set.html @@ -0,0 +1,162 @@ + + + + + + + + mongoc_write_concern_journal_is_set() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_journal_is_set()

+
+

Synopsis

+
bool
+mongoc_write_concern_journal_is_set (
+   const mongoc_write_concern_t *write_concern);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Test whether this write concern’s “journal” option was explicitly set or uses the default setting.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_new.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_new.html new file mode 100644 index 0000000..ffdea73 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_new.html @@ -0,0 +1,155 @@ + + + + + + + + mongoc_write_concern_new() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_new()

+
+

Synopsis

+
mongoc_write_concern_t *
+mongoc_write_concern_new (void);
+
+
+
+
+

Returns

+

Creates a newly allocated write concern that can be configured based on user preference. This should be freed with mongoc_write_concern_destroy() when no longer in use.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_fsync.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_fsync.html new file mode 100644 index 0000000..402594d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_fsync.html @@ -0,0 +1,175 @@ + + + + + + + + mongoc_write_concern_set_fsync() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_fsync()

+
+

Synopsis

+
void
+mongoc_write_concern_set_fsync (mongoc_write_concern_t *write_concern,
+                                bool fsync_);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets if a fsync must be performed before indicating write success.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+

Deprecated

+
+

Warning

+

The fsync write concern is deprecated.

+
+

Please use mongoc_write_concern_set_journal() instead.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_journal.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_journal.html new file mode 100644 index 0000000..99c148b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_journal.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_write_concern_set_journal() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_journal()

+
+

Synopsis

+
void
+mongoc_write_concern_set_journal (mongoc_write_concern_t *write_concern,
+                                  bool journal);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets if the write must have been journaled before indicating success.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_w.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_w.html new file mode 100644 index 0000000..36ac735 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_w.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_write_concern_set_w() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_w()

+
+

Synopsis

+
void
+mongoc_write_concern_set_w (mongoc_write_concern_t *write_concern, int32_t w);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the w value for the write concern. See mongoc_write_concern_t for more information on this setting.

+

Unacknowledged writes are not causally consistent. If you execute a write operation with a mongoc_write_concern_t on which you have called mongoc_write_concern_set_w() with a value of 0, the write does not participate in causal consistency, even when executed with a mongoc_client_session_t.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wmajority.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wmajority.html new file mode 100644 index 0000000..3467753 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wmajority.html @@ -0,0 +1,168 @@ + + + + + + + + mongoc_write_concern_set_wmajority() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_wmajority()

+
+

Synopsis

+
void
+mongoc_write_concern_set_wmajority (mongoc_write_concern_t *write_concern,
+                                    int32_t wtimeout_msec);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets if the write must have been propagated to a majority of nodes before indicating write success.

+

The timeout specifies how long, in milliseconds, the server should wait before indicating that the write has failed. This is not the same as a socket timeout. A value of zero may be used to indicate no timeout.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtag.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtag.html new file mode 100644 index 0000000..1d8cd59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtag.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_write_concern_set_wtag() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_wtag()

+
+

Synopsis

+
void
+mongoc_write_concern_set_wtag (mongoc_write_concern_t *write_concern,
+                               const char *tag);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Sets the write tag that must be satisfied for the write to indicate success. Write tags are preset write concerns configured on your MongoDB server. See mongoc_write_concern_t for more information on this setting.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtimeout.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtimeout.html new file mode 100644 index 0000000..3e38fa6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_set_wtimeout.html @@ -0,0 +1,167 @@ + + + + + + + + mongoc_write_concern_set_wtimeout() — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_set_wtimeout()

+
+

Synopsis

+
void
+mongoc_write_concern_set_wtimeout (mongoc_write_concern_t *write_concern,
+                                   int32_t wtimeout_msec);
+
+
+
+
+

Parameters

+ +
+
+

Description

+

Set the timeout in milliseconds that the server should wait before returning with a write concern timeout. This is not the same as a socket timeout. A value of zero may be used to indicate no write concern timeout.

+

Beginning in version 1.9.0, this function can now alter the write concern after +it has been used in an operation. Previously, using the struct with an operation +would mark it as “frozen” and calling this function would log a warning instead +instead of altering the write concern.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_t.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_t.html new file mode 100644 index 0000000..de94123 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/mongoc_write_concern_t.html @@ -0,0 +1,215 @@ + + + + + + + + mongoc_write_concern_t — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

mongoc_write_concern_t

+

Write Concern abstraction

+
+

Synopsis

+

mongoc_write_concern_t tells the driver what level of acknowledgement to await from the server. The default, MONGOC_WRITE_CONCERN_W_DEFAULT, is right for the great majority of applications.

+

You can specify a write concern on connection objects, database objects, collection objects, or per-operation. Data-modifying operations typically use the write concern of the object they operate on, and check the server response for a write concern error or write concern timeout. For example, mongoc_collection_drop_index() uses the collection’s write concern, and a write concern error or timeout in the response is considered a failure.

+

Exceptions to this principle are the generic command functions:

+ +

These generic command functions do not automatically apply a write concern, and they do not check the server response for a write concern error or write concern timeout.

+

See Write Concern on the MongoDB website for more information.

+
+
+

Write Concern Levels

+

Set the write concern level with mongoc_write_concern_set_w().

+ ++++ + + + + + + + + + + + + + + +
MONGOC_WRITE_CONCERN_W_DEFAULT (1)By default, writes block awaiting acknowledgement from MongoDB. Acknowledged write concern allows clients to catch network, duplicate key, and other errors.
MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (0)With this write concern, MongoDB does not acknowledge the receipt of write operation. Unacknowledged is similar to errors ignored; however, mongoc attempts to receive and handle network errors when possible.
MONGOC_WRITE_CONCERN_W_MAJORITY (majority)Block until a write has been propagated to a majority of the nodes in the replica set.
nBlock until a write has been propagated to at least n nodes in the replica set.
+
+
+

Deprecations

+

The write concern MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED (value -1) is a deprecated synonym for MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (value 0), and will be removed in the next major release.

+

mongoc_write_concern_set_fsync() is deprecated.

+
+ +
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/objects.inv b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/objects.inv new file mode 100644 index 0000000..920816b Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/objects.inv differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/search.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/search.html new file mode 100644 index 0000000..9782a26 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/search.html @@ -0,0 +1,115 @@ + + + + + + + + Search — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/searchindex.js b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/searchindex.js new file mode 100644 index 0000000..8944b32 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({docnames:["advanced-connections","aggregate","api","application-performance-monitoring","authentication","basic-troubleshooting","bulk","connection-pooling","create-indexes","cursors","debugging","distinct-mapreduce","errors","full_index","guides","index","init-cleanup","installing","lifecycle","logging","matcher","mongoc-common-task-examples","mongoc_apm_callbacks_destroy","mongoc_apm_callbacks_new","mongoc_apm_callbacks_t","mongoc_apm_command_failed_get_command_name","mongoc_apm_command_failed_get_context","mongoc_apm_command_failed_get_duration","mongoc_apm_command_failed_get_error","mongoc_apm_command_failed_get_host","mongoc_apm_command_failed_get_operation_id","mongoc_apm_command_failed_get_reply","mongoc_apm_command_failed_get_request_id","mongoc_apm_command_failed_get_server_id","mongoc_apm_command_failed_t","mongoc_apm_command_started_get_command","mongoc_apm_command_started_get_command_name","mongoc_apm_command_started_get_context","mongoc_apm_command_started_get_database_name","mongoc_apm_command_started_get_host","mongoc_apm_command_started_get_operation_id","mongoc_apm_command_started_get_request_id","mongoc_apm_command_started_get_server_id","mongoc_apm_command_started_t","mongoc_apm_command_succeeded_get_command_name","mongoc_apm_command_succeeded_get_context","mongoc_apm_command_succeeded_get_duration","mongoc_apm_command_succeeded_get_host","mongoc_apm_command_succeeded_get_operation_id","mongoc_apm_command_succeeded_get_reply","mongoc_apm_command_succeeded_get_request_id","mongoc_apm_command_succeeded_get_server_id","mongoc_apm_command_succeeded_t","mongoc_apm_server_changed_get_context","mongoc_apm_server_changed_get_host","mongoc_apm_server_changed_get_new_description","mongoc_apm_server_changed_get_previous_description","mongoc_apm_server_changed_get_topology_id","mongoc_apm_server_changed_t","mongoc_apm_server_closed_get_context","mongoc_apm_server_closed_get_host","mongoc_apm_server_closed_get_topology_id","mongoc_apm_server_closed_t","mongoc_apm_server_heartbeat_failed_get_context","mongoc_apm_server_heartbeat_failed_get_duration","mongoc_apm_server_heartbeat_failed_get_error","mongoc_apm_server_heartbeat_failed_get_host","mongoc_apm_server_heartbeat_failed_t","mongoc_apm_server_heartbeat_started_get_context","mongoc_apm_server_heartbeat_started_get_host","mongoc_apm_server_heartbeat_started_t","mongoc_apm_server_heartbeat_succeeded_get_context","mongoc_apm_server_heartbeat_succeeded_get_duration","mongoc_apm_server_heartbeat_succeeded_get_host","mongoc_apm_server_heartbeat_succeeded_get_reply","mongoc_apm_server_heartbeat_succeeded_t","mongoc_apm_server_opening_get_context","mongoc_apm_server_opening_get_host","mongoc_apm_server_opening_get_topology_id","mongoc_apm_server_opening_t","mongoc_apm_set_command_failed_cb","mongoc_apm_set_command_started_cb","mongoc_apm_set_command_succeeded_cb","mongoc_apm_set_server_changed_cb","mongoc_apm_set_server_closed_cb","mongoc_apm_set_server_heartbeat_failed_cb","mongoc_apm_set_server_heartbeat_started_cb","mongoc_apm_set_server_heartbeat_succeeded_cb","mongoc_apm_set_server_opening_cb","mongoc_apm_set_topology_changed_cb","mongoc_apm_set_topology_closed_cb","mongoc_apm_set_topology_opening_cb","mongoc_apm_topology_changed_get_context","mongoc_apm_topology_changed_get_new_description","mongoc_apm_topology_changed_get_previous_description","mongoc_apm_topology_changed_get_topology_id","mongoc_apm_topology_changed_t","mongoc_apm_topology_closed_get_context","mongoc_apm_topology_closed_get_topology_id","mongoc_apm_topology_closed_t","mongoc_apm_topology_opening_get_context","mongoc_apm_topology_opening_get_topology_id","mongoc_apm_topology_opening_t","mongoc_bulk_operation_delete","mongoc_bulk_operation_delete_one","mongoc_bulk_operation_destroy","mongoc_bulk_operation_execute","mongoc_bulk_operation_get_hint","mongoc_bulk_operation_get_write_concern","mongoc_bulk_operation_insert","mongoc_bulk_operation_insert_with_opts","mongoc_bulk_operation_remove","mongoc_bulk_operation_remove_many_with_opts","mongoc_bulk_operation_remove_one","mongoc_bulk_operation_remove_one_with_opts","mongoc_bulk_operation_replace_one","mongoc_bulk_operation_replace_one_with_opts","mongoc_bulk_operation_set_bypass_document_validation","mongoc_bulk_operation_set_hint","mongoc_bulk_operation_t","mongoc_bulk_operation_update","mongoc_bulk_operation_update_many_with_opts","mongoc_bulk_operation_update_one","mongoc_bulk_operation_update_one_with_opts","mongoc_change_stream_destroy","mongoc_change_stream_error_document","mongoc_change_stream_next","mongoc_change_stream_t","mongoc_check_version","mongoc_cleanup","mongoc_client_command","mongoc_client_command_simple","mongoc_client_command_simple_with_server_id","mongoc_client_command_with_opts","mongoc_client_destroy","mongoc_client_find_databases_with_opts","mongoc_client_get_collection","mongoc_client_get_database","mongoc_client_get_database_names","mongoc_client_get_database_names_with_opts","mongoc_client_get_default_database","mongoc_client_get_gridfs","mongoc_client_get_max_bson_size","mongoc_client_get_max_message_size","mongoc_client_get_read_concern","mongoc_client_get_read_prefs","mongoc_client_get_server_description","mongoc_client_get_server_descriptions","mongoc_client_get_server_status","mongoc_client_get_uri","mongoc_client_get_write_concern","mongoc_client_new","mongoc_client_new_from_uri","mongoc_client_pool_destroy","mongoc_client_pool_max_size","mongoc_client_pool_min_size","mongoc_client_pool_new","mongoc_client_pool_pop","mongoc_client_pool_push","mongoc_client_pool_set_apm_callbacks","mongoc_client_pool_set_appname","mongoc_client_pool_set_error_api","mongoc_client_pool_set_ssl_opts","mongoc_client_pool_t","mongoc_client_pool_try_pop","mongoc_client_read_command_with_opts","mongoc_client_read_write_command_with_opts","mongoc_client_select_server","mongoc_client_session_abort_transaction","mongoc_client_session_advance_cluster_time","mongoc_client_session_advance_operation_time","mongoc_client_session_append","mongoc_client_session_commit_transaction","mongoc_client_session_destroy","mongoc_client_session_get_client","mongoc_client_session_get_cluster_time","mongoc_client_session_get_lsid","mongoc_client_session_get_operation_time","mongoc_client_session_get_opts","mongoc_client_session_in_transaction","mongoc_client_session_start_transaction","mongoc_client_session_t","mongoc_client_set_apm_callbacks","mongoc_client_set_appname","mongoc_client_set_error_api","mongoc_client_set_read_concern","mongoc_client_set_read_prefs","mongoc_client_set_ssl_opts","mongoc_client_set_stream_initiator","mongoc_client_set_write_concern","mongoc_client_start_session","mongoc_client_t","mongoc_client_watch","mongoc_client_write_command_with_opts","mongoc_collection_aggregate","mongoc_collection_command","mongoc_collection_command_simple","mongoc_collection_command_with_opts","mongoc_collection_copy","mongoc_collection_count","mongoc_collection_count_documents","mongoc_collection_count_with_opts","mongoc_collection_create_bulk_operation","mongoc_collection_create_bulk_operation_with_opts","mongoc_collection_create_index","mongoc_collection_create_index_with_opts","mongoc_collection_delete","mongoc_collection_delete_many","mongoc_collection_delete_one","mongoc_collection_destroy","mongoc_collection_drop","mongoc_collection_drop_index","mongoc_collection_drop_index_with_opts","mongoc_collection_drop_with_opts","mongoc_collection_ensure_index","mongoc_collection_estimated_document_count","mongoc_collection_find","mongoc_collection_find_and_modify","mongoc_collection_find_and_modify_with_opts","mongoc_collection_find_indexes","mongoc_collection_find_indexes_with_opts","mongoc_collection_find_with_opts","mongoc_collection_get_last_error","mongoc_collection_get_name","mongoc_collection_get_read_concern","mongoc_collection_get_read_prefs","mongoc_collection_get_write_concern","mongoc_collection_insert","mongoc_collection_insert_bulk","mongoc_collection_insert_many","mongoc_collection_insert_one","mongoc_collection_keys_to_index_string","mongoc_collection_read_command_with_opts","mongoc_collection_read_write_command_with_opts","mongoc_collection_remove","mongoc_collection_rename","mongoc_collection_rename_with_opts","mongoc_collection_replace_one","mongoc_collection_save","mongoc_collection_set_read_concern","mongoc_collection_set_read_prefs","mongoc_collection_set_write_concern","mongoc_collection_stats","mongoc_collection_t","mongoc_collection_update","mongoc_collection_update_many","mongoc_collection_update_one","mongoc_collection_validate","mongoc_collection_watch","mongoc_collection_write_command_with_opts","mongoc_cursor_clone","mongoc_cursor_current","mongoc_cursor_destroy","mongoc_cursor_error","mongoc_cursor_error_document","mongoc_cursor_get_batch_size","mongoc_cursor_get_hint","mongoc_cursor_get_host","mongoc_cursor_get_id","mongoc_cursor_get_limit","mongoc_cursor_get_max_await_time_ms","mongoc_cursor_is_alive","mongoc_cursor_more","mongoc_cursor_new_from_command_reply","mongoc_cursor_new_from_command_reply_with_opts","mongoc_cursor_next","mongoc_cursor_set_batch_size","mongoc_cursor_set_hint","mongoc_cursor_set_limit","mongoc_cursor_set_max_await_time_ms","mongoc_cursor_t","mongoc_database_add_user","mongoc_database_command","mongoc_database_command_simple","mongoc_database_command_with_opts","mongoc_database_copy","mongoc_database_create_collection","mongoc_database_destroy","mongoc_database_drop","mongoc_database_drop_with_opts","mongoc_database_find_collections","mongoc_database_find_collections_with_opts","mongoc_database_get_collection","mongoc_database_get_collection_names","mongoc_database_get_collection_names_with_opts","mongoc_database_get_name","mongoc_database_get_read_concern","mongoc_database_get_read_prefs","mongoc_database_get_write_concern","mongoc_database_has_collection","mongoc_database_read_command_with_opts","mongoc_database_read_write_command_with_opts","mongoc_database_remove_all_users","mongoc_database_remove_user","mongoc_database_set_read_concern","mongoc_database_set_read_prefs","mongoc_database_set_write_concern","mongoc_database_t","mongoc_database_watch","mongoc_database_write_command_with_opts","mongoc_delete_flags_t","mongoc_error_has_label","mongoc_find_and_modify_opts_append","mongoc_find_and_modify_opts_destroy","mongoc_find_and_modify_opts_get_bypass_document_validation","mongoc_find_and_modify_opts_get_fields","mongoc_find_and_modify_opts_get_flags","mongoc_find_and_modify_opts_get_max_time_ms","mongoc_find_and_modify_opts_get_sort","mongoc_find_and_modify_opts_get_update","mongoc_find_and_modify_opts_new","mongoc_find_and_modify_opts_set_bypass_document_validation","mongoc_find_and_modify_opts_set_fields","mongoc_find_and_modify_opts_set_flags","mongoc_find_and_modify_opts_set_max_time_ms","mongoc_find_and_modify_opts_set_sort","mongoc_find_and_modify_opts_set_update","mongoc_find_and_modify_opts_t","mongoc_get_major_version","mongoc_get_micro_version","mongoc_get_minor_version","mongoc_get_version","mongoc_gridfs_create_file","mongoc_gridfs_create_file_from_stream","mongoc_gridfs_destroy","mongoc_gridfs_drop","mongoc_gridfs_file_destroy","mongoc_gridfs_file_error","mongoc_gridfs_file_get_aliases","mongoc_gridfs_file_get_chunk_size","mongoc_gridfs_file_get_content_type","mongoc_gridfs_file_get_filename","mongoc_gridfs_file_get_id","mongoc_gridfs_file_get_length","mongoc_gridfs_file_get_md5","mongoc_gridfs_file_get_metadata","mongoc_gridfs_file_get_upload_date","mongoc_gridfs_file_list_destroy","mongoc_gridfs_file_list_error","mongoc_gridfs_file_list_next","mongoc_gridfs_file_list_t","mongoc_gridfs_file_opt_t","mongoc_gridfs_file_readv","mongoc_gridfs_file_remove","mongoc_gridfs_file_save","mongoc_gridfs_file_seek","mongoc_gridfs_file_set_aliases","mongoc_gridfs_file_set_content_type","mongoc_gridfs_file_set_filename","mongoc_gridfs_file_set_id","mongoc_gridfs_file_set_md5","mongoc_gridfs_file_set_metadata","mongoc_gridfs_file_t","mongoc_gridfs_file_tell","mongoc_gridfs_file_writev","mongoc_gridfs_find","mongoc_gridfs_find_one","mongoc_gridfs_find_one_by_filename","mongoc_gridfs_find_one_with_opts","mongoc_gridfs_find_with_opts","mongoc_gridfs_get_chunks","mongoc_gridfs_get_files","mongoc_gridfs_remove_by_filename","mongoc_gridfs_t","mongoc_host_list_t","mongoc_index_opt_geo_get_default","mongoc_index_opt_geo_init","mongoc_index_opt_geo_t","mongoc_index_opt_get_default","mongoc_index_opt_init","mongoc_index_opt_t","mongoc_index_opt_wt_get_default","mongoc_index_opt_wt_init","mongoc_index_opt_wt_t","mongoc_init","mongoc_insert_flags_t","mongoc_iovec_t","mongoc_matcher_destroy","mongoc_matcher_match","mongoc_matcher_new","mongoc_matcher_t","mongoc_query_flags_t","mongoc_rand","mongoc_rand_add","mongoc_rand_seed","mongoc_rand_status","mongoc_read_concern_append","mongoc_read_concern_copy","mongoc_read_concern_destroy","mongoc_read_concern_get_level","mongoc_read_concern_is_default","mongoc_read_concern_new","mongoc_read_concern_set_level","mongoc_read_concern_t","mongoc_read_mode_t","mongoc_read_prefs_add_tag","mongoc_read_prefs_copy","mongoc_read_prefs_destroy","mongoc_read_prefs_get_max_staleness_seconds","mongoc_read_prefs_get_mode","mongoc_read_prefs_get_tags","mongoc_read_prefs_is_valid","mongoc_read_prefs_new","mongoc_read_prefs_set_max_staleness_seconds","mongoc_read_prefs_set_mode","mongoc_read_prefs_set_tags","mongoc_read_prefs_t","mongoc_remove_flags_t","mongoc_reply_flags_t","mongoc_server_description_destroy","mongoc_server_description_host","mongoc_server_description_id","mongoc_server_description_ismaster","mongoc_server_description_new_copy","mongoc_server_description_round_trip_time","mongoc_server_description_t","mongoc_server_description_type","mongoc_server_descriptions_destroy_all","mongoc_session_opt_t","mongoc_session_opts_clone","mongoc_session_opts_destroy","mongoc_session_opts_get_causal_consistency","mongoc_session_opts_get_default_transaction_opts","mongoc_session_opts_new","mongoc_session_opts_set_causal_consistency","mongoc_session_opts_set_default_transaction_opts","mongoc_socket_accept","mongoc_socket_bind","mongoc_socket_close","mongoc_socket_connect","mongoc_socket_destroy","mongoc_socket_errno","mongoc_socket_getnameinfo","mongoc_socket_getsockname","mongoc_socket_listen","mongoc_socket_new","mongoc_socket_recv","mongoc_socket_send","mongoc_socket_sendv","mongoc_socket_setsockopt","mongoc_socket_t","mongoc_ssl_opt_get_default","mongoc_ssl_opt_t","mongoc_stream_buffered_new","mongoc_stream_buffered_t","mongoc_stream_close","mongoc_stream_cork","mongoc_stream_destroy","mongoc_stream_file_get_fd","mongoc_stream_file_new","mongoc_stream_file_new_for_path","mongoc_stream_file_t","mongoc_stream_flush","mongoc_stream_get_base_stream","mongoc_stream_gridfs_new","mongoc_stream_read","mongoc_stream_readv","mongoc_stream_setsockopt","mongoc_stream_socket_get_socket","mongoc_stream_socket_new","mongoc_stream_socket_t","mongoc_stream_t","mongoc_stream_timed_out","mongoc_stream_tls_t","mongoc_stream_uncork","mongoc_stream_write","mongoc_stream_writev","mongoc_topology_description_get_servers","mongoc_topology_description_has_readable_server","mongoc_topology_description_has_writable_server","mongoc_topology_description_t","mongoc_topology_description_type","mongoc_transaction_opt_t","mongoc_transaction_opts_clone","mongoc_transaction_opts_destroy","mongoc_transaction_opts_get_read_concern","mongoc_transaction_opts_get_read_prefs","mongoc_transaction_opts_get_write_concern","mongoc_transaction_opts_new","mongoc_transaction_opts_set_read_concern","mongoc_transaction_opts_set_read_prefs","mongoc_transaction_opts_set_write_concern","mongoc_update_flags_t","mongoc_uri_copy","mongoc_uri_destroy","mongoc_uri_get_auth_mechanism","mongoc_uri_get_auth_source","mongoc_uri_get_compressors","mongoc_uri_get_database","mongoc_uri_get_hosts","mongoc_uri_get_mechanism_properties","mongoc_uri_get_option_as_bool","mongoc_uri_get_option_as_int32","mongoc_uri_get_option_as_utf8","mongoc_uri_get_options","mongoc_uri_get_password","mongoc_uri_get_read_concern","mongoc_uri_get_read_prefs","mongoc_uri_get_read_prefs_t","mongoc_uri_get_replica_set","mongoc_uri_get_service","mongoc_uri_get_ssl","mongoc_uri_get_string","mongoc_uri_get_username","mongoc_uri_get_write_concern","mongoc_uri_new","mongoc_uri_new_for_host_port","mongoc_uri_new_with_error","mongoc_uri_option_is_bool","mongoc_uri_option_is_int32","mongoc_uri_option_is_utf8","mongoc_uri_set_auth_mechanism","mongoc_uri_set_auth_source","mongoc_uri_set_compressors","mongoc_uri_set_database","mongoc_uri_set_mechanism_properties","mongoc_uri_set_option_as_bool","mongoc_uri_set_option_as_int32","mongoc_uri_set_option_as_utf8","mongoc_uri_set_password","mongoc_uri_set_read_concern","mongoc_uri_set_read_prefs_t","mongoc_uri_set_username","mongoc_uri_set_write_concern","mongoc_uri_t","mongoc_uri_unescape","mongoc_version","mongoc_write_concern_append","mongoc_write_concern_copy","mongoc_write_concern_destroy","mongoc_write_concern_get_fsync","mongoc_write_concern_get_journal","mongoc_write_concern_get_w","mongoc_write_concern_get_wmajority","mongoc_write_concern_get_wtag","mongoc_write_concern_get_wtimeout","mongoc_write_concern_is_acknowledged","mongoc_write_concern_is_default","mongoc_write_concern_is_valid","mongoc_write_concern_journal_is_set","mongoc_write_concern_new","mongoc_write_concern_set_fsync","mongoc_write_concern_set_journal","mongoc_write_concern_set_w","mongoc_write_concern_set_wmajority","mongoc_write_concern_set_wtag","mongoc_write_concern_set_wtimeout","mongoc_write_concern_t","tutorial","visual-studio-guide"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,sphinx:55},filenames:["advanced-connections.rst","aggregate.rst","api.rst","application-performance-monitoring.rst","authentication.rst","basic-troubleshooting.rst","bulk.rst","connection-pooling.rst","create-indexes.rst","cursors.rst","debugging.rst","distinct-mapreduce.rst","errors.rst","full_index.rst","guides.rst","index.rst","init-cleanup.rst","installing.rst","lifecycle.rst","logging.rst","matcher.rst","mongoc-common-task-examples.rst","mongoc_apm_callbacks_destroy.rst","mongoc_apm_callbacks_new.rst","mongoc_apm_callbacks_t.rst","mongoc_apm_command_failed_get_command_name.rst","mongoc_apm_command_failed_get_context.rst","mongoc_apm_command_failed_get_duration.rst","mongoc_apm_command_failed_get_error.rst","mongoc_apm_command_failed_get_host.rst","mongoc_apm_command_failed_get_operation_id.rst","mongoc_apm_command_failed_get_reply.rst","mongoc_apm_command_failed_get_request_id.rst","mongoc_apm_command_failed_get_server_id.rst","mongoc_apm_command_failed_t.rst","mongoc_apm_command_started_get_command.rst","mongoc_apm_command_started_get_command_name.rst","mongoc_apm_command_started_get_context.rst","mongoc_apm_command_started_get_database_name.rst","mongoc_apm_command_started_get_host.rst","mongoc_apm_command_started_get_operation_id.rst","mongoc_apm_command_started_get_request_id.rst","mongoc_apm_command_started_get_server_id.rst","mongoc_apm_command_started_t.rst","mongoc_apm_command_succeeded_get_command_name.rst","mongoc_apm_command_succeeded_get_context.rst","mongoc_apm_command_succeeded_get_duration.rst","mongoc_apm_command_succeeded_get_host.rst","mongoc_apm_command_succeeded_get_operation_id.rst","mongoc_apm_command_succeeded_get_reply.rst","mongoc_apm_command_succeeded_get_request_id.rst","mongoc_apm_command_succeeded_get_server_id.rst","mongoc_apm_command_succeeded_t.rst","mongoc_apm_server_changed_get_context.rst","mongoc_apm_server_changed_get_host.rst","mongoc_apm_server_changed_get_new_description.rst","mongoc_apm_server_changed_get_previous_description.rst","mongoc_apm_server_changed_get_topology_id.rst","mongoc_apm_server_changed_t.rst","mongoc_apm_server_closed_get_context.rst","mongoc_apm_server_closed_get_host.rst","mongoc_apm_server_closed_get_topology_id.rst","mongoc_apm_server_closed_t.rst","mongoc_apm_server_heartbeat_failed_get_context.rst","mongoc_apm_server_heartbeat_failed_get_duration.rst","mongoc_apm_server_heartbeat_failed_get_error.rst","mongoc_apm_server_heartbeat_failed_get_host.rst","mongoc_apm_server_heartbeat_failed_t.rst","mongoc_apm_server_heartbeat_started_get_context.rst","mongoc_apm_server_heartbeat_started_get_host.rst","mongoc_apm_server_heartbeat_started_t.rst","mongoc_apm_server_heartbeat_succeeded_get_context.rst","mongoc_apm_server_heartbeat_succeeded_get_duration.rst","mongoc_apm_server_heartbeat_succeeded_get_host.rst","mongoc_apm_server_heartbeat_succeeded_get_reply.rst","mongoc_apm_server_heartbeat_succeeded_t.rst","mongoc_apm_server_opening_get_context.rst","mongoc_apm_server_opening_get_host.rst","mongoc_apm_server_opening_get_topology_id.rst","mongoc_apm_server_opening_t.rst","mongoc_apm_set_command_failed_cb.rst","mongoc_apm_set_command_started_cb.rst","mongoc_apm_set_command_succeeded_cb.rst","mongoc_apm_set_server_changed_cb.rst","mongoc_apm_set_server_closed_cb.rst","mongoc_apm_set_server_heartbeat_failed_cb.rst","mongoc_apm_set_server_heartbeat_started_cb.rst","mongoc_apm_set_server_heartbeat_succeeded_cb.rst","mongoc_apm_set_server_opening_cb.rst","mongoc_apm_set_topology_changed_cb.rst","mongoc_apm_set_topology_closed_cb.rst","mongoc_apm_set_topology_opening_cb.rst","mongoc_apm_topology_changed_get_context.rst","mongoc_apm_topology_changed_get_new_description.rst","mongoc_apm_topology_changed_get_previous_description.rst","mongoc_apm_topology_changed_get_topology_id.rst","mongoc_apm_topology_changed_t.rst","mongoc_apm_topology_closed_get_context.rst","mongoc_apm_topology_closed_get_topology_id.rst","mongoc_apm_topology_closed_t.rst","mongoc_apm_topology_opening_get_context.rst","mongoc_apm_topology_opening_get_topology_id.rst","mongoc_apm_topology_opening_t.rst","mongoc_bulk_operation_delete.rst","mongoc_bulk_operation_delete_one.rst","mongoc_bulk_operation_destroy.rst","mongoc_bulk_operation_execute.rst","mongoc_bulk_operation_get_hint.rst","mongoc_bulk_operation_get_write_concern.rst","mongoc_bulk_operation_insert.rst","mongoc_bulk_operation_insert_with_opts.rst","mongoc_bulk_operation_remove.rst","mongoc_bulk_operation_remove_many_with_opts.rst","mongoc_bulk_operation_remove_one.rst","mongoc_bulk_operation_remove_one_with_opts.rst","mongoc_bulk_operation_replace_one.rst","mongoc_bulk_operation_replace_one_with_opts.rst","mongoc_bulk_operation_set_bypass_document_validation.rst","mongoc_bulk_operation_set_hint.rst","mongoc_bulk_operation_t.rst","mongoc_bulk_operation_update.rst","mongoc_bulk_operation_update_many_with_opts.rst","mongoc_bulk_operation_update_one.rst","mongoc_bulk_operation_update_one_with_opts.rst","mongoc_change_stream_destroy.rst","mongoc_change_stream_error_document.rst","mongoc_change_stream_next.rst","mongoc_change_stream_t.rst","mongoc_check_version.rst","mongoc_cleanup.rst","mongoc_client_command.rst","mongoc_client_command_simple.rst","mongoc_client_command_simple_with_server_id.rst","mongoc_client_command_with_opts.rst","mongoc_client_destroy.rst","mongoc_client_find_databases_with_opts.rst","mongoc_client_get_collection.rst","mongoc_client_get_database.rst","mongoc_client_get_database_names.rst","mongoc_client_get_database_names_with_opts.rst","mongoc_client_get_default_database.rst","mongoc_client_get_gridfs.rst","mongoc_client_get_max_bson_size.rst","mongoc_client_get_max_message_size.rst","mongoc_client_get_read_concern.rst","mongoc_client_get_read_prefs.rst","mongoc_client_get_server_description.rst","mongoc_client_get_server_descriptions.rst","mongoc_client_get_server_status.rst","mongoc_client_get_uri.rst","mongoc_client_get_write_concern.rst","mongoc_client_new.rst","mongoc_client_new_from_uri.rst","mongoc_client_pool_destroy.rst","mongoc_client_pool_max_size.rst","mongoc_client_pool_min_size.rst","mongoc_client_pool_new.rst","mongoc_client_pool_pop.rst","mongoc_client_pool_push.rst","mongoc_client_pool_set_apm_callbacks.rst","mongoc_client_pool_set_appname.rst","mongoc_client_pool_set_error_api.rst","mongoc_client_pool_set_ssl_opts.rst","mongoc_client_pool_t.rst","mongoc_client_pool_try_pop.rst","mongoc_client_read_command_with_opts.rst","mongoc_client_read_write_command_with_opts.rst","mongoc_client_select_server.rst","mongoc_client_session_abort_transaction.rst","mongoc_client_session_advance_cluster_time.rst","mongoc_client_session_advance_operation_time.rst","mongoc_client_session_append.rst","mongoc_client_session_commit_transaction.rst","mongoc_client_session_destroy.rst","mongoc_client_session_get_client.rst","mongoc_client_session_get_cluster_time.rst","mongoc_client_session_get_lsid.rst","mongoc_client_session_get_operation_time.rst","mongoc_client_session_get_opts.rst","mongoc_client_session_in_transaction.rst","mongoc_client_session_start_transaction.rst","mongoc_client_session_t.rst","mongoc_client_set_apm_callbacks.rst","mongoc_client_set_appname.rst","mongoc_client_set_error_api.rst","mongoc_client_set_read_concern.rst","mongoc_client_set_read_prefs.rst","mongoc_client_set_ssl_opts.rst","mongoc_client_set_stream_initiator.rst","mongoc_client_set_write_concern.rst","mongoc_client_start_session.rst","mongoc_client_t.rst","mongoc_client_watch.rst","mongoc_client_write_command_with_opts.rst","mongoc_collection_aggregate.rst","mongoc_collection_command.rst","mongoc_collection_command_simple.rst","mongoc_collection_command_with_opts.rst","mongoc_collection_copy.rst","mongoc_collection_count.rst","mongoc_collection_count_documents.rst","mongoc_collection_count_with_opts.rst","mongoc_collection_create_bulk_operation.rst","mongoc_collection_create_bulk_operation_with_opts.rst","mongoc_collection_create_index.rst","mongoc_collection_create_index_with_opts.rst","mongoc_collection_delete.rst","mongoc_collection_delete_many.rst","mongoc_collection_delete_one.rst","mongoc_collection_destroy.rst","mongoc_collection_drop.rst","mongoc_collection_drop_index.rst","mongoc_collection_drop_index_with_opts.rst","mongoc_collection_drop_with_opts.rst","mongoc_collection_ensure_index.rst","mongoc_collection_estimated_document_count.rst","mongoc_collection_find.rst","mongoc_collection_find_and_modify.rst","mongoc_collection_find_and_modify_with_opts.rst","mongoc_collection_find_indexes.rst","mongoc_collection_find_indexes_with_opts.rst","mongoc_collection_find_with_opts.rst","mongoc_collection_get_last_error.rst","mongoc_collection_get_name.rst","mongoc_collection_get_read_concern.rst","mongoc_collection_get_read_prefs.rst","mongoc_collection_get_write_concern.rst","mongoc_collection_insert.rst","mongoc_collection_insert_bulk.rst","mongoc_collection_insert_many.rst","mongoc_collection_insert_one.rst","mongoc_collection_keys_to_index_string.rst","mongoc_collection_read_command_with_opts.rst","mongoc_collection_read_write_command_with_opts.rst","mongoc_collection_remove.rst","mongoc_collection_rename.rst","mongoc_collection_rename_with_opts.rst","mongoc_collection_replace_one.rst","mongoc_collection_save.rst","mongoc_collection_set_read_concern.rst","mongoc_collection_set_read_prefs.rst","mongoc_collection_set_write_concern.rst","mongoc_collection_stats.rst","mongoc_collection_t.rst","mongoc_collection_update.rst","mongoc_collection_update_many.rst","mongoc_collection_update_one.rst","mongoc_collection_validate.rst","mongoc_collection_watch.rst","mongoc_collection_write_command_with_opts.rst","mongoc_cursor_clone.rst","mongoc_cursor_current.rst","mongoc_cursor_destroy.rst","mongoc_cursor_error.rst","mongoc_cursor_error_document.rst","mongoc_cursor_get_batch_size.rst","mongoc_cursor_get_hint.rst","mongoc_cursor_get_host.rst","mongoc_cursor_get_id.rst","mongoc_cursor_get_limit.rst","mongoc_cursor_get_max_await_time_ms.rst","mongoc_cursor_is_alive.rst","mongoc_cursor_more.rst","mongoc_cursor_new_from_command_reply.rst","mongoc_cursor_new_from_command_reply_with_opts.rst","mongoc_cursor_next.rst","mongoc_cursor_set_batch_size.rst","mongoc_cursor_set_hint.rst","mongoc_cursor_set_limit.rst","mongoc_cursor_set_max_await_time_ms.rst","mongoc_cursor_t.rst","mongoc_database_add_user.rst","mongoc_database_command.rst","mongoc_database_command_simple.rst","mongoc_database_command_with_opts.rst","mongoc_database_copy.rst","mongoc_database_create_collection.rst","mongoc_database_destroy.rst","mongoc_database_drop.rst","mongoc_database_drop_with_opts.rst","mongoc_database_find_collections.rst","mongoc_database_find_collections_with_opts.rst","mongoc_database_get_collection.rst","mongoc_database_get_collection_names.rst","mongoc_database_get_collection_names_with_opts.rst","mongoc_database_get_name.rst","mongoc_database_get_read_concern.rst","mongoc_database_get_read_prefs.rst","mongoc_database_get_write_concern.rst","mongoc_database_has_collection.rst","mongoc_database_read_command_with_opts.rst","mongoc_database_read_write_command_with_opts.rst","mongoc_database_remove_all_users.rst","mongoc_database_remove_user.rst","mongoc_database_set_read_concern.rst","mongoc_database_set_read_prefs.rst","mongoc_database_set_write_concern.rst","mongoc_database_t.rst","mongoc_database_watch.rst","mongoc_database_write_command_with_opts.rst","mongoc_delete_flags_t.rst","mongoc_error_has_label.rst","mongoc_find_and_modify_opts_append.rst","mongoc_find_and_modify_opts_destroy.rst","mongoc_find_and_modify_opts_get_bypass_document_validation.rst","mongoc_find_and_modify_opts_get_fields.rst","mongoc_find_and_modify_opts_get_flags.rst","mongoc_find_and_modify_opts_get_max_time_ms.rst","mongoc_find_and_modify_opts_get_sort.rst","mongoc_find_and_modify_opts_get_update.rst","mongoc_find_and_modify_opts_new.rst","mongoc_find_and_modify_opts_set_bypass_document_validation.rst","mongoc_find_and_modify_opts_set_fields.rst","mongoc_find_and_modify_opts_set_flags.rst","mongoc_find_and_modify_opts_set_max_time_ms.rst","mongoc_find_and_modify_opts_set_sort.rst","mongoc_find_and_modify_opts_set_update.rst","mongoc_find_and_modify_opts_t.rst","mongoc_get_major_version.rst","mongoc_get_micro_version.rst","mongoc_get_minor_version.rst","mongoc_get_version.rst","mongoc_gridfs_create_file.rst","mongoc_gridfs_create_file_from_stream.rst","mongoc_gridfs_destroy.rst","mongoc_gridfs_drop.rst","mongoc_gridfs_file_destroy.rst","mongoc_gridfs_file_error.rst","mongoc_gridfs_file_get_aliases.rst","mongoc_gridfs_file_get_chunk_size.rst","mongoc_gridfs_file_get_content_type.rst","mongoc_gridfs_file_get_filename.rst","mongoc_gridfs_file_get_id.rst","mongoc_gridfs_file_get_length.rst","mongoc_gridfs_file_get_md5.rst","mongoc_gridfs_file_get_metadata.rst","mongoc_gridfs_file_get_upload_date.rst","mongoc_gridfs_file_list_destroy.rst","mongoc_gridfs_file_list_error.rst","mongoc_gridfs_file_list_next.rst","mongoc_gridfs_file_list_t.rst","mongoc_gridfs_file_opt_t.rst","mongoc_gridfs_file_readv.rst","mongoc_gridfs_file_remove.rst","mongoc_gridfs_file_save.rst","mongoc_gridfs_file_seek.rst","mongoc_gridfs_file_set_aliases.rst","mongoc_gridfs_file_set_content_type.rst","mongoc_gridfs_file_set_filename.rst","mongoc_gridfs_file_set_id.rst","mongoc_gridfs_file_set_md5.rst","mongoc_gridfs_file_set_metadata.rst","mongoc_gridfs_file_t.rst","mongoc_gridfs_file_tell.rst","mongoc_gridfs_file_writev.rst","mongoc_gridfs_find.rst","mongoc_gridfs_find_one.rst","mongoc_gridfs_find_one_by_filename.rst","mongoc_gridfs_find_one_with_opts.rst","mongoc_gridfs_find_with_opts.rst","mongoc_gridfs_get_chunks.rst","mongoc_gridfs_get_files.rst","mongoc_gridfs_remove_by_filename.rst","mongoc_gridfs_t.rst","mongoc_host_list_t.rst","mongoc_index_opt_geo_get_default.rst","mongoc_index_opt_geo_init.rst","mongoc_index_opt_geo_t.rst","mongoc_index_opt_get_default.rst","mongoc_index_opt_init.rst","mongoc_index_opt_t.rst","mongoc_index_opt_wt_get_default.rst","mongoc_index_opt_wt_init.rst","mongoc_index_opt_wt_t.rst","mongoc_init.rst","mongoc_insert_flags_t.rst","mongoc_iovec_t.rst","mongoc_matcher_destroy.rst","mongoc_matcher_match.rst","mongoc_matcher_new.rst","mongoc_matcher_t.rst","mongoc_query_flags_t.rst","mongoc_rand.rst","mongoc_rand_add.rst","mongoc_rand_seed.rst","mongoc_rand_status.rst","mongoc_read_concern_append.rst","mongoc_read_concern_copy.rst","mongoc_read_concern_destroy.rst","mongoc_read_concern_get_level.rst","mongoc_read_concern_is_default.rst","mongoc_read_concern_new.rst","mongoc_read_concern_set_level.rst","mongoc_read_concern_t.rst","mongoc_read_mode_t.rst","mongoc_read_prefs_add_tag.rst","mongoc_read_prefs_copy.rst","mongoc_read_prefs_destroy.rst","mongoc_read_prefs_get_max_staleness_seconds.rst","mongoc_read_prefs_get_mode.rst","mongoc_read_prefs_get_tags.rst","mongoc_read_prefs_is_valid.rst","mongoc_read_prefs_new.rst","mongoc_read_prefs_set_max_staleness_seconds.rst","mongoc_read_prefs_set_mode.rst","mongoc_read_prefs_set_tags.rst","mongoc_read_prefs_t.rst","mongoc_remove_flags_t.rst","mongoc_reply_flags_t.rst","mongoc_server_description_destroy.rst","mongoc_server_description_host.rst","mongoc_server_description_id.rst","mongoc_server_description_ismaster.rst","mongoc_server_description_new_copy.rst","mongoc_server_description_round_trip_time.rst","mongoc_server_description_t.rst","mongoc_server_description_type.rst","mongoc_server_descriptions_destroy_all.rst","mongoc_session_opt_t.rst","mongoc_session_opts_clone.rst","mongoc_session_opts_destroy.rst","mongoc_session_opts_get_causal_consistency.rst","mongoc_session_opts_get_default_transaction_opts.rst","mongoc_session_opts_new.rst","mongoc_session_opts_set_causal_consistency.rst","mongoc_session_opts_set_default_transaction_opts.rst","mongoc_socket_accept.rst","mongoc_socket_bind.rst","mongoc_socket_close.rst","mongoc_socket_connect.rst","mongoc_socket_destroy.rst","mongoc_socket_errno.rst","mongoc_socket_getnameinfo.rst","mongoc_socket_getsockname.rst","mongoc_socket_listen.rst","mongoc_socket_new.rst","mongoc_socket_recv.rst","mongoc_socket_send.rst","mongoc_socket_sendv.rst","mongoc_socket_setsockopt.rst","mongoc_socket_t.rst","mongoc_ssl_opt_get_default.rst","mongoc_ssl_opt_t.rst","mongoc_stream_buffered_new.rst","mongoc_stream_buffered_t.rst","mongoc_stream_close.rst","mongoc_stream_cork.rst","mongoc_stream_destroy.rst","mongoc_stream_file_get_fd.rst","mongoc_stream_file_new.rst","mongoc_stream_file_new_for_path.rst","mongoc_stream_file_t.rst","mongoc_stream_flush.rst","mongoc_stream_get_base_stream.rst","mongoc_stream_gridfs_new.rst","mongoc_stream_read.rst","mongoc_stream_readv.rst","mongoc_stream_setsockopt.rst","mongoc_stream_socket_get_socket.rst","mongoc_stream_socket_new.rst","mongoc_stream_socket_t.rst","mongoc_stream_t.rst","mongoc_stream_timed_out.rst","mongoc_stream_tls_t.rst","mongoc_stream_uncork.rst","mongoc_stream_write.rst","mongoc_stream_writev.rst","mongoc_topology_description_get_servers.rst","mongoc_topology_description_has_readable_server.rst","mongoc_topology_description_has_writable_server.rst","mongoc_topology_description_t.rst","mongoc_topology_description_type.rst","mongoc_transaction_opt_t.rst","mongoc_transaction_opts_clone.rst","mongoc_transaction_opts_destroy.rst","mongoc_transaction_opts_get_read_concern.rst","mongoc_transaction_opts_get_read_prefs.rst","mongoc_transaction_opts_get_write_concern.rst","mongoc_transaction_opts_new.rst","mongoc_transaction_opts_set_read_concern.rst","mongoc_transaction_opts_set_read_prefs.rst","mongoc_transaction_opts_set_write_concern.rst","mongoc_update_flags_t.rst","mongoc_uri_copy.rst","mongoc_uri_destroy.rst","mongoc_uri_get_auth_mechanism.rst","mongoc_uri_get_auth_source.rst","mongoc_uri_get_compressors.rst","mongoc_uri_get_database.rst","mongoc_uri_get_hosts.rst","mongoc_uri_get_mechanism_properties.rst","mongoc_uri_get_option_as_bool.rst","mongoc_uri_get_option_as_int32.rst","mongoc_uri_get_option_as_utf8.rst","mongoc_uri_get_options.rst","mongoc_uri_get_password.rst","mongoc_uri_get_read_concern.rst","mongoc_uri_get_read_prefs.rst","mongoc_uri_get_read_prefs_t.rst","mongoc_uri_get_replica_set.rst","mongoc_uri_get_service.rst","mongoc_uri_get_ssl.rst","mongoc_uri_get_string.rst","mongoc_uri_get_username.rst","mongoc_uri_get_write_concern.rst","mongoc_uri_new.rst","mongoc_uri_new_for_host_port.rst","mongoc_uri_new_with_error.rst","mongoc_uri_option_is_bool.rst","mongoc_uri_option_is_int32.rst","mongoc_uri_option_is_utf8.rst","mongoc_uri_set_auth_mechanism.rst","mongoc_uri_set_auth_source.rst","mongoc_uri_set_compressors.rst","mongoc_uri_set_database.rst","mongoc_uri_set_mechanism_properties.rst","mongoc_uri_set_option_as_bool.rst","mongoc_uri_set_option_as_int32.rst","mongoc_uri_set_option_as_utf8.rst","mongoc_uri_set_password.rst","mongoc_uri_set_read_concern.rst","mongoc_uri_set_read_prefs_t.rst","mongoc_uri_set_username.rst","mongoc_uri_set_write_concern.rst","mongoc_uri_t.rst","mongoc_uri_unescape.rst","mongoc_version.rst","mongoc_write_concern_append.rst","mongoc_write_concern_copy.rst","mongoc_write_concern_destroy.rst","mongoc_write_concern_get_fsync.rst","mongoc_write_concern_get_journal.rst","mongoc_write_concern_get_w.rst","mongoc_write_concern_get_wmajority.rst","mongoc_write_concern_get_wtag.rst","mongoc_write_concern_get_wtimeout.rst","mongoc_write_concern_is_acknowledged.rst","mongoc_write_concern_is_default.rst","mongoc_write_concern_is_valid.rst","mongoc_write_concern_journal_is_set.rst","mongoc_write_concern_new.rst","mongoc_write_concern_set_fsync.rst","mongoc_write_concern_set_journal.rst","mongoc_write_concern_set_w.rst","mongoc_write_concern_set_wmajority.rst","mongoc_write_concern_set_wtag.rst","mongoc_write_concern_set_wtimeout.rst","mongoc_write_concern_t.rst","tutorial.rst","visual-studio-guide.rst"],objects:{},objnames:{},objtypes:{},terms:{"0000m":524,"000m":524,"05552b562c7a0b3143a729aaa0838e558dc49b25":21,"0x555556cd7310":10,"15m":524,"16mb":142,"250m":[0,524],"2fmongodb":[0,507],"2ftmp":[0,507],"40domain":[490,515],"40exampl":[4,507],"40mb":143,"5372ab0a25164be923d10d50":9,"537afac9a70e5b4d556153bc":20,"55ef43766cb5f36a3bae6ee4":548,"55ef549236fe322f9490e17b":548,"56562a99d13e6d86239c7b00":[311,312,313,315,316,317],"5a1442f3122d331c3c6757e1":10,"abstract":[19,119,270,297,317,340,352,363,376,380,393,406,440,461,524,547],"boolean":[117,125,126,221,247,501,508,541,542,548],"break":[163,180,363,472,548],"byte":[5,138,139,283,284,333,342,354,382,383,384,436,437,438,443,446,452,455,456,464,465,466],"case":[5,6,9,11,12,17,20,107,148,180,183,213,289,363,472,491,492,493,508,509,510,516,517,518,524],"catch":[181,547],"char":[0,1,3,6,8,9,11,19,21,25,36,38,44,127,130,131,132,133,136,137,138,139,141,151,160,163,165,166,180,181,183,191,193,196,211,212,216,217,221,223,231,235,236,246,254,270,271,276,282,283,284,285,289,293,297,301,302,311,312,313,314,315,316,317,321,330,331,334,341,347,348,350,357,362,363,364,370,373,376,380,389,392,405,416,432,442,450,471,472,485,486,488,490,491,492,493,495,499,500,502,503,505,506,507,508,509,510,511,512,513,514,516,517,518,519,522,525,534,545,548],"const":[0,1,3,6,8,9,11,19,21,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,53,54,55,56,57,59,60,61,63,64,65,66,68,69,71,72,73,74,76,77,78,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,100,101,103,104,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,125,126,127,130,131,132,133,135,136,137,139,141,144,145,147,149,150,151,152,156,160,162,163,165,166,167,169,171,174,175,176,177,178,179,180,181,183,185,186,187,189,191,192,193,194,195,196,197,199,200,201,202,203,204,205,206,207,208,211,212,214,215,216,217,218,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,244,245,246,247,248,249,250,251,254,255,256,258,261,264,265,270,271,272,273,274,276,279,280,281,282,284,285,286,287,288,289,290,291,293,294,295,296,298,299,301,302,304,305,306,307,308,309,312,313,315,316,317,321,328,330,331,332,334,335,341,346,347,348,349,350,351,354,355,356,357,358,359,362,363,365,368,370,371,373,378,379,380,382,383,384,387,389,392,395,396,398,399,400,401,405,410,411,412,413,414,416,419,421,422,425,427,429,437,439,441,442,450,467,468,469,471,472,473,475,476,477,479,480,481,483,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,525,528,530,531,532,533,534,535,536,538,539,545,548],"default":[0,4,5,6,12,16,17,18,19,126,140,141,142,143,144,145,150,155,157,180,181,185,186,188,189,190,191,195,202,216,221,224,225,226,238,239,240,241,244,254,270,286,287,288,294,295,296,313,314,365,366,368,369,371,372,390,393,394,398,406,418,421,422,423,424,425,441,442,455,456,461,465,466,468,472,482,491,492,493,515,524,536,537,539,547,548],"enum":[11,19,21,300,375,381,394,407,408,482],"final":[1,3,9,17,262,549],"function":[1,4,5,7,8,9,10,11,16,18,19,21,80,81,82,83,84,85,86,87,88,89,90,91,103,104,106,107,109,111,113,115,118,120,121,122,123,126,129,130,131,132,135,138,139,141,142,143,148,154,155,156,157,158,159,160,161,162,164,165,166,167,171,180,183,184,185,186,187,188,189,190,192,193,194,195,196,198,199,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,219,220,222,227,228,230,231,232,233,234,235,236,237,238,242,244,245,246,247,248,249,250,253,254,256,261,262,263,264,265,267,268,269,271,272,273,275,276,278,279,280,281,283,286,288,289,290,291,292,293,294,295,296,298,299,302,312,314,315,316,322,323,324,327,339,342,353,355,356,366,369,372,374,378,386,392,395,396,413,416,425,426,427,428,429,430,431,434,436,439,443,445,446,447,448,450,452,453,454,455,456,457,459,464,465,466,468,469,471,479,480,481,490,497,505,507,527,541,542,543,544,545,546,548],"goto":[11,21,127,180,181,472,548],"import":[1,10,19,442],"int":[0,1,3,6,8,9,11,19,21,127,128,163,165,180,181,191,193,194,200,215,217,246,254,270,297,317,318,319,320,345,363,364,380,382,383,384,385,405,427,428,429,431,433,434,435,436,439,445,446,448,449,450,452,457,464,472,548],"long":[0,160,302,314,317,524,544],"new":[3,5,7,12,23,55,79,88,93,103,104,138,141,142,143,148,151,152,155,156,163,169,170,188,199,201,202,203,204,205,214,216,217,219,221,228,235,236,237,238,242,245,246,247,262,263,269,271,276,280,282,283,300,312,316,317,322,323,341,370,379,393,402,413,435,442,443,449,450,454,459,497,506,511,512,514,516,517,518,519,522,524,548,549],"null":[0,1,3,6,8,9,10,11,12,19,21,22,105,106,110,112,114,116,121,123,125,127,131,132,133,134,135,138,139,140,141,146,147,148,151,163,164,165,166,167,168,171,172,173,175,180,181,182,190,191,192,193,194,195,196,197,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,227,228,229,230,232,233,234,235,236,237,238,242,244,245,246,247,248,249,251,252,253,254,264,270,271,272,273,274,276,277,278,279,280,281,283,284,289,290,291,292,293,298,299,302,303,311,312,313,314,315,316,317,323,324,325,326,327,337,338,343,356,357,358,359,362,379,380,388,389,393,397,405,409,420,424,425,426,430,435,443,447,449,450,453,454,468,472,474,484,488,489,490,500,505,507,529,534,536,548],"public":[5,524],"return":[0,1,3,6,7,8,9,11,12,18,19,21,107,127,158,163,173,174,181,191,255,259,266,269,270,297,317,363,364,380,381,390,408,416,417,418,421,422,423,471,472,475,476,477,491,492,493,508,509,510,524,536,537,546,548],"short":[5,548],"st\u0155\u00ec\u00f1g":10,"static":[1,3,6,9,10,127,163,194,196,199,200,201,215,216,221,405,490,526,548],"switch":[548,549],"throw":[381,524],"transient":[180,472],"true":[0,3,4,6,9,10,11,21,110,112,114,115,116,120,121,122,123,127,128,131,132,133,148,159,160,161,163,165,166,167,168,171,172,179,180,182,183,184,193,194,196,197,202,205,206,207,208,212,213,216,217,218,221,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,253,254,262,265,267,268,271,273,274,279,289,290,291,292,293,299,301,302,304,311,312,313,314,315,316,317,325,327,338,343,344,349,362,378,386,390,392,401,421,424,442,462,468,469,490,501,507,508,509,510,515,516,517,518,524,527,530,531,533,536,537,548],"try":[11,12,21,180,338,472,524],"var":11,"void":[1,3,6,9,11,19,21,22,23,26,28,37,45,53,57,59,61,63,65,68,71,76,78,80,81,82,83,84,85,86,87,88,89,90,91,92,95,97,98,100,101,103,104,105,109,111,113,115,117,118,120,122,124,127,129,134,147,153,154,155,158,159,162,163,169,170,173,177,182,185,186,187,188,189,191,196,199,200,201,209,215,216,221,239,240,241,252,254,257,266,269,277,294,295,296,302,303,305,308,309,310,311,312,313,314,315,316,317,318,319,320,321,324,326,337,346,347,348,350,351,363,364,365,366,368,369,370,371,372,373,374,377,382,383,384,385,388,391,395,397,403,404,405,409,417,420,423,424,425,430,436,437,439,441,442,447,455,457,465,474,478,479,480,481,484,520,521,523,526,529,540,541,542,543,544,545,546,548],"while":[1,7,9,11,12,110,112,114,116,121,123,127,163,180,181,191,216,221,253,254,270,281,338,340,344,354,363,380,382,405,406,472,524,548],Adding:549,And:[3,416,471],But:524,CAs:0,DNS:[0,12,524],For:[0,4,7,12,16,17,19,127,185,186,189,193,194,199,201,210,211,221,229,235,249,263,264,278,281,284,299,390,393,468,469,508,509,510,524,525,537,547,548],Has:[169,170],Its:470,NOT:[191,270,344,345,352,354,363],Not:[195,446,452,464,524],One:[6,17,165,193,201,345,513,524],Such:453,TLS:[0,188,271,463],That:[0,363,524],The:[0,1,3,4,5,6,7,9,10,11,12,15,17,18,19,20,25,26,27,29,30,31,32,33,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,53,54,55,56,57,59,60,61,63,64,66,68,69,71,72,73,74,76,77,78,92,93,94,95,97,98,100,101,106,107,109,110,118,119,126,127,128,130,131,132,133,135,136,137,138,139,141,142,143,144,145,148,150,154,155,157,159,160,161,162,165,166,169,170,180,182,183,184,185,186,187,188,189,191,192,193,194,195,196,197,199,201,202,205,206,207,208,220,222,227,228,229,230,232,233,234,235,236,237,239,240,241,242,245,246,248,249,250,254,256,263,264,265,266,267,268,269,271,272,273,274,276,281,290,291,294,295,296,298,299,301,314,316,318,319,320,332,342,345,354,356,363,364,376,381,382,385,392,393,394,398,406,408,412,413,417,422,425,428,433,435,436,437,438,442,450,455,456,457,461,465,466,475,476,477,478,479,480,481,482,490,491,492,493,508,509,510,511,512,514,516,517,518,519,522,524,526,530,541,544,547,548,549],Then:[221,442,548],There:[12,17,136,137,363,425,461,548],These:[0,1,6,12,300,375,381,407,408,482,524,547,548],Use:[1,4,12,15,18,32,41,50,118,135,165,166,167,169,170,171,181,190,193,199,201,216,220,232,233,249,262,263,264,267,281,290,291,299,322,342,354,381,412,418,423,468,469,524],Used:[24,381],Useful:[140,198,275],Using:[4,7,13,14,15,17],Will:[117,313,513],With:[216,221,547],__line__:[302,311,312,313,314,315,316,317],_id:[1,3,6,9,11,12,20,127,180,181,192,201,221,227,229,230,238,246,248,298,311,312,313,315,316,317,332,424,472,548],_id_:[6,201,548],_load_resume_token:127,_mongoc_bulk_operation_t:119,_mongoc_change_stream_t:127,_mongoc_client_pool_t:163,_mongoc_client_t:191,_mongoc_collection_t:243,_mongoc_cursor_t:270,_mongoc_database_t:297,_mongoc_gridfs_file_list_t:340,_mongoc_gridfs_file_t:352,_mongoc_gridfs_t:363,_mongoc_matcher_t:380,_mongoc_server_description_t:415,_mongoc_session_opt_t:418,_mongoc_socket_t:440,_mongoc_stream_buffered_t:444,_mongoc_stream_file_t:451,_mongoc_stream_socket_t:460,_mongoc_stream_t:461,_mongoc_stream_tls_t:463,_mongoc_topology_description_t:470,_mongoc_transaction_opt_t:472,_mongoc_uri_t:524,_mongodb:524,_new:217,_previous_:[316,317],_remov:217,_save_resume_token:127,_simpl:548,_tcp:524,_win32:[9,376,380],aaaa:[0,524],aarch64:17,abbbbc:281,abbrevi:1,abl:317,abort:[12,168,173,179,180,302,314,317,424],about:[5,18,31,146,181,190,216,221,242,254,363,393,415,418,423,524,548],abov:[1,6,17,524,549],absolut:[429,437,438,442],accept:[127,155,255,426,492,515,524],access:[5,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,127,191,243,263,264,270,271,292,297,344,354,382,406,548],accommod:317,accord:[17,133,167,197,274],account:[5,165,166,193,232,233,249,290,291,299],accur:[199,200,201,215,228],acknowledg:[0,189,202,241,296,524,536,547],acmar:1,acquir:[18,181,190,418,423],across:16,action:[243,297],activ:[5,7],actual:[4,107,155,256,258,262,524,549],add:[0,3,6,7,10,11,12,79,88,133,135,139,165,166,180,181,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,302,311,312,313,314,315,316,317,395,429,472,548,549],add_execut:548,added:[0,9,10,17,227,229,230,271,311,312,313,314,315,316],adding:119,addit:[9,110,112,114,116,121,123,133,135,139,165,166,191,193,194,197,200,201,203,205,207,208,212,213,215,216,220,229,230,232,233,236,237,245,246,249,254,262,263,264,270,274,279,281,284,290,291,299,517,524,549],addition:[5,17,127,196],addr:[427,429,433],address:[4,435,524],addressless:4,addrlen:[427,429,433],addtoset:1,adjust:[17,345],admin:[3,4,21,163,317,524,548],admindb:21,advanc:[11,13,14,15,21,169,170,548],advantag:[6,17],af_inet:435,affect:[19,185,189],after:[6,9,12,16,18,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,119,127,129,159,162,165,180,181,182,183,187,190,192,193,202,203,217,229,236,246,248,254,258,268,269,294,295,296,298,302,312,315,316,340,363,374,381,392,418,423,424,425,431,442,447,450,479,480,481,488,490,494,511,512,513,514,515,516,517,518,519,520,521,522,523,524,541,542,543,544,545,546,548],afterward:[106,119,263,264],again:[10,12,180,425,472,524],against:[0,4,6,9,192,248,298,442,526,548],age:[302,311,313,314,315,316,317],agg:11,aggreg:[11,13,14,15,127,192,194,248,263,264,298],aggregation1:1,agre:[11,21],aid:[13,14,15],algorithm:0,alia:524,alias:[328,341,346,352],aliv:0,all:[1,3,4,5,6,7,9,11,16,17,18,19,30,40,48,106,110,116,117,119,121,123,127,129,134,147,153,155,157,162,173,180,182,187,194,195,202,203,207,208,213,216,221,228,229,230,237,245,246,252,258,266,268,269,272,277,281,283,284,292,303,315,317,325,355,359,362,363,374,377,381,388,397,405,406,407,409,430,442,446,447,452,464,467,484,494,515,524,529,548,549],all_build:17,alloc:[5,10,16,106,124,129,136,137,140,147,151,152,156,190,192,194,198,202,203,216,221,248,250,252,275,276,282,298,310,322,323,339,355,356,357,358,359,374,379,387,391,396,402,426,432,443,449,450,454,459,467,483,490,505,506,507,525,528,540,548],allow:[0,3,6,118,127,142,143,201,267,363,376,381,382,393,406,426,442,461,464,482,524,547],allow_invalid_hostnam:442,allowpartialresult:221,allplansexecut:21,along:[162,183,187,199,201,206,234],alreadi:[5,12,17,180,183,375,482,511,512,516,517,518],also:[3,6,9,10,11,15,16,17,160,217,236,247,268,363,406,415,514,519,522,524,548,549],alter:[392,541,542,543,544,545,546],altern:[4,524,548],although:[268,269,314],alwai:[12,16,18,106,131,133,148,165,166,172,193,197,205,209,217,218,232,233,242,247,249,274,290,291,299,332,363],among:[406,524,548],amount:[17,127,192,221,248,269,298,345],ani:[0,5,6,11,12,16,18,21,89,96,116,121,123,127,129,133,155,159,165,166,171,175,177,180,181,182,184,187,190,191,192,193,194,197,199,201,217,221,227,229,230,232,233,248,249,267,268,274,290,291,298,299,302,317,324,326,332,337,338,349,363,366,369,372,374,386,393,400,405,406,418,423,425,442,452,472,513,524,527,548],anoth:[4,7,10,12,17,21,126,127,157,169,170,431,524],anyth:[17,313,393],apach:[11,21],api:[6,13,15,161,184,193,213,249,299,352,363,442,452,455,461,465,466,470,548],apm:[13,15],app:17,append:[127,171,192,248,298,312,386,511,512,516,517,518,527],appli:[121,123,130,131,165,166,193,194,196,221,232,233,245,246,249,269,272,273,290,291,299,406,524,547],applic:[4,5,7,9,11,12,13,15,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,118,127,155,159,160,167,182,183,185,189,216,237,241,245,246,263,264,266,267,268,269,296,393,406,468,469,470,524,547,548,549],applicationnam:524,appnam:[1,3,6,8,160,163,165,180,181,183,191,193,217,246,254,270,317,363,405,424,472,524,548],approach:17,appropri:[199,201,206,234,263,264,345,548],apt:17,arbitrari:[6,201,221,302,363,548],archiv:549,archlinux:17,aren:548,argc:[0,1,3,6,8,9,11,19,21,163,165,180,181,191,193,217,246,254,270,297,363,380,472,548],argument:[11,12,110,112,114,116,121,123,131,132,133,148,159,165,166,168,171,172,180,182,184,193,196,197,205,206,207,208,212,213,217,218,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,263,267,268,269,271,273,274,279,289,290,291,292,293,299,302,311,312,314,315,316,317,325,343,345,349,362,386,425,479,480,481,527,548],argv:[0,1,3,6,8,9,11,19,21,163,165,180,181,191,193,217,246,254,270,297,363,380,472,548],arm:17,armor:[0,442],around:[217,426,427,428,429,432,457],arrai:[1,6,11,12,20,121,123,147,194,207,208,227,228,229,230,237,245,246,283,284,342,354,417,467,548],array_it:11,arrayfilt:[121,123,245,246],arrayofint:10,arrayofstr:10,artifact:17,as_json:127,as_json_len:127,ascend:[8,231],ascii:4,assert:[6,140,363],associ:[0,124,134,153,173,176,188,209,213,252,277,303,324,325,326,327,328,337,351,377,388,397,409,430,447,484,524,529],assum:[17,548],asynchron:7,attack:442,attempt:[0,4,6,12,127,202,203,229,254,272,279,442,524,547],auth:5,authent:[0,5,6,11,12,13,15,17,21,311,485,486,490,511,512,514,515,519,522,549],authmechan:[4,485,490,507,511,515,524],authmechanismproperti:[4,490,515,524],author:[0,5,292,293,315,316,317,442,524],authsourc:[4,486,507,512,524],auto:10,automat:[0,9,10,17,127,136,137,167,180,216,442,547],avail:[1,3,4,5,6,12,16,17,154,164,201,222,311,393,405,406,438,442,468,469,513,524,548],avg:1,avg_city_pop:1,avgobjs:548,avoid:[0,18,181,190,418,423,448,524],awai:[3,468,469],await:[189,241,296,547],awaitdata:[9,221,263,264,269],back:[158,323,524,548],background:[7,370,524],backlog:434,backward:[12,16,107,118,256,267,268],bad:12,bad_queri:254,badoper:254,badvalu:254,bar:[6,194,216,221],base:[6,12,140,191,217,373,380,391,406,453,461,496,498,504,506,526,540,548],base_stream:443,basi:[11,21,163],basic:[13,15,189,201,241,296,340,363,380,524],basic_aggreg:11,bat:17,batch:[6,119,194,195,202,203,216,221,255,262,263,266,272],batch_siz:[130,195,216,266,272],batchsiz:[192,194,221,248,263,264,298],bcon:[6,217],bcon_bool:[6,194,221,315,316,317,548],bcon_cod:11,bcon_date_tim:548,bcon_docu:8,bcon_doubl:[11,21],bcon_int32:[1,3,6,21,127,147,180,181,216,217,221,246,302,311,312,314,317,424,472,548],bcon_int64:[6,127,165,193,200,215,221,254],bcon_new:[1,3,6,8,11,21,127,147,165,180,181,193,194,196,200,201,215,216,217,221,246,254,302,311,312,313,314,315,316,317,380,405,424,472,548],bcon_oid:548,bcon_utf8:[6,8,11,21,165,193,194,196,201,216,221,313,317,405,548],bcrypt:549,becaus:[3,12,155,262],becom:[9,164,490,524,525],been:[3,5,17,18,142,143,157,175,177,179,181,190,216,251,252,262,327,338,385,390,392,393,400,408,418,423,429,431,462,490,511,512,513,514,515,516,517,518,519,520,521,522,523,524,534,537,541,542,543,544,545,546,547,548],befor:[0,4,6,16,18,79,88,118,126,159,160,161,162,165,166,181,187,190,193,194,200,201,209,215,216,217,221,233,235,236,249,262,267,268,291,299,363,366,369,372,375,386,418,423,442,455,465,466,488,524,527,530,531,533,535,541,542,544,546,548,549],began:12,begin:[7,10,12,16,24,43,70,81,86,129,133,135,139,165,166,193,197,200,201,202,203,205,207,208,212,213,215,216,220,221,229,230,232,233,236,237,245,246,249,250,274,279,281,284,290,291,299,374,392,442,524,541,542,543,544,545,546],begun:262,behavior:[0,7,12,127,155,261,524],behaviour:442,behind:4,being:[344,354],below:[4,19,216,507,548],besid:[194,442],best:[323,442],better:[427,429,446,464],between:[0,4,254,426,427,429,440,524],bewar:376,beyond:[265,524],bin:[17,549],binari:10,bind:427,bit:[17,329,333,353,382,535,549],bitwis:[110,116,121,123,207,208,228,229,230,237,244,245,246,375,381,407,408,482],blast:381,block:[7,126,127,157,164,181,189,192,241,248,265,296,298,339,342,381,455,456,465,466,468,469,524,526,547],book:[316,317],bool:[6,8,10,11,21,110,112,114,115,116,117,120,121,122,123,125,126,127,128,131,132,133,147,148,159,160,161,163,165,166,167,168,171,172,179,180,181,182,183,184,193,196,197,202,204,205,206,207,208,210,211,212,213,214,217,218,221,227,228,229,230,232,233,234,235,236,237,238,242,244,245,246,247,249,253,254,261,262,265,267,268,271,273,274,278,279,289,290,291,292,293,299,301,302,304,311,312,313,314,315,316,317,325,327,338,343,344,349,362,370,378,386,390,392,401,421,424,442,462,468,469,472,490,491,501,508,509,510,511,512,513,514,515,516,517,518,519,522,527,530,531,533,536,537,538,539,541,542,548],born:548,both:[0,7,17,127,166,221,233,291,363,442,524],bound:383,brew:17,brief:548,brows:548,bsd:[426,427,428,429,434,440],bson:[0,6,9,10,12,13,15,31,110,112,114,116,121,123,125,126,133,135,139,142,165,166,170,175,176,177,193,194,196,197,199,200,201,203,205,206,207,208,212,213,215,216,217,220,221,227,229,230,232,233,234,236,237,245,246,249,254,264,265,274,279,281,284,290,291,299,305,308,309,335,346,349,351,363,380,412,482,487,494,497,515,549],bson_append_array_begin:548,bson_append_array_end:548,bson_append_bool:[6,9],bson_append_date_tim:548,bson_append_document_begin:[9,281,363,548],bson_append_document_end:[9,281,363,548],bson_append_int32:[3,8,163,302,312,313,314,315,317,363,548],bson_append_int64:127,bson_append_oid:548,bson_append_regex:281,bson_append_timestamp:9,bson_append_utf8:[191,201,270,302,311,312,313,314,315,316,317,370,515,548],bson_append_valu:127,bson_as_canonical_extended_json:[1,3,6,9,11,21,127,165,191,193,196,216,217,221,270,302,311,312,313,314,315,316,317,380,405,490,548],bson_as_json:[8,180,181,254,472,548],bson_as_relaxed_extended_json:[3,127,246],bson_assert:[9,11,21,246],bson_concat:127,bson_destroi:[1,3,6,8,9,11,21,106,127,131,133,147,148,163,165,166,172,180,181,191,193,194,196,197,200,201,205,207,208,215,216,217,218,221,229,230,232,233,237,242,245,246,247,249,254,270,274,281,284,290,291,299,302,311,312,313,314,315,316,317,363,370,380,405,472,515,548],bson_empti:127,bson_error_t:[1,3,6,8,9,11,12,21,28,65,106,110,112,114,116,121,123,125,127,131,132,133,138,139,141,147,148,163,165,166,167,168,171,172,180,181,190,191,193,194,196,197,199,200,201,204,205,206,207,208,210,211,212,213,214,215,216,217,218,219,221,227,228,229,230,232,233,234,235,236,237,238,242,244,245,246,247,249,253,254,270,271,273,274,276,278,279,280,281,283,284,289,290,291,292,293,299,302,311,312,313,314,315,316,317,325,327,338,343,349,356,357,358,362,363,370,379,405,424,472,507,548],bson_fre:[1,3,6,8,9,11,21,127,165,180,181,191,193,196,216,217,221,231,246,254,270,302,311,312,313,314,315,316,317,380,405,432,472,490,525,548],bson_get_monotonic_tim:[180,472],bson_gnuc_deprec:[148,155,214,242],bson_gnuc_deprecated_for:[199,201,202,206,216,228,238,261,263,280,355,356],bson_gnuc_printf:19,bson_gnuc_pur:[365,368,371,441],bson_gnuc_warn_unused_result:[194,195,202,203,216,221,250,358,359,505,507],bson_has_field:487,bson_host_name_max:364,bson_init:[8,9,127,191,201,270,363,370],bson_init_stat:490,bson_initi:[3,6,9,11,127,163,180,281,284,302,311,312,313,314,315,316,317,405,424,472,515,548],bson_iter_doubl:11,bson_iter_holds_arrai:11,bson_iter_holds_doubl:11,bson_iter_holds_timestamp:9,bson_iter_init_find:[9,11,127,281],bson_iter_next:11,bson_iter_recurs:11,bson_iter_t:[9,11,127,281],bson_iter_timestamp:9,bson_iter_utf8:281,bson_iter_valu:127,bson_json_reader_destroi:127,bson_json_reader_new_from_fil:127,bson_json_reader_read:127,bson_json_reader_t:[127,548],bson_new:[6,165,180,181,193,472,548],bson_new_from_json:548,bson_oid_init:548,bson_oid_t:[57,61,78,95,98,101,227,229,230,548],bson_reader_destroi:380,bson_reader_new_from_fd:380,bson_reader_read:380,bson_reader_t:380,bson_stat:549,bson_strdup:[11,21],bson_strdup_printf:[11,21,492],bson_strfreev:[138,139,283,284],bson_t:[1,3,6,8,9,10,11,12,21,31,35,49,74,103,104,106,109,110,111,112,113,114,115,116,120,121,122,123,125,126,127,130,131,132,133,135,139,147,148,163,165,166,169,171,172,175,176,180,181,191,192,193,194,195,196,197,199,200,201,203,204,205,206,207,208,210,211,212,213,214,215,216,217,218,220,221,222,227,228,229,230,231,232,233,234,235,236,237,238,242,244,245,246,247,248,249,251,254,263,264,265,270,271,272,273,274,276,278,279,280,281,284,290,291,298,299,301,302,305,308,309,311,312,313,314,315,316,317,328,335,341,346,351,355,356,358,359,363,370,378,379,380,386,395,400,405,412,424,472,487,490,494,497,511,512,515,516,517,518,527,548],bson_type_int32:363,bson_uint32_to_str:548,bson_validate_flags_t:[110,116,121,123,207,208,229,230,237,245,246],bson_value_copi:127,bson_value_destroi:127,bson_value_t:[127,332,349,363],bsondump:20,buf:[363,382,383,384,436,437,455,465,548],buffer:[0,6,188,262,383,384,436,437,438,443,444,446,448,452,455,461,464,465,493],buffer_s:443,buflen:[436,437],bug:[15,20,548],build:[1,4,10,15,21,118,165,167,193,194,217,263,264,267,370,442,524,549],builder:[303,310,311,312,313,314,315,316,317],buildinfo:3,built:[0,5,12,17,190,461],bulk1:6,bulk2:6,bulk3:6,bulk4:6,bulk5:6,bulk5_fail:6,bulk5_success:6,bulk6:6,bulk:[11,13,14,15,21,30,40,48,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,193,202,203,222,228,229,249,299],bulk_col:6,bump:[302,311,312,314,315,317],bundl:[17,524],bye:20,bypass:[117,311,317],bypassdocumentvalid:[194,229,230,237,245,246],c_rehash:0,ca_dir:[0,4,162,187,442],ca_fil:[0,4,162,187,442],cach:[0,4,127,524],cached_operation_tim:127,calcul:548,call:[5,6,7,9,11,12,16,18,19,80,81,82,83,84,85,86,87,88,89,90,91,103,104,106,107,109,110,111,112,113,114,115,116,118,119,120,121,122,123,126,129,130,133,135,139,148,154,155,157,158,159,160,161,162,164,165,166,175,180,181,183,185,186,187,189,190,192,193,194,197,198,199,200,201,202,203,212,213,215,216,220,221,231,232,233,236,248,249,250,256,265,266,267,268,269,270,271,272,274,275,279,281,284,290,291,294,295,296,298,299,302,304,312,315,316,346,347,348,350,351,366,369,372,374,390,392,418,423,424,425,430,431,433,435,447,479,480,481,505,524,537,541,542,543,544,545,546,548],callback:[3,22,23,24,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,80,81,82,83,84,85,86,87,88,89,90,91,93,94,159,182,188,468,469,470],caller:[106,413,448],came:[18,181,190,418,423],can:[0,1,4,5,6,9,10,11,12,16,17,18,19,21,127,133,135,139,157,159,160,161,162,165,166,180,190,191,192,193,194,197,200,201,203,205,207,208,212,213,215,216,220,221,227,229,230,232,233,236,237,243,245,246,248,249,263,265,268,271,274,279,281,284,290,291,297,298,299,311,317,341,344,354,355,358,359,363,364,375,380,381,382,391,392,393,401,406,425,437,438,442,472,479,480,481,492,507,516,517,518,524,526,540,541,542,543,544,545,546,547,548,549],cancel:[0,524],cannot:[12,19,160,228,254,269,511,512,513,514,515,519,522],canon:[231,524],canonicalize_host_nam:[4,490,515],canonicalizehostnam:524,cap:[9,548],capabl:[1,408],captur:431,casefirst:[6,165,193,201,221],cast:[3,468,469],cat:[11,21],categori:12,caus:[254,524],causal:[18,169,170,181,190,418,421,423,424,543],causal_consist:424,caution:363,caveat:[363,406],cbs:3,cdriver:5,center:200,centerspher:200,cento:17,certain:[0,6,12,21,524,526],certif:[0,15,524],cflag:[3,8,9,11,21,163,165,180,181,191,193,270,472,548],challeng:4,chang:[3,4,58,83,89,96,124,125,127,192,216,248,266,268,269,298,345,346,347,348,350,351,407,442,468,469,524,548,549],changestream:127,charact:4,check:[1,2,4,5,7,9,13,15,17,67,70,75,85,86,87,125,130,131,132,135,179,196,213,220,253,254,263,264,272,273,281,289,327,378,382,401,406,431,442,524,547,548],checklist:15,checkout:17,checksum:350,child2:548,child:[363,548],choic:[406,549],choos:[12,17,118,140,167,216,267,312,393,406,524,549],chose:549,chosen:524,chunk:[12,141,329,343,360,362],chunk_siz:[341,352],clang:17,clariti:3,clean:[0,409,415,548],cleanup:[2,5,11,13,15,17,21,127,217],clear:[4,182,289,431],cleartext:271,click:[5,549],client:[0,1,3,4,5,6,7,8,9,11,15,21,32,41,50,110,116,121,123,125,127,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,155,157,158,160,161,162,163,164,165,166,167,173,180,181,182,183,184,185,186,187,188,189,190,191,192,193,202,203,207,208,213,217,229,230,237,240,243,245,246,254,262,263,264,270,286,288,295,297,317,363,370,380,393,398,403,405,411,412,414,424,425,472,482,487,513,524,547,548],client_sess:[171,181,424],clock:[406,429,436,437,438,524],clone:[17,21,250,270],clone_collect:21,clonecollect:198,clonecollectionascap:[165,193],close:[3,12,18,62,99,155,181,190,381,418,423,428,436,445],closer:548,cluster:[3,142,143,169,191,406,524,548],cluster_tim:169,clustertim:[169,170,175],cmake:[4,5,16,17,442,549],cmake_install_prefix:[17,549],cmakelist:548,cmd:[3,165,193,196],cmpxchg:217,cng:442,coalesc:6,cobol:548,code:[3,6,11,12,16,19,21,103,104,133,135,138,139,142,143,148,165,166,171,173,180,193,194,197,199,200,201,202,203,204,205,207,208,212,213,214,215,216,218,219,220,221,227,228,229,230,232,233,236,237,238,242,245,246,247,249,254,263,274,279,280,281,283,284,290,291,299,300,301,356,357,358,370,376,386,418,420,423,472,490,497,527,548,549],codenam:254,coll:[127,246,248],coll_nam:548,collat:[112,114,116,121,123,133,165,166,192,193,194,197,200,201,207,208,212,213,215,221,232,233,236,237,245,246,248,249,274,279,290,291,298,299,370],collect:[1,3,6,8,9,11,12,20,21,106,127,136,137,141,166,180,181,185,189,191,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,254,262,263,264,270,276,280,281,282,283,284,289,291,294,295,296,302,311,312,313,314,315,316,317,370,393,405,406,424,472,547,548],collection1:194,collection2:194,collection_nam:[3,8,11,21,191,216,221,270],collectionnam:317,collnam:[6,405],collscan:21,collstat:[196,242,548],colon:406,color:548,com:[4,9,17,490,507,515,524],combin:[406,538],come:[5,6,19,201,254,406,461],comma:[0,406,489,513,524],command:[1,4,8,10,12,15,17,24,25,30,31,34,35,36,40,43,44,48,52,67,70,75,85,86,87,110,112,114,116,121,123,127,130,131,132,133,135,139,148,165,166,171,192,193,194,195,196,197,198,200,201,202,203,205,207,208,212,213,215,217,220,222,229,230,232,233,236,237,242,243,245,246,247,248,249,263,264,269,272,273,274,275,276,279,281,284,290,291,292,293,298,299,302,310,317,363,386,407,412,414,524,527,547],command_fail:3,command_opt:205,command_start:3,command_succeed:3,comment:221,commit:[12,172,179,180,472,524],common:[0,11,13,14,15,270,442,548],common_oper:21,commun:[12,257],comparison:[112,114,116,121,123,133,165,166,193,194,197,200,201,207,208,212,213,215,232,233,236,237,245,246,249,274,279,290,291,299],compat:[4,12,16,107,118,199,201,206,234,256,263,264,267,268,393,406,442],compil:[0,4,5,9,11,17,19,21,162,187,318,319,320,378,442,526,548],complet:[0,7,9,12,17,19,75,82,87,180,188,262,263,524],compli:6,complianc:[11,21],compon:[17,170,177],composit:1,compress:524,compressor:[0,487,513,524],comput:[4,334],concaten:[0,524],concern:[12,106,108,130,131,132,133,144,150,165,166,180,185,189,192,193,194,196,197,200,201,202,203,205,206,207,208,212,213,215,217,218,221,224,226,227,228,229,230,232,233,236,237,238,239,241,244,245,246,248,249,272,273,274,276,279,290,291,294,296,297,298,299,302,314,317,386,388,389,390,391,392,406,425,472,479,481,496,498,504,520,523,527,529,530,532,535,536,537,538,539,540,541,542,543,544,545,546],conclud:17,concurr:[7,363],condit:[11,21,526],config:[3,8,9,11,21,163,165,180,181,191,193,270,408,472],config_str:373,configur:[0,3,4,7,9,10,16,17,19,112,114,116,121,123,133,140,144,145,150,161,162,165,166,167,171,178,184,190,193,194,197,198,200,201,207,208,212,213,215,221,232,233,236,237,239,245,246,249,274,275,279,286,288,290,291,292,294,299,391,406,421,424,425,461,472,478,479,480,481,496,498,504,524,540,545,549],confirm:[442,524],conflict:12,conform:[3,470],conjunct:448,connect:[1,3,4,11,12,13,14,15,17,20,21,58,83,89,96,140,142,143,147,151,154,162,163,183,187,191,192,240,248,254,270,295,298,363,393,406,412,415,429,442,468,469,470,492,507,514,547,549],connection_str:[3,8,163,165,180,181,191,193,270,472,548],connecttimeoutm:[454,492,509,524],consecut:6,consequ:[0,524],consid:[3,5,19,106,166,193,206,217,218,227,228,229,230,233,237,238,244,245,246,249,291,299,406,444,460,492,524,547,548],consider:17,consist:[18,169,170,181,190,192,248,298,401,418,421,423,424,543],consol:549,constant:[11,524],constraint:[6,517],construct:[11,110,116,121,123,133,135,139,162,165,166,187,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,317,492,548],consult:[133,165,166,193,197,232,233,249,274,290,291,299,548],consum:[9,376,382],contact:[11,262],contain:[0,4,10,11,12,17,21,31,115,116,120,121,122,123,127,130,131,133,135,136,139,151,165,166,192,193,194,195,196,197,199,200,201,202,206,207,208,211,212,216,217,218,219,220,221,229,230,232,233,234,237,238,242,244,245,246,248,249,272,273,274,280,281,283,284,289,290,291,293,297,298,299,301,335,341,346,347,348,350,351,357,358,359,360,361,362,363,367,370,373,378,379,383,426,429,434,435,438,439,443,494,497,505,506,507,532,534,535,545],content:[10,198,275,323,330,347,483,490],content_typ:[341,347,352],context:[3,26,37,45,53,59,63,68,71,76,92,97,100,159,182],continu:[9,17,180,202,203,229,236,375,472],contract:188,contrast:[200,215],contribut:17,control:[382,442,524],conveni:[216,302,314,317,363,524,548],convert:[216,221],copi:[0,5,11,17,19,21,25,28,29,31,35,36,38,39,44,47,49,54,55,56,60,65,66,69,73,74,77,93,94,126,159,162,169,170,180,182,183,187,198,250,265,275,305,308,309,387,396,413,419,425,442,473,479,480,481,483,528],copydb:275,copyright:[11,21],core:5,cork:464,correct:[4,17,185,189,241,296,491,492,493],correctli:10,correl:[30,32,40,41,48,50],correspond:[12,135,141,219,220,280,281,375,381,407,408,482],corrupt:12,could:[19,147,180,181,293,356,363,379,472],couldn:[6,11],count:[1,6,7,11,106,165,199,201,215,232,290,455,465],counter:[15,16,129,374],cover:[4,406],creat:[0,1,3,4,5,6,7,10,12,13,14,15,16,18,23,24,125,126,130,136,137,141,149,151,152,156,157,174,180,181,190,192,202,203,204,205,209,214,231,237,245,246,248,250,254,268,269,270,271,272,276,294,295,296,298,310,313,317,322,323,332,341,370,379,391,402,405,418,419,423,425,435,443,449,450,454,459,472,473,478,506,524,540,549],create_index:8,createindex:[8,205,370],createrol:[193,249,299],creation:[18,205,363,365,368,371,382],credenti:[4,12,514,524],critic:19,crl_file:[162,187,442],cross:15,crud:[15,193,243,249,299],crypt32:549,crypto:[190,442],cryptograph:382,cryptographi:442,csharp:5,curl:17,current:[4,12,17,20,148,169,170,240,247,251,292,293,295,345,353,380,389,406,428,431,437,442,461,468,469],cursor:[1,5,11,12,13,14,15,126,130,131,135,181,191,194,195,216,219,220,221,246,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,272,280,281,314,381,405,408,548],custom:[0,6,10,127,167,188,191,406],custom_data:271,cyru:[4,17,524],data:[10,11,12,15,21,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,124,126,163,181,192,248,262,271,298,323,343,362,381,383,385,452,490,515,524,547,548],databas:[3,4,6,11,21,38,130,131,132,133,135,136,137,138,139,140,141,163,165,166,180,185,189,193,197,232,233,235,236,249,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,317,393,406,472,488,514,524,547,548],databasenam:317,datacent:405,date:336,db1:524,db2:[21,524],db_name:[130,131,132,133,140,165,166,193,299,548],dbadmin:[6,311],dbname:405,dbpath:21,dcmake_build_typ:17,dcmake_install_prefix:17,dcmake_prefix_path:17,debian:17,debug:[13,14,15,17,19,549],decis:12,deep:[198,275,387,396,528],default_languag:370,default_txn_opt:[180,472],defin:[6,9,10,11,12,19,266,375,416,471,482,489,524,526,549],degre:[382,548],delai:[0,524],deleg:4,delet:[5,103,104,112,193,206,207,208,234,243,249,299,300,407,524],deletedcount:[207,208],deliv:5,delta:345,demand:[3,7,548],demonstr:[9,11,12,165,180,193,301,548],denable_automatic_init_and_cleanup:[16,17],denable_html_doc:17,denable_man_pag:17,denable_mongoc:17,denable_shm_count:5,denable_ssl:[162,187],denable_trac:[5,19],depend:[0,3,15,17,18,382,524,549],deploy:412,deprec:[4,155,524],deriv:4,descend:[1,221,231,315,317],describ:[4,6,17,167,193,249,299,394,524],descript:[0,17,55,56,93,94,147,186,295,393,415,417,467],descriptor:[445,448,449,451],design:12,desir:[110,116,121,123,207,208,229,230,237,243,245,246,429,443],despit:[3,180],destin:[437,438],destroi:[18,90,99,105,106,119,124,155,159,181,182,190,205,209,247,263,264,324,326,413,418,423,490,548],destruct:18,detail:[8,12,31,120,121,122,123,130,183,199,201,262,301,342,354,392,406,524,548],detect:[0,12,17,370],determin:[3,4,12,265,270,315,468,469,524],dev:[17,321],devel:17,develop:[5,19,155],dialog:549,did:[5,181],didn:[313,317],died:548,differ:[4,17,21,216,254,376,382,406,548,549],direct:[21,406],directli:[0,7,17,18,147,148,216,242,247,302,382,440],directori:[0,10,17,548,549],disabl:[5,18,181,190,406,418,423,424,442,524],discov:[3,7,524],discoveri:[3,416,471],disk:524,dispatch:394,displai:[1,17],dispos:5,distinct:[13,14,15,133,165,166,193,194,197,221,232,233,249,274,290,291,299],distinguish:4,distribut:[11,17,21,442,524],dll:549,dnf:17,do_someth:[340,526],doc:[0,1,3,6,9,11,17,21,127,180,181,191,216,221,254,270,281,405,424,472,548],docsexamin:21,document:[1,3,4,9,11,12,15,18,31,103,104,106,109,110,111,112,113,114,115,116,117,120,121,122,123,125,126,127,131,133,135,136,137,139,142,165,166,168,171,172,173,175,176,179,180,181,190,192,193,194,195,196,197,199,200,201,203,205,206,207,208,212,213,215,216,217,218,219,220,221,227,228,229,230,232,233,234,236,237,238,244,245,246,247,248,249,251,254,255,262,263,264,265,266,268,269,270,272,273,274,279,280,281,284,290,291,298,299,305,308,309,311,313,315,316,317,335,370,375,378,380,386,407,408,412,418,423,472,478,482,487,494,497,524,527],doe:[0,4,5,12,16,17,22,105,120,121,122,123,127,129,131,132,134,155,173,190,196,198,209,213,219,220,229,252,262,273,275,277,302,303,312,315,316,324,326,337,363,374,380,388,397,409,420,424,430,447,454,468,469,474,484,497,524,529,543,547],doesn:[11,183,302,313,314,317],dog:[11,21],doing:6,domain:[6,9,12,19,213,254,356,357,358,435,524],don:[11,21,162,187],done:[4,9,21,180,181,472,548],dopenssl_root_dir:442,doubel:382,doubl:[10,11,367,383],down:[381,428,524],download:[17,549],driver:[0,3,4,5,6,7,9,10,12,13,16,19,20,21,34,43,52,58,62,67,70,75,79,80,81,82,83,84,85,86,87,88,89,90,91,96,99,102,107,118,129,161,162,163,167,183,184,187,189,190,216,221,241,256,258,263,264,267,296,302,314,317,332,363,374,382,406,412,415,442,461,468,469,470,492,514,519,522,524,526,547,548,549],drop:[0,1,3,16,193,212,213,235,236,249,262,279,299,325],drop_dup:370,drop_target_before_renam:[235,236],dropdup:370,due:[6,18,181,190,418,423,524],dump:[5,19],dup:6,duplic:[3,6,12,370,547],durat:[27,46,64,72,414],dure:[4,19,228,407],dynam:[548,549],e11000:6,each:[1,5,6,7,11,18,133,135,159,165,166,182,192,193,194,195,197,219,220,232,233,248,249,266,274,280,281,290,291,298,299,312,339,382,398,403,406,412,424,425,472,524,548,549],easier:524,easili:[5,127,461],echo:20,edit:[3,4,549],effect:[6,118,169,170,267,268],egress:5,einval:345,either:[6,11,17,21,161,184,194,207,208,217,230,237,245,246,254,289,311,524],elaps:7,element:[121,123,227,230,245,246,342,354,417,438],elig:[406,524],els:[3,6,11,21,127,139,165,180,193,196,199,200,201,213,215,284,302,311,312,313,314,315,316,317,363,376,380,405,421,455,472,490,548],embed:[7,196],embeddeddocu:10,emit:11,empti:[6,11,12,19,31,125,127,192,205,219,220,221,239,248,254,262,294,298,305,308,309,406,412,524,548],en_u:[6,165,193,201,221],enabl:[0,5,6,16,19,187,201,311,442,487,513,524,526],enable_icu:4,enablemajorityreadconcern:[165,193],enclos:524,encod:[0,4,348,357,362,525],encount:[4,12,192,248,298,455,465],encrypt:[442,524],end:[0,5,16,129,173,323,345,374,455,465,524,548],endif:[9,162,187,191,270,376,380,526],enough:[382,385],ensur:[4,5,147,162,169,170,263,264,401,442,548],enter:17,enterpris:[4,165,193,549],entir:[180,325,472,483],entireti:[120,121,122,123],entri:[8,17,112,114,116,121,123,127,133,165,166,181,193,194,197,200,201,207,208,212,213,215,232,233,236,237,245,246,249,274,279,281,284,290,291,299,424],entropi:[383,384],environ:[4,5,382,549],epel:17,ephemer:265,epoch:336,equal:[1,20,128,213,398,403,524],equival:[261,428,450,524],err:[125,180,472],err_doc:127,errmsg:[3,6,254],errno:[19,345,427,428,429,431,433,434,435,436,437,438,439,445,446,449,450,452,455,456,457,464,465,466],error:[1,2,3,4,5,6,8,9,11,13,15,17,19,21,28,31,65,125,127,130,132,147,159,160,161,163,167,168,171,172,180,181,182,183,184,185,186,187,189,191,192,194,204,210,211,216,221,231,235,248,250,251,263,264,265,267,270,272,278,298,301,302,311,312,313,314,315,316,317,323,342,344,349,354,363,370,381,382,386,405,408,424,431,442,462,472,505,507,524,527,547,548],error_cod:[180,472],errorlabel:[12,180,472],escaped_str:525,especi:19,essenti:363,establish:[0,142,143,192,248,270,298,548],estim:[383,398,403,406],etc:[17,243,442,524],evalu:406,even:[9,106,148,196,202,262,273,311,317,375,442,543],event:[3,7,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,127,159,182],everi:[7,524],everyth:[1,6],exact:17,exactli:[16,129,374,524],exampl:[0,4,6,7,9,10,12,13,14,15,19,106,135,173,203,205,207,208,212,213,220,222,229,230,236,237,245,262,263,264,279,301,364,390,418,423,508,509,510,511,512,514,519,522,525,537,547,548],example_col:246,exceed:155,except:[1,11,18,21,160,162,164,221,406,456,524,547],excess:155,exclud:312,exclus:[127,216],exe:[17,548],execut:[3,6,7,8,15,16,34,43,52,70,80,86,103,104,106,111,112,113,114,115,116,119,120,121,122,123,130,132,133,165,166,180,193,194,195,196,197,199,200,201,202,203,215,216,221,222,232,233,247,249,250,254,256,258,263,267,270,272,274,290,291,299,314,356,358,359,424,543,549],executionstag:21,executionstat:21,executionsuccess:21,executiontimemilli:21,executiontimemillisestim:21,exhaust:[12,221,265,524],exist:[9,12,19,20,127,141,213,219,220,235,236,289,313,317,363],exit:[9,16,18,127,363,548],exit_cod:[11,127,180,181,472],exit_failur:[1,3,6,8,9,11,21,127,163,165,180,181,191,193,217,246,270,317,363,472,548],exit_success:[1,3,6,8,9,11,127,163,165,180,181,191,193,217,246,270,317,363,472,548],expand:549,expect:155,expens:[363,375],expir:[4,436,437,442,524],expire_after_second:370,expire_at:[426,429,436,437,438],explain:[6,549],explicitli:[4,21,216,221,239,294,393,539],explor:549,expos:[442,524],expr:200,express:[11,17,21,170,177],extend:[7,126],extens:[363,461],extern:4,extra:[9,17,201,242,271,302,314,317,524],extract:[11,17,524],fail:[0,1,3,5,6,8,9,11,12,21,24,31,34,67,80,85,106,107,127,139,163,165,180,181,190,191,193,199,200,201,215,217,228,246,254,270,284,292,301,317,363,370,375,405,408,424,429,472,524,544,548],failov:[0,180,472,524],failur:[1,5,12,106,138,139,141,148,166,180,181,191,193,194,196,199,200,201,202,203,206,215,217,218,227,228,229,230,233,237,238,244,245,246,249,250,254,263,264,270,271,273,276,283,284,291,299,342,345,354,379,426,427,428,429,434,436,437,438,439,446,449,450,455,456,464,465,466,505,507,547,548],fake:254,fall:524,fallback:[438,491,492,493],fals:[4,6,10,11,12,21,106,110,112,114,116,121,123,126,127,130,131,132,133,148,159,160,161,163,165,166,168,171,172,179,180,182,183,184,192,193,194,196,197,203,205,206,207,208,212,213,217,218,221,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,248,249,253,254,265,267,268,271,273,274,279,289,290,291,292,293,298,299,302,311,312,313,314,315,316,317,325,327,338,343,344,349,362,378,380,386,392,421,424,442,490,508,511,512,513,514,515,519,522,524,527,548],fam:317,fam_bypass:[311,317],fam_field:[312,317],fam_flag:[313,317],fam_opt:[302,314,317],fam_sort:[315,317],fam_upd:[316,317],famili:[364,382,435],fan:7,far:524,faster:381,fastest:524,fclose:127,fcntl:363,featur:[5,6,17,20,162,187,201,221,452,526,548],feb:4,fedora:17,fedoraproject:17,fetch:[6,108,135,147,149,219,220,223,224,225,226,251,257,258,262,280,281,283,284,285,287,316,317,328,329,330,331,332,333,334,335,336,338,399,400,438,453,467,485,486,488,489,490,494,495,496,497,498,499,501,502,503,504,530,531,532,533,548],few:6,fewer:17,fflush:452,field:[1,6,8,11,12,115,116,120,121,122,123,127,130,133,135,139,165,166,192,193,194,195,197,200,201,207,208,212,213,215,216,217,220,221,229,230,232,233,236,237,238,245,246,248,249,254,272,274,279,281,284,289,290,291,298,299,302,305,317,358,359,366,369,372,425,442,472,548],field_name_on:221,field_name_two:221,fieldnam:312,file:[0,4,10,11,12,17,20,21,127,140,141,322,323,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,442,445,448,449,450,451,454,455,465,548,549],file_id:363,file_stream:127,filenam:[12,331,341,348,352,357,362,363],fileno:380,fill:[12,167,171,194,207,208,229,230,245,246,323,356,357,358],filter:[20,21,121,123,200,216,221,245,246,280,281,358,359,363,380,405,468],find:[11,20,21,30,40,48,217,218,221,243,254,256,263,264,267,281,302,303,310,311,312,313,314,315,316,317,355,357,358,359,524],find_and_modifi:[217,313,317],find_and_modify_opt:303,find_opt:181,find_packag:548,find_queri:11,findandmodifi:[217,310,314,315,317],findicu:4,findon:1,finish:[18,262,548],firewal:4,first:[0,1,3,6,7,11,17,18,21,106,127,131,133,135,136,137,139,159,160,161,162,165,166,193,194,196,197,200,201,202,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,269,270,273,274,279,281,284,290,291,299,315,356,357,358,393,406,407,425,472,482,524,548],firstbatch:[263,264],firstnam:[302,311,312,313,314,315,316,317],fit:363,five:127,fix:12,flag:[10,130,194,195,199,201,206,216,227,228,234,244,272,300,306,317,436,450],flaw:12,flow:548,flush:452,follow:[0,1,4,5,9,11,12,17,19,21,127,165,166,180,183,192,193,194,196,200,221,232,233,246,248,249,290,291,298,299,363,406,524,526,548,549],foo:[6,10,194,216,221,405],footbal:[302,311,313,314,315,316,317],fopen:127,for_writ:167,forc:452,foreach:11,form:[1,11,12,21],format:[3,15,19,316,321,548],forward:[4,21,106],found:[0,5,11,12,127,167,213,221,227,230,254,281,356,357,358,408,548],four:548,fourth:6,fprintf:[1,3,6,8,9,11,21,127,139,163,165,181,191,193,196,199,200,201,213,215,216,217,221,246,254,270,281,284,302,311,312,313,314,315,316,317,363,405,424,548],framework:[11,13,14,15],free:[0,18,22,23,105,134,141,153,173,175,176,178,181,190,252,277,303,337,356,357,358,363,377,388,397,410,417,418,420,423,447,474,484,529],freebsd:17,freed:[25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,108,130,133,136,137,138,139,140,144,145,146,147,149,150,152,156,165,166,167,172,180,190,192,193,194,195,197,198,202,203,207,208,216,217,218,221,223,224,225,226,229,230,231,232,233,237,242,245,246,248,249,250,251,254,272,274,275,282,283,284,285,286,287,288,290,291,298,299,310,322,323,328,330,331,332,334,335,339,355,359,360,361,379,387,391,396,400,402,425,432,435,441,443,449,450,459,467,478,479,480,481,483,485,486,487,488,489,493,494,495,496,497,498,499,502,503,504,506,525,528,534,540,548],freeli:17,friendlier:440,from:[1,4,5,6,7,9,10,11,12,15,18,21,126,127,131,133,135,139,154,155,157,158,160,162,164,165,166,169,170,174,180,181,183,185,186,187,189,190,191,192,193,194,197,199,201,203,205,207,208,209,212,213,215,216,220,221,224,226,229,230,232,233,236,237,240,241,243,245,246,248,249,254,258,262,263,264,265,267,269,270,272,274,276,279,281,284,290,291,293,295,296,297,298,299,301,323,342,343,345,352,362,375,380,381,382,390,406,407,408,418,423,425,442,443,448,454,455,472,497,511,512,513,514,515,516,517,518,519,520,521,522,523,524,537,547,549],fromdb:21,fromhost:21,frozen:[392,541,542,543,544,545,546],fseek:345,fsync:[530,541],fsync_:541,fulfil:[188,191],full:[0,247,380,381,524],fulli:382,futur:[12,16,185,186,189,221,302,314,317,393],futureopt:[302,314,317],fwrite:[127,363],gather:[354,376,438,456],gcc:[3,8,9,11,17,21,163,165,180,181,191,193,270,472,548],gdbinit:10,gener:[1,12,15,213,227,229,230,352,363,382,383,384,385,406,411,442,446,461,464,547,548,549],geo:[365,367,370],geo_opt:370,geo_test:370,geowithin:200,get:[1,11,17,106,136,137,140,146,175,176,177,178,281,381,411,412,414,432,535,548],gethostnam:549,getlasterror:524,getmor:[5,30,40,48,269],getnameinfo:432,getpeernam:432,github:17,gitvers:21,give:[9,12,524,548],given:[5,11,163,188,191,206,207,208,231,234,263,264,276,292,331,345,413,468,548],global:[16,129,186,202,240,295,374,406],goal:[311,312,313,315,316,317],going:19,good:265,good_queri:254,got:[127,302,311,312,313,314,315,316,317],govern:[11,21,524],grab:363,grace:548,graph:5,great:[185,189,241,296,393,406,547],greater:[1,11,128,169,170,524],greatest:1,gridf:[12,141,322,323,324,325,328,329,331,332,333,334,335,336,339,340,341,344,346,347,352,354,355,356,357,358,359,360,361,362,363,454],gridfs_fil:363,gridfs_file_list:363,group:[1,272],grow:443,gssapi:[15,490,507,511,515],gssapiservicenam:524,gte:[1,6,20,380],guarante:[181,199,200,201,215,382,524,548,549],guid:[0,4,13,15,17,548],half:524,hand:254,handl:[6,12,127,194,202,203,243,250,297,363,405,440,505,507,524,547,548],handshak:183,happen:[192,248,298,375,379],hardwar:382,has:[0,1,3,7,9,12,18,118,125,142,143,147,157,175,177,179,181,183,190,194,199,201,238,246,251,252,253,254,258,261,262,263,267,268,327,338,385,390,392,393,408,418,423,429,431,442,462,468,469,511,512,513,514,515,516,517,518,519,520,521,522,523,524,534,537,541,542,543,544,545,546,547,548],hash:4,hat:17,have:[5,6,7,10,11,12,17,116,121,123,135,162,175,183,187,216,220,228,229,264,281,302,311,312,315,316,332,390,400,424,490,517,524,537,542,543,544,548,549],haven:10,haystack_bucket_s:367,heartbeat:[3,67,70,75],heartbeat_failed_ev:3,heartbeat_started_ev:3,heartbeat_succeeded_ev:3,heartbeatfrequencym:[7,524],hello:[20,191,270,380,548],hello_mongoc:548,help:[5,10,548,549],helper:[10,11,12,19,21,148,192,236,242,247,248,298,432,439,548],here:[3,9,11,17,21,192,221,248,298,406,440],hex:[5,19],higher:[15,167,263,264],highest:[133,165,166,193,194,197,221,232,233,249,274,290,291,299],him:[316,317],hint:[107,118,201,221,256,267,406],his:[302,311,312,313,314,315,317],histor:[216,468,469,524],hold:[1,10,23,163,415,524,548],home:17,homebrew:17,hopper:548,host01:0,host02:0,host03:0,host1:524,host2:524,host:[0,3,4,21,29,39,47,54,60,66,69,73,77,140,191,257,270,364,410,489,524,548],host_and_port:[3,11,21,147,364],hosta:7,hostb:7,hostn:524,hostnam:[0,4,442,506,524],how:[0,1,5,6,9,11,12,21,161,165,180,184,193,200,215,216,375,381,394,524,544,548,549],howev:[0,6,9,216,406,524,547,548],http:[11,17,21,163,548],human:12,hurt:[155,524],i686:17,iOS:442,ibrahimov:[302,311,312,313,314,315,316,317],icu_root:4,idea:461,ident:[160,162,164,456],identifi:[17,118,267,411],idl:[0,18,155,181,190,381,418,423],ids:3,ifdef:[9,162,187,376,380],ignor:[0,166,168,199,200,201,213,215,221,233,291,311,370,406,442,454,468,524,547],illustr:548,immedi:[11,164,254],implement:[20,127,191,193,249,299,356,363,446,452,453,464,524],impli:[11,21],in_shutdown:[163,548],inact:381,inc:[6,11,21,181,302,311,312,314,317],includ:[0,1,3,6,8,9,10,11,12,15,17,19,21,107,118,127,133,135,139,147,153,159,163,165,166,180,181,182,191,193,194,196,197,199,200,201,212,213,215,216,217,220,221,227,229,230,232,233,236,243,246,249,254,256,263,267,270,271,274,277,279,281,284,290,291,293,297,299,301,312,325,340,358,359,362,363,367,370,373,376,377,380,405,415,418,440,442,447,453,472,497,514,524,526,549],inconsist:[12,16,20,440],increas:6,increment:[170,177],indefinit:524,independ:[18,425,472],index:[3,6,12,14,15,204,205,211,212,213,214,219,220,231,365,367,368,370,371,373],index_nam:[8,211,212],index_opt:205,indexdetail:548,indexfilterset:21,indexs:548,indic:[6,125,126,127,262,345,353,455,456,466,501,524,531,533,535,541,542,544,545,546,548],individu:[191,370,393,516,517,518],industri:442,info:[17,19,28,65],inform:[0,4,5,106,127,146,194,199,201,210,211,216,221,235,237,245,246,247,254,278,393,404,415,497,524,543,545,547,548],ingress:5,inherit:[133,135,139,165,166,180,185,189,193,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,243,245,246,249,274,279,281,284,290,291,294,295,296,297,299,425,472],initi:[2,4,13,15,17,91,102,106,129,133,148,165,166,172,183,188,193,196,197,200,205,215,217,218,232,233,237,242,247,249,263,264,270,273,274,290,291,299,305,308,309,363,366,369,372,374,376,443,490,524,548],inlin:[10,11],input:[11,12,549],input_fil:363,insensit:[491,492,493,508,509,510,516,517,518,524],insert:[3,5,7,9,11,12,20,21,109,110,116,121,123,127,136,137,165,180,193,203,227,228,229,230,238,243,246,249,299,313,375,424,472,524],insert_cmd:127,insert_data:[11,21],insert_opt:[180,424,472],insertedcount:[229,230],insid:216,insofar:382,instal:[1,4,5,10,13,15,442,549],instanc:[0,1,11,21,141,144,145,150,326,360,361,363,405,496,498,504,524,548],instead:[4,103,104,127,138,148,155,164,185,186,187,189,199,201,202,206,216,219,221,228,238,242,247,263,280,283,300,355,356,381,392,497,530,541,542,543,544,545,546,548,549],instruct:[0,11,17,313,548,549],int32:[10,133,135,139,165,166,192,193,194,197,200,201,212,213,215,220,232,233,236,248,249,274,279,281,284,290,291,298,299,492,517],int32_t:[142,143,161,180,184,329,370,455,456,465,466,472,532,535,543,544,546],int64:[10,192,221,248,298,336],int64_t:[27,30,32,40,41,46,48,50,64,72,180,199,200,201,215,258,259,268,333,336,345,398,403,414,426,429,436,437,438,472,548],integ:[221,329,333,353,403,406,509,532,535],integr:[19,363],intend:[4,17,198,275,548],interact:548,interfac:[131,273,317,340,376,380,406,426,427,429,461],intern:[19,183,236,381,490,493,548],interpret:[133,197,274,345,524],interv:[5,7,524],introduc:[4,12,166,233,291],introduct:[22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,159,182,468,469,470,548],invalid:[0,4,12,21,110,112,114,116,121,123,131,132,133,148,159,161,165,166,168,171,172,180,182,184,193,194,196,197,205,206,207,208,212,213,218,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,254,267,268,271,273,274,279,289,290,291,292,293,299,302,325,343,349,362,379,386,408,442,447,490,491,492,493,527,538],invis:216,invok:17,iov:[342,354,363,438,456,466],iov_bas:[363,376],iov_len:[363,376],iov_max:438,iovcnt:[342,354,438,456,466],iovec:376,irrespect:406,is_initi:370,iseof:21,ismast:[7,67,70,75,85,86,87,183,406,412,414,524],isod:548,isol:[393,524],issu:[0,4,5,442,524,548],issuer:524,item:[17,456,466],iter:[9,11,12,125,126,127,253,254,262,265,270,281,339,340,355,359,548],its:[6,7,11,12,17,18,19,21,62,84,90,99,127,133,135,139,141,155,165,166,173,181,190,193,194,197,198,200,201,209,212,213,215,220,221,232,233,236,249,262,274,275,279,281,284,290,291,299,343,363,412,418,423,442,490,515,524,548],java:5,javascript:10,jira:5,journal:[524,530,531,539,542],json:[1,10,127,165,193,217,490],jsw:10,just:[11,363,393,405,524],keep:[0,5,17,155,429],keepal:0,kei:[3,6,8,11,12,115,116,120,121,122,123,165,193,201,204,205,214,231,370,406,442,487,524,547,548],kept:155,kerbero:[15,17,515,524,549],kerberosus:507,keychain:442,keylen:548,killcursor:5,kind:[11,21,363],kinit:4,klistcredenti:4,know:[4,12,227,229,230,375,381,482],knowledg:[468,469,470],known:[4,12,15,138,139,147,393,467,468,469,508,509,510,516,517,518,524],krb5cc_1000:4,krbtgt:4,label:[180,301],lack:524,lag:[406,524],lang_nam:548,languag:[7,11,15,21,118,167,263,264,267,461,548],language_overrid:370,larg:[30,40,48,202,203],larger:12,last:[1,169,170,222,327,381,406,431,524,548],last_tim:9,lasterrorobject:[311,312,313,315,316,317],lastextents:548,lastnam:[302,311,312,313,314,315,316,317],lastwrited:406,later:[6,11,21,112,114,116,121,123,127,133,165,166,193,194,197,200,201,207,208,212,213,215,216,232,233,236,237,245,246,249,269,270,274,279,290,291,299,311,381,406],latest:17,latitud:1,launch:[7,21],law:[11,21],lazi:270,lbson:548,ldap:[4,17],leak:[5,9],learn:549,least:[155,222,406,442,547],leav:[12,118,267,268],left:[127,524],legaci:[6,15,221],len:10,length:[11,147,160,183,229,333,352,439,467,548],less:[19,398,403,548],let:[1,9,17],letter:1,level:[15,19,167,263,264,382,392,439,457,524],lib:[3,8,9,11,21,163,165,180,181,191,193,270,472,548,549],libbson:[10,12,13,15,548,549],libicu:4,libmongoc:[3,8,9,11,13,14,15,18,21,127,128,163,165,166,180,181,191,193,233,270,291,318,319,320,321,472,524],librari:[13,15,16,442,526,548,549],libresolv:524,libsasl2:17,libssl:17,licens:[11,21],lifecycl:[2,13,15],lifetim:[18,126,265,422,454,475,476,477],like:[0,1,3,4,5,7,8,10,11,16,17,155,169,216,221,269,281,314,321,347,363,426,427,429,442,492,524,548,549],limit:[1,11,21,130,157,195,199,200,201,206,215,216,221,234,264,266,268,272],line:[9,17,302,311,312,313,314,315,316,317,524,548],lineariz:393,linger:5,link:[4,15,29,39,47,54,60,66,69,73,77,364,489],linker:549,linux:[5,17,440,442],list:[0,4,5,7,10,12,17,29,39,47,54,60,66,69,73,77,133,138,139,147,165,166,193,194,197,221,232,233,249,274,281,284,290,291,299,337,338,339,340,355,359,363,364,393,406,442,489,524,549],listcollect:[263,264,281,284],listen:[0,127,192,248,298,434,524],littl:19,lldb_bson:10,lldbinit:10,lmongoc:548,load:[1,10,442],loc:1,local:[0,6,9,10,11,17,21,165,193,201,221,227,229,230,262,393,401,432,442,548],localhost:[0,1,3,4,6,11,21,127,246,254,297,317,363,405,487,490,492,507,513,515,524,548],localthreshold:524,localthresholdm:524,locat:[1,106,110,112,114,125,126,131,132,133,138,139,141,148,165,166,167,168,171,172,180,193,196,197,199,200,201,204,205,206,207,208,210,211,212,213,214,215,216,217,218,219,227,228,229,230,232,233,234,235,236,237,238,242,244,245,246,247,249,253,254,265,271,273,274,276,278,279,280,283,284,289,290,291,292,293,299,325,327,338,343,356,357,358,362,370,379,507],locktimeout:12,log:[2,13,15,32,41,50,159,160,161,182,183,184,267,302,311,313,314,323,349,386,513,524,527,541,542,543,544,545,546,548],log_domain:19,log_func:19,log_level:19,logic:[3,12,127,133,165,166,167,171,176,192,193,197,232,233,248,249,274,290,291,298,299,406],login:5,longer:[4,136,137,146,152,156,183,190,192,194,198,202,203,216,248,250,275,298,310,323,339,355,357,358,359,379,387,391,430,435,442,443,449,450,459,506,528,540],longest:524,longitud:1,look:[10,17,363,442,524,548],loop:[7,254,524],loos:[455,465,466],lot:[11,21,381],low:[263,264,382],lower:[6,165,193,201,221,383],lte:[20,317,380],macbook:21,machin:[11,21,442],maco:15,macro:[393,513,526,548],made:[9,142,143,363,431],mai:[0,3,6,9,11,12,18,19,20,21,110,112,114,115,116,121,123,126,133,135,139,159,165,166,180,181,182,188,190,192,193,194,197,200,201,202,203,205,207,208,212,213,215,220,228,229,230,232,233,236,237,245,246,248,249,264,270,274,279,280,281,284,290,291,292,298,299,332,345,367,370,373,375,381,382,406,407,408,418,423,431,443,448,452,472,482,524,526,544,546],main:[0,1,3,5,6,8,9,11,16,18,19,21,127,163,165,180,181,191,193,217,246,254,270,297,317,363,380,405,472,548],mainli:107,maintain:[12,191],major:[128,165,185,189,192,193,241,248,296,298,393,524,526,533,544,547,548],make:[4,6,12,15,17,19,165,193,201,316,317,323,401,406,442,524,549],makefil:17,man:[12,442,524],manag:[5,15,191,196,273,548],mani:[0,12,200,215],manner:548,manual:[8,112,114,116,121,123,127,133,136,137,165,166,181,193,194,197,200,201,207,208,212,213,215,216,221,232,233,236,237,245,246,249,255,266,274,279,281,284,290,291,299,370,382,393,424,524],map:[11,455,465,466],map_reduce_advanc:11,map_reduce_bas:11,mapper:11,mapreduc:[13,14,15,166,233,291],mark:[392,541,542,543,544,545,546],marshal:340,master:17,match:[0,1,12,116,121,123,155,194,200,206,207,208,215,217,234,235,236,237,244,245,246,254,262,313,355,356,357,358,359,362,378,380,405,406,407,408,468,482,524,548],matchedcount:[237,245,246],matcher:[280,377,378,380],math:548,matic:548,matter:406,max:[1,12,127,142,143,195,216,221,434],max_await_time_m:269,max_pool_s:154,max_staleness_second:403,max_tim:127,max_time_m:314,maxawaittimem:[126,127,192,221,248,264,298],maxidletimem:524,maximum:[126,142,143,154,155,192,200,215,221,248,255,266,268,269,272,298,314,406,524],maxpools:[157,524],maxscan:221,maxstalenesssecond:[398,403,524],maxtimem:[181,221,269,307],md5:[334,341,350,352],mean:[4,5,6,9,12,180,255,264,265,270,406,472,548],meant:[11,21,434],meanwhil:16,measur:414,mechan:[4,382],member:[0,3,12,147,406,524],memcpi:0,memori:[5,9,16,129,196,273,374,409],mere:6,messag:[0,1,3,6,8,9,11,12,19,21,32,41,50,127,139,143,147,161,163,165,180,181,191,193,196,199,200,201,213,215,216,217,221,246,254,270,284,302,311,312,313,314,315,316,317,323,363,405,424,472,524,548],metadata:[3,335,341,351,352,361],method:[4,6,363,524,549],micro:[128,526],microsecond:[27,46,64,72,436,437,438],microsoft:[13,14,15,17,426,427,429],middl:[442,524],might:[0,4,11,12,262],migrat:[199,201,263],millisecond:[6,126,269,314,336,414,426,429,455,456,465,466,524,535,544,546],mimic:452,min:[1,221],min_byt:[342,455,456,465],min_pool_s:155,mind:429,ming64_shel:17,mingw64:17,mingw:15,minheartbeatfrequencym:517,minim:7,minimum:[128,155,342,455,456,548],minor:[128,526],minpools:524,minut:[0,7,18,181,190,381,418,423,524],misconfigur:190,miss:[12,127],mistak:[166,233,291],mix:383,mkdir:[17,21],mktime:548,mode:[130,131,195,196,272,273,394,399,402,404,450,497,524],model:[363,455,465,466],moder:317,modif:[217,344],modifi:[25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,108,122,123,144,145,149,150,175,176,178,217,218,221,222,223,224,225,226,251,285,286,287,288,303,310,315,316,317,328,330,331,332,334,335,344,354,360,361,366,369,372,375,381,390,400,410,441,448,482,485,486,487,488,489,490,493,494,495,496,497,498,499,502,503,504,534,537,547],modifiedcount:[237,245,246],modul:[10,17],mongo:[0,1,4,9,10,12,17,20,21,147,165,193,381,415,416,469,524,548,549],mongo_uri:9,mongoc:[0,1,3,5,6,8,9,11,17,21,127,163,165,180,181,191,193,194,196,199,200,201,215,216,217,221,243,246,270,297,340,363,367,370,373,376,380,382,383,384,385,405,415,418,440,461,472,526,547,549],mongoc_apm_callbacks_destroi:[3,13,23,24],mongoc_apm_callbacks_new:[3,13,24],mongoc_apm_callbacks_t:[3,13,15,22,23,80,81,82,83,84,85,86,87,88,89,90,91,159,182],mongoc_apm_command_failed_cb_t:80,mongoc_apm_command_failed_get_command_nam:[3,13,34],mongoc_apm_command_failed_get_context:[3,13,34],mongoc_apm_command_failed_get_dur:[13,34],mongoc_apm_command_failed_get_error:[3,13,34],mongoc_apm_command_failed_get_host:[13,34],mongoc_apm_command_failed_get_operation_id:[13,34],mongoc_apm_command_failed_get_repli:[13,34],mongoc_apm_command_failed_get_request_id:[13,34],mongoc_apm_command_failed_get_server_id:[13,34],mongoc_apm_command_failed_t:[3,13,15,25,26,27,28,29,30,31,32,33,80],mongoc_apm_command_started_cb_t:81,mongoc_apm_command_started_get_command:[3,13,43],mongoc_apm_command_started_get_command_nam:[3,13,43],mongoc_apm_command_started_get_context:[3,13,43],mongoc_apm_command_started_get_database_nam:[13,43],mongoc_apm_command_started_get_host:[3,13,43],mongoc_apm_command_started_get_operation_id:[13,43],mongoc_apm_command_started_get_request_id:[13,43],mongoc_apm_command_started_get_server_id:[13,43],mongoc_apm_command_started_t:[3,13,15,35,36,37,38,39,40,41,42,81],mongoc_apm_command_succeeded_cb_t:82,mongoc_apm_command_succeeded_get_command_nam:[3,13,52],mongoc_apm_command_succeeded_get_context:[3,13,52],mongoc_apm_command_succeeded_get_dur:[13,52],mongoc_apm_command_succeeded_get_host:[13,52],mongoc_apm_command_succeeded_get_operation_id:[13,52],mongoc_apm_command_succeeded_get_repli:[3,13,52],mongoc_apm_command_succeeded_get_request_id:[13,52],mongoc_apm_command_succeeded_get_server_id:[13,52],mongoc_apm_command_succeeded_t:[3,13,15,44,45,46,47,48,49,50,51,82],mongoc_apm_server_changed_cb_t:83,mongoc_apm_server_changed_get_context:[3,13,58],mongoc_apm_server_changed_get_host:[3,13,58],mongoc_apm_server_changed_get_new_descript:[3,13,58],mongoc_apm_server_changed_get_previous_descript:[3,13,58],mongoc_apm_server_changed_get_topology_id:[13,58],mongoc_apm_server_changed_t:[3,13,15,53,54,55,56,57,83],mongoc_apm_server_closed_cb_t:84,mongoc_apm_server_closed_get_context:[3,13,62],mongoc_apm_server_closed_get_host:[3,13,62],mongoc_apm_server_closed_get_topology_id:[13,62],mongoc_apm_server_closed_t:[3,13,15,59,60,61,84],mongoc_apm_server_heartbeat_failed_cb_t:85,mongoc_apm_server_heartbeat_failed_get_context:[3,13,67],mongoc_apm_server_heartbeat_failed_get_dur:[13,67],mongoc_apm_server_heartbeat_failed_get_error:[3,13,67],mongoc_apm_server_heartbeat_failed_get_host:[3,13,67],mongoc_apm_server_heartbeat_failed_t:[3,13,15,63,64,65,66,85],mongoc_apm_server_heartbeat_started_cb_t:86,mongoc_apm_server_heartbeat_started_get_context:[3,13,70],mongoc_apm_server_heartbeat_started_get_host:[3,13,70],mongoc_apm_server_heartbeat_started_t:[3,13,15,68,69,86],mongoc_apm_server_heartbeat_succeeded_cb_t:87,mongoc_apm_server_heartbeat_succeeded_get_context:[3,13,75],mongoc_apm_server_heartbeat_succeeded_get_dur:[13,75],mongoc_apm_server_heartbeat_succeeded_get_host:[3,13,75],mongoc_apm_server_heartbeat_succeeded_get_repli:[3,13,75],mongoc_apm_server_heartbeat_succeeded_t:[3,13,15,71,72,73,74,87],mongoc_apm_server_opening_cb_t:88,mongoc_apm_server_opening_get_context:[3,13,79],mongoc_apm_server_opening_get_host:[3,13,79],mongoc_apm_server_opening_get_topology_id:[13,79],mongoc_apm_server_opening_t:[3,13,15,76,77,78,88],mongoc_apm_set_command_failed_cb:[3,13,24],mongoc_apm_set_command_started_cb:[3,13,24],mongoc_apm_set_command_succeeded_cb:[3,13,24],mongoc_apm_set_server_changed_cb:[3,13,24],mongoc_apm_set_server_closed_cb:[3,13,24],mongoc_apm_set_server_heartbeat_failed_cb:[3,13,24],mongoc_apm_set_server_heartbeat_started_cb:[3,13,24],mongoc_apm_set_server_heartbeat_succeeded_cb:[3,13,24],mongoc_apm_set_server_opening_cb:[3,13,24],mongoc_apm_set_topology_changed_cb:[3,13,24,468,469],mongoc_apm_set_topology_closed_cb:[3,13,24],mongoc_apm_set_topology_opening_cb:[3,13,24],mongoc_apm_topology_changed_cb_t:89,mongoc_apm_topology_changed_get_context:[3,13,96],mongoc_apm_topology_changed_get_new_descript:[3,13,96],mongoc_apm_topology_changed_get_previous_descript:[3,13,96],mongoc_apm_topology_changed_get_topology_id:[13,96],mongoc_apm_topology_changed_t:[3,13,15,89,92,93,94,95],mongoc_apm_topology_closed_cb_t:90,mongoc_apm_topology_closed_get_context:[3,13,99],mongoc_apm_topology_closed_get_topology_id:[13,99],mongoc_apm_topology_closed_t:[3,13,15,90,97,98],mongoc_apm_topology_opening_cb_t:91,mongoc_apm_topology_opening_get_context:[3,13,102],mongoc_apm_topology_opening_get_topology_id:[13,102],mongoc_apm_topology_opening_t:[3,13,15,91,100,101],mongoc_bulk_operation_delet:[13,119],mongoc_bulk_operation_delete_on:[13,119],mongoc_bulk_operation_destroi:[6,11,13,21,119,202,203],mongoc_bulk_operation_execut:[6,11,12,13,21,103,104,107,109,110,111,112,113,114,115,116,118,119,120,121,122,123,202,203],mongoc_bulk_operation_get_hint:[13,106,119],mongoc_bulk_operation_get_write_concern:[13,119],mongoc_bulk_operation_insert:[6,11,13,21,116,119,202,203],mongoc_bulk_operation_insert_with_opt:[13,109,119],mongoc_bulk_operation_remov:[6,13,103,112,119],mongoc_bulk_operation_remove_many_with_opt:[13,103,104,111,113,114,116,119],mongoc_bulk_operation_remove_on:[6,13,104,111,114,119],mongoc_bulk_operation_remove_one_with_opt:[13,103,104,111,112,113,119],mongoc_bulk_operation_replace_on:[6,13,119],mongoc_bulk_operation_replace_one_with_opt:[6,13,115,119],mongoc_bulk_operation_set_bypass_document_valid:[6,13,119],mongoc_bulk_operation_set_hint:[13,119],mongoc_bulk_operation_t:[2,6,11,13,15,18,21,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,202,203],mongoc_bulk_operation_upd:[13,119,122,202,203],mongoc_bulk_operation_update_many_with_opt:[6,13,119,120,123],mongoc_bulk_operation_update_on:[13,119],mongoc_bulk_operation_update_one_with_opt:[6,13,119,120,121,122],mongoc_change_stream_destroi:[13,127,192,248,298],mongoc_change_stream_error_docu:[13,127,192,248,298],mongoc_change_stream_next:[12,13,127,192,248,298],mongoc_change_stream_t:[2,13,15,18,124,125,126,181,190,192,248,298,418,423],mongoc_check_vers:[13,526],mongoc_cleanup:[0,1,3,5,6,8,11,13,16,18,19,21,127,163,165,180,181,191,193,217,254,270,297,317,363,374,380,405,472,548],mongoc_client_command:[13,131,191,547],mongoc_client_command_simpl:[3,13,133,147,163,165,166,191,193,197,274,547,548],mongoc_client_command_simple_with_server_id:[13,191],mongoc_client_command_with_opt:[12,13,130,191],mongoc_client_destroi:[0,1,3,6,8,9,11,13,18,21,127,140,152,165,180,181,191,193,213,217,246,254,270,297,317,363,405,472,548],mongoc_client_find_databases_with_opt:[13,191,266,268,269],mongoc_client_get_collect:[1,3,6,9,13,127,181,191,213,217,246,254,270,370,405,424,548],mongoc_client_get_databas:[6,8,11,13,21,180,191,297,317,472,548],mongoc_client_get_database_nam:[13,191],mongoc_client_get_database_names_with_opt:[12,13,138,191],mongoc_client_get_default_databas:[13,191,514],mongoc_client_get_gridf:[13,191,363],mongoc_client_get_max_bson_s:[13,191],mongoc_client_get_max_message_s:[13,191],mongoc_client_get_read_concern:[13,191,390],mongoc_client_get_read_pref:[13,191],mongoc_client_get_server_descript:[13,191,412,415,417],mongoc_client_get_server_statu:[13,191],mongoc_client_get_uri:[13,191],mongoc_client_get_write_concern:[13,191,537],mongoc_client_new:[0,4,7,13,18,140,191,213,254,297,405,424,548],mongoc_client_new_from_uri:[1,3,6,8,9,11,13,18,21,127,151,165,180,181,191,193,217,246,270,317,363,472,513,548],mongoc_client_pool_destroi:[13,18,156,163,548],mongoc_client_pool_max_s:[13,163],mongoc_client_pool_min_s:[13,154,163],mongoc_client_pool_new:[7,13,18,163,548],mongoc_client_pool_pop:[7,13,18,159,160,161,162,163,164,524,548],mongoc_client_pool_push:[7,13,18,155,157,163,548],mongoc_client_pool_set_apm_callback:[3,13,24,26,37,45,53,59,63,68,71,76,92,97,100,163],mongoc_client_pool_set_appnam:[13,163],mongoc_client_pool_set_error_api:[12,13,163,184,548],mongoc_client_pool_set_ssl_opt:[13,163,187,442,524],mongoc_client_pool_t:[2,7,13,15,18,153,154,155,156,157,158,159,160,161,162,164,183,185,186,187,189,191,442,524,548],mongoc_client_pool_try_pop:[13,162,163],mongoc_client_read_command_with_opt:[13,130,133,148,166,191,193,194,197,200,201,215,232,233,242,247,249,274,290,291,299,386],mongoc_client_read_write_command_with_opt:[13,130,191],mongoc_client_select_serv:[13,133,135,139,165,166,191,193,194,197,200,201,212,213,215,220,221,232,233,236,249,274,279,281,284,290,291,299],mongoc_client_session_abort_transact:[13,169,170,172,173,174,175,176,177,178,180,181,190,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_client_session_advance_cluster_tim:[13,168,170,172,173,174,175,176,177,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_advance_operation_tim:[13,168,169,172,173,174,175,176,177,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_append:[13,133,135,139,165,166,180,181,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,424,472],mongoc_client_session_commit_transact:[12,13,168,169,170,173,174,175,176,177,178,180,181,190,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_client_session_destroi:[13,18,168,169,170,172,174,175,176,177,178,180,181,190,418,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_client_session_get_cli:[13,168,169,170,172,173,175,176,177,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_get_cluster_tim:[13,168,169,170,172,173,174,176,177,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_get_lsid:[13,168,169,170,172,173,174,175,177,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_get_operation_tim:[13,168,169,170,172,173,174,175,176,178,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_get_opt:[13,168,169,170,172,173,174,175,176,177,180,181,190,419,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_client_session_in_transact:[13,181],mongoc_client_session_start_transact:[12,13,133,135,139,165,166,168,169,170,172,173,174,175,176,177,178,181,190,193,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,301,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_client_session_t:[2,13,15,18,133,135,139,165,166,168,169,170,171,172,173,174,175,176,177,178,179,180,190,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,418,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481,543],mongoc_client_set_apm_callback:[3,13,24,26,37,45,53,59,63,68,71,76,92,97,100,191],mongoc_client_set_appnam:[13,160,191,548],mongoc_client_set_error_api:[1,3,6,8,9,11,12,13,21,165,180,181,191,193,213,217,246,254,270,317,363,405,424,472],mongoc_client_set_read_concern:[13,191,390],mongoc_client_set_read_pref:[13,191],mongoc_client_set_ssl_opt:[0,4,13,162,191,442,524],mongoc_client_set_stream_initi:[13,191],mongoc_client_set_write_concern:[13,191,537],mongoc_client_start_sess:[13,18,133,135,139,165,166,168,169,170,172,173,174,175,176,177,178,180,181,191,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,418,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_client_t:[0,1,2,3,4,6,7,8,9,11,12,13,15,18,21,127,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,155,157,158,163,164,165,166,167,174,180,181,182,183,184,185,186,187,188,189,190,192,193,213,217,246,254,263,264,270,297,317,352,363,405,418,423,424,442,472,487,513,524,548],mongoc_client_watch:[13,127,191,248,298],mongoc_client_write_command_with_opt:[13,130,133,165,166,171,191,194,197,203,205,207,208,212,213,229,230,233,236,237,245,246,249,274,279,291,299,527],mongoc_collection_aggreg:[1,13,243,263,264],mongoc_collection_command:[13,196,243,547],mongoc_collection_command_simpl:[13,21,216,221,232,233,243,249,547,548],mongoc_collection_command_with_opt:[13,195,243],mongoc_collection_copi:[13,243],mongoc_collection_count:[13,200,201,243,548],mongoc_collection_count_docu:[13,199,201,215,243],mongoc_collection_count_with_opt:[12,13,200,243],mongoc_collection_create_bulk_oper:[13,243],mongoc_collection_create_bulk_operation_with_opt:[6,11,13,21,106,202,243],mongoc_collection_create_index:[12,13,243,370],mongoc_collection_create_index_with_opt:[13,243],mongoc_collection_delet:[13,243],mongoc_collection_delete_mani:[12,13,206,208,234,243,300],mongoc_collection_delete_on:[12,13,206,207,234,243,300,548],mongoc_collection_destroi:[1,3,6,9,11,13,21,127,136,180,181,191,198,213,217,243,246,254,270,282,317,370,405,472,548],mongoc_collection_drop:[3,13,243,246,317],mongoc_collection_drop_index:[13,243,547],mongoc_collection_drop_index_with_opt:[13,243],mongoc_collection_drop_with_opt:[13,210,211,243],mongoc_collection_ensure_index:[13,243],mongoc_collection_estimated_document_count:[13,199,200,201,243],mongoc_collection_find:[13,243,259,268],mongoc_collection_find_and_modifi:[13,243],mongoc_collection_find_and_modify_with_opt:[13,217,243,302,311,312,313,314,315,316,317],mongoc_collection_find_index:[13,243],mongoc_collection_find_indexes_with_opt:[13,219,243,266,268,269],mongoc_collection_find_with_opt:[9,11,12,13,181,191,216,243,246,254,264,269,270,314,340,358,359,405,548],mongoc_collection_get_last_error:[13,243],mongoc_collection_get_nam:[13,196,243],mongoc_collection_get_read_concern:[13,243],mongoc_collection_get_read_pref:[13,243],mongoc_collection_get_write_concern:[13,243],mongoc_collection_insert:[13,243],mongoc_collection_insert_bulk:[12,13,243],mongoc_collection_insert_mani:[3,13,227,228,230,243],mongoc_collection_insert_on:[3,12,13,127,180,193,227,229,238,243,246,249,299,424,472,548],mongoc_collection_keys_to_index_str:[8,13,243],mongoc_collection_read_command_with_opt:[13,195,243],mongoc_collection_read_write_command_with_opt:[13,195,243],mongoc_collection_remov:[13,243],mongoc_collection_renam:[13,243],mongoc_collection_rename_with_opt:[13,235,243],mongoc_collection_replace_on:[12,13,238,243,244,246],mongoc_collection_sav:[13,243],mongoc_collection_set_read_concern:[13,198,243],mongoc_collection_set_read_pref:[13,198,243],mongoc_collection_set_write_concern:[13,198,243],mongoc_collection_stat:[13,243],mongoc_collection_t:[1,2,3,6,9,11,13,15,18,21,127,136,180,181,191,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,232,233,234,235,236,237,238,239,240,241,242,244,245,246,247,248,249,254,270,276,282,297,302,311,312,313,314,315,316,317,360,361,405,424,472,548],mongoc_collection_upd:[13,243,316],mongoc_collection_update_mani:[12,13,237,243,244,246],mongoc_collection_update_on:[12,13,181,237,243,244,245,548],mongoc_collection_valid:[13,243],mongoc_collection_watch:[13,126,127,192,298],mongoc_collection_write_command_with_opt:[8,13,127,195,243],mongoc_crit:19,mongoc_cursor_clon:[13,270],mongoc_cursor_curr:[13,270],mongoc_cursor_destroi:[1,9,11,13,130,181,191,194,195,216,221,250,254,270,272,281,405,548],mongoc_cursor_error:[1,9,11,12,13,130,135,181,191,216,220,221,254,263,264,265,270,281,405],mongoc_cursor_error_docu:[13,125,130,253,270],mongoc_cursor_get_batch_s:[13,270],mongoc_cursor_get_hint:[13,270],mongoc_cursor_get_host:[13,270,364],mongoc_cursor_get_id:[13,270],mongoc_cursor_get_limit:[13,270],mongoc_cursor_get_max_await_time_m:[13,270],mongoc_cursor_is_al:[13,270],mongoc_cursor_mor:[9,13,261,270],mongoc_cursor_new_from_command_repli:[13,270],mongoc_cursor_new_from_command_reply_with_opt:[13,263,270],mongoc_cursor_next:[1,9,11,12,13,126,130,181,191,194,216,221,246,250,254,262,268,269,270,272,281,405,548],mongoc_cursor_set_batch_s:[13,135,220,269,270,281],mongoc_cursor_set_hint:[13,256,270],mongoc_cursor_set_limit:[13,135,220,259,270,281],mongoc_cursor_set_max_await_time_m:[9,13,135,220,260,270,281],mongoc_cursor_t:[1,2,9,11,13,15,18,130,135,181,190,191,194,195,209,216,219,220,221,246,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,272,280,281,340,405,418,423,548],mongoc_database_add_us:[13,297],mongoc_database_command:[11,13,273,297,547],mongoc_database_command_simpl:[11,13,21,290,291,297,299,547],mongoc_database_command_with_opt:[12,13,272,297],mongoc_database_copi:[13,297],mongoc_database_create_collect:[6,13,180,297,317,472],mongoc_database_destroi:[6,8,11,13,21,137,140,180,275,297,317,472,548],mongoc_database_drop:[13,297],mongoc_database_drop_with_opt:[13,278,297],mongoc_database_find_collect:[13,297],mongoc_database_find_collections_with_opt:[13,266,268,269,280,297],mongoc_database_get_collect:[11,13,21,180,294,295,296,297,472],mongoc_database_get_collection_nam:[13,297],mongoc_database_get_collection_names_with_opt:[13,281,283,297],mongoc_database_get_nam:[13,140,297],mongoc_database_get_read_concern:[13,297],mongoc_database_get_read_pref:[13,297],mongoc_database_get_write_concern:[13,297],mongoc_database_has_collect:[13,297],mongoc_database_read_command_with_opt:[13,272,297],mongoc_database_read_write_command_with_opt:[13,272,297],mongoc_database_remove_all_us:[13,297],mongoc_database_remove_us:[13,297],mongoc_database_set_read_concern:[13,275,297],mongoc_database_set_read_pref:[13,275,297],mongoc_database_set_write_concern:[13,275,297],mongoc_database_t:[2,6,8,11,13,15,18,21,137,140,180,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,298,299,317,472,548],mongoc_database_watch:[13,127,192,248,297],mongoc_database_write_command_with_opt:[8,13,272,297],mongoc_debug:19,mongoc_definit:548,mongoc_delete_flags_t:[2,13,15,206],mongoc_delete_non:300,mongoc_delete_single_remov:[206,300],mongoc_disable_shm:5,mongoc_enable_ssl:[162,187],mongoc_error:[19,147,180,363,472],mongoc_error_api_version_2:[12,161,184],mongoc_error_api_version_legaci:[12,161,184],mongoc_error_bson:12,mongoc_error_bson_invalid:12,mongoc_error_change_stream_no_resume_token:12,mongoc_error_cli:12,mongoc_error_client_authent:12,mongoc_error_client_in_exhaust:12,mongoc_error_client_no_acceptable_p:12,mongoc_error_client_session_failur:12,mongoc_error_client_too_big:12,mongoc_error_collect:12,mongoc_error_collection_delete_fail:12,mongoc_error_collection_insert_fail:12,mongoc_error_collection_update_fail:12,mongoc_error_command:[6,12],mongoc_error_command_invalid_arg:12,mongoc_error_cursor:12,mongoc_error_cursor_invalid_cursor:12,mongoc_error_duplicate_kei:12,mongoc_error_gridf:12,mongoc_error_gridfs_chunk_miss:12,mongoc_error_gridfs_corrupt:12,mongoc_error_gridfs_invalid_filenam:12,mongoc_error_gridfs_protocol_error:12,mongoc_error_has_label:[12,13,180,472],mongoc_error_namespac:12,mongoc_error_namespace_invalid:12,mongoc_error_protocol:12,mongoc_error_protocol_bad_wire_vers:12,mongoc_error_protocol_invalid_repli:12,mongoc_error_queri:12,mongoc_error_query_failur:[12,213],mongoc_error_sasl:12,mongoc_error_scram:12,mongoc_error_scram_protocol_error:12,mongoc_error_serv:[9,12,213],mongoc_error_server_select:[12,524],mongoc_error_server_selection_failur:12,mongoc_error_stream:12,mongoc_error_stream_connect:12,mongoc_error_stream_name_resolut:12,mongoc_error_stream_socket:12,mongoc_error_transact:12,mongoc_error_transaction_invalid:12,mongoc_error_write_concern:[6,12],mongoc_find_and_modify_flags_t:[306,313],mongoc_find_and_modify_non:313,mongoc_find_and_modify_opts_append:[13,314,317],mongoc_find_and_modify_opts_destroi:[13,302,310,311,312,313,314,315,316,317],mongoc_find_and_modify_opts_get_bypass_document_valid:[13,317],mongoc_find_and_modify_opts_get_field:[13,317],mongoc_find_and_modify_opts_get_flag:[13,317],mongoc_find_and_modify_opts_get_max_time_m:[13,317],mongoc_find_and_modify_opts_get_sort:[13,317],mongoc_find_and_modify_opts_get_upd:[13,317],mongoc_find_and_modify_opts_new:[13,302,311,312,313,314,315,316,317],mongoc_find_and_modify_opts_set_bypass_document_valid:[13,304,317],mongoc_find_and_modify_opts_set_field:[13,305,317],mongoc_find_and_modify_opts_set_flag:[13,306,312,316,317],mongoc_find_and_modify_opts_set_max_time_m:[13,302,307,317],mongoc_find_and_modify_opts_set_sort:[13,308,317],mongoc_find_and_modify_opts_set_upd:[13,302,309,311,312,313,314,315,317],mongoc_find_and_modify_opts_t:[2,13,15,218,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316],mongoc_find_and_modify_remov:313,mongoc_find_and_modify_return_new:[312,313,316,317],mongoc_find_and_modify_upsert:[313,317],mongoc_get_major_vers:[13,526],mongoc_get_micro_vers:[13,526],mongoc_get_minor_vers:[13,526],mongoc_get_vers:[13,526],mongoc_gridf:363,mongoc_gridfs_create_fil:[13,363,454],mongoc_gridfs_create_file_from_stream:[13,363,454],mongoc_gridfs_destroi:[13,141,363],mongoc_gridfs_drop:[13,363],mongoc_gridfs_file_destroi:[13,322,323,339,340,352,356,357,358,363],mongoc_gridfs_file_error:[13,342,344,352,354,363],mongoc_gridfs_file_get_alias:[13,352],mongoc_gridfs_file_get_chunk_s:[13,352],mongoc_gridfs_file_get_content_typ:[13,352],mongoc_gridfs_file_get_filenam:[13,352,363],mongoc_gridfs_file_get_id:[13,352],mongoc_gridfs_file_get_length:[13,352],mongoc_gridfs_file_get_md5:[13,352],mongoc_gridfs_file_get_metadata:[13,352],mongoc_gridfs_file_get_upload_d:[13,352],mongoc_gridfs_file_list_destroi:[13,340,355,359,363],mongoc_gridfs_file_list_error:[13,340],mongoc_gridfs_file_list_next:[13,340,363],mongoc_gridfs_file_list_t:[2,13,15,18,337,338,339,352,355,359,363],mongoc_gridfs_file_opt_t:[2,13,15,322,323,352,363],mongoc_gridfs_file_readv:[13,352],mongoc_gridfs_file_remov:[13,352],mongoc_gridfs_file_sav:[12,13,346,347,348,350,351,352,363],mongoc_gridfs_file_seek:[13,352],mongoc_gridfs_file_set_alias:[13,352],mongoc_gridfs_file_set_content_typ:[13,352],mongoc_gridfs_file_set_filenam:[13,352],mongoc_gridfs_file_set_id:[12,13,352,363],mongoc_gridfs_file_set_md5:[13,352],mongoc_gridfs_file_set_metadata:[13,352],mongoc_gridfs_file_t:[2,13,15,18,322,323,326,327,328,329,330,331,332,333,334,335,336,339,340,341,342,343,344,345,346,347,348,349,350,351,353,354,356,357,358,363,454],mongoc_gridfs_file_tel:[13,352],mongoc_gridfs_file_writev:[13,322,352],mongoc_gridfs_find:[13,340,363],mongoc_gridfs_find_on:[13,363],mongoc_gridfs_find_one_by_filenam:[13,363],mongoc_gridfs_find_one_with_opt:[13,356,363],mongoc_gridfs_find_with_opt:[13,355,363],mongoc_gridfs_get_chunk:[13,363],mongoc_gridfs_get_fil:[13,363],mongoc_gridfs_remove_by_filenam:[12,13,363],mongoc_gridfs_t:[2,13,15,18,141,322,323,324,325,352,355,356,357,358,359,360,361,362],mongoc_handshake_appname_max:[160,183],mongoc_host_list_t:[2,13,15,29,39,47,54,60,66,69,73,77,191,257,410,489],mongoc_include_dir:548,mongoc_index_opt_geo_get_default:[13,367],mongoc_index_opt_geo_init:[13,367,370],mongoc_index_opt_geo_t:[2,13,15,365,366,370,373],mongoc_index_opt_get_default:[13,370],mongoc_index_opt_init:[13,370],mongoc_index_opt_storage_t:[370,373],mongoc_index_opt_t:[2,13,15,204,205,214,367,368,369,373],mongoc_index_opt_wt_get_default:[13,373],mongoc_index_opt_wt_init:[13,373],mongoc_index_opt_wt_t:[2,13,15,367,370,371,372],mongoc_info:19,mongoc_init:[0,1,3,5,6,8,9,11,13,16,18,19,21,127,129,163,165,180,181,191,193,217,254,270,297,317,363,380,405,472,548],mongoc_insert_continue_on_error:375,mongoc_insert_flags_t:[2,13,15,227,228],mongoc_insert_no_valid:375,mongoc_insert_non:375,mongoc_iovec_t:[2,13,15,342,354,363,438,456,466],mongoc_librari:548,mongoc_log:19,mongoc_log_default_handl:19,mongoc_log_domain:19,mongoc_log_func_t:19,mongoc_log_level_crit:19,mongoc_log_level_debug:19,mongoc_log_level_error:19,mongoc_log_level_info:19,mongoc_log_level_messag:19,mongoc_log_level_str:19,mongoc_log_level_t:19,mongoc_log_level_trac:19,mongoc_log_level_warn:19,mongoc_log_set_handl:19,mongoc_log_trace_dis:19,mongoc_log_trace_en:19,mongoc_major_vers:[318,526],mongoc_matcher_destroi:[13,379,380],mongoc_matcher_match:[13,380],mongoc_matcher_new:[13,378,380],mongoc_matcher_t:[2,13,15,377,378,379],mongoc_messag:19,mongoc_micro_vers:[319,526],mongoc_minor_vers:[320,526],mongoc_no_max_stal:[398,403,406],mongoc_query_await_data:[381,408],mongoc_query_exhaust:381,mongoc_query_flags_t:[2,13,15,130,194,195,199,201,216,272],mongoc_query_no_cursor_timeout:381,mongoc_query_non:[1,11,194,199,201,216,381,548],mongoc_query_oplog_replai:381,mongoc_query_parti:381,mongoc_query_slave_ok:381,mongoc_query_tailable_cursor:381,mongoc_rand:[2,13,15],mongoc_rand_add:[13,382],mongoc_rand_se:[13,382],mongoc_rand_statu:[13,382],mongoc_read_concern_append:[13,133,165,166,193,194,197,200,201,215,221,232,233,274,284,290,291,393],mongoc_read_concern_copi:[13,393],mongoc_read_concern_destroi:[13,165,180,193,284,387,391,393,472],mongoc_read_concern_get_level:[13,393],mongoc_read_concern_is_default:[13,393],mongoc_read_concern_level_avail:393,mongoc_read_concern_level_lineariz:393,mongoc_read_concern_level_loc:[185,393],mongoc_read_concern_level_major:[165,193,284,393],mongoc_read_concern_level_snapshot:393,mongoc_read_concern_new:[13,165,180,193,221,284,393,472],mongoc_read_concern_set_level:[13,165,180,193,221,284,393,472],mongoc_read_concern_t:[2,13,15,133,144,165,166,180,185,193,194,197,199,200,201,215,221,224,232,233,239,274,284,286,290,291,294,386,387,388,389,390,391,392,472,475,479,496,520],mongoc_read_mode_t:[2,13,15,399,402,404],mongoc_read_nearest:[394,406],mongoc_read_prefs_add_tag:[13,406],mongoc_read_prefs_copi:[13,406],mongoc_read_prefs_destroi:[3,11,13,165,181,193,396,402,405,406],mongoc_read_prefs_get_max_staleness_second:[13,406],mongoc_read_prefs_get_mod:[13,406],mongoc_read_prefs_get_tag:[13,406],mongoc_read_prefs_is_valid:[13,406],mongoc_read_prefs_new:[3,11,13,165,181,193,221,405,406],mongoc_read_prefs_set_max_staleness_second:[13,406],mongoc_read_prefs_set_mod:[13,406],mongoc_read_prefs_set_tag:[13,406],mongoc_read_prefs_t:[2,3,11,12,13,15,130,131,132,133,145,148,165,166,167,181,186,191,193,194,195,196,197,199,200,201,215,216,221,225,232,233,240,242,272,273,274,287,290,291,295,395,396,397,398,399,400,401,402,403,404,405,468,476,480,498,521],mongoc_read_primari:[130,131,195,196,240,272,273,295,394,406],mongoc_read_primary_pref:[394,406],mongoc_read_secondari:[3,11,165,181,193,221,394,405,406],mongoc_read_secondary_pref:[394,406],mongoc_remove_flags_t:[2,13,15,234],mongoc_remove_non:407,mongoc_remove_single_remov:[234,407],mongoc_reply_await_cap:408,mongoc_reply_cursor_not_found:408,mongoc_reply_flags_t:[2,13,15],mongoc_reply_non:408,mongoc_reply_query_failur:408,mongoc_reply_shard_config_stal:408,mongoc_server_description_destroi:[13,146,167,415],mongoc_server_description_host:[3,13,147,415],mongoc_server_description_id:[13,133,135,139,165,166,193,194,197,200,201,212,213,215,220,221,232,233,236,249,274,279,281,284,290,291,299,415],mongoc_server_description_ismast:[13,415],mongoc_server_description_new_copi:[13,415],mongoc_server_description_round_trip_tim:[13,415],mongoc_server_description_t:[2,3,13,15,55,56,62,79,84,88,146,147,167,409,410,411,412,413,414,416,417,467],mongoc_server_description_typ:[3,13,415],mongoc_server_descriptions_destroy_al:[3,13,147,415,467],mongoc_session_opt_t:[2,13,15,18,178,180,181,190,419,420,421,422,423,424,425,472],mongoc_session_opts_clon:[13,168,169,170,172,173,174,175,176,177,178,180,190,418,420,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_session_opts_destroi:[13,18,168,169,170,172,173,174,175,176,177,178,180,181,190,418,419,421,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_session_opts_get_causal_consist:[13,168,169,170,172,173,174,175,176,177,178,180,190,418,419,420,422,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_session_opts_get_default_transaction_opt:[13,168,169,170,172,173,174,175,176,177,178,180,190,418,419,420,421,423,424,425,473,474,475,476,477,478,479,480,481],mongoc_session_opts_new:[13,18,168,169,170,172,173,174,175,176,177,178,180,181,190,418,419,420,421,422,424,425,472,473,474,475,476,477,478,479,480,481],mongoc_session_opts_set_causal_consist:[13,18,168,169,170,172,173,174,175,176,177,178,180,181,190,418,419,420,421,422,423,425,473,474,475,476,477,478,479,480,481],mongoc_session_opts_set_default_transaction_opt:[13,168,169,170,172,173,174,175,176,177,178,180,190,418,419,420,421,422,423,424,472,473,474,475,476,477,478,479,480,481],mongoc_smallest_max_staleness_second:406,mongoc_socket_accept:[13,440],mongoc_socket_bind:[13,440],mongoc_socket_clos:[13,440],mongoc_socket_connect:[13,440],mongoc_socket_destroi:[13,426,435,440],mongoc_socket_errno:[13,428,440],mongoc_socket_getnameinfo:[13,440],mongoc_socket_getsocknam:[13,440],mongoc_socket_listen:[13,440],mongoc_socket_new:[13,440],mongoc_socket_recv:[13,440],mongoc_socket_send:[13,440],mongoc_socket_sendv:[13,440],mongoc_socket_setsockopt:[13,440],mongoc_socket_t:[2,13,15,426,427,428,429,430,431,432,433,434,435,436,437,438,439,458,459],mongoc_socklen_t:[427,429,433,439,457],mongoc_ssl_opt_get_default:[0,13,442],mongoc_ssl_opt_t:[0,2,4,13,15,162,187,441,524],mongoc_stat:549,mongoc_static_definit:548,mongoc_static_include_dir:548,mongoc_static_librari:548,mongoc_static_vers:548,mongoc_stream_buffered_new:[13,444,446,461,464],mongoc_stream_buffered_t:[2,13,15,443,453,461],mongoc_stream_clos:[13,461],mongoc_stream_cork:[13,461,464],mongoc_stream_destroi:[13,363,443,444,445,449,450,459,461],mongoc_stream_file_get_fd:[13,451],mongoc_stream_file_new:[13,451],mongoc_stream_file_new_for_path:[13,363,451],mongoc_stream_file_t:[2,13,15,448,449,450,461],mongoc_stream_flush:[13,461],mongoc_stream_get_base_stream:[13,461],mongoc_stream_gridfs_new:[13,352,363],mongoc_stream_initiator_t:[188,191],mongoc_stream_read:[13,456,461,465],mongoc_stream_readv:[13,363,454,455,461,465],mongoc_stream_setsockopt:[13,461],mongoc_stream_socket_get_socket:[13,460],mongoc_stream_socket_new:[13,460],mongoc_stream_socket_t:[2,13,15,458,459,461],mongoc_stream_t:[2,13,15,18,188,191,323,363,376,443,444,445,446,447,449,450,451,452,453,454,455,456,457,459,460,462,463,464,465,466],mongoc_stream_timed_out:[13,461],mongoc_stream_tls_t:[2,13,15,453,461],mongoc_stream_uncork:[13,446,461],mongoc_stream_writ:[13,455,456,461],mongoc_stream_writev:[13,454,455,456,461,465],mongoc_topology_description_get_serv:[3,13,470],mongoc_topology_description_has_readable_serv:[3,13,470],mongoc_topology_description_has_writable_serv:[3,13,470],mongoc_topology_description_t:[2,3,13,15,90,91,93,94,99,102,467,468,469,471],mongoc_topology_description_typ:[3,13,470],mongoc_transaction_opt_t:[2,13,15,133,135,139,165,166,180,193,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,422,425,473,474,475,476,477,478,479,480,481],mongoc_transaction_opts_clon:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,474,475,476,477,478,479,480,481],mongoc_transaction_opts_destroi:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,475,476,477,478,479,480,481],mongoc_transaction_opts_get_read_concern:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,476,477,478,479,480,481],mongoc_transaction_opts_get_read_pref:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,477,478,479,480,481],mongoc_transaction_opts_get_write_concern:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,476,478,479,480,481],mongoc_transaction_opts_new:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,476,477,479,480,481],mongoc_transaction_opts_set_read_concern:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,476,477,478,480,481],mongoc_transaction_opts_set_read_pref:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,481],mongoc_transaction_opts_set_write_concern:[13,168,169,170,172,173,174,175,176,177,178,180,190,419,420,421,422,423,424,425,472,473,474,475,476,477,478,479,480],mongoc_update_flags_t:[2,13,15,244],mongoc_update_multi_upd:[244,482],mongoc_update_no_valid:482,mongoc_update_non:482,mongoc_update_upsert:482,mongoc_uri_appnam:524,mongoc_uri_authmechan:524,mongoc_uri_authmechanismproperti:524,mongoc_uri_authsourc:524,mongoc_uri_canonicalizehostnam:524,mongoc_uri_compressor:524,mongoc_uri_connecttimeoutm:524,mongoc_uri_copi:[13,524],mongoc_uri_destroi:[1,3,6,8,9,11,13,21,127,163,165,180,181,191,193,217,246,270,317,363,472,483,506,524,548],mongoc_uri_get_auth_mechan:[4,13,486,490,511,512,515,524],mongoc_uri_get_auth_sourc:[4,13,485,490,511,512,515,524],mongoc_uri_get_compressor:[13,524],mongoc_uri_get_databas:[13,524],mongoc_uri_get_host:[13,364,524],mongoc_uri_get_mechanism_properti:[4,13,485,486,511,512,515,524],mongoc_uri_get_opt:[13,524],mongoc_uri_get_option_as_bool:[13,524],mongoc_uri_get_option_as_int32:[13,524],mongoc_uri_get_option_as_utf8:[13,524],mongoc_uri_get_password:[13,524],mongoc_uri_get_read_concern:[13,524],mongoc_uri_get_read_pref:[13,524],mongoc_uri_get_read_prefs_t:[13,497,524],mongoc_uri_get_replica_set:[13,524],mongoc_uri_get_servic:[13,524],mongoc_uri_get_ssl:[13,524],mongoc_uri_get_str:[13,524],mongoc_uri_get_usernam:[13,524],mongoc_uri_get_write_concern:[13,524],mongoc_uri_gssapiservicenam:524,mongoc_uri_heartbeatfrequencym:524,mongoc_uri_journ:524,mongoc_uri_localthresholdm:524,mongoc_uri_maxidletimem:524,mongoc_uri_maxpools:524,mongoc_uri_maxstalenesssecond:524,mongoc_uri_minpools:524,mongoc_uri_new:[0,7,13,487,490,513,515,524],mongoc_uri_new_for_host_port:[13,524],mongoc_uri_new_with_error:[1,3,6,8,9,11,13,21,127,163,165,180,181,191,193,217,246,270,317,363,472,505,524,548],mongoc_uri_option_is_bool:[13,524],mongoc_uri_option_is_int32:[13,524],mongoc_uri_option_is_utf8:[13,524],mongoc_uri_readconcernlevel:524,mongoc_uri_readprefer:524,mongoc_uri_readpreferencetag:524,mongoc_uri_replicaset:524,mongoc_uri_retrywrit:524,mongoc_uri_saf:524,mongoc_uri_serverselectiontimeoutm:524,mongoc_uri_serverselectiontryonc:524,mongoc_uri_set_auth_mechan:[4,13,485,486,490,512,515,524],mongoc_uri_set_auth_sourc:[4,13,485,486,490,511,515,524],mongoc_uri_set_compressor:[13,524],mongoc_uri_set_databas:[13,524],mongoc_uri_set_mechanism_properti:[4,13,485,486,490,511,512,524],mongoc_uri_set_option_as_bool:[13,524],mongoc_uri_set_option_as_int32:[13,524],mongoc_uri_set_option_as_utf8:[13,524],mongoc_uri_set_password:[13,524],mongoc_uri_set_read_concern:[13,524],mongoc_uri_set_read_prefs_t:[13,524],mongoc_uri_set_usernam:[13,524],mongoc_uri_set_write_concern:[13,524],mongoc_uri_slaveok:524,mongoc_uri_socketcheckintervalm:524,mongoc_uri_sockettimeoutm:524,mongoc_uri_ssl:524,mongoc_uri_sslallowinvalidcertif:524,mongoc_uri_sslallowinvalidhostnam:524,mongoc_uri_sslcertificateauthorityfil:524,mongoc_uri_sslclientcertificatekeyfil:524,mongoc_uri_sslclientcertificatekeypassword:524,mongoc_uri_t:[0,1,2,3,6,7,8,9,11,13,15,21,127,149,152,156,163,165,180,181,191,193,217,246,270,317,363,472,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,511,512,513,514,515,516,517,518,519,520,521,522,523,548],mongoc_uri_unescap:[13,524],mongoc_uri_w:524,mongoc_uri_waitqueuemultipl:524,mongoc_uri_waitqueuetimeoutm:524,mongoc_uri_wtimeoutm:524,mongoc_uri_zlibcompressionlevel:524,mongoc_vers:548,mongoc_version_:526,mongoc_version_hex:526,mongoc_warn:[19,505,513],mongoc_write_concern_append:[6,13,127,133,165,166,193,194,197,203,205,207,208,212,213,229,230,233,236,237,245,246,249,274,279,291,299,302,314,317,547],mongoc_write_concern_copi:[13,547],mongoc_write_concern_destroi:[6,13,127,165,180,193,302,314,317,472,528,540,547],mongoc_write_concern_get_fsync:[13,547],mongoc_write_concern_get_journ:[13,547],mongoc_write_concern_get_w:[13,547],mongoc_write_concern_get_wmajor:[13,547],mongoc_write_concern_get_wtag:[13,547],mongoc_write_concern_get_wtimeout:[13,547],mongoc_write_concern_is_acknowledg:[13,547],mongoc_write_concern_is_default:[13,547],mongoc_write_concern_is_valid:[13,547],mongoc_write_concern_journal_is_set:[13,547],mongoc_write_concern_new:[6,13,127,165,180,193,194,302,314,317,472,547],mongoc_write_concern_set_fsync:[13,547],mongoc_write_concern_set_journ:[13,541,547],mongoc_write_concern_set_w:[6,13,194,302,314,317,424,547],mongoc_write_concern_set_wmajor:[13,127,165,180,193,472,547],mongoc_write_concern_set_wtag:[13,547],mongoc_write_concern_set_wtimeout:[6,13,547],mongoc_write_concern_t:[2,6,13,15,108,127,133,150,165,166,180,189,191,193,194,197,202,203,205,206,207,208,212,213,217,226,227,228,229,230,233,234,236,237,238,241,244,245,246,249,274,279,287,288,291,296,299,302,314,317,424,472,477,481,504,523,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546],mongoc_write_concern_w_default:[189,202,222,241,296,547],mongoc_write_concern_w_errors_ignor:547,mongoc_write_concern_w_major:[532,547],mongoc_write_concern_w_unacknowledg:547,mongod:[0,1,3,4,11,21,405,415,524],mongodb:[1,3,5,6,7,8,9,11,12,13,16,19,20,21,24,34,43,52,80,81,82,112,114,116,121,122,123,127,129,133,135,136,137,138,139,140,147,151,162,163,165,166,180,181,185,186,187,189,191,193,194,197,198,199,200,201,205,207,208,212,213,215,216,217,221,232,233,236,237,240,241,243,245,246,247,249,250,254,255,257,263,264,266,269,270,274,275,279,281,284,289,290,291,295,296,297,299,311,317,323,342,343,344,352,362,363,364,370,374,375,380,381,382,390,393,394,404,405,406,407,412,424,442,454,468,469,470,472,482,487,489,490,492,500,507,508,509,510,513,515,520,521,523,524,526,537,545,547,549],mongodbus:4,mongodump:20,mongoimport:1,monitor:[5,7,13,15,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,159,182,416,468,469,470,471],monoton:[429,436,437,438],month:548,more:[0,4,7,9,10,19,120,121,122,123,127,194,199,201,210,211,216,221,235,237,245,246,247,262,263,264,270,278,313,393,404,426,482,513,524,543,545,547,548],most:[17,160,183,207,208,216,243,245,246,406,412,442,549],mous:[11,21],move:345,msbuild:17,msg:[5,281],msy:17,msys2:15,msys2_shel:17,msys64:17,much:[0,5],multi:[7,12,18,163,168,172,173,179,180,181,190,191,418,423,472,478,524],multipl:[0,18,119,154,155,157,158,164,244,246,315,364,381,406,524],munin:5,must:[0,1,4,6,7,10,11,12,16,18,21,23,106,119,120,121,122,123,129,133,141,146,147,159,160,161,162,165,166,167,172,175,176,178,180,181,190,192,193,194,197,200,202,205,207,208,216,217,218,221,222,227,229,230,232,233,237,242,245,246,247,248,249,263,264,265,274,290,291,298,299,311,342,356,357,358,374,406,410,418,423,442,454,467,468,469,478,490,524,541,542,544,545,548,549],mutex:[19,163,548],mutual:127,my_capped_collect:[165,193],my_collect:[165,193],my_logg:19,my_r:[7,510],my_servic:515,myca:4,mycert:4,mycertpassword:4,mycol:548,mydb:[4,507,548],mypass:507,myreplset:[0,9,507],myshard01:0,myuser:507,myvalu:492,n_document:[228,229],n_new_sd:3,n_prev_sd:3,n_written:127,nagio:5,nagl:0,name:[0,1,3,4,8,10,12,21,25,36,38,44,107,118,130,131,132,133,136,137,140,141,160,165,166,183,193,194,196,211,212,216,223,235,236,256,267,271,276,281,282,283,284,285,289,293,299,363,370,432,433,439,491,492,493,500,508,509,510,514,515,516,517,518,524,548],name_filt:281,namespac:[21,141],namespaceexist:[180,472],nat:4,nativ:[0,4,15],navig:5,ndoc:[11,21],nearest:[406,524],nearspher:200,necessari:[3,6,181,188,216],need:[0,4,6,7,18,126,136,137,192,216,248,298,346,347,348,350,351,442,524,548],needtim:21,needyield:21,neg:[221,268,345,455,456,465,466],negoti:[4,270],neq:380,nest:1,net:4,network:[4,5,6,9,12,19,31,121,123,131,132,133,148,165,166,168,172,180,193,196,197,205,206,207,208,212,213,218,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,254,270,271,273,274,279,289,290,291,292,293,299,323,325,343,362,435,462,472,524,547],never:[4,9,192,194,248,254,298,524],new_db:[235,236],new_nam:[235,236],new_sd:3,new_td:3,new_valu:548,newer:[17,442,526],newli:[136,137,140,147,151,152,156,190,192,194,198,202,203,216,221,248,250,275,276,282,298,310,322,323,339,355,356,357,358,359,379,387,391,396,402,426,432,443,449,450,454,459,467,483,505,506,507,525,528,540],next:[6,7,11,15,126,262,265,339,364,442,524,547],next_doc:246,nfail:3,nin:[20,380],nindex:548,nindexeswa:3,ninsert:[6,20,165,193],nmatch:6,nmodifi:6,noconfirm:17,nocursortimeout:221,node:[0,3,191,405,406,533,544,547],non:[4,7,199,201,207,208,221,227,229,230,231,245,246,356,425,442,456,461,466,472,492,524],none:[4,12,116,121,123,140,221,389,524],nonexist:[180,472],normal:[6,7,17,165,180,193,201,381,472],notat:548,note:[0,1,4,6,11,16,129,160,263,269,314,316,317,323,374,406,454,497],noth:[22,105,134,173,209,252,277,303,324,326,337,388,397,409,420,430,447,474,484,529],notherdoc:10,notic:548,notif:[3,23,24,34,43,52,58,62,67,70,75,79,80,81,82,83,84,85,86,87,88,89,90,91,96,99,102,159,182],now:[4,6,11,17,21,107,118,180,256,267,392,472,541,542,543,544,545,546,549],nremov:6,nrepli:254,nreturn:21,nsucceed:3,num:[382,383,384],number:[1,5,6,11,30,32,40,41,48,50,107,118,154,155,157,192,194,195,199,200,201,215,216,228,248,255,256,258,266,267,268,270,272,298,342,354,382,383,384,385,407,417,436,437,438,455,456,461,465,466,524,548],numberint:10,numberlong:10,numer:20,numext:548,nupsert:6,o_rdonli:363,obei:[166,233,291],object:[2,7,13,15,217,218,265,297,363,393,406,410,413,547,548],objectid:[10,332,548,549],observ:[58,83,89,96],obsolet:205,obtain:[11,21,126,127,133,135,139,165,166,193,194,197,200,201,212,213,215,220,221,232,233,236,249,274,279,281,284,290,291,299,548],occur:[6,9,19,20,116,121,123,125,192,216,221,236,248,253,254,270,298,338,344,349,382,524],occurr:11,off:[5,17,127],offer:548,offici:548,often:5,oid:[9,20,311,312,313,315,316,317,548],old:[12,107,118,216,221,256,267,311,317],old_valu:548,older:[213,221],oldest:[315,317],omit:[0,126,166,193,194,221,233,249,291,299,442],onc:[4,7,16,17,18,106,119,127,129,159,160,161,162,374,442,524],one:[0,1,6,7,10,12,17,18,157,164,165,181,190,191,193,201,207,208,230,231,237,245,246,266,313,344,345,352,354,375,406,416,418,423,425,471,524,548],onli:[0,4,5,6,7,9,17,18,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,103,104,106,111,112,113,114,115,116,118,119,120,121,122,123,127,140,159,160,161,162,163,167,169,170,181,185,189,190,191,192,244,247,248,262,263,264,267,269,270,281,298,311,344,352,354,363,393,398,401,403,405,406,407,418,422,423,428,442,455,465,466,468,475,476,477,482,493,516,517,518,524,526,548,549],onto:[163,548],op_delet:6,op_insert:6,op_queri:[216,221],op_upd:6,opaqu:[107,118,119,132,146,191,256,263,267,411,470],opcod:6,open:[3,5,7,9,17,79,102,127,428,450,549],openssl:[17,463],oper:[1,3,5,7,12,13,14,15,18,21,30,40,48,80,81,82,103,104,106,107,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,127,167,169,170,175,177,180,181,185,186,189,190,192,200,202,203,222,224,225,226,229,236,239,240,241,243,248,254,256,267,270,294,295,296,298,300,301,302,314,315,317,327,375,380,381,392,406,407,418,423,424,437,448,482,524,530,541,542,543,544,545,546,547,549],operationtim:[127,169,170,177],oplog:9,oplogreplai:221,opportun:425,opt:[6,8,9,106,110,112,114,116,121,123,127,133,135,139,162,165,166,171,180,181,187,190,192,193,194,197,200,201,203,204,205,207,208,212,213,214,215,218,220,221,229,230,232,233,236,237,245,246,248,249,263,264,274,276,279,281,284,290,291,298,299,302,304,305,306,307,308,309,311,312,313,314,315,316,317,322,323,358,359,363,366,369,370,372,386,419,420,421,422,424,425,472,473,474,475,476,477,479,480,481],optim:[7,17,127],option:[4,5,6,7,10,12,17,106,110,112,114,116,121,123,125,126,127,130,131,132,133,135,138,139,141,147,148,157,159,162,165,166,167,168,171,172,180,181,182,187,190,191,192,193,194,195,196,197,199,200,201,202,203,204,205,206,207,208,210,211,212,213,214,215,216,217,218,219,220,227,228,229,230,232,233,234,235,236,237,238,242,244,245,246,247,248,249,253,254,263,264,269,270,271,272,273,274,276,278,279,280,281,283,284,289,290,291,292,293,298,299,311,312,313,314,315,316,317,322,323,325,327,338,341,343,356,357,358,359,362,363,365,367,368,370,371,373,379,386,390,419,422,425,441,450,472,473,475,476,477,490,491,492,493,494,507,508,509,510,511,512,513,514,515,516,517,518,519,520,522,523,527,537,538,539,548,549],option_kei:524,option_valu:524,optlen:[439,457],optnam:[439,457],optval:[439,457],order:[0,1,3,4,18,106,112,114,116,121,123,133,165,166,193,194,197,200,201,202,203,207,208,212,213,215,216,217,221,229,232,233,236,237,245,246,249,274,279,290,291,299,315,358,359,376,406,424,548],orderbi:216,org:[11,17,21],origin:[12,224,226,413],other:[0,4,11,12,16,17,18,21,129,169,170,180,183,193,202,203,216,221,227,229,230,231,249,254,271,293,299,332,374,382,393,406,461,472,490,515,524,536,547,548],other_host_and_port:21,otherwis:[0,11,18,112,114,116,121,123,130,131,133,151,164,165,166,167,179,183,193,194,195,196,197,199,200,201,207,208,212,213,215,232,233,236,237,238,240,245,246,249,253,254,265,272,273,274,279,290,291,295,299,311,312,313,314,315,316,327,338,344,345,378,385,392,406,431,433,435,442,443,445,449,450,452,454,457,468,505,507,511,512,516,517,518,524,534],our:[0,5,11,217,548],out:[6,7,11,12,17,110,112,114,116,121,123,167,171,181,194,207,208,229,230,245,246,257,356,357,358,381,490,524],out_collect:11,out_collection_nam:11,outcollect:11,output:[3,9,11,17,166,233,291,311,312,313,315,316,317,490],outsid:5,over:[4,6,11,125,192,248,298],overal:[3,6,89,96],overhead:19,overrid:[19,133,135,139,162,165,166,180,187,193,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,425,472,524],overridden:[133,165,166,193,194,197,221,232,233,243,249,274,290,291,297,299,425,472],overs:12,overwrit:[442,513],own:[5,7,11,19,21,127,360,361,363,410,412,496,498,504,548],ownership:[454,459],packag:[15,548],packet:[0,5,19,381],pacman:17,pad:[364,367,370,373,442],paddingfactor:548,page:[0,18,221,548],pain:19,pair:[11,406,524,548],parallel:[0,6,524],paramet:[0,12,470,524],parent:[243,297],pars:[1,3,6,8,9,11,15,21,127,133,151,163,165,180,181,191,193,197,217,246,270,274,317,363,472,507,511,512,513,514,515,516,517,518,519,520,521,522,523,524,548],parsedqueri:21,part:[4,29,39,47,54,60,66,69,73,77,103,104,111,112,113,114,115,116,117,120,121,122,123,183,364,524,530],partial:381,partial_filter_express:370,particip:[424,543],particular:[17,297,363,382,548],partit:9,pass:[0,3,4,6,11,12,21,24,26,37,45,53,59,63,68,71,76,92,97,100,106,110,112,114,116,121,123,127,167,180,181,182,188,194,199,201,206,207,208,210,211,221,229,230,234,235,242,245,246,263,268,278,316,386,425,450,454,457,464,468,469,472,507,524,527,548],password:[0,4,11,21,271,490,495,515,519,522,524],past:443,path:[0,4,10,17,442,450,524,549],paus:524,pem:[0,4,442,524],pem_fil:[0,4,162,187,442],pem_pwd:[4,162,187,442],peopl:549,per:[1,7,255,266,406,547],perfectli:12,perform:[4,6,7,9,13,15,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,109,110,120,122,155,159,163,182,198,199,201,202,217,228,244,245,246,275,292,293,294,295,296,342,354,375,380,381,387,401,429,436,438,444,448,455,456,465,466,468,469,470,482,524,526,528,530,541,548,549],perhap:461,period:[381,412],permiss:[11,21],permit:314,persist:[127,346,347,348,350,351],phd:548,php:7,physic:452,pid:5,ping:[147,163,548],pip:10,pipe:[1,20],pipelin:[1,6,127,192,194,248,263,264,298],pipeline_queri:194,pkg:[3,8,9,11,17,21,163,165,180,181,191,193,270,472],place:[216,511,512,516,517,518,524,548],plai:[311,317],plain:[15,347],plan:[216,221],plannervers:21,platform:[0,5,15,16,376,426,427,429,442,450,548,549],player:[302,311,313,314,315,316,317],pleas:[5,20,103,104,138,186,202,206,219,228,238,240,263,280,283,295,300,394,497,541,548],point:[0,162,187,192,248,270,298,442,490],pointer:[3,26,37,45,53,59,63,68,71,76,92,97,100,159,171,177,182,188,217,229,254,345,365,368,371,386,390,461,468,469,493,527,537],poll:7,pool:[5,13,14,15,153,154,155,157,158,159,160,161,162,163,164,173,181,184,185,186,187,189,190,191,411,412,418,423,442,548],pop:[1,187],popul:[207,208,229,230,237,245,246,507],port1:524,port2:524,port:[0,3,11,21,364,410,506,524,548],portabl:[16,376,426,427,429,440],portion:[163,488,495,503,548],portn:524,posit:[311,313,315,316,317,345,353,403,406,543,544,546],possibl:[0,5,6,9,17,188,196,269,314,442,547],possibleprimari:416,potenti:[106,262,342,524],power8:17,ppc64le:17,practic:[1,11,363,442],pre:334,preced:6,pref:[3,167,191,254,270,401,468,521],prefenc:406,prefer:[12,130,131,133,145,165,166,167,180,186,192,194,196,197,199,201,216,221,225,232,233,240,248,267,272,273,274,287,290,291,295,297,298,363,391,394,395,396,397,399,400,403,404,405,406,425,468,472,480,497,498,521,540,549],prefix:[10,141,363,524],prepar:[165,193],preprocess:4,preprocessor:[526,549],present:[0,4],preserv:[12,198,275],preset:545,pretti:[311,317],prev_sd:3,prev_td:3,prevent:[381,446],previou:[3,7,10,56,94,262,424],previous:[6,263,304,392,464,513,541,542,543,544,545,546],prid64:[199,200,201,215,548],primari:[3,7,12,133,165,180,181,186,193,194,197,221,232,240,274,290,295,363,406,469,472,524],primarypref:[406,524],primit:[16,129,374,382],princip:4,principl:547,print:[3,10,12,19,216,217,221,254,548],print_all_docu:[9,216],print_bson:9,print_collection_stat:196,print_count:[200,215],print_pipelin:1,print_query_count:[199,201],print_r:[11,21],print_ten_docu:221,printbson:10,printf:[1,3,6,8,9,11,21,127,139,147,165,180,193,196,199,200,201,213,215,216,217,221,246,281,284,302,311,312,313,314,315,316,317,363,380,405,472,490,548],prioriti:[0,133,165,166,193,194,197,221,232,233,249,274,290,291,299],privat:[461,524,548],prng:[382,385],pro:21,probabl:[163,548],probe:0,problem:[5,17,363],problemat:16,proce:549,process:[1,5,9,16,17,129,202,344,354,374,428,441],produc:[1,490],product:[5,17],profess:[302,311,313,314,315,316,317],profil:[524,548],program:[3,5,7,11,15,16,17,18,20,21,129,163,185,186,187,189,194,202,203,231,250,374,382,505,507],programm:548,progress:[12,106,168,172,173,179,180],prohibit:[18,133,165,166,181,190,193,194,197,221,232,233,249,274,290,291,299,418,423],project:[5,13,14,15,17,221],prompt:10,proof:[4,16],prop:[490,515],propag:[103,104,106,109,110,111,112,113,114,115,116,120,121,123,131,133,138,139,141,148,165,166,193,196,197,199,200,201,202,203,205,206,207,208,212,213,214,215,217,218,219,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,253,254,273,274,276,279,280,283,284,289,290,291,292,293,299,325,327,338,343,356,357,358,362,379,544,547],properli:[4,216],properti:[4,490,515,549],protocol:[4,5,32,41,50,216,270,375,381,407,408,435,482,524],prove:548,provid:[0,1,4,5,6,10,11,12,17,19,21,110,116,119,121,123,132,142,143,151,152,156,180,191,192,194,205,206,207,208,212,213,229,230,234,236,237,243,245,246,248,263,270,276,279,297,298,340,352,363,364,378,379,380,382,406,408,427,429,440,442,449,459,461,485,486,488,494,506,524,548,549],pseudo:382,pthread:[163,548],pthread_creat:[163,548],pthread_join:[163,548],pthread_mutex_init:[163,548],pthread_mutex_lock:[163,548],pthread_mutex_t:[163,548],pthread_mutex_unlock:[163,548],pthread_t:[163,548],publicli:1,pull:[381,382],purpos:[198,275,549],push:[1,155,524],put:7,pymongo:10,python:10,queri:[1,5,6,9,11,12,20,21,30,40,48,130,138,139,148,163,165,181,191,193,194,199,200,201,206,207,208,215,216,217,218,221,234,237,244,245,246,250,254,258,262,268,269,270,302,311,312,313,314,315,316,317,340,355,356,358,359,363,378,379,380,381,408,524,548],query_collect:9,query_don:11,queryplann:21,queu:106,queue:[103,104,109,110,111,112,113,114,115,116,120,121,122,123],quick:524,quit:363,r_ok:127,rack1:405,rack2:405,rack:[405,406],ran:549,random:[382,383,384,385],randomli:524,rang:[263,264],rather:[4,7,381,382,524],raw:[10,127,133,165,166,192,193,197,232,233,248,249,274,290,291,298,299],reach:[429,438,524],read:[1,11,12,127,130,131,133,144,145,165,166,167,180,181,185,186,191,192,193,194,196,197,199,200,201,215,216,221,224,225,232,233,239,240,248,249,254,262,265,267,270,272,273,274,287,290,291,294,295,297,298,299,323,342,363,386,388,389,390,391,392,394,395,396,397,398,399,400,401,403,404,405,424,425,436,448,454,455,456,468,472,479,480,496,497,498,520,521],read_concern:[165,180,185,193,239,294,386,387,388,389,390,392,472,479],read_mod:402,read_pref:[11,130,131,132,133,148,165,166,186,193,194,195,196,197,199,200,201,215,216,221,232,233,240,272,273,274,290,291,295,395,396,397,398,399,400,401,403,404,405,468,480],readabl:[12,468],readconcern:[133,165,166,193,194,197,200,201,215,221,232,233,239,274,290,291,294,389,390,392,393,524],readconcernlevel:524,reader:[127,363,380],readprefer:524,readpreferencetag:[406,524],readv:352,reason:[202,203,268,468,469,524],receipt:547,receiv:[3,5,6,7,12,24,25,28,29,31,35,36,38,39,44,47,49,54,55,56,57,60,61,65,66,69,73,74,77,78,80,81,82,83,84,85,86,87,88,89,90,91,93,94,95,98,101,127,147,159,172,177,182,192,221,248,298,436,467,470,524,547],recent:[17,155,412,442],recommend:[0,4,17,127,191,442],record:[0,216,270,524],recreat:127,recv:436,red:[17,548],redhat:17,reduc:[6,11,19,380],refer:[13,15,178,199,201,221,410,412,470,524,548],referenc:[17,324],reflect:181,refresh:[18,181,190,418,423],regardless:[6,428],regex:10,regist:[19,159,182,327,338,400,468,469,548],regul:442,regular:[262,340],reiniti:[16,129,374],rejectedplan:21,rel:345,relat:[0,3,12,16,363,386,527],releas:[16,106,129,131,134,148,153,252,277,337,374,377,426,430,447,524,547,548],reli:[216,524],reliabl:[12,180],relwithdebinfo:17,remain:[0,1,9,162,183,187,302,312,315,316,442,454,490],rememb:549,remoteth:21,remov:[6,19,20,62,84,111,112,113,114,115,116,120,121,122,123,207,208,217,221,234,292,293,313,343,362,377,378,379,380,407,547,548,549],renam:[235,236],repeat:270,repeatedli:524,replac:[6,115,116,188,191,200,237,515,549],repli:[0,3,5,6,8,11,12,21,31,49,74,106,125,127,131,132,133,148,165,166,172,180,181,193,196,197,200,205,207,208,215,216,217,218,221,229,230,232,233,237,242,245,246,247,249,254,263,264,273,274,290,291,299,301,302,311,312,313,314,315,316,317,381,408,424,472,548],replic:[6,406,524],replica:[3,9,11,12,147,165,186,191,193,240,295,363,381,406,468,547,548],replicaset:[0,3,7,9,127,147,405,499,507,510,524],replicasetnoprimari:[3,471],replicasetwithprimari:[3,471],replset:[165,193],reply_json:[180,472],reply_str:8,report:[2,4,6,13,15,110,112,114,116,121,123,161,184,548],repositori:[10,17],repres:[192,248,298,405,406,470,548],represent:[135,219,220,280,281,321,524],reproduc:5,request:[5,32,41,50,163,192,205,212,213,248,266,298,325,405,548],requir:[0,4,10,11,17,21,30,40,48,112,114,116,121,123,128,133,162,165,166,187,193,194,197,200,201,207,208,212,213,215,217,232,233,236,237,245,246,249,266,270,274,279,290,291,299,382,442,524,548,549],required_major:128,required_micro:128,required_minor:128,requiressl:[0,4],res:[11,21],res_nsearch:524,res_search:524,rescan:524,resembl:524,reset:250,resolv:[0,254,524],resort:406,resourc:[16,129,134,153,173,209,252,277,303,324,326,337,374,377,388,397,430,447,484,529],respect:[155,524,548],respond:[7,12,213],respons:[4,7,11,12,16,129,130,131,132,194,196,254,263,272,273,374,406,412,413,547],rest:548,restart:127,restor:[6,19,311],restorest:21,result:[0,1,4,6,9,11,30,40,48,126,127,131,133,135,138,139,144,145,148,150,165,166,193,194,196,197,202,203,207,208,216,217,218,219,220,221,222,229,230,232,233,237,242,245,246,249,250,258,262,266,268,269,270,272,273,274,280,281,290,291,299,313,345,355,356,357,358,359,381,425,433,435,442,472,505,507,524,548],resum:[12,192,248,298,381],resume_token:127,resume_token_doc:127,resume_token_path:127,resumeaft:[127,192,248,298],ret:[6,11,21,163,548],retain:265,retri:[180,472,524],retriev:[9,107,130,144,145,150,157,160,162,163,191,192,199,201,242,248,255,256,258,260,268,270,286,288,298,338,342,344,354,361,381,428,433,437,458,548],retry_transact:[180,472],retrywrit:524,returnkei:221,retval:548,revers:[18,548],review:17,revoc:442,rfc:[0,4,524],rhel:17,right:[393,547,549],robust:9,robustli:9,role:[6,271,311],root:442,roughli:[7,524],round:[6,255,262,266,414,524],rout:[191,363],routin:549,rp_tag:405,rs0:127,rsarbit:416,rsghost:416,rsother:416,rsprimari:[3,416],rssecondari:[3,416],rule:[6,16,311],run:[0,4,6,9,10,17,130,131,132,133,148,165,166,188,192,193,205,242,247,248,254,298,299,382,406,412,524,548,549],run_queri:254,run_query_with_read_prefs_tag:405,runtim:[5,382],s390x:17,safe:[3,7,10,154,155,157,158,163,164,191,213,236,270,344,352,354,363,442,448,524,548],safeti:[19,548],said:363,sake:[107,118,180,256,267,393,472],same:[0,1,4,12,17,20,107,162,192,199,201,248,264,298,316,363,382,406,428,524,544,546],sampl:[9,11,21,548],sasl:[12,15,17,524],sasl_error:12,saslprep:4,satisfi:[6,221,269,401,545],save:[238,344,363,375],savest:21,scan:[7,524],scandata:247,scanner:524,scatter:[342,376],scenario:191,schannel:442,schema:[6,194,229,230,237,245,246,311],scheme:[489,500],school:548,scope:[10,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94],scram:[12,15,511],script:10,sdam:470,sds:[147,417],search:524,second:[0,1,3,6,7,17,21,127,180,406,472,524],secondari:[3,7,11,181,381,398,403,406,524],secondarypref:[406,524],section:[489,548],secur32:549,secur:[4,382],see:[0,1,5,6,7,8,9,10,11,17,19,21,127,133,135,139,161,163,165,166,171,181,184,186,191,193,194,197,199,201,204,205,207,208,210,211,212,213,214,217,218,220,222,229,230,231,232,233,235,236,240,247,249,255,261,266,274,278,279,284,289,290,291,295,299,301,327,358,359,363,378,386,392,393,394,404,415,418,470,472,524,527,543,545,547,548],seed:[0,382,384,385],seek:352,seek_cur:345,seek_end:345,seek_set:345,seen:507,segfault:5,segment:5,select:[4,7,17,112,113,114,115,116,120,121,122,123,167,194,315,398,403,406,549],selector:[6,103,104,111,112,113,114,115,116,120,121,122,123,181,201,206,207,208,234,237,244,245,246,407],semant:[452,455,465,466],send:[0,6,12,21,67,85,133,165,166,193,197,232,233,249,274,290,291,299,437,438,524],sendmsg:438,sens:[401,406],sent:[4,5,6,34,43,52,58,62,67,70,75,79,96,99,102,183,216,239,294,302,393,437,438],separ:[0,1,17,21,216,221,406,489,513,524],sequenc:[12,18,181,190,380,418,423,548],serial:6,server:[3,4,5,6,7,12,17,20,21,29,31,32,33,39,41,42,47,50,51,54,58,60,62,66,67,69,70,73,75,77,79,83,84,85,86,87,88,89,90,96,99,106,107,118,121,122,123,125,127,130,131,132,133,135,136,137,138,139,142,143,146,147,148,163,165,166,167,168,172,176,183,187,190,191,192,193,194,196,197,198,199,200,201,205,206,207,208,212,213,215,218,219,220,221,227,228,229,230,232,233,234,236,237,238,239,240,242,244,245,246,247,248,249,250,252,254,255,256,258,262,263,264,266,267,269,271,272,273,274,275,279,280,281,284,289,290,291,292,293,294,295,298,299,302,314,323,325,342,343,344,362,364,370,375,380,381,406,408,409,410,411,412,413,414,415,416,417,434,467,468,469,470,471,482,535,544,545,546,547,548],server_chang:3,server_changed_ev:3,server_clos:3,server_closed_ev:3,server_heartbeat_fail:3,server_heartbeat_start:3,server_heartbeat_succeed:3,server_id:[118,132,146,263,267],server_open:3,server_opening_ev:3,serverid:[133,135,139,165,166,193,194,197,200,201,212,213,215,220,221,232,233,236,249,264,274,279,281,284,290,291,299],serverinfo:21,serverselectiontimeoutm:524,serverselectiontryonc:[254,524],serverstatu:148,servic:[4,500,515,524],service_nam:[4,490,515],session:[3,10,12,133,135,139,165,166,168,169,170,171,172,173,174,175,176,177,178,179,180,181,190,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,418,419,421,422,423,424,425,472],session_opt:[180,424,472],sessionid:[133,135,139,165,166,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,264,274,279,281,284,290,291,299],set:[3,4,9,10,11,17,24,106,110,112,114,116,121,123,125,126,127,131,132,133,138,139,141,147,148,154,155,159,160,161,162,165,166,168,172,180,182,183,184,185,186,187,189,190,191,193,194,196,197,200,201,203,205,206,207,208,212,213,215,216,217,218,227,228,229,230,232,233,234,236,237,238,239,240,241,242,244,245,246,247,249,253,254,259,260,262,263,264,265,268,269,271,273,274,276,279,283,284,289,290,291,292,293,294,295,296,299,302,305,306,307,308,309,317,325,327,338,341,343,345,346,347,348,349,350,351,362,363,375,379,381,389,390,392,393,403,404,405,408,424,425,427,428,429,433,434,435,436,437,438,439,442,445,446,449,450,452,455,456,457,464,465,466,468,472,482,490,491,492,493,511,512,513,514,515,516,517,518,519,520,521,522,523,530,532,533,534,537,539,541,542,543,544,545,546,547,548,549],set_:243,setsockopt:[439,457],setter:[425,472],sever:[4,17,352,548],sha:[12,15,511],shall:[141,154,188,194,199,201,202,203,206,209,216,227,230,234,237,238,244,250,262,265,271,322,323,324,339,356,395,396,443,445,446,447,448,450,452,453,454,455,464,465,466],shallow:442,shard:[191,381,406,408,471,524,548],share:[0,5,17,524,548],shell:[1,9,21,548],shim:461,should:[0,1,7,9,12,17,18,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,103,104,108,115,120,121,122,123,127,130,131,136,137,138,139,140,141,142,143,144,145,148,149,150,152,155,156,188,190,191,194,195,196,198,199,200,201,202,203,204,205,206,214,215,216,217,219,222,223,224,225,226,228,231,234,238,242,245,246,247,250,251,263,272,275,280,282,283,284,285,286,287,288,300,310,311,322,323,328,330,331,332,334,335,339,347,352,355,359,360,361,363,366,369,370,372,376,379,387,391,394,396,400,402,406,426,429,430,432,433,435,441,443,444,448,449,450,459,460,482,483,485,486,487,488,489,490,494,495,496,497,498,499,501,502,503,504,506,524,525,528,530,531,533,534,535,540,544,546,548],show:[5,10,127,216,254],show_serv:147,showdiskloc:216,shown:3,showrecordid:[216,221],shut:428,shutdown:[16,428],side:[32,41,50,110,116,121,123,125,176,194,207,208,229,230,237,245,246,252,254,262,270,271,314,380,482],sign:[268,329,333,336,535],signal:524,significantli:19,silent:370,similar:[4,17,125,126,199,201,434,547,548],simpl:[0,7,11,548],simpli:[0,5,11,17,199,201,206,216,234,262,548],simplifi:[131,196,273],sinc:[6,7,127,163,181,262,336],singl:[6,11,20,104,109,110,113,114,115,116,119,122,123,147,191,206,229,234,244,265,442,471,482,524,548],singlebatch:221,situat:[16,406,524],sixth:6,size:[7,12,142,143,155,165,193,216,255,266,329,433,434,443,548],size_t:[3,127,147,229,342,354,417,436,437,438,443,455,456,465,466,467,548],sizeof:[0,127,363,548],skip:[110,116,121,123,127,130,194,195,199,200,201,207,208,215,216,221,229,230,237,245,246,264,272],slaveok:524,sleep:[9,163,548],slow:524,slower:524,slowest:524,small:0,smaller:19,smallest:524,smoot:1,snappi:[0,487,513,524],snapshot:[180,221,393,472],snippet:[17,21,548],so_keepal:0,sock:[0,426,427,429,430,431,432,433,434,436,437,438,439,507],sock_stream:435,sockaddr:[427,429,433],socket:[5,7,191,271,292,293,376,426,427,428,429,430,431,432,433,434,435,436,440,446,457,459,460,464,524,544,546,549],socketcheckintervalm:524,sockettimeoutm:[454,509,524],sockopt:439,softwar:[11,21],solari:440,sole:[18,29,39,47,54,60,66,69,73,77],solut:549,some:[0,11,12,16,17,18,20,21,181,190,221,263,264,269,302,314,317,363,375,381,382,418,423,442,507,517,524],someth:[0,3,11,17,21,163,321,347,548],soon:[0,7],sort:[1,6,165,193,201,216,217,221,308,317,358,359,363],sourc:[1,10,12,17,133,165,166,180,193,194,197,221,232,233,249,274,290,291,299,472],space:452,spars:370,spec:[3,6,167,217,380,416,471],special:[193,249,299,524],specif:[0,4,11,12,20,21,120,121,122,123,130,131,132,133,135,139,165,166,193,194,197,200,201,212,213,215,220,221,231,232,233,236,249,274,279,281,284,290,291,299,301,370,373,378,379,406,431,470,524,548],specifi:[0,1,3,4,5,11,17,106,118,121,123,126,132,140,146,192,194,199,200,201,215,216,217,225,226,240,245,246,248,267,298,314,315,317,322,323,330,336,357,363,375,381,382,383,393,402,406,407,442,501,524,544,547],spectrum:380,sphinx:17,srv:[489,500],ssize_t:[127,342,354,363,436,437,438,455,456,465,466],ssl:[4,12,16,17,129,162,187,374,441,442,461,501,507,508,549],ssl_default:0,ssl_opt:[0,4,442],sslallowconnectionswithoutcertif:0,sslallowinvalidcertif:[442,524],sslallowinvalidhostnam:[442,524],sslcafil:[0,4,442],sslcertificateauthorityfil:[442,524],sslclientcertificatekeyfil:[442,524],sslclientcertificatekeypassword:[442,524],sslmode:[0,4],sslpemkeyfil:[0,4],sspi:4,stack:[196,490],stage:[21,127,194],stale:[398,403,408],standalon:[0,416,469,524,548],standard:[10,201,231,451,524],start:[0,3,4,6,10,11,12,15,17,18,43,70,81,120,121,122,123,165,179,180,181,190,192,193,248,298,345,418,422,423,424,425,442,472],startatoperationtim:[127,192,248,298],startup:382,stat:[3,5,196],state:[12,16,17,129,374,468,469],statist:[5,242],stats_t:3,statu:[58,67,70,75,83,85,86,87,148,385,470],stdafx:549,stderr:[1,3,5,6,8,9,11,19,21,127,139,163,165,181,191,193,196,199,200,201,213,215,216,217,221,246,254,270,281,284,302,311,312,313,314,315,316,317,363,405,424,513,548],stdin:380,stdin_fileno:380,stdio:[1,3,6,8,9,11,21,163,165,180,181,191,193,196,199,200,201,215,216,217,221,270,363,380,472,548],stdlib:[8,9,165,191,193,270,363],stdout:[5,9,19,181,191,270,363,548],step:[4,11,15,17],stepdown:12,stick:406,still:[0,205,311,317,406,492,524],stop:[62,84,90,99,106,202],storage_opt:370,storages:548,store:[0,4,127,132,148,200,205,215,242,273,433,442,548],str:[1,6,9,11,21,181,191,196,216,217,221,254,270,302,311,312,313,314,315,316,317,347,348,350,380,405,548],straight:231,strcmp:[140,363],stream:[5,30,40,48,124,125,126,127,188,192,248,298,323,363,381,436,444,445,446,447,448,452,453,454,455,456,457,458,459,460,462,463,464,465,466],strerror:19,striker:[302,311,313,314,315,316,317],string:[0,1,4,7,10,11,12,20,21,25,36,38,44,138,139,151,162,183,187,211,212,213,221,223,231,283,284,285,289,293,321,330,331,334,347,348,350,357,362,393,406,416,432,471,485,486,488,493,495,499,500,502,503,505,506,507,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,534,545,548],stringif:231,strncmp:[11,21],strong:382,strongli:4,struct:[3,18,23,119,127,147,162,163,181,187,190,191,198,243,270,275,297,340,341,352,363,364,367,370,373,376,380,392,415,417,418,419,423,427,429,433,440,442,444,451,460,461,463,467,470,472,473,478,479,480,481,524,541,542,543,544,545,546,548],structur:[0,9,10,12,105,134,153,163,277,282,297,303,310,324,341,352,366,367,369,370,372,373,376,377,388,435,440,442,447,489,529,548],strv:[139,284],studio:[13,14,15],style:[340,449,451,507],subclass:[444,451,460,463],subdocu:[20,207,208,230,237,245,246,548],subject:4,submit:[15,119,217],subsequ:[155,169,170,192,248,298],subset:[20,192,248,298,312,435],subsystem:[12,376],succe:[0,6,12,24,180,289,472,524],succeed:[3,52,75,548],success:[0,3,5,106,107,110,112,114,116,121,123,131,132,133,141,148,159,165,166,171,180,182,184,190,193,196,197,205,206,207,208,212,218,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,267,268,273,274,276,279,290,291,292,293,299,302,311,312,313,314,315,316,317,325,343,344,345,349,357,358,362,386,426,427,428,429,433,434,435,436,438,439,443,445,446,452,454,455,456,457,464,465,466,472,505,507,524,527,530,531,533,541,542,544,545,548],successfulli:[1,17,52,151,183,213,254,271,311,312,313,314,315,316,370,516,517,518,524,548],sudo:17,suffer:[406,524],suffici:382,suffix:0,suit:323,suitabl:[118,167,254,267,405,524],sum:[1,11],supersed:[109,111,113,115,120,122,130,195,227,234,244,261,272],suppli:[12,172,188],support:[0,4,5,6,12,15,20,190,192,195,221,247,248,298,302,314,317,363,380,406,524],suppress:19,sure:442,suse:17,symbol:[10,349,549],synchron:127,synonym:547,syntax:[1,216,221],synthes:[263,342],sysadmin:5,system:[0,3,17,19,363,382,429,436,437,438,442,461,549],syu:17,tabl:[165,166,193,194,221,232,233,249,290,291,299],tag:[11,17,21,395,400,405,497,524,545],tagset:405,tail:9,tail_collect:9,tailabl:[221,262,263,264,269],take:[6,165,166,171,193,216,232,233,249,290,291,299,302,314,317,386,456,524,527],talk:311,talli:[312,315,317],tar:17,target:[133,135,139,165,166,193,194,197,200,201,212,213,215,217,218,220,221,232,233,236,249,274,279,281,284,290,291,299,406,450],target_compile_definit:548,target_include_directori:548,target_link_librari:548,task:[13,14,15],tcp:[0,188],tcp_keepcnt:0,tcp_keepidl:0,tcp_keepintvl:0,tcp_nodelai:0,technic:524,tell:[12,352,547,548],temporari:[180,470,472],ten:221,term:[107,118,256,267],termin:[138,139,283,284],test2:21,test:[1,3,6,8,9,11,12,17,20,21,165,181,191,193,217,270,297,301,363,370,424,524,536,538,539,548],testasdf:6,text:[4,347],textual:[112,114,116,121,123,133,165,166,193,194,197,200,201,207,208,212,213,215,232,233,236,237,245,246,249,274,279,290,291,299],than:[0,1,4,7,11,12,128,169,170,183,212,221,231,381,382,393,398,403,440,482,524,548],thei:[4,5,6,9,18,155,162,181,187,243,297,375,376,381,382,407,408,482,524,547,548],them:[17,127,147,363,386,442,527,548,549],therefor:[12,16,250,376,442,454,524],thi:[1,3,4,5,6,7,9,10,11,12,16,17,18,19,20,21,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,53,54,55,56,57,59,60,61,63,64,65,66,68,69,71,72,73,74,76,77,78,92,93,94,95,97,98,100,101,103,104,106,107,109,111,112,113,114,115,116,117,118,120,121,122,123,126,127,130,131,132,133,135,138,139,142,143,148,154,155,156,157,158,159,160,161,162,163,164,165,166,167,169,170,171,174,176,178,179,180,183,184,185,186,187,188,189,190,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,219,220,222,225,227,228,230,231,232,233,234,235,236,237,238,241,242,243,244,245,246,247,248,249,250,253,254,256,258,261,262,263,264,265,266,267,268,269,271,272,273,274,275,276,278,279,280,281,283,286,288,289,290,291,292,293,294,295,296,297,298,299,302,310,311,312,315,316,322,323,324,327,339,341,342,346,347,348,350,351,352,353,355,356,360,361,363,366,367,369,370,372,373,375,378,379,381,382,386,391,392,393,394,395,396,401,410,413,414,416,421,422,425,426,427,428,429,430,431,432,433,434,435,436,438,439,440,441,442,443,445,446,447,448,450,452,453,454,456,457,459,462,464,468,469,471,472,479,480,481,482,488,489,490,493,496,497,498,500,504,505,507,514,519,522,524,526,527,532,536,538,539,540,541,542,543,544,545,546,547,548,549],thin:[210,211,217,235,278],thing:[5,11,21],think:5,third:[3,6],those:[9,193,249,299,398,403],though:[17,205,311,317,455,465,466],thread:[7,15,16,18,19,129,163,181,190,344,354,374,418,423,431,442,524],three:1,threshold:524,through:[4,11,17,162,187,188,201,269,271,273,314,376,548],throughput:6,thu:141,ticket:4,tightli:363,time:[0,3,6,7,9,12,17,18,127,159,169,170,181,182,188,190,191,192,221,248,269,298,314,352,375,381,406,414,418,423,436,437,438,524,548],timemilli:11,timeout:[5,9,12,18,106,126,130,131,132,133,166,181,190,193,196,197,206,217,218,227,228,229,230,233,237,238,244,245,246,249,254,269,272,273,274,291,299,418,423,426,429,437,438,454,455,456,462,465,466,492,524,535,544,546,547],timeout_msec:[342,354,455,456,465,466],timeoutm:524,timestamp:[9,10,19,127,169,170,177,192,248,298],tlocal:[11,21],tls:461,tm_mdai:548,tm_mon:548,tm_year:548,tmp:[0,4,21],to_insert:[127,246],to_str:246,tocollect:[165,193],todb:21,todo:0,togeth:[6,375,381,407,408,482],token:[12,127],told:262,too:[12,160,221,302,314,317],tool:[5,17],top:[340,406,461,524],topic:548,topolog:[3,7,57,61,78,89,90,95,96,98,99,101,102,146,147,467,468,469,471,524],topology_chang:3,topology_changed_ev:3,topology_clos:3,topology_closed_ev:3,topology_id:[57,61,78,95,98,101],topology_open:3,topology_opening_ev:3,total:[5,7,11,157,524],total_pop:1,totaldocsexamin:21,totalindexs:548,totalkeysexamin:21,trace:5,track:[5,258,548],tradit:216,traffic:270,transact:[12,18,133,135,139,165,166,168,172,173,179,180,181,190,193,194,197,200,201,203,205,207,208,212,213,215,220,221,229,230,232,233,236,237,245,246,249,274,279,281,284,290,291,299,418,422,423,425,472,473,475,476,477,478,479,480,481],transfer:[5,454,459],transienttransactionerror:[180,301,472],translat:4,transpar:[221,548],transport:[188,191,452],tri:[0,12,196,524],trip:[6,255,262,266,414,524],troubleshoot:[13,15,548],trust:[0,442,524],trust_dir:4,tune:[367,370,373],turn:461,tutori:[0,4,6,13,15,193,249,299,549],two:[1,3,6,7,10,17,21,127,165,180,193,472,549],twod_bits_precis:[367,370],twod_location_max:[367,370],twod_location_min:[367,370],twod_sphere_vers:367,txn_opt:[180,425,472],txt:[524,548],type:[0,5,6,10,17,18,20,119,191,221,227,229,230,330,332,347,349,363,406,416,435,470,471,491,492,493,508,509,510,516,517,518,524,548],typedef:[3,19,80,81,82,83,84,85,86,87,88,89,90,91,119,127,163,191,243,270,297,300,340,341,352,363,364,367,370,373,375,376,380,381,394,407,408,415,418,440,442,444,451,460,461,463,470,472,482,524],typic:[216,435,547],u_long:376,ubuntu:17,uint16_t:[364,506],uint32_t:[6,9,33,42,51,106,107,118,130,132,146,154,155,170,177,195,216,228,255,256,260,263,266,267,269,272,307,314,341,342,354,411,548],uint64_t:[269,314,353],uint8_t:[367,548],unacknowledg:[18,171,181,190,418,423,424,536,543,547],unalt:[198,275],unavail:[3,406,524],unawar:548,unblock:7,unchang:268,undef:19,under:[11,21],undergo:4,underli:[126,191,194,199,201,216,265,329,330,334,339,345,354,356,436,443,444,445,446,448,450,452,453,458,464],underneath:435,unescap:525,unfortun:3,uniniti:[106,172,200,207,208,215,217,229,230,237,242,245,246,305,308,309,490],uninstal:17,uniqu:[5,6,12,370,406,549],unistd:127,unit:1,unix:[4,15,336,426,427,429,442,449,451,461,524],unknown:[0,3,12,254,270,363,416,471],unknowntransactioncommitresult:[180,301,472],unless:[0,11,17,21,106,239,294,442],unlock:[442,524],unmodifi:221,unnecessari:524,unrecogn:213,unrecover:[180,472],unreli:262,unset:[118,267,492,515],unsign:[139,163,284,353,434,548],unspecifi:524,untar:17,until:[6,7,12,107,109,110,126,142,143,147,157,256,258,265,270,323,493,524,547],untrust:524,unus:[130,166,233,291,342,354],unwrap:196,updat:[5,6,7,9,12,120,121,122,123,181,193,217,218,236,237,238,243,244,245,246,249,299,302,309,311,312,313,314,315,317,412,482,511,512,516,517,518,524,549],update_opt:181,updatedexist:[311,312,313,315,316,317],upload:336,upload_d:352,upon:[106,136,137,138,139,141,186,196,273,276,283,284,327,379,426,449,450,455,460,465,466],upsert:[6,115,116,120,121,122,123,217,237,238,245,246,313,317,482],upsertedcount:237,upsertedid:[237,245,246],uri:[0,1,3,4,6,7,8,9,11,21,127,140,147,151,152,156,157,163,165,180,181,185,186,189,191,193,217,246,270,317,363,364,390,454,472,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,537,548],uri_str:[1,3,6,8,127,151,163,165,180,181,191,193,217,246,254,270,317,363,472,505,507,548],url:[0,4],usabl:7,usag:[9,11,21,363],use:[0,1,4,7,9,11,12,17,18,19,21,103,104,118,127,132,133,135,136,137,138,139,140,152,156,157,165,166,167,171,180,181,184,186,187,190,191,192,193,194,197,198,200,201,202,203,205,206,207,208,212,213,215,216,219,220,221,225,228,229,230,232,233,236,237,238,239,240,241,245,246,248,249,250,263,267,274,275,279,280,281,283,284,286,287,288,290,291,294,295,296,298,299,300,301,310,316,317,323,339,355,356,357,358,359,363,376,379,387,391,392,406,418,423,435,442,443,447,449,450,455,456,459,461,465,497,501,506,524,528,530,540,541,547,548,549],used:[0,4,7,18,103,104,106,107,108,138,142,143,148,149,155,163,175,177,181,188,190,191,192,199,201,202,204,205,212,213,214,216,217,219,224,226,228,236,238,242,247,248,256,258,263,268,270,276,279,280,283,298,300,310,317,329,341,352,363,367,370,373,382,392,403,405,418,423,438,442,443,448,497,501,524,526,541,542,543,544,545,546,548,549],useful:[17,19,107,243,262,268,297,386,431,482,524,526,527],user:[0,4,6,11,17,21,127,188,201,216,271,292,293,311,315,317,382,391,442,452,490,507,515,524,540,548],user_data:[19,188,191],userflag:548,usernam:[0,4,11,21,271,293,503,519,522,524],uses:[0,1,4,5,7,12,18,107,130,131,192,195,196,201,242,248,256,258,266,272,273,298,332,438,442,454,468,469,492,538,539,547,548,549],using:[0,4,5,6,7,11,12,15,17,18,127,132,151,152,156,181,190,192,194,236,248,298,370,379,392,402,406,418,423,429,430,436,437,438,442,449,459,505,524,541,542,543,544,545,546,548],usr:[17,548],usual:[382,549],utcdatetim:10,utf8:[518,525],utf:[348,357,362,511,512,513,514,519,522],util:17,v_int32:363,val:11,valgrind:5,valid:[4,25,29,31,35,36,38,39,44,47,49,54,55,56,60,66,69,73,74,77,93,94,106,110,112,114,116,117,119,121,123,162,183,187,194,199,201,206,207,208,229,230,234,237,245,246,247,265,302,311,312,315,316,317,375,401,422,442,454,475,476,477,482,493,507,508,509,510,511,512,513,514,515,519,522,524],validationact:317,validationlevel:317,valu:[0,1,4,11,19,107,133,135,139,165,166,175,193,194,197,200,201,212,213,215,220,221,232,233,236,249,259,260,274,279,281,284,290,291,299,302,307,311,312,313,315,316,317,318,319,320,363,364,366,369,370,372,406,422,424,439,442,454,456,466,475,476,477,491,492,493,511,512,513,514,516,517,518,524,532,535,543,544,546,547,548],value_typ:[127,363],variabl:[5,10,431],variant:548,variat:17,varieti:17,variou:[0,19,133,165,166,193,194,197,202,203,221,232,233,249,274,290,291,299,341,376,440,526],vassar:548,vast:548,vcxproj:17,vector:[138,139,438,456,466],verbos:10,veri:4,verif:524,verifi:[0,1,442,548],version:[2,11,13,15,16,17,20,21,128,133,161,165,166,184,193,196,197,205,213,217,221,232,233,249,263,264,274,290,291,299,316,317,321,370,377,378,379,380,392,393,442,541,542,543,544,545,546,548],via:[4,5,103,104,106,109,110,111,112,113,114,115,116,120,121,123,131,133,138,139,141,148,165,166,193,196,197,199,200,201,205,206,207,208,212,213,214,215,217,218,219,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,253,254,274,276,279,280,283,284,289,290,291,292,293,299,325,327,338,343,356,357,358,362,379,548],view:[7,412],violat:12,virtual:4,vista:17,visual:[13,14,15],w64:15,wai:[7,9,12,17,406,482,548],wait:[6,7,181,192,221,248,269,298,382,455,465,524,535,544,546],waitqueuemultipl:524,waitqueuetimeoutm:524,wake:524,wall:[9,11,21,406,524],want:[0,5,11,17,21,140,163,198,206,234,275,381,526,548,549],warn:[19,180,472,513,541,542,543,544,545,546],warranti:[11,21],watch:[5,127],weak_cert_valid:[4,442],websit:[186,199,201,240,295,393,394,404,524,547],weight:370,well:[7,9,12,252,263,382,524],were:[3,18,437,442,489,548],wget:17,what:[4,11,12,19,155,547],whatev:188,when:[0,4,5,6,7,9,12,17,18,19,24,34,43,52,58,62,67,70,75,79,96,99,102,118,125,126,130,136,137,140,152,156,166,167,180,187,190,191,192,194,196,198,200,202,203,216,233,237,245,246,248,250,256,258,263,264,267,272,275,291,298,310,311,318,319,320,323,339,341,355,357,358,359,362,364,376,379,381,387,391,393,406,425,430,433,435,438,442,443,449,450,455,459,465,472,482,506,524,528,540,543,547,548,549],whenc:345,whenev:[80,81,82,83,84,85,86,87,88,89,90,91,524],where:[1,6,12,16,127,135,165,193,200,219,220,280,281],whether:[12,126,167,179,213,301,406,524,539],which:[0,3,6,10,11,12,17,21,106,112,113,114,115,116,118,120,121,122,123,127,130,132,140,141,154,155,162,174,178,187,192,205,221,223,228,245,246,247,248,254,261,264,267,270,272,285,298,312,315,330,331,358,359,363,406,410,424,425,436,442,472,485,486,487,488,494,495,499,502,503,524,534,543,549],whichev:[0,524],whole:[180,363,472],whom:524,whose:[120,121,122,123,398,403,524],why:31,wide:127,win32:549,win64:17,window:[4,15,426,427,428,429,440,548],winningplan:21,wire:[4,5,32,41,50,216,270,375,381,407,408,482,524],wiredtig:[371,373],wish:265,within:[0,7,12,17,18,181,190,270,289,353,366,369,372,418,423,524],without:[0,5,11,17,21,127,133,165,166,193,197,225,232,233,249,271,274,290,291,299,363,524],wmajor:[532,533],won:406,word:536,work:[0,21,446,451,460,463,464,548],worker:[163,548],world:[20,191,270,380,548],worth:363,would:[216,345,392,524,525,532,541,542,543,544,545,546],wrap:[0,118,167,191,263,264,267,270,363,453,457,461],wrapper:[210,211,217,235,278,426,427,428,429,432,457,461],writabl:469,write:[11,12,13,14,15,18,21,106,108,109,118,119,127,130,131,132,133,150,163,165,166,167,171,180,181,189,190,194,196,197,202,203,205,206,207,208,212,213,217,218,221,222,226,227,228,229,230,232,233,236,237,238,241,244,245,246,263,264,267,272,273,274,276,279,290,291,296,297,302,314,317,322,323,354,363,376,406,418,423,424,425,438,446,448,452,454,465,466,472,481,504,523,527,529,530,531,532,533,535,536,537,538,539,540,541,542,543,544,545,546,548],write_concern:[6,165,180,189,193,194,202,206,222,227,228,234,238,241,244,296,472,481,527,528,529,530,531,532,533,534,535,536,537,538,539,541,542,543,544,545,546],writeconcern:[133,165,166,193,194,197,203,205,207,208,212,213,229,230,233,236,237,245,246,249,274,279,291,299],writeconcernerror:[6,207,208,229,230,237,245,246],writeerror:[3,6,207,208,229,230,237,245,246],writeresult:[20,165,193],writev:[352,466],written:[17,216,354,465,466,533],wrong:12,ws2_32:549,wtag:534,wtimeout:[6,180,472],wtimeout_msec:[544,546],wtimeoutm:[165,193,524],www:[11,21],x00:10,x01:10,x02:10,x10x:10,x10y:10,x13:10,x509:4,x509_derived_usernam:4,x86:17,x86_64:17,xcode:17,xzf:17,yale:548,year:548,yet:[6,262],you:[1,3,4,5,9,10,11,12,16,17,18,19,20,21,23,129,133,135,139,140,141,163,165,166,175,176,178,191,193,194,197,198,200,201,202,203,205,206,207,208,212,213,215,216,220,221,227,229,230,232,233,234,236,237,245,246,249,265,274,275,279,281,284,290,291,299,346,347,348,350,351,355,356,357,358,359,363,374,375,376,381,382,390,393,406,410,424,429,430,437,468,469,482,524,526,537,543,547,548,549],your:[3,4,5,7,10,12,15,16,17,18,19,129,191,227,229,230,363,374,375,382,406,429,442,482,524,545,549],yourself:16,yum:17,zero:[6,107,195,199,201,255,256,258,266,492,543,544,546],zipcod:1,zlatan:[302,311,312,313,314,315,316,317],zlib:[0,487,513,524],zlibcompressionlevel:524,zseri:17},titles:["Advanced Connections","Aggregation Framework Examples","API Reference","Application Performance Monitoring (APM)","Authentication","Basic Troubleshooting","Bulk Write Operations","Connection Pooling","Creating Indexes","Cursors","Aids for Debugging","\u201cdistinct\u201d and \u201cmapReduce\u201d","Error Reporting","Index","Guides","MongoDB C Driver","Initialization and cleanup","Installing the MongoDB C Driver (libmongoc) and BSON library (libbson)","Object Lifecycle","Logging","Client Side Document Matching","Common Tasks","mongoc_apm_callbacks_destroy()","mongoc_apm_callbacks_new()","mongoc_apm_callbacks_t","mongoc_apm_command_failed_get_command_name()","mongoc_apm_command_failed_get_context()","mongoc_apm_command_failed_get_duration()","mongoc_apm_command_failed_get_error()","mongoc_apm_command_failed_get_host()","mongoc_apm_command_failed_get_operation_id()","mongoc_apm_command_failed_get_reply()","mongoc_apm_command_failed_get_request_id()","mongoc_apm_command_failed_get_server_id()","mongoc_apm_command_failed_t","mongoc_apm_command_started_get_command()","mongoc_apm_command_started_get_command_name()","mongoc_apm_command_started_get_context()","mongoc_apm_command_started_get_database_name()","mongoc_apm_command_started_get_host()","mongoc_apm_command_started_get_operation_id()","mongoc_apm_command_started_get_request_id()","mongoc_apm_command_started_get_server_id()","mongoc_apm_command_started_t","mongoc_apm_command_succeeded_get_command_name()","mongoc_apm_command_succeeded_get_context()","mongoc_apm_command_succeeded_get_duration()","mongoc_apm_command_succeeded_get_host()","mongoc_apm_command_succeeded_get_operation_id()","mongoc_apm_command_succeeded_get_reply()","mongoc_apm_command_succeeded_get_request_id()","mongoc_apm_command_succeeded_get_server_id()","mongoc_apm_command_succeeded_t","mongoc_apm_server_changed_get_context()","mongoc_apm_server_changed_get_host()","mongoc_apm_server_changed_get_new_description()","mongoc_apm_server_changed_get_previous_description()","mongoc_apm_server_changed_get_topology_id()","mongoc_apm_server_changed_t","mongoc_apm_server_closed_get_context()","mongoc_apm_server_closed_get_host()","mongoc_apm_server_closed_get_topology_id()","mongoc_apm_server_closed_t","mongoc_apm_server_heartbeat_failed_get_context()","mongoc_apm_server_heartbeat_failed_get_duration()","mongoc_apm_server_heartbeat_failed_get_error()","mongoc_apm_server_heartbeat_failed_get_host()","mongoc_apm_server_heartbeat_failed_t","mongoc_apm_server_heartbeat_started_get_context()","mongoc_apm_server_heartbeat_started_get_host()","mongoc_apm_server_heartbeat_started_t","mongoc_apm_server_heartbeat_succeeded_get_context()","mongoc_apm_server_heartbeat_succeeded_get_duration()","mongoc_apm_server_heartbeat_succeeded_get_host()","mongoc_apm_server_heartbeat_succeeded_get_reply()","mongoc_apm_server_heartbeat_succeeded_t","mongoc_apm_server_opening_get_context()","mongoc_apm_server_opening_get_host()","mongoc_apm_server_opening_get_topology_id()","mongoc_apm_server_opening_t","mongoc_apm_set_command_failed_cb()","mongoc_apm_set_command_started_cb()","mongoc_apm_set_command_succeeded_cb()","mongoc_apm_set_server_changed_cb()","mongoc_apm_set_server_closed_cb()","mongoc_apm_set_server_heartbeat_failed_cb()","mongoc_apm_set_server_heartbeat_started_cb()","mongoc_apm_set_server_heartbeat_succeeded_cb()","mongoc_apm_set_server_opening_cb()","mongoc_apm_set_topology_changed_cb()","mongoc_apm_set_topology_closed_cb()","mongoc_apm_set_topology_opening_cb()","mongoc_apm_topology_changed_get_context()","mongoc_apm_topology_changed_get_new_description()","mongoc_apm_topology_changed_get_previous_description()","mongoc_apm_topology_changed_get_topology_id()","mongoc_apm_topology_changed_t","mongoc_apm_topology_closed_get_context()","mongoc_apm_topology_closed_get_topology_id()","mongoc_apm_topology_closed_t","mongoc_apm_topology_opening_get_context()","mongoc_apm_topology_opening_get_topology_id()","mongoc_apm_topology_opening_t","mongoc_bulk_operation_delete()","mongoc_bulk_operation_delete_one()","mongoc_bulk_operation_destroy()","mongoc_bulk_operation_execute()","mongoc_bulk_operation_get_hint()","mongoc_bulk_operation_get_write_concern()","mongoc_bulk_operation_insert()","mongoc_bulk_operation_insert_with_opts()","mongoc_bulk_operation_remove()","mongoc_bulk_operation_remove_many_with_opts()","mongoc_bulk_operation_remove_one()","mongoc_bulk_operation_remove_one_with_opts()","mongoc_bulk_operation_replace_one()","mongoc_bulk_operation_replace_one_with_opts()","mongoc_bulk_operation_set_bypass_document_validation()","mongoc_bulk_operation_set_hint()","mongoc_bulk_operation_t","mongoc_bulk_operation_update()","mongoc_bulk_operation_update_many_with_opts()","mongoc_bulk_operation_update_one()","mongoc_bulk_operation_update_one_with_opts()","mongoc_change_stream_destroy()","mongoc_change_stream_error_document()","mongoc_change_stream_next()","mongoc_change_stream_t","mongoc_check_version()","mongoc_cleanup()","mongoc_client_command()","mongoc_client_command_simple()","mongoc_client_command_simple_with_server_id()","mongoc_client_command_with_opts()","mongoc_client_destroy()","mongoc_client_find_databases_with_opts()","mongoc_client_get_collection()","mongoc_client_get_database()","mongoc_client_get_database_names()","mongoc_client_get_database_names_with_opts()","mongoc_client_get_default_database()","mongoc_client_get_gridfs()","mongoc_client_get_max_bson_size()","mongoc_client_get_max_message_size()","mongoc_client_get_read_concern()","mongoc_client_get_read_prefs()","mongoc_client_get_server_description()","mongoc_client_get_server_descriptions()","mongoc_client_get_server_status()","mongoc_client_get_uri()","mongoc_client_get_write_concern()","mongoc_client_new()","mongoc_client_new_from_uri()","mongoc_client_pool_destroy()","mongoc_client_pool_max_size()","mongoc_client_pool_min_size()","mongoc_client_pool_new()","mongoc_client_pool_pop()","mongoc_client_pool_push()","mongoc_client_pool_set_apm_callbacks()","mongoc_client_pool_set_appname()","mongoc_client_pool_set_error_api()","mongoc_client_pool_set_ssl_opts()","mongoc_client_pool_t","mongoc_client_pool_try_pop()","mongoc_client_read_command_with_opts()","mongoc_client_read_write_command_with_opts()","mongoc_client_select_server()","mongoc_client_session_abort_transaction()","mongoc_client_session_advance_cluster_time()","mongoc_client_session_advance_operation_time()","mongoc_client_session_append()","mongoc_client_session_commit_transaction()","mongoc_client_session_destroy()","mongoc_client_session_get_client()","mongoc_client_session_get_cluster_time()","mongoc_client_session_get_lsid()","mongoc_client_session_get_operation_time()","mongoc_client_session_get_opts()","mongoc_client_session_in_transaction()","mongoc_client_session_start_transaction()","mongoc_client_session_t","mongoc_client_set_apm_callbacks()","mongoc_client_set_appname()","mongoc_client_set_error_api()","mongoc_client_set_read_concern()","mongoc_client_set_read_prefs()","mongoc_client_set_ssl_opts()","mongoc_client_set_stream_initiator()","mongoc_client_set_write_concern()","mongoc_client_start_session()","mongoc_client_t","mongoc_client_watch()","mongoc_client_write_command_with_opts()","mongoc_collection_aggregate()","mongoc_collection_command()","mongoc_collection_command_simple()","mongoc_collection_command_with_opts()","mongoc_collection_copy()","mongoc_collection_count()","mongoc_collection_count_documents()","mongoc_collection_count_with_opts()","mongoc_collection_create_bulk_operation()","mongoc_collection_create_bulk_operation_with_opts()","mongoc_collection_create_index()","mongoc_collection_create_index_with_opts()","mongoc_collection_delete()","mongoc_collection_delete_many()","mongoc_collection_delete_one()","mongoc_collection_destroy()","mongoc_collection_drop()","mongoc_collection_drop_index()","mongoc_collection_drop_index_with_opts()","mongoc_collection_drop_with_opts()","mongoc_collection_ensure_index()","mongoc_collection_estimated_document_count()","mongoc_collection_find()","mongoc_collection_find_and_modify()","mongoc_collection_find_and_modify_with_opts()","mongoc_collection_find_indexes()","mongoc_collection_find_indexes_with_opts()","mongoc_collection_find_with_opts()","mongoc_collection_get_last_error()","mongoc_collection_get_name()","mongoc_collection_get_read_concern()","mongoc_collection_get_read_prefs()","mongoc_collection_get_write_concern()","mongoc_collection_insert()","mongoc_collection_insert_bulk()","mongoc_collection_insert_many()","mongoc_collection_insert_one()","mongoc_collection_keys_to_index_string()","mongoc_collection_read_command_with_opts()","mongoc_collection_read_write_command_with_opts()","mongoc_collection_remove()","mongoc_collection_rename()","mongoc_collection_rename_with_opts()","mongoc_collection_replace_one()","mongoc_collection_save()","mongoc_collection_set_read_concern()","mongoc_collection_set_read_prefs()","mongoc_collection_set_write_concern()","mongoc_collection_stats()","mongoc_collection_t","mongoc_collection_update()","mongoc_collection_update_many()","mongoc_collection_update_one()","mongoc_collection_validate()","mongoc_collection_watch()","mongoc_collection_write_command_with_opts()","mongoc_cursor_clone()","mongoc_cursor_current()","mongoc_cursor_destroy()","mongoc_cursor_error()","mongoc_cursor_error_document()","mongoc_cursor_get_batch_size()","mongoc_cursor_get_hint()","mongoc_cursor_get_host()","mongoc_cursor_get_id()","mongoc_cursor_get_limit()","mongoc_cursor_get_max_await_time_ms()","mongoc_cursor_is_alive()","mongoc_cursor_more()","mongoc_cursor_new_from_command_reply()","mongoc_cursor_new_from_command_reply_with_opts()","mongoc_cursor_next()","mongoc_cursor_set_batch_size()","mongoc_cursor_set_hint()","mongoc_cursor_set_limit()","mongoc_cursor_set_max_await_time_ms()","mongoc_cursor_t","mongoc_database_add_user()","mongoc_database_command()","mongoc_database_command_simple()","mongoc_database_command_with_opts()","mongoc_database_copy()","mongoc_database_create_collection()","mongoc_database_destroy()","mongoc_database_drop()","mongoc_database_drop_with_opts()","mongoc_database_find_collections()","mongoc_database_find_collections_with_opts()","mongoc_database_get_collection()","mongoc_database_get_collection_names()","mongoc_database_get_collection_names_with_opts()","mongoc_database_get_name()","mongoc_database_get_read_concern()","mongoc_database_get_read_prefs()","mongoc_database_get_write_concern()","mongoc_database_has_collection()","mongoc_database_read_command_with_opts()","mongoc_database_read_write_command_with_opts()","mongoc_database_remove_all_users()","mongoc_database_remove_user()","mongoc_database_set_read_concern()","mongoc_database_set_read_prefs()","mongoc_database_set_write_concern()","mongoc_database_t","mongoc_database_watch()","mongoc_database_write_command_with_opts()","mongoc_delete_flags_t","mongoc_error_has_label()","mongoc_find_and_modify_opts_append()","mongoc_find_and_modify_opts_destroy()","mongoc_find_and_modify_opts_get_bypass_document_validation()","mongoc_find_and_modify_opts_get_fields()","mongoc_find_and_modify_opts_get_flags()","mongoc_find_and_modify_opts_get_max_time_ms()","mongoc_find_and_modify_opts_get_sort()","mongoc_find_and_modify_opts_get_update()","mongoc_find_and_modify_opts_new()","mongoc_find_and_modify_opts_set_bypass_document_validation()","mongoc_find_and_modify_opts_set_fields()","mongoc_find_and_modify_opts_set_flags()","mongoc_find_and_modify_opts_set_max_time_ms()","mongoc_find_and_modify_opts_set_sort()","mongoc_find_and_modify_opts_set_update()","mongoc_find_and_modify_opts_t","mongoc_get_major_version()","mongoc_get_micro_version()","mongoc_get_minor_version()","mongoc_get_version()","mongoc_gridfs_create_file()","mongoc_gridfs_create_file_from_stream()","mongoc_gridfs_destroy()","mongoc_gridfs_drop()","mongoc_gridfs_file_destroy()","mongoc_gridfs_file_error()","mongoc_gridfs_file_get_aliases()","mongoc_gridfs_file_get_chunk_size()","mongoc_gridfs_file_get_content_type()","mongoc_gridfs_file_get_filename()","mongoc_gridfs_file_get_id()","mongoc_gridfs_file_get_length()","mongoc_gridfs_file_get_md5()","mongoc_gridfs_file_get_metadata()","mongoc_gridfs_file_get_upload_date()","mongoc_gridfs_file_list_destroy()","mongoc_gridfs_file_list_error()","mongoc_gridfs_file_list_next()","mongoc_gridfs_file_list_t","mongoc_gridfs_file_opt_t","mongoc_gridfs_file_readv()","mongoc_gridfs_file_remove()","mongoc_gridfs_file_save()","mongoc_gridfs_file_seek()","mongoc_gridfs_file_set_aliases()","mongoc_gridfs_file_set_content_type()","mongoc_gridfs_file_set_filename()","mongoc_gridfs_file_set_id()","mongoc_gridfs_file_set_md5()","mongoc_gridfs_file_set_metadata()","mongoc_gridfs_file_t","mongoc_gridfs_file_tell()","mongoc_gridfs_file_writev()","mongoc_gridfs_find()","mongoc_gridfs_find_one()","mongoc_gridfs_find_one_by_filename()","mongoc_gridfs_find_one_with_opts()","mongoc_gridfs_find_with_opts()","mongoc_gridfs_get_chunks()","mongoc_gridfs_get_files()","mongoc_gridfs_remove_by_filename()","mongoc_gridfs_t","mongoc_host_list_t","mongoc_index_opt_geo_get_default()","mongoc_index_opt_geo_init()","mongoc_index_opt_geo_t","mongoc_index_opt_get_default()","mongoc_index_opt_init()","mongoc_index_opt_t","mongoc_index_opt_wt_get_default()","mongoc_index_opt_wt_init()","mongoc_index_opt_wt_t","mongoc_init()","mongoc_insert_flags_t","mongoc_iovec_t","mongoc_matcher_destroy()","mongoc_matcher_match()","mongoc_matcher_new()","mongoc_matcher_t","mongoc_query_flags_t","mongoc_rand","mongoc_rand_add()","mongoc_rand_seed()","mongoc_rand_status()","mongoc_read_concern_append()","mongoc_read_concern_copy()","mongoc_read_concern_destroy()","mongoc_read_concern_get_level()","mongoc_read_concern_is_default()","mongoc_read_concern_new()","mongoc_read_concern_set_level()","mongoc_read_concern_t","mongoc_read_mode_t","mongoc_read_prefs_add_tag()","mongoc_read_prefs_copy()","mongoc_read_prefs_destroy()","mongoc_read_prefs_get_max_staleness_seconds()","mongoc_read_prefs_get_mode()","mongoc_read_prefs_get_tags()","mongoc_read_prefs_is_valid()","mongoc_read_prefs_new()","mongoc_read_prefs_set_max_staleness_seconds()","mongoc_read_prefs_set_mode()","mongoc_read_prefs_set_tags()","mongoc_read_prefs_t","mongoc_remove_flags_t","mongoc_reply_flags_t","mongoc_server_description_destroy()","mongoc_server_description_host()","mongoc_server_description_id()","mongoc_server_description_ismaster()","mongoc_server_description_new_copy()","mongoc_server_description_round_trip_time()","mongoc_server_description_t","mongoc_server_description_type()","mongoc_server_descriptions_destroy_all()","mongoc_session_opt_t","mongoc_session_opts_clone()","mongoc_session_opts_destroy()","mongoc_session_opts_get_causal_consistency()","mongoc_session_opts_get_default_transaction_opts()","mongoc_session_opts_new()","mongoc_session_opts_set_causal_consistency()","mongoc_session_opts_set_default_transaction_opts()","mongoc_socket_accept()","mongoc_socket_bind()","mongoc_socket_close()","mongoc_socket_connect()","mongoc_socket_destroy()","mongoc_socket_errno()","mongoc_socket_getnameinfo()","mongoc_socket_getsockname()","mongoc_socket_listen()","mongoc_socket_new()","mongoc_socket_recv()","mongoc_socket_send()","mongoc_socket_sendv()","mongoc_socket_setsockopt()","mongoc_socket_t","mongoc_ssl_opt_get_default()","mongoc_ssl_opt_t","mongoc_stream_buffered_new()","mongoc_stream_buffered_t","mongoc_stream_close()","mongoc_stream_cork()","mongoc_stream_destroy()","mongoc_stream_file_get_fd()","mongoc_stream_file_new()","mongoc_stream_file_new_for_path()","mongoc_stream_file_t","mongoc_stream_flush()","mongoc_stream_get_base_stream()","mongoc_stream_gridfs_new()","mongoc_stream_read()","mongoc_stream_readv()","mongoc_stream_setsockopt()","mongoc_stream_socket_get_socket()","mongoc_stream_socket_new()","mongoc_stream_socket_t","mongoc_stream_t","mongoc_stream_timed_out()","mongoc_stream_tls_t","mongoc_stream_uncork()","mongoc_stream_write()","mongoc_stream_writev()","mongoc_topology_description_get_servers()","mongoc_topology_description_has_readable_server()","mongoc_topology_description_has_writable_server()","mongoc_topology_description_t","mongoc_topology_description_type()","mongoc_transaction_opt_t","mongoc_transaction_opts_clone()","mongoc_transaction_opts_destroy()","mongoc_transaction_opts_get_read_concern()","mongoc_transaction_opts_get_read_prefs()","mongoc_transaction_opts_get_write_concern()","mongoc_transaction_opts_new()","mongoc_transaction_opts_set_read_concern()","mongoc_transaction_opts_set_read_prefs()","mongoc_transaction_opts_set_write_concern()","mongoc_update_flags_t","mongoc_uri_copy()","mongoc_uri_destroy()","mongoc_uri_get_auth_mechanism()","mongoc_uri_get_auth_source()","mongoc_uri_get_compressors()","mongoc_uri_get_database()","mongoc_uri_get_hosts()","mongoc_uri_get_mechanism_properties()","mongoc_uri_get_option_as_bool()","mongoc_uri_get_option_as_int32()","mongoc_uri_get_option_as_utf8()","mongoc_uri_get_options()","mongoc_uri_get_password()","mongoc_uri_get_read_concern()","mongoc_uri_get_read_prefs()","mongoc_uri_get_read_prefs_t()","mongoc_uri_get_replica_set()","mongoc_uri_get_service()","mongoc_uri_get_ssl()","mongoc_uri_get_string()","mongoc_uri_get_username()","mongoc_uri_get_write_concern()","mongoc_uri_new()","mongoc_uri_new_for_host_port()","mongoc_uri_new_with_error()","mongoc_uri_option_is_bool()","mongoc_uri_option_is_int32()","mongoc_uri_option_is_utf8()","mongoc_uri_set_auth_mechanism()","mongoc_uri_set_auth_source()","mongoc_uri_set_compressors()","mongoc_uri_set_database()","mongoc_uri_set_mechanism_properties()","mongoc_uri_set_option_as_bool()","mongoc_uri_set_option_as_int32()","mongoc_uri_set_option_as_utf8()","mongoc_uri_set_password()","mongoc_uri_set_read_concern()","mongoc_uri_set_read_prefs_t()","mongoc_uri_set_username()","mongoc_uri_set_write_concern()","mongoc_uri_t","mongoc_uri_unescape()","Version Checks","mongoc_write_concern_append()","mongoc_write_concern_copy()","mongoc_write_concern_destroy()","mongoc_write_concern_get_fsync()","mongoc_write_concern_get_journal()","mongoc_write_concern_get_w()","mongoc_write_concern_get_wmajority()","mongoc_write_concern_get_wtag()","mongoc_write_concern_get_wtimeout()","mongoc_write_concern_is_acknowledged()","mongoc_write_concern_is_default()","mongoc_write_concern_is_valid()","mongoc_write_concern_journal_is_set()","mongoc_write_concern_new()","mongoc_write_concern_set_fsync()","mongoc_write_concern_set_journal()","mongoc_write_concern_set_w()","mongoc_write_concern_set_wmajority()","mongoc_write_concern_set_wtag()","mongoc_write_concern_set_wtimeout()","mongoc_write_concern_t","Tutorial","Using libmongoc in a Microsoft Visual Studio project"],titleterms:{"function":[3,12,24,34,43,52,58,62,67,70,75,79,96,99,102,119,127,163,181,191,200,243,270,297,317,340,341,352,363,367,370,373,380,382,393,406,415,418,440,442,451,460,461,463,470,472,524,547],"return":[23,25,26,27,29,30,31,32,33,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,53,54,55,56,57,59,60,61,63,64,66,68,69,71,72,73,74,76,77,78,92,93,94,95,97,98,100,101,106,108,110,112,114,116,121,123,125,126,128,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,156,157,159,160,161,164,165,166,167,168,171,172,175,176,178,179,180,182,183,184,190,192,193,194,195,196,197,198,199,200,201,202,203,205,206,207,208,212,213,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,236,237,238,242,244,245,246,247,248,249,250,251,253,254,261,262,263,264,265,267,268,271,272,273,274,275,276,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,298,299,301,302,304,306,307,310,311,312,313,314,315,316,318,319,320,321,322,323,325,327,328,329,330,331,332,333,334,335,336,338,339,342,343,344,345,349,353,354,355,356,357,358,359,360,361,362,365,368,371,378,379,385,386,387,389,391,392,396,399,400,401,402,410,412,413,426,427,428,429,431,432,433,434,435,436,437,438,439,441,443,445,446,448,449,450,452,453,454,455,456,457,458,459,462,464,465,466,467,468,469,483,485,486,487,488,489,490,494,495,496,497,498,499,500,501,502,503,504,505,506,507,511,512,513,514,515,516,517,518,519,522,525,527,528,530,531,532,533,534,535,540],"static":549,TLS:442,The:[216,221],Use:548,Using:[548,549],addit:0,address:0,advanc:0,aggreg:1,aid:10,also:[4,12,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,106,109,111,112,113,114,115,116,117,119,120,121,122,123,151,159,168,169,170,172,173,174,175,176,177,178,180,182,190,192,200,202,203,215,216,221,237,245,246,248,253,254,262,269,281,298,364,367,370,373,419,420,421,422,423,424,425,442,444,445,446,455,456,461,464,465,468,469,473,474,475,476,477,478,479,480,481,485,486,490,511,512,515],api:[2,12],apm:3,append:[302,548],applic:3,authent:[4,442,524],automat:16,avail:[162,187],averag:1,basic:[4,5,11,20,193,249,299,548],bcon:548,bson:[17,548],bug:5,build:17,bulk:6,bypass:6,bypassdocumentvalid:311,certif:[4,442],channel:442,check:526,checklist:5,citi:1,cleanup:16,client:[18,20,442],clonecollect:21,cluster:0,cmake:548,code:1,collat:6,collect:18,command:[3,11,21,216,221,548],common:21,complic:11,compress:0,concern:[6,243,393,524,547],config:548,configur:442,connect:[0,7,524,548],content:548,copydb:21,count:[200,548],counter:5,creat:[8,548],crud:548,cursor:9,custom:19,darwin:442,data:[0,1],databas:18,debug:10,delet:548,deprec:[16,20,103,104,138,142,143,148,199,200,201,202,204,205,206,214,216,219,221,228,238,242,247,261,263,280,283,300,355,356,370,377,378,379,380,497,530,541,547],descript:[12,107,108,117,118,129,130,138,171,194,196,198,199,200,201,202,203,205,206,207,208,209,210,211,212,213,215,216,217,218,221,222,223,224,225,226,227,228,229,230,231,234,235,236,237,238,239,240,241,242,244,245,246,247,250,251,252,253,254,255,256,257,258,259,260,262,263,264,265,266,267,268,269,272,275,276,278,279,280,283,302,303,305,308,309,311,312,313,314,315,316,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,366,367,369,370,372,373,374,375,381,382,383,384,385,386,387,388,389,390,392,394,395,396,397,398,399,400,401,402,403,404,405,407,408,409,410,411,412,413,414,416,426,427,428,429,430,431,432,433,434,435,436,437,438,439,442,444,471,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,541,542,543,544,545,546],destroi:9,disabl:19,discoveri:524,distinct:11,document:[6,17,20,548],domain:0,driver:[15,17],entropi:382,error:[12,103,104,106,109,110,111,112,113,114,115,116,120,121,123,131,133,135,138,139,141,148,165,166,190,193,196,197,199,200,201,202,203,205,206,207,208,212,213,214,215,217,218,219,220,227,228,229,230,232,233,234,236,237,238,242,244,245,246,247,249,253,254,271,273,274,276,279,280,281,283,284,289,290,291,292,293,299,325,327,338,343,345,356,357,358,362,379],exampl:[1,3,8,11,21,127,133,139,140,163,165,166,171,180,181,191,193,194,196,197,199,200,201,215,216,217,218,221,232,233,246,249,254,270,274,281,284,290,291,297,299,317,340,363,370,380,386,405,420,424,472,487,490,507,513,515,524,527],execut:548,explain:[21,216,221],failur:9,featur:16,field:312,find:[216,548],findandmodifi:302,flag:[313,375,381,407,408,482],format:524,framework:1,from:[0,17,200,548],further:6,gdb:10,gener:17,git:17,gridf:18,gssapi:4,guid:14,handl:9,handler:19,header:548,includ:548,index:[8,13],initi:16,insert:[6,548],instal:[17,548],introduct:15,ipv4:[0,524],ipv6:[0,524],json:548,kerbero:4,label:12,legaci:[4,524],level:[393,547],libbson:17,libmongoc:[17,548,549],librari:17,libressl:442,libtl:442,lifecycl:[18,265,363,415],link:[548,549],lldb:10,log:19,maco:[17,442],macro:19,make:548,manag:17,manual:548,mapreduc:11,match:20,max:406,maxtimem:314,mechan:524,microsoft:[548,549],migrat:200,million:1,mingw:17,mix:6,mode:[7,406],mongoc:548,mongoc_apm_callbacks_destroi:22,mongoc_apm_callbacks_new:23,mongoc_apm_callbacks_t:24,mongoc_apm_command_failed_get_command_nam:25,mongoc_apm_command_failed_get_context:26,mongoc_apm_command_failed_get_dur:27,mongoc_apm_command_failed_get_error:28,mongoc_apm_command_failed_get_host:29,mongoc_apm_command_failed_get_operation_id:30,mongoc_apm_command_failed_get_repli:31,mongoc_apm_command_failed_get_request_id:32,mongoc_apm_command_failed_get_server_id:33,mongoc_apm_command_failed_t:34,mongoc_apm_command_started_get_command:35,mongoc_apm_command_started_get_command_nam:36,mongoc_apm_command_started_get_context:37,mongoc_apm_command_started_get_database_nam:38,mongoc_apm_command_started_get_host:39,mongoc_apm_command_started_get_operation_id:40,mongoc_apm_command_started_get_request_id:41,mongoc_apm_command_started_get_server_id:42,mongoc_apm_command_started_t:43,mongoc_apm_command_succeeded_get_command_nam:44,mongoc_apm_command_succeeded_get_context:45,mongoc_apm_command_succeeded_get_dur:46,mongoc_apm_command_succeeded_get_host:47,mongoc_apm_command_succeeded_get_operation_id:48,mongoc_apm_command_succeeded_get_repli:49,mongoc_apm_command_succeeded_get_request_id:50,mongoc_apm_command_succeeded_get_server_id:51,mongoc_apm_command_succeeded_t:52,mongoc_apm_server_changed_get_context:53,mongoc_apm_server_changed_get_host:54,mongoc_apm_server_changed_get_new_descript:55,mongoc_apm_server_changed_get_previous_descript:56,mongoc_apm_server_changed_get_topology_id:57,mongoc_apm_server_changed_t:58,mongoc_apm_server_closed_get_context:59,mongoc_apm_server_closed_get_host:60,mongoc_apm_server_closed_get_topology_id:61,mongoc_apm_server_closed_t:62,mongoc_apm_server_heartbeat_failed_get_context:63,mongoc_apm_server_heartbeat_failed_get_dur:64,mongoc_apm_server_heartbeat_failed_get_error:65,mongoc_apm_server_heartbeat_failed_get_host:66,mongoc_apm_server_heartbeat_failed_t:67,mongoc_apm_server_heartbeat_started_get_context:68,mongoc_apm_server_heartbeat_started_get_host:69,mongoc_apm_server_heartbeat_started_t:70,mongoc_apm_server_heartbeat_succeeded_get_context:71,mongoc_apm_server_heartbeat_succeeded_get_dur:72,mongoc_apm_server_heartbeat_succeeded_get_host:73,mongoc_apm_server_heartbeat_succeeded_get_repli:74,mongoc_apm_server_heartbeat_succeeded_t:75,mongoc_apm_server_opening_get_context:76,mongoc_apm_server_opening_get_host:77,mongoc_apm_server_opening_get_topology_id:78,mongoc_apm_server_opening_t:79,mongoc_apm_set_command_failed_cb:80,mongoc_apm_set_command_started_cb:81,mongoc_apm_set_command_succeeded_cb:82,mongoc_apm_set_server_changed_cb:83,mongoc_apm_set_server_closed_cb:84,mongoc_apm_set_server_heartbeat_failed_cb:85,mongoc_apm_set_server_heartbeat_started_cb:86,mongoc_apm_set_server_heartbeat_succeeded_cb:87,mongoc_apm_set_server_opening_cb:88,mongoc_apm_set_topology_changed_cb:89,mongoc_apm_set_topology_closed_cb:90,mongoc_apm_set_topology_opening_cb:91,mongoc_apm_topology_changed_get_context:92,mongoc_apm_topology_changed_get_new_descript:93,mongoc_apm_topology_changed_get_previous_descript:94,mongoc_apm_topology_changed_get_topology_id:95,mongoc_apm_topology_changed_t:96,mongoc_apm_topology_closed_get_context:97,mongoc_apm_topology_closed_get_topology_id:98,mongoc_apm_topology_closed_t:99,mongoc_apm_topology_opening_get_context:100,mongoc_apm_topology_opening_get_topology_id:101,mongoc_apm_topology_opening_t:102,mongoc_bulk_operation_delet:103,mongoc_bulk_operation_delete_on:104,mongoc_bulk_operation_destroi:105,mongoc_bulk_operation_execut:106,mongoc_bulk_operation_get_hint:107,mongoc_bulk_operation_get_write_concern:108,mongoc_bulk_operation_insert:109,mongoc_bulk_operation_insert_with_opt:110,mongoc_bulk_operation_remov:111,mongoc_bulk_operation_remove_many_with_opt:112,mongoc_bulk_operation_remove_on:113,mongoc_bulk_operation_remove_one_with_opt:114,mongoc_bulk_operation_replace_on:115,mongoc_bulk_operation_replace_one_with_opt:116,mongoc_bulk_operation_set_bypass_document_valid:117,mongoc_bulk_operation_set_hint:118,mongoc_bulk_operation_t:119,mongoc_bulk_operation_upd:120,mongoc_bulk_operation_update_many_with_opt:121,mongoc_bulk_operation_update_on:122,mongoc_bulk_operation_update_one_with_opt:123,mongoc_change_stream_destroi:124,mongoc_change_stream_error_docu:125,mongoc_change_stream_next:126,mongoc_change_stream_t:127,mongoc_check_vers:128,mongoc_cleanup:129,mongoc_client_command:130,mongoc_client_command_simpl:131,mongoc_client_command_simple_with_server_id:132,mongoc_client_command_with_opt:133,mongoc_client_destroi:134,mongoc_client_find_databases_with_opt:135,mongoc_client_get_collect:136,mongoc_client_get_databas:137,mongoc_client_get_database_nam:138,mongoc_client_get_database_names_with_opt:139,mongoc_client_get_default_databas:140,mongoc_client_get_gridf:141,mongoc_client_get_max_bson_s:142,mongoc_client_get_max_message_s:143,mongoc_client_get_read_concern:144,mongoc_client_get_read_pref:145,mongoc_client_get_server_descript:[146,147],mongoc_client_get_server_statu:148,mongoc_client_get_uri:149,mongoc_client_get_write_concern:150,mongoc_client_new:151,mongoc_client_new_from_uri:152,mongoc_client_pool_destroi:153,mongoc_client_pool_max_s:154,mongoc_client_pool_min_s:155,mongoc_client_pool_new:156,mongoc_client_pool_pop:157,mongoc_client_pool_push:158,mongoc_client_pool_set_apm_callback:159,mongoc_client_pool_set_appnam:160,mongoc_client_pool_set_error_api:161,mongoc_client_pool_set_ssl_opt:162,mongoc_client_pool_t:163,mongoc_client_pool_try_pop:164,mongoc_client_read_command_with_opt:165,mongoc_client_read_write_command_with_opt:166,mongoc_client_select_serv:167,mongoc_client_session_abort_transact:168,mongoc_client_session_advance_cluster_tim:169,mongoc_client_session_advance_operation_tim:170,mongoc_client_session_append:171,mongoc_client_session_commit_transact:172,mongoc_client_session_destroi:173,mongoc_client_session_get_cli:174,mongoc_client_session_get_cluster_tim:175,mongoc_client_session_get_lsid:176,mongoc_client_session_get_operation_tim:177,mongoc_client_session_get_opt:178,mongoc_client_session_in_transact:179,mongoc_client_session_start_transact:180,mongoc_client_session_t:181,mongoc_client_set_apm_callback:182,mongoc_client_set_appnam:183,mongoc_client_set_error_api:184,mongoc_client_set_read_concern:185,mongoc_client_set_read_pref:186,mongoc_client_set_ssl_opt:187,mongoc_client_set_stream_initi:188,mongoc_client_set_write_concern:189,mongoc_client_start_sess:190,mongoc_client_t:191,mongoc_client_watch:192,mongoc_client_write_command_with_opt:193,mongoc_collection_aggreg:194,mongoc_collection_command:195,mongoc_collection_command_simpl:196,mongoc_collection_command_with_opt:197,mongoc_collection_copi:198,mongoc_collection_count:199,mongoc_collection_count_docu:200,mongoc_collection_count_with_opt:201,mongoc_collection_create_bulk_oper:202,mongoc_collection_create_bulk_operation_with_opt:203,mongoc_collection_create_index:204,mongoc_collection_create_index_with_opt:205,mongoc_collection_delet:206,mongoc_collection_delete_mani:207,mongoc_collection_delete_on:208,mongoc_collection_destroi:209,mongoc_collection_drop:210,mongoc_collection_drop_index:211,mongoc_collection_drop_index_with_opt:212,mongoc_collection_drop_with_opt:213,mongoc_collection_ensure_index:214,mongoc_collection_estimated_document_count:215,mongoc_collection_find:216,mongoc_collection_find_and_modifi:217,mongoc_collection_find_and_modify_with_opt:218,mongoc_collection_find_index:219,mongoc_collection_find_indexes_with_opt:220,mongoc_collection_find_with_opt:221,mongoc_collection_get_last_error:222,mongoc_collection_get_nam:223,mongoc_collection_get_read_concern:224,mongoc_collection_get_read_pref:225,mongoc_collection_get_write_concern:226,mongoc_collection_insert:227,mongoc_collection_insert_bulk:228,mongoc_collection_insert_mani:229,mongoc_collection_insert_on:230,mongoc_collection_keys_to_index_str:231,mongoc_collection_read_command_with_opt:232,mongoc_collection_read_write_command_with_opt:233,mongoc_collection_remov:234,mongoc_collection_renam:235,mongoc_collection_rename_with_opt:236,mongoc_collection_replace_on:237,mongoc_collection_sav:238,mongoc_collection_set_read_concern:239,mongoc_collection_set_read_pref:240,mongoc_collection_set_write_concern:241,mongoc_collection_stat:242,mongoc_collection_t:243,mongoc_collection_upd:244,mongoc_collection_update_mani:245,mongoc_collection_update_on:246,mongoc_collection_valid:247,mongoc_collection_watch:248,mongoc_collection_write_command_with_opt:249,mongoc_cursor_clon:250,mongoc_cursor_curr:251,mongoc_cursor_destroi:252,mongoc_cursor_error:253,mongoc_cursor_error_docu:254,mongoc_cursor_get_batch_s:255,mongoc_cursor_get_hint:256,mongoc_cursor_get_host:257,mongoc_cursor_get_id:258,mongoc_cursor_get_limit:259,mongoc_cursor_get_max_await_time_m:260,mongoc_cursor_is_al:261,mongoc_cursor_mor:262,mongoc_cursor_new_from_command_repli:263,mongoc_cursor_new_from_command_reply_with_opt:264,mongoc_cursor_next:265,mongoc_cursor_set_batch_s:266,mongoc_cursor_set_hint:267,mongoc_cursor_set_limit:268,mongoc_cursor_set_max_await_time_m:269,mongoc_cursor_t:270,mongoc_database_add_us:271,mongoc_database_command:272,mongoc_database_command_simpl:273,mongoc_database_command_with_opt:274,mongoc_database_copi:275,mongoc_database_create_collect:276,mongoc_database_destroi:277,mongoc_database_drop:278,mongoc_database_drop_with_opt:279,mongoc_database_find_collect:280,mongoc_database_find_collections_with_opt:281,mongoc_database_get_collect:282,mongoc_database_get_collection_nam:283,mongoc_database_get_collection_names_with_opt:284,mongoc_database_get_nam:285,mongoc_database_get_read_concern:286,mongoc_database_get_read_pref:287,mongoc_database_get_write_concern:288,mongoc_database_has_collect:289,mongoc_database_read_command_with_opt:290,mongoc_database_read_write_command_with_opt:291,mongoc_database_remove_all_us:292,mongoc_database_remove_us:293,mongoc_database_set_read_concern:294,mongoc_database_set_read_pref:295,mongoc_database_set_write_concern:296,mongoc_database_t:297,mongoc_database_watch:298,mongoc_database_write_command_with_opt:299,mongoc_delete_flags_t:300,mongoc_error_has_label:301,mongoc_find_and_modify_opts_append:302,mongoc_find_and_modify_opts_destroi:303,mongoc_find_and_modify_opts_get_bypass_document_valid:304,mongoc_find_and_modify_opts_get_field:305,mongoc_find_and_modify_opts_get_flag:306,mongoc_find_and_modify_opts_get_max_time_m:307,mongoc_find_and_modify_opts_get_sort:308,mongoc_find_and_modify_opts_get_upd:309,mongoc_find_and_modify_opts_new:310,mongoc_find_and_modify_opts_set_bypass_document_valid:311,mongoc_find_and_modify_opts_set_field:312,mongoc_find_and_modify_opts_set_flag:313,mongoc_find_and_modify_opts_set_max_time_m:314,mongoc_find_and_modify_opts_set_sort:315,mongoc_find_and_modify_opts_set_upd:316,mongoc_find_and_modify_opts_t:317,mongoc_get_major_vers:318,mongoc_get_micro_vers:319,mongoc_get_minor_vers:320,mongoc_get_vers:321,mongoc_gridfs_create_fil:322,mongoc_gridfs_create_file_from_stream:323,mongoc_gridfs_destroi:324,mongoc_gridfs_drop:325,mongoc_gridfs_file_destroi:326,mongoc_gridfs_file_error:327,mongoc_gridfs_file_get_alias:328,mongoc_gridfs_file_get_chunk_s:329,mongoc_gridfs_file_get_content_typ:330,mongoc_gridfs_file_get_filenam:331,mongoc_gridfs_file_get_id:332,mongoc_gridfs_file_get_length:333,mongoc_gridfs_file_get_md5:334,mongoc_gridfs_file_get_metadata:335,mongoc_gridfs_file_get_upload_d:336,mongoc_gridfs_file_list_destroi:337,mongoc_gridfs_file_list_error:338,mongoc_gridfs_file_list_next:339,mongoc_gridfs_file_list_t:340,mongoc_gridfs_file_opt_t:341,mongoc_gridfs_file_readv:342,mongoc_gridfs_file_remov:343,mongoc_gridfs_file_sav:344,mongoc_gridfs_file_seek:345,mongoc_gridfs_file_set_alias:346,mongoc_gridfs_file_set_content_typ:347,mongoc_gridfs_file_set_filenam:348,mongoc_gridfs_file_set_id:349,mongoc_gridfs_file_set_md5:350,mongoc_gridfs_file_set_metadata:351,mongoc_gridfs_file_t:352,mongoc_gridfs_file_tel:353,mongoc_gridfs_file_writev:354,mongoc_gridfs_find:355,mongoc_gridfs_find_on:356,mongoc_gridfs_find_one_by_filenam:357,mongoc_gridfs_find_one_with_opt:358,mongoc_gridfs_find_with_opt:359,mongoc_gridfs_get_chunk:360,mongoc_gridfs_get_fil:361,mongoc_gridfs_remove_by_filenam:362,mongoc_gridfs_t:363,mongoc_host_list_t:364,mongoc_index_opt_geo_get_default:365,mongoc_index_opt_geo_init:366,mongoc_index_opt_geo_t:367,mongoc_index_opt_get_default:368,mongoc_index_opt_init:369,mongoc_index_opt_t:370,mongoc_index_opt_wt_get_default:371,mongoc_index_opt_wt_init:372,mongoc_index_opt_wt_t:373,mongoc_init:374,mongoc_insert_flags_t:375,mongoc_iovec_t:376,mongoc_matcher_destroi:377,mongoc_matcher_match:378,mongoc_matcher_new:379,mongoc_matcher_t:380,mongoc_query_flags_t:381,mongoc_rand:382,mongoc_rand_add:383,mongoc_rand_se:384,mongoc_rand_statu:385,mongoc_read_concern_append:386,mongoc_read_concern_copi:387,mongoc_read_concern_destroi:388,mongoc_read_concern_get_level:389,mongoc_read_concern_is_default:390,mongoc_read_concern_new:391,mongoc_read_concern_set_level:392,mongoc_read_concern_t:393,mongoc_read_mode_t:394,mongoc_read_prefs_add_tag:395,mongoc_read_prefs_copi:396,mongoc_read_prefs_destroi:397,mongoc_read_prefs_get_max_staleness_second:398,mongoc_read_prefs_get_mod:399,mongoc_read_prefs_get_tag:400,mongoc_read_prefs_is_valid:401,mongoc_read_prefs_new:402,mongoc_read_prefs_set_max_staleness_second:403,mongoc_read_prefs_set_mod:404,mongoc_read_prefs_set_tag:405,mongoc_read_prefs_t:406,mongoc_remove_flags_t:407,mongoc_reply_flags_t:408,mongoc_server_description_destroi:409,mongoc_server_description_host:410,mongoc_server_description_id:411,mongoc_server_description_ismast:412,mongoc_server_description_new_copi:413,mongoc_server_description_round_trip_tim:414,mongoc_server_description_t:415,mongoc_server_description_typ:416,mongoc_server_descriptions_destroy_al:417,mongoc_session_opt_t:418,mongoc_session_opts_clon:419,mongoc_session_opts_destroi:420,mongoc_session_opts_get_causal_consist:421,mongoc_session_opts_get_default_transaction_opt:422,mongoc_session_opts_new:423,mongoc_session_opts_set_causal_consist:424,mongoc_session_opts_set_default_transaction_opt:425,mongoc_socket_accept:426,mongoc_socket_bind:427,mongoc_socket_clos:428,mongoc_socket_connect:429,mongoc_socket_destroi:430,mongoc_socket_errno:431,mongoc_socket_getnameinfo:432,mongoc_socket_getsocknam:433,mongoc_socket_listen:434,mongoc_socket_new:435,mongoc_socket_recv:436,mongoc_socket_send:437,mongoc_socket_sendv:438,mongoc_socket_setsockopt:439,mongoc_socket_t:440,mongoc_ssl_opt_get_default:441,mongoc_ssl_opt_t:442,mongoc_stream_buffered_new:443,mongoc_stream_buffered_t:444,mongoc_stream_clos:445,mongoc_stream_cork:446,mongoc_stream_destroi:447,mongoc_stream_file_get_fd:448,mongoc_stream_file_new:449,mongoc_stream_file_new_for_path:450,mongoc_stream_file_t:451,mongoc_stream_flush:452,mongoc_stream_get_base_stream:453,mongoc_stream_gridfs_new:454,mongoc_stream_read:455,mongoc_stream_readv:456,mongoc_stream_setsockopt:457,mongoc_stream_socket_get_socket:458,mongoc_stream_socket_new:459,mongoc_stream_socket_t:460,mongoc_stream_t:461,mongoc_stream_timed_out:462,mongoc_stream_tls_t:463,mongoc_stream_uncork:464,mongoc_stream_writ:465,mongoc_stream_writev:466,mongoc_topology_description_get_serv:467,mongoc_topology_description_has_readable_serv:468,mongoc_topology_description_has_writable_serv:469,mongoc_topology_description_t:470,mongoc_topology_description_typ:471,mongoc_transaction_opt_t:472,mongoc_transaction_opts_clon:473,mongoc_transaction_opts_destroi:474,mongoc_transaction_opts_get_read_concern:475,mongoc_transaction_opts_get_read_pref:476,mongoc_transaction_opts_get_write_concern:477,mongoc_transaction_opts_new:478,mongoc_transaction_opts_set_read_concern:479,mongoc_transaction_opts_set_read_pref:480,mongoc_transaction_opts_set_write_concern:481,mongoc_update_flags_t:482,mongoc_uri_copi:483,mongoc_uri_destroi:484,mongoc_uri_get_auth_mechan:485,mongoc_uri_get_auth_sourc:486,mongoc_uri_get_compressor:487,mongoc_uri_get_databas:488,mongoc_uri_get_host:489,mongoc_uri_get_mechanism_properti:490,mongoc_uri_get_opt:494,mongoc_uri_get_option_as_bool:491,mongoc_uri_get_option_as_int32:492,mongoc_uri_get_option_as_utf8:493,mongoc_uri_get_password:495,mongoc_uri_get_read_concern:496,mongoc_uri_get_read_pref:497,mongoc_uri_get_read_prefs_t:498,mongoc_uri_get_replica_set:499,mongoc_uri_get_servic:500,mongoc_uri_get_ssl:501,mongoc_uri_get_str:502,mongoc_uri_get_usernam:503,mongoc_uri_get_write_concern:504,mongoc_uri_new:505,mongoc_uri_new_for_host_port:506,mongoc_uri_new_with_error:507,mongoc_uri_option_is_bool:508,mongoc_uri_option_is_int32:509,mongoc_uri_option_is_utf8:510,mongoc_uri_set_auth_mechan:511,mongoc_uri_set_auth_sourc:512,mongoc_uri_set_compressor:513,mongoc_uri_set_databas:514,mongoc_uri_set_mechanism_properti:515,mongoc_uri_set_option_as_bool:516,mongoc_uri_set_option_as_int32:517,mongoc_uri_set_option_as_utf8:518,mongoc_uri_set_password:519,mongoc_uri_set_read_concern:520,mongoc_uri_set_read_prefs_t:521,mongoc_uri_set_usernam:522,mongoc_uri_set_write_concern:523,mongoc_uri_t:524,mongoc_uri_unescap:525,mongoc_write_concern_append:527,mongoc_write_concern_copi:528,mongoc_write_concern_destroi:529,mongoc_write_concern_get_fsync:530,mongoc_write_concern_get_journ:531,mongoc_write_concern_get_w:532,mongoc_write_concern_get_wmajor:533,mongoc_write_concern_get_wtag:534,mongoc_write_concern_get_wtimeout:535,mongoc_write_concern_is_acknowledg:536,mongoc_write_concern_is_default:537,mongoc_write_concern_is_valid:538,mongoc_write_concern_journal_is_set:539,mongoc_write_concern_new:540,mongoc_write_concern_set_fsync:541,mongoc_write_concern_set_journ:542,mongoc_write_concern_set_w:543,mongoc_write_concern_set_wmajor:544,mongoc_write_concern_set_wtag:545,mongoc_write_concern_set_wtimeout:546,mongoc_write_concern_t:547,mongodb:[0,4,15,17,548],monitor:[3,524],more:11,msys2:17,nativ:442,next:[548,549],object:18,openssl:442,oper:[6,193,249,299,548],option:[0,221,302,442,524],order:6,other:194,over:[0,1],packag:17,paramet:[25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,53,54,55,56,57,59,60,61,63,64,65,66,68,69,71,72,73,74,76,77,78,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,100,101,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,124,125,126,128,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,271,272,273,274,275,276,277,278,279,280,281,283,284,285,286,287,288,289,290,291,292,293,294,295,296,298,299,301,302,303,304,305,306,307,308,309,311,312,313,314,315,316,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,342,343,344,345,346,347,348,349,350,351,353,354,355,356,357,358,359,360,361,362,366,369,372,377,378,379,383,384,386,387,388,389,390,392,395,396,397,398,399,400,401,402,403,404,405,409,410,411,412,413,414,416,417,419,420,421,422,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,443,445,446,447,448,449,450,452,453,454,455,456,457,458,459,462,464,465,466,467,468,469,471,473,474,475,476,477,479,480,481,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,525,527,528,529,530,531,532,533,534,535,536,537,538,539,541,542,543,544,545,546],path:548,perform:[3,5],pkg:548,plain:4,platform:17,pool:[7,18,524],popul:1,prefer:[243,524],prerequisit:17,program:548,project:[548,549],properti:524,read:[6,243,393,406,524],refer:2,relat:[18,352],releas:17,replica:[0,524],report:[5,12],requir:1,resum:127,run:[11,21,526],safeti:[154,155,157,158,159,160,161,162,164,191,270,352,363],sasl:4,scram:4,sdam:3,secur:442,see:[4,12,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,106,109,111,112,113,114,115,116,117,119,120,121,122,123,151,159,168,169,170,172,173,174,175,176,177,178,180,182,190,192,200,202,203,215,216,221,237,245,246,248,253,254,262,269,281,298,364,367,370,373,419,420,421,422,423,424,425,442,444,445,446,455,456,461,464,465,468,469,473,474,475,476,477,478,479,480,481,485,486,490,511,512,515],select:524,server:[0,9,442,524],session:18,set:[0,1,6,12,311,312,313,314,315,316,406,524],setup:[11,21],sha:4,shard:0,side:[9,20],singl:7,socket:0,sort:315,specifi:548,srv:524,ssl:[0,524],stale:406,start:[127,548],state:1,statu:382,step:[548,549],stream:[191,461],studio:[17,548,549],submit:5,support:[17,442],synopsi:[16,19,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547],tag:406,tailabl:9,tarbal:17,task:21,thread:[154,155,157,158,159,160,161,162,164,191,270,352,363,548],through:442,time:526,trace:19,transienttransactionerror:12,transport:442,troubleshoot:5,tutori:548,type:461,unacknowledg:6,unix:[0,17],unknowntransactioncommitresult:12,unord:6,updat:[316,548],uri:442,using:1,valid:6,valu:[375,381,407,408,482],verif:442,version:[12,526],visual:[17,548,549],w64:17,window:[17,442],write:[6,193,243,249,299,524,547],your:548,zip:1}}) \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/tutorial.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/tutorial.html new file mode 100644 index 0000000..b01701b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/tutorial.html @@ -0,0 +1,1086 @@ + + + + + + + + Tutorial — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Tutorial

+

This guide offers a brief introduction to the MongoDB C Driver.

+

For more information on the C API, please refer to the API Reference.

+ +
+

Installing

+

For detailed instructions on installing the MongoDB C Driver on a particular platform, please see the installation guide.

+
+
+

Starting MongoDB

+

To run the examples in this tutorial, MongoDB must be installed and running on localhost on the default port, 27017. To check if it is up and running, connect to it with the MongoDB shell.

+
$ mongo --host localhost --port 27017
+MongoDB shell version: 3.0.6
+connecting to: localhost:27017/test
+>
+
+
+
+ + +
+

Making a Connection

+

Access MongoDB with a mongoc_client_t. It transparently connects to standalone servers, replica sets and sharded clusters on demand. To perform operations on a database or collection, create a mongoc_database_t or mongoc_collection_t struct from the mongoc_client_t.

+

At the start of an application, call mongoc_init() before any other libmongoc functions. At the end, call the appropriate destroy function for each collection, database, or client handle, in reverse order from how they were constructed. Call mongoc_cleanup() before exiting.

+

The example below establishes a connection to a standalone server on localhost, registers the client application as “connect-example,” and performs a simple command.

+

More information about database operations can be found in the CRUD Operations and Executing Commands sections. Examples of connecting to replica sets and sharded clusters can be found on the Advanced Connections page.

+
+
hello_mongoc.c
+
#include <mongoc/mongoc.h>
+
+int
+main (int argc, char *argv[])
+{
+   const char *uri_string = "mongodb://localhost:27017";
+   mongoc_uri_t *uri;
+   mongoc_client_t *client;
+   mongoc_database_t *database;
+   mongoc_collection_t *collection;
+   bson_t *command, reply, *insert;
+   bson_error_t error;
+   char *str;
+   bool retval;
+
+   /*
+    * Required to initialize libmongoc's internals
+    */
+   mongoc_init ();
+
+   /*
+    * Optionally get MongoDB URI from command line
+    */
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   /*
+    * Safely create a MongoDB URI object from the given string
+    */
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   /*
+    * Create a new client instance
+    */
+   client = mongoc_client_new_from_uri (uri);
+   if (!client) {
+      return EXIT_FAILURE;
+   }
+
+   /*
+    * Register the application name so we can track it in the profile logs
+    * on the server. This can also be done from the URI (see other examples).
+    */
+   mongoc_client_set_appname (client, "connect-example");
+
+   /*
+    * Get a handle on the database "db_name" and collection "coll_name"
+    */
+   database = mongoc_client_get_database (client, "db_name");
+   collection = mongoc_client_get_collection (client, "db_name", "coll_name");
+
+   /*
+    * Do work. This example pings the database, prints the result as JSON and
+    * performs an insert
+    */
+   command = BCON_NEW ("ping", BCON_INT32 (1));
+
+   retval = mongoc_client_command_simple (
+      client, "admin", command, NULL, &reply, &error);
+
+   if (!retval) {
+      fprintf (stderr, "%s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   str = bson_as_json (&reply, NULL);
+   printf ("%s\n", str);
+
+   insert = BCON_NEW ("hello", BCON_UTF8 ("world"));
+
+   if (!mongoc_collection_insert_one (collection, insert, NULL, NULL, &error)) {
+      fprintf (stderr, "%s\n", error.message);
+   }
+
+   bson_destroy (insert);
+   bson_destroy (&reply);
+   bson_destroy (command);
+   bson_free (str);
+
+   /*
+    * Release our handles and clean up libmongoc
+    */
+   mongoc_collection_destroy (collection);
+   mongoc_database_destroy (database);
+   mongoc_uri_destroy (uri);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+

Creating BSON Documents

+

Documents are stored in MongoDB’s data format, BSON. The C driver uses libbson to create BSON documents. There are several ways to construct them: appending key-value pairs, using BCON, or parsing JSON.

+
+

Appending BSON

+

A BSON document, represented as a bson_t in code, can be constructed one field at a time using libbson’s append functions.

+

For example, to create a document like this:

+
{
+   born : ISODate("1906-12-09"),
+   died : ISODate("1992-01-01"),
+   name : {
+      first : "Grace",
+      last : "Hopper"
+   },
+   languages : [ "MATH-MATIC", "FLOW-MATIC", "COBOL" ],
+   degrees: [ { degree: "BA", school: "Vassar" }, { degree: "PhD", school: "Yale" } ]
+}
+
+
+

Use the following code:

+
#include <bson/bson.h>
+
+int
+main (int   argc,
+      char *argv[])
+{
+   struct tm   born = { 0 };
+   struct tm   died = { 0 };
+   const char *lang_names[] = {"MATH-MATIC", "FLOW-MATIC", "COBOL"};
+   const char *schools[] = {"Vassar", "Yale"};
+   const char *degrees[] = {"BA", "PhD"};
+   uint32_t    i;
+   char        buf[16];
+   const       char *key;
+   size_t      keylen;
+   bson_t     *document;
+   bson_t      child;
+   bson_t      child2;
+   char       *str;
+
+   document = bson_new ();
+
+   /*
+    * Append { "born" : ISODate("1906-12-09") } to the document.
+    * Passing -1 for the length argument tells libbson to calculate the string length.
+    */
+   born.tm_year = 6;  /* years are 1900-based */
+   born.tm_mon = 11;  /* months are 0-based */
+   born.tm_mday = 9;
+   bson_append_date_time (document, "born", -1, mktime (&born) * 1000);
+
+   /*
+    * Append { "died" : ISODate("1992-01-01") } to the document.
+    */
+   died.tm_year = 92;
+   died.tm_mon = 0;
+   died.tm_mday = 1;
+
+   /*
+    * For convenience, this macro passes length -1 by default.
+    */
+   BSON_APPEND_DATE_TIME (document, "died", mktime (&died) * 1000);
+
+   /*
+    * Append a subdocument.
+    */
+   BSON_APPEND_DOCUMENT_BEGIN (document, "name", &child);
+   BSON_APPEND_UTF8 (&child, "first", "Grace");
+   BSON_APPEND_UTF8 (&child, "last", "Hopper");
+   bson_append_document_end (document, &child);
+
+   /*
+    * Append array of strings. Generate keys "0", "1", "2".
+    */
+   BSON_APPEND_ARRAY_BEGIN (document, "languages", &child);
+   for (i = 0; i < sizeof lang_names / sizeof (char *); ++i) {
+      keylen = bson_uint32_to_string (i, &key, buf, sizeof buf);
+      bson_append_utf8 (&child, key, (int) keylen, lang_names[i], -1);
+   }
+   bson_append_array_end (document, &child);
+
+   /*
+    * Array of subdocuments:
+    *    degrees: [ { degree: "BA", school: "Vassar" }, ... ]
+    */
+   BSON_APPEND_ARRAY_BEGIN (document, "degrees", &child);
+   for (i = 0; i < sizeof degrees / sizeof (char *); ++i) {
+      keylen = bson_uint32_to_string (i, &key, buf, sizeof buf);
+      bson_append_document_begin (&child, key, (int) keylen, &child2);
+      BSON_APPEND_UTF8 (&child2, "degree", degrees[i]);
+      BSON_APPEND_UTF8 (&child2, "school", schools[i]);
+      bson_append_document_end (&child, &child2);
+   }
+   bson_append_array_end (document, &child);
+
+   /*
+    * Print the document as a JSON string.
+    */
+   str = bson_as_canonical_extended_json (document, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   /*
+    * Clean up allocated bson documents.
+    */
+   bson_destroy (document);
+   return 0;
+}
+
+
+

See the libbson documentation for all of the types that can be appended to a bson_t.

+
+
+

Using BCON

+

BSON C Object Notation, BCON for short, is an alternative way of constructing BSON documents in a manner closer to the intended format. It has less type-safety than BSON’s append functions but results in less code.

+
#include <bson/bson.h>
+
+int
+main (int   argc,
+      char *argv[])
+{
+   struct tm born = { 0 };
+   struct tm died = { 0 };
+   bson_t   *document;
+   char     *str;
+
+   born.tm_year = 6;
+   born.tm_mon = 11;
+   born.tm_mday = 9;
+
+   died.tm_year = 92;
+   died.tm_mon = 0;
+   died.tm_mday = 1;
+
+   document = BCON_NEW (
+      "born", BCON_DATE_TIME (mktime (&born) * 1000),
+      "died", BCON_DATE_TIME (mktime (&died) * 1000),
+      "name", "{",
+      "first", BCON_UTF8 ("Grace"),
+      "last", BCON_UTF8 ("Hopper"),
+      "}",
+      "languages", "[",
+      BCON_UTF8 ("MATH-MATIC"),
+      BCON_UTF8 ("FLOW-MATIC"),
+      BCON_UTF8 ("COBOL"),
+      "]",
+      "degrees", "[",
+      "{", "degree", BCON_UTF8 ("BA"), "school", BCON_UTF8 ("Vassar"), "}",
+      "{", "degree", BCON_UTF8 ("PhD"), "school", BCON_UTF8 ("Yale"), "}",
+      "]");
+
+   /*
+    * Print the document as a JSON string.
+    */
+   str = bson_as_canonical_extended_json (document, NULL);
+   printf ("%s\n", str);
+   bson_free (str);
+
+   /*
+    * Clean up allocated bson documents.
+    */
+   bson_destroy (document);
+   return 0;
+}
+
+
+

Notice that BCON can create arrays, subdocuments and arbitrary fields.

+
+
+

Creating BSON from JSON

+

For single documents, BSON can be created from JSON strings via bson_new_from_json.

+
#include <bson/bson.h>
+
+int
+main (int   argc,
+      char *argv[])
+{
+   bson_error_t error;
+   bson_t      *bson;
+   char        *string;
+
+   const char *json = "{\"name\": {\"first\":\"Grace\", \"last\":\"Hopper\"}}";
+   bson = bson_new_from_json ((const uint8_t *)json, -1, &error);
+
+   if (!bson) {
+      fprintf (stderr, "%s\n", error.message);
+      return EXIT_FAILURE;
+   }
+
+   string = bson_as_canonical_extended_json (bson, NULL);
+   printf ("%s\n", string);
+   bson_free (string);
+
+   return 0;
+}
+
+
+

To initialize BSON from a sequence of JSON documents, use bson_json_reader_t.

+
+
+
+

Basic CRUD Operations

+

This section demonstrates the basics of using the C Driver to interact with MongoDB.

+
+

Inserting a Document

+

To insert documents into a collection, first obtain a handle to a mongoc_collection_t via a mongoc_client_t. Then, use mongoc_collection_insert_one() to add BSON documents to the collection. This example inserts into the database “mydb” and collection “mycoll”.

+

When finished, ensure that allocated structures are freed by using their respective destroy functions.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int   argc,
+      char *argv[])
+{
+    mongoc_client_t *client;
+    mongoc_collection_t *collection;
+    bson_error_t error;
+    bson_oid_t oid;
+    bson_t *doc;
+
+    mongoc_init ();
+
+    client = mongoc_client_new ("mongodb://localhost:27017/?appname=insert-example");
+    collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+
+    doc = bson_new ();
+    bson_oid_init (&oid, NULL);
+    BSON_APPEND_OID (doc, "_id", &oid);
+    BSON_APPEND_UTF8 (doc, "hello", "world");
+
+    if (!mongoc_collection_insert_one (
+           collection, doc, NULL, NULL, &error)) {
+        fprintf (stderr, "%s\n", error.message);
+    }
+
+    bson_destroy (doc);
+    mongoc_collection_destroy (collection);
+    mongoc_client_destroy (client);
+    mongoc_cleanup ();
+
+    return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o insert insert.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./insert
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 insert.c
+C:\> insert
+
+
+

To verify that the insert succeeded, connect with the MongoDB shell.

+
$ mongo
+MongoDB shell version: 3.0.6
+connecting to: test
+> use mydb
+switched to db mydb
+> db.mycoll.find()
+{ "_id" : ObjectId("55ef43766cb5f36a3bae6ee4"), "hello" : "world" }
+>
+
+
+
+
+

Finding a Document

+

To query a MongoDB collection with the C driver, use the function mongoc_collection_find_with_opts(). This returns a cursor to the matching documents. The following examples iterate through the result cursors and print the matches to stdout as JSON strings.

+

Use a document as a query specifier; for example,

+
{ "color" : "red" }
+
+
+

will match any document with a field named “color” with value “red”. An empty document {} can be used to match all documents.

+

This first example uses an empty query specifier to find all documents in the database “mydb” and collection “mycoll”.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_cursor_t *cursor;
+   const bson_t *doc;
+   bson_t *query;
+   char *str;
+
+   mongoc_init ();
+
+   client =
+      mongoc_client_new ("mongodb://localhost:27017/?appname=find-example");
+   collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+   query = bson_new ();
+   cursor = mongoc_collection_find_with_opts (collection, query, NULL, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   bson_destroy (query);
+   mongoc_cursor_destroy (cursor);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o find find.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./find
+{ "_id" : { "$oid" : "55ef43766cb5f36a3bae6ee4" }, "hello" : "world" }
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 find.c
+C:\> find
+{ "_id" : { "$oid" : "55ef43766cb5f36a3bae6ee4" }, "hello" : "world" }
+
+
+

To look for a specific document, add a specifier to query. This example adds a call to BSON_APPEND_UTF8() to look for all documents matching {"hello" : "world"}.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   mongoc_cursor_t *cursor;
+   const bson_t *doc;
+   bson_t *query;
+   char *str;
+
+   mongoc_init ();
+
+   client = mongoc_client_new (
+      "mongodb://localhost:27017/?appname=find-specific-example");
+   collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+   query = bson_new ();
+   BSON_APPEND_UTF8 (query, "hello", "world");
+
+   cursor = mongoc_collection_find_with_opts (collection, query, NULL, NULL);
+
+   while (mongoc_cursor_next (cursor, &doc)) {
+      str = bson_as_canonical_extended_json (doc, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   }
+
+   bson_destroy (query);
+   mongoc_cursor_destroy (cursor);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+
$ gcc -o find-specific find-specific.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./find-specific
+{ "_id" : { "$oid" : "55ef43766cb5f36a3bae6ee4" }, "hello" : "world" }
+
+
+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 find-specific.c
+C:\> find-specific
+{ "_id" : { "$oid" : "55ef43766cb5f36a3bae6ee4" }, "hello" : "world" }
+
+
+
+
+

Updating a Document

+

This code snippet gives an example of using mongoc_collection_update_one() to update the fields of a document.

+

Using the “mydb” database, the following example inserts an example document into the “mycoll” collection. Then, using its _id field, the document is updated with different values and a new field.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_collection_t *collection;
+   mongoc_client_t *client;
+   bson_error_t error;
+   bson_oid_t oid;
+   bson_t *doc = NULL;
+   bson_t *update = NULL;
+   bson_t *query = NULL;
+
+   mongoc_init ();
+
+   client =
+      mongoc_client_new ("mongodb://localhost:27017/?appname=update-example");
+   collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+
+   bson_oid_init (&oid, NULL);
+   doc = BCON_NEW ("_id", BCON_OID (&oid), "key", BCON_UTF8 ("old_value"));
+
+   if (!mongoc_collection_insert_one (collection, doc, NULL, &error)) {
+      fprintf (stderr, "%s\n", error.message);
+      goto fail;
+   }
+
+   query = BCON_NEW ("_id", BCON_OID (&oid));
+   update = BCON_NEW ("$set",
+                      "{",
+                      "key",
+                      BCON_UTF8 ("new_value"),
+                      "updated",
+                      BCON_BOOL (true),
+                      "}");
+
+   if (!mongoc_collection_update_one (
+          collection, query, update, NULL, NULL, &error)) {
+      fprintf (stderr, "%s\n", error.message);
+      goto fail;
+   }
+
+fail:
+   if (doc)
+      bson_destroy (doc);
+   if (query)
+      bson_destroy (query);
+   if (update)
+      bson_destroy (update);
+
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o update update.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./update
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 update.c
+C:\> update
+{ "_id" : { "$oid" : "55ef43766cb5f36a3bae6ee4" }, "hello" : "world" }
+
+
+

To verify that the update succeeded, connect with the MongoDB shell.

+
$ mongo
+MongoDB shell version: 3.0.6
+connecting to: test
+> use mydb
+switched to db mydb
+> db.mycoll.find({"updated" : true})
+{ "_id" : ObjectId("55ef549236fe322f9490e17b"), "updated" : true, "key" : "new_value" }
+>
+
+
+
+
+

Deleting a Document

+

This example illustrates the use of mongoc_collection_delete_one() to delete a document.

+

The following code inserts a sample document into the database “mydb” and collection “mycoll”. Then, it deletes all documents matching {"hello" : "world"}.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   bson_error_t error;
+   bson_oid_t oid;
+   bson_t *doc;
+
+   mongoc_init ();
+
+   client =
+      mongoc_client_new ("mongodb://localhost:27017/?appname=delete-example");
+   collection = mongoc_client_get_collection (client, "test", "test");
+
+   doc = bson_new ();
+   bson_oid_init (&oid, NULL);
+   BSON_APPEND_OID (doc, "_id", &oid);
+   BSON_APPEND_UTF8 (doc, "hello", "world");
+
+   if (!mongoc_collection_insert_one (collection, doc, NULL, &error)) {
+      fprintf (stderr, "Insert failed: %s\n", error.message);
+   }
+
+   bson_destroy (doc);
+
+   doc = bson_new ();
+   BSON_APPEND_OID (doc, "_id", &oid);
+
+   if (!mongoc_collection_delete_one (
+          collection, doc, NULL, NULL, &error)) {
+      fprintf (stderr, "Delete failed: %s\n", error.message);
+   }
+
+   bson_destroy (doc);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o delete delete.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./delete
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 delete.c
+C:\> delete
+
+
+

Use the MongoDB shell to prove that the documents have been removed successfully.

+
$ mongo
+MongoDB shell version: 3.0.6
+connecting to: test
+> use mydb
+switched to db mydb
+> db.mycoll.count({"hello" : "world"})
+0
+>
+
+
+
+
+

Counting Documents

+

Counting the number of documents in a MongoDB collection is similar to performing a find operation. This example counts the number of documents matching {"hello" : "world"} in the database “mydb” and collection “mycoll”.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   bson_error_t error;
+   bson_t *doc;
+   int64_t count;
+
+   mongoc_init ();
+
+   client =
+      mongoc_client_new ("mongodb://localhost:27017/?appname=count-example");
+   collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+   doc = bson_new_from_json (
+      (const uint8_t *) "{\"hello\" : \"world\"}", -1, &error);
+
+   count = mongoc_collection_count (
+      collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error);
+
+   if (count < 0) {
+      fprintf (stderr, "%s\n", error.message);
+   } else {
+      printf ("%" PRId64 "\n", count);
+   }
+
+   bson_destroy (doc);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o count count.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./count
+1
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 count.c
+C:\> count
+1
+
+
+
+
+
+

Executing Commands

+

The driver provides helper functions for executing MongoDB commands on client, database and collection structures. These functions return cursors; the _simple variants return booleans indicating success or failure.

+

This example executes the collStats command against the collection “mycoll” in database “mydb”.

+
#include <bson/bson.h>
+#include <mongoc/mongoc.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+   mongoc_client_t *client;
+   mongoc_collection_t *collection;
+   bson_error_t error;
+   bson_t *command;
+   bson_t reply;
+   char *str;
+
+   mongoc_init ();
+
+   client = mongoc_client_new (
+      "mongodb://localhost:27017/?appname=executing-example");
+   collection = mongoc_client_get_collection (client, "mydb", "mycoll");
+
+   command = BCON_NEW ("collStats", BCON_UTF8 ("mycoll"));
+   if (mongoc_collection_command_simple (
+          collection, command, NULL, &reply, &error)) {
+      str = bson_as_canonical_extended_json (&reply, NULL);
+      printf ("%s\n", str);
+      bson_free (str);
+   } else {
+      fprintf (stderr, "Failed to run command: %s\n", error.message);
+   }
+
+   bson_destroy (command);
+   bson_destroy (&reply);
+   mongoc_collection_destroy (collection);
+   mongoc_client_destroy (client);
+   mongoc_cleanup ();
+
+   return 0;
+}
+
+
+

Compile the code and run it:

+
$ gcc -o executing executing.c $(pkg-config --cflags --libs libmongoc-1.0)
+$ ./executing
+{ "ns" : "mydb.mycoll", "count" : 1, "size" : 48, "avgObjSize" : 48, "numExtents" : 1, "storageSize" : 8192,
+"lastExtentSize" : 8192.000000, "paddingFactor" : 1.000000, "userFlags" : 1, "capped" : false, "nindexes" : 1,
+"indexDetails" : {  }, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1.000000 }
+
+
+

On Windows:

+
C:\> cl.exe /IC:\mongo-c-driver\include\libbson-1.0 /IC:\mongo-c-driver\include\libmongoc-1.0 executing.c
+C:\> executing
+{ "ns" : "mydb.mycoll", "count" : 1, "size" : 48, "avgObjSize" : 48, "numExtents" : 1, "storageSize" : 8192,
+"lastExtentSize" : 8192.000000, "paddingFactor" : 1.000000, "userFlags" : 1, "capped" : false, "nindexes" : 1,
+"indexDetails" : {  }, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1.000000 }
+
+
+
+
+

Threading

+

The MongoDB C Driver is thread-unaware in the vast majority of its operations. This means it is up to the programmer to guarantee thread-safety.

+

However, mongoc_client_pool_t is thread-safe and is used to fetch a mongoc_client_t in a thread-safe manner. After retrieving a client from the pool, the client structure should be considered owned by the calling thread. When the thread is finished, the client should be placed back into the pool.

+
+
example-pool.c
+
/* gcc example-pool.c -o example-pool $(pkg-config --cflags --libs
+ * libmongoc-1.0) */
+
+/* ./example-pool [CONNECTION_STRING] */
+
+#include <mongoc/mongoc.h>
+#include <pthread.h>
+#include <stdio.h>
+
+static pthread_mutex_t mutex;
+static bool in_shutdown = false;
+
+static void *
+worker (void *data)
+{
+   mongoc_client_pool_t *pool = data;
+   mongoc_client_t *client;
+   bson_t ping = BSON_INITIALIZER;
+   bson_error_t error;
+   bool r;
+
+   BSON_APPEND_INT32 (&ping, "ping", 1);
+
+   while (true) {
+      client = mongoc_client_pool_pop (pool);
+      /* Do something with client. If you are writing an HTTP server, you
+       * probably only want to hold onto the client for the portion of the
+       * request performing database queries.
+       */
+      r = mongoc_client_command_simple (
+         client, "admin", &ping, NULL, NULL, &error);
+
+      if (!r) {
+         fprintf (stderr, "%s\n", error.message);
+      }
+
+      mongoc_client_pool_push (pool, client);
+
+      pthread_mutex_lock (&mutex);
+      if (in_shutdown || !r) {
+         pthread_mutex_unlock (&mutex);
+         break;
+      }
+
+      pthread_mutex_unlock (&mutex);
+   }
+
+   bson_destroy (&ping);
+   return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+   const char *uri_string = "mongodb://127.0.0.1/?appname=pool-example";
+   mongoc_uri_t *uri;
+   bson_error_t error;
+   mongoc_client_pool_t *pool;
+   pthread_t threads[10];
+   unsigned i;
+   void *ret;
+
+   pthread_mutex_init (&mutex, NULL);
+   mongoc_init ();
+
+   if (argc > 1) {
+      uri_string = argv[1];
+   }
+
+   uri = mongoc_uri_new_with_error (uri_string, &error);
+   if (!uri) {
+      fprintf (stderr,
+               "failed to parse URI: %s\n"
+               "error message:       %s\n",
+               uri_string,
+               error.message);
+      return EXIT_FAILURE;
+   }
+
+   pool = mongoc_client_pool_new (uri);
+   mongoc_client_pool_set_error_api (pool, 2);
+
+   for (i = 0; i < 10; i++) {
+      pthread_create (&threads[i], NULL, worker, pool);
+   }
+
+   sleep (10);
+   pthread_mutex_lock (&mutex);
+   in_shutdown = true;
+   pthread_mutex_unlock (&mutex);
+
+   for (i = 0; i < 10; i++) {
+      pthread_join (threads[i], &ret);
+   }
+
+   mongoc_client_pool_destroy (pool);
+   mongoc_uri_destroy (uri);
+
+   mongoc_cleanup ();
+
+   return EXIT_SUCCESS;
+}
+
+
+
+
+
+

Next Steps

+

To find information on advanced topics, browse the rest of the C driver guide or the official MongoDB documentation.

+

For help with common issues, consult the Troubleshooting page. To report a bug or request a new feature, follow these instructions.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/visual-studio-guide.html b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/visual-studio-guide.html new file mode 100644 index 0000000..09bf4ad --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/html/visual-studio-guide.html @@ -0,0 +1,156 @@ + + + + + + + + Using libmongoc in a Microsoft Visual Studio project — MongoDB C Driver 1.13.1 + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +
+

Using libmongoc in a Microsoft Visual Studio project

+

Download and install libmongoc on your system, then open Visual Studio, select “File→New→Project…”, and create a new Win32 Console Application.

+_images/msvc-create-project.png +

Remember to switch the platform from 32-bit to 64-bit:

+_images/msvc-switch-architecture.png +

Right-click on your console application in the Solution Explorer and select “Properties”. Choose to edit properties for “All Configurations”, expand the “C/C++” options and choose “General”. Add to the “Additional Include Directories” these paths:

+
C:\mongo-c-driver\include\libbson-1.0
+C:\mongo-c-driver\include\libmongoc-1.0
+
+
+_images/msvc-add-include-directories.png +

(If you chose a different CMAKE_INSTALL_PREFIX when you ran CMake, your include paths will be different.)

+

Also in the Properties dialog, expand the “Linker” options and choose “Input”, and add to the “Additional Dependencies” these libraries:

+
C:\mongo-c-driver\lib\bson-1.0.lib
+C:\mongo-c-driver\lib\mongoc-1.0.lib
+
+
+_images/msvc-add-dependencies.png +

Adding these libraries as dependencies provides linker symbols to build your application, but to actually run it, libbson’s and libmongoc’s DLLs must be in your executable path. Select “Debugging” in the Properties dialog, and set the “Environment” option to:

+
PATH=c:/mongo-c-driver/bin
+
+
+_images/msvc-set-path.png +

Finally, include “mongoc/mongoc.h” in your project’s “stdafx.h”:

+
#include <mongoc/mongoc.h>
+
+
+
+

Static linking

+

Following the instructions above, you have dynamically linked your application to the libbson and libmongoc DLLs. This is usually the right choice. If you want to link statically instead, update your “Additional Dependencies” list by removing bson-1.0.lib and mongoc-1.0.lib and replacing them with these libraries:

+
C:\mongo-c-driver\lib\bson-static-1.0.lib
+C:\mongo-c-driver\lib\mongoc-static-1.0.lib
+ws2_32.lib
+Secur32.lib
+Crypt32.lib
+BCrypt.lib
+
+
+_images/msvc-add-dependencies-static.png +

(To explain the purpose of each library: bson-static-1.0.lib and mongoc-static-1.0.lib are static archives of the driver code. The socket library ws2_32 is required by libbson, which uses the socket routine gethostname to help guarantee ObjectId uniqueness. The BCrypt library is used by libmongoc for SSL connections to MongoDB, and Secur32 and Crypt32 are required for enterprise authentication methods like Kerberos.)

+

Finally, define two preprocessor symbols before including mongoc/mongoc.h in your stdafx.h:

+
#define BSON_STATIC
+#define MONGOC_STATIC
+#include <mongoc/mongoc.h>
+
+
+

Making these changes to your project is only required for static linking; for most people, the dynamic-linking instructions above are preferred.

+
+
+

Next Steps

+

Now you can build and debug applications in Visual Studio that use libbson and libmongoc. Proceed to Making a Connection in the tutorial to learn how connect to MongoDB and perform operations.

+
+
+ + +
+ +
+
+ +
+
+
+ Created using Sphinx 1.8.3, based on Sphinx Readable Theme. +
+ + + \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/CMakeLists.txt new file mode 100644 index 0000000..e59474f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/CMakeLists.txt @@ -0,0 +1,10 @@ +file (GLOB src_libmongoc_doc_includes_DIST_txts + RELATIVE + ${CMAKE_CURRENT_SOURCE_DIR} + *.txt +) + +set_dist_list (src_libmongoc_doc_includes_DIST + CMakeLists.txt + ${src_libmongoc_doc_includes_DIST_txts} +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-insert-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-insert-opts.txt new file mode 100644 index 0000000..4165bcd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-insert-opts.txt @@ -0,0 +1,3 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-opts.txt new file mode 100644 index 0000000..1e72800 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-opts.txt @@ -0,0 +1,5 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``ordered``: set to ``false`` to attempt to insert all documents, continuing after errors. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-many-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-many-opts.txt new file mode 100644 index 0000000..099c46e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-many-opts.txt @@ -0,0 +1,3 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-one-opts.txt new file mode 100644 index 0000000..099c46e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-one-opts.txt @@ -0,0 +1,3 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-opts.txt new file mode 100644 index 0000000..72e0f48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-remove-opts.txt @@ -0,0 +1,3 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-replace-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-replace-one-opts.txt new file mode 100644 index 0000000..5935d3f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-replace-one-opts.txt @@ -0,0 +1,5 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: If true, insert a document if none match ``selector``. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-many-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-many-opts.txt new file mode 100644 index 0000000..84819a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-many-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: If true, insert a document if none match ``selector``. +* ``arrayFilters``: An array of filters specifying to which array elements an update should apply. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-one-opts.txt new file mode 100644 index 0000000..84819a9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/bulk-update-one-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: If true, insert a document if none match ``selector``. +* ``arrayFilters``: An array of filters specifying to which array elements an update should apply. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/cast-away-td-const.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/cast-away-td-const.txt new file mode 100644 index 0000000..7cfb734 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/cast-away-td-const.txt @@ -0,0 +1 @@ +Use this function in a topology-changed callback registered with :symbol:`mongoc_apm_set_topology_changed_cb`. For historical reasons, the :symbol:`mongoc_topology_description_t` passed to the callback is a const pointer, you must cast away const to pass the pointer to |td-func|. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/create-index-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/create-index-opts.txt new file mode 100644 index 0000000..cb0db1b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/create-index-opts.txt @@ -0,0 +1,4 @@ +``command_opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-many-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-many-opts.txt new file mode 100644 index 0000000..d075473 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-many-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-one-opts.txt new file mode 100644 index 0000000..d075473 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/delete-one-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/generic-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/generic-opts.txt new file mode 100644 index 0000000..48973ae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/generic-opts.txt @@ -0,0 +1,4 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``serverId``: To target a specific server, include an int32 "serverId" field. Obtain the id by calling :symbol:`mongoc_client_select_server`, then :symbol:`mongoc_server_description_id` on its return value. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/init_cleanup.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/init_cleanup.txt new file mode 100644 index 0000000..62fc594 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/init_cleanup.txt @@ -0,0 +1,3 @@ +Initialize the MongoDB C Driver by calling :symbol:`mongoc_init` exactly once at the beginning of your program. It is responsible for initializing global state such as process counters, SSL, and threading primitives. + +Call :symbol:`mongoc_cleanup` exactly once at the end of your program to release all memory and other resources allocated by the driver. You must not call any other MongoDB C Driver functions after :symbol:`mongoc_cleanup`. Note that :symbol:`mongoc_init` does **not** reinitialize the driver after :symbol:`mongoc_cleanup`. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-many-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-many-opts.txt new file mode 100644 index 0000000..0564f35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-many-opts.txt @@ -0,0 +1,7 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``ordered``: set to ``false`` to attempt to insert all documents, continuing after errors. +* ``bypassDocumentValidation``: Set to ``true`` to skip server-side schema validation of the provided BSON documents. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-one-opts.txt new file mode 100644 index 0000000..61c2153 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/insert-one-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``bypassDocumentValidation``: Set to ``true`` to skip server-side schema validation of the provided BSON documents. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/ipv4-and-ipv6.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/ipv4-and-ipv6.txt new file mode 100644 index 0000000..e85e4b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/ipv4-and-ipv6.txt @@ -0,0 +1,5 @@ +If connecting to a hostname that has both IPv4 and IPv6 DNS records, the behavior follows `RFC-6555 `_. A connection to the IPv6 address is attempted first. If IPv6 fails, then a connection is attempted to the IPv4 address. If the connection attempt to IPv6 does not complete within 250ms, then IPv4 is tried in parallel. Whichever succeeds connection first cancels the other. The successful DNS result is cached for 10 minutes. + +As a consequence, attempts to connect to a mongod only listening on IPv4 may be delayed if there are both A (IPv4) and AAAA (IPv6) DNS records associated with the host. + +To avoid a delay, configure hostnames to match the MongoDB configuration. That is, only create an A record if the mongod is only listening on IPv4. \ No newline at end of file diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_call_once.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_call_once.txt new file mode 100644 index 0000000..12e0afe --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_call_once.txt @@ -0,0 +1,4 @@ +Thread Safety +------------- + +This function can only be called once on a pool, and must be called before the first call to :symbol:`mongoc_client_pool_pop`. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_thread_safe.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_thread_safe.txt new file mode 100644 index 0000000..9a2b7dc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/mongoc_client_pool_thread_safe.txt @@ -0,0 +1,4 @@ +Thread Safety +------------- + +This function is safe to call from multiple threads. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/opts-sources.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/opts-sources.txt new file mode 100644 index 0000000..f99a768 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/opts-sources.txt @@ -0,0 +1,12 @@ +Read preferences, read and write concern, and collation can be overridden by various sources. The highest-priority sources for these options are listed first: + +================== ============== ============== ========= +Read Preferences Read Concern Write Concern Collation +================== ============== ============== ========= +``read_prefs`` ``opts`` ``opts`` ``opts`` +Transaction Transaction Transaction +|opts-source| +================== ============== ============== ========= + +In a transaction, read concern and write concern are prohibited in ``opts`` and the read preference must be primary or NULL. +:ref:`See the example for transactions ` and for :ref:`the "distinct" command with opts `. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-cmd-opts-sources.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-cmd-opts-sources.txt new file mode 100644 index 0000000..3fafcdb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-cmd-opts-sources.txt @@ -0,0 +1,3 @@ +Use this function for commands that read such as "count" or "distinct". + +.. include:: includes/read-opts-sources.txt diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts-sources.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts-sources.txt new file mode 100644 index 0000000..e9f5f29 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts-sources.txt @@ -0,0 +1,11 @@ +Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in ``opts`` and the read preference must be primary or NULL. The highest-priority sources for these options are listed first in the following table. No write concern is applied. + +================== ============== ========= +Read Preferences Read Concern Collation +================== ============== ========= +``read_prefs`` ``opts`` ``opts`` +Transaction Transaction +|opts-source| +================== ============== ========= + +:ref:`See the example for transactions ` and for :ref:`the "distinct" command with opts `. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts.txt new file mode 100644 index 0000000..7d59690 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``readConcern``: Construct a :symbol:`mongoc_read_concern_t` and use :symbol:`mongoc_read_concern_append` to add the read concern to ``opts``. See the example code for :symbol:`mongoc_client_read_command_with_opts`. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``serverId``: To target a specific server, include an int32 "serverId" field. Obtain the id by calling :symbol:`mongoc_client_select_server`, then :symbol:`mongoc_server_description_id` on its return value. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts-sources.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts-sources.txt new file mode 100644 index 0000000..2eda77a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts-sources.txt @@ -0,0 +1,13 @@ +Use this function for commands that both read and write, such as "mapReduce" with an output collection. + +Read and write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in ``opts``. The highest-priority sources for these options are listed first in the following table. Read preferences are *not* applied. The write concern is omitted for MongoDB before 3.4. + +============== ============== ========= +Read Concern Write Concern Collation +============== ============== ========= +``opts`` ``opts`` ``opts`` +Transaction Transaction +|opts-source| |opts-source| +============== ============== ========= + +:ref:`See the example for transactions ` and for :ref:`the "distinct" command with opts `. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts.txt new file mode 100644 index 0000000..d3da004 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/read-write-opts.txt @@ -0,0 +1,7 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``readConcern``: Construct a :symbol:`mongoc_read_concern_t` and use :symbol:`mongoc_read_concern_append` to add the read concern to ``opts``. See the example code for :symbol:`mongoc_client_read_command_with_opts`. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``serverId``: To target a specific server, include an int32 "serverId" field. Obtain the id by calling :symbol:`mongoc_client_select_server`, then :symbol:`mongoc_server_description_id` on its return value. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/replace-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/replace-one-opts.txt new file mode 100644 index 0000000..dac1551 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/replace-one-opts.txt @@ -0,0 +1,8 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``bypassDocumentValidation``: Set to ``true`` to skip server-side schema validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: When true, creates a new document if no document matches the query. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/session-lifecycle.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/session-lifecycle.txt new file mode 100644 index 0000000..5ba4762 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/session-lifecycle.txt @@ -0,0 +1,9 @@ +Start a session with :symbol:`mongoc_client_start_session`, use the session for a sequence of operations and multi-document transactions, then free it with :symbol:`mongoc_client_session_destroy()`. Any :symbol:`mongoc_cursor_t` or :symbol:`mongoc_change_stream_t` using a session must be destroyed before the session, and a session must be destroyed before the :symbol:`mongoc_client_t` it came from. + +By default, sessions are `causally consistent `_. To disable causal consistency, before starting a session create a :symbol:`mongoc_session_opt_t` with :symbol:`mongoc_session_opts_new()` and call :symbol:`mongoc_session_opts_set_causal_consistency()`, then free the struct with :symbol:`mongoc_session_opts_destroy`. + +Unacknowledged writes are prohibited with sessions. + +.. the timeout warning is mandated by the Driver Sessions Spec + +A :symbol:`mongoc_client_session_t` must be used by only one thread at a time. Due to session pooling, :symbol:`mongoc_client_start_session` may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-many-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-many-opts.txt new file mode 100644 index 0000000..51ecd28 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-many-opts.txt @@ -0,0 +1,9 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``bypassDocumentValidation``: Set to ``true`` to skip server-side schema validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: When true, creates a new document if no document matches the query. +* ``arrayFilters``: An array of filters specifying to which array elements an update should apply. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-one-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-one-opts.txt new file mode 100644 index 0000000..51ecd28 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/update-one-opts.txt @@ -0,0 +1,9 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``validate``: Construct a bitwise-or of all desired :symbol:`bson_validate_flags_t `. Set to ``false`` to skip client-side validation of the provided BSON documents. +* ``bypassDocumentValidation``: Set to ``true`` to skip server-side schema validation of the provided BSON documents. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``upsert``: When true, creates a new document if no document matches the query. +* ``arrayFilters``: An array of filters specifying to which array elements an update should apply. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts-sources.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts-sources.txt new file mode 100644 index 0000000..245ab2a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts-sources.txt @@ -0,0 +1,11 @@ +Use this function for commands that write such as "drop" or "createRole" (but not for "insert", "update", or "delete", see `Basic Write Operations`_). Write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in ``opts``. The highest-priority sources for these options are listed first in the following table. The write concern is omitted for MongoDB before 3.4. + +============== ========= +Write Concern Collation +============== ========= +``opts`` ``opts`` +Transaction +|opts-source| +============== ========= + +:ref:`See the example for transactions ` and for :ref:`the "distinct" command with opts `. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts.txt new file mode 100644 index 0000000..8de41d3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/includes/write-opts.txt @@ -0,0 +1,6 @@ +``opts`` may be NULL or a BSON document with additional command options: + +* ``writeConcern``: Construct a :symbol:`mongoc_write_concern_t` and use :symbol:`mongoc_write_concern_append` to add the write concern to ``opts``. See the example code for :symbol:`mongoc_client_write_command_with_opts`. +* ``sessionId``: First, construct a :symbol:`mongoc_client_session_t` with :symbol:`mongoc_client_start_session`. You can begin a transaction with :symbol:`mongoc_client_session_start_transaction`, optionally with a :symbol:`mongoc_transaction_opt_t` that overrides the options inherited from |opts-source|, and use :symbol:`mongoc_client_session_append` to add the session to ``opts``. See the example code for :symbol:`mongoc_client_session_t`. +* ``collation``: Configure textual comparisons. See :ref:`Setting Collation Order `, and `the MongoDB Manual entry on Collation `_. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +* ``serverId``: To target a specific server, include an int32 "serverId" field. Obtain the id by calling :symbol:`mongoc_client_select_server`, then :symbol:`mongoc_server_description_id` on its return value. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/index.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/index.rst new file mode 100644 index 0000000..eab7d48 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/index.rst @@ -0,0 +1,48 @@ +MongoDB C Driver +================ + +A Cross Platform MongoDB Client Library for C + +Introduction +------------ + +The MongoDB C Driver, also known as "libmongoc", is a library for using MongoDB from C applications, and for writing MongoDB drivers in higher-level languages. + +It depends on :doc:`libbson ` to generate and parse BSON documents, the native data format of MongoDB. + +.. toctree:: + :maxdepth: 2 + + installing + +.. toctree:: + :maxdepth: 2 + + tutorial + +.. toctree:: + :maxdepth: 2 + + authentication + +.. toctree:: + :maxdepth: 2 + + basic-troubleshooting + +.. toctree:: + :maxdepth: 2 + + guides + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + api + +.. toctree:: + :titlesonly: + :maxdepth: 2 + + application-performance-monitoring diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/init-cleanup.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/init-cleanup.rst new file mode 100644 index 0000000..24fc15d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/init-cleanup.rst @@ -0,0 +1,29 @@ +:man_page: mongoc_init_cleanup + +Initialization and cleanup +========================== + +Synopsis +-------- + +.. include:: includes/init_cleanup.txt + +.. only:: html + + .. toctree:: + :titlesonly: + :maxdepth: 1 + + mongoc_init + mongoc_cleanup + +Deprecated feature: automatic initialization and cleanup +-------------------------------------------------------- + +On some platforms the driver can automatically call :symbol:`mongoc_init` before ``main``, and call :symbol:`mongoc_cleanup` as the process exits. This is problematic in situations where related libraries also execute cleanup code on shutdown, and it creates inconsistent rules across platforms. Therefore the automatic initialization and cleanup feature is deprecated, and will be dropped in version 2.0. Meanwhile, for backward compatibility, the feature is *enabled* by default on platforms where it is available. + +For portable, future-proof code, always call :symbol:`mongoc_init` and :symbol:`mongoc_cleanup` yourself, and configure the driver like: + +.. code-block:: none + + cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=NO diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/installing.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/installing.rst new file mode 100644 index 0000000..d506303 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/installing.rst @@ -0,0 +1,287 @@ +:man_page: mongoc_installing + +Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) +====================================================================== + +The following guide will step you through the process of downloading, building, and installing the current release of the MongoDB C Driver (libmongoc) and BSON library (libbson). + +Supported Platforms +------------------- + +The MongoDB C Driver is `continuously tested `_ on variety of platforms including: + +- Archlinux +- Debian 8.1 +- macOS 10.10 +- Microsoft Windows Server 2008 +- RHEL 7.0, 7.1, 7.2 +- SUSE 12 +- Ubuntu 12.04, 14.04, 16.04 +- Clang 3.4, 3.5, 3.7, 3.8 +- GCC 4.6, 4.8, 4.9, 5.3 +- MinGW-W64 +- Visual Studio 2010, 2013, 2015 +- x86, x86_64, ARM (aarch64), Power8 (ppc64le), zSeries (s390x) + +Install libmongoc with a Package Manager +---------------------------------------- + +Several Linux distributions provide packages for libmongoc and its dependencies. One advantage of installing libmongoc with a package manager is that its dependencies (including libbson) will be installed automatically. + +The libmongoc package is available on recent versions of Debian and Ubuntu. + +.. code-block:: none + + $ apt-get install libmongoc-1.0-0 + +On Fedora, a mongo-c-driver package is available in the default repositories and can be installed with: + +.. code-block:: none + + $ dnf install mongo-c-driver + +On recent Red Hat systems, such as CentOS and RHEL 7, a mongo-c-driver package is available in the `EPEL `_ repository. To check which version is available, see `https://apps.fedoraproject.org/packages/mongo-c-driver `_. The package can be installed with: + +.. code-block:: none + + $ yum install mongo-c-driver + +Install libbson with a Package Manager +-------------------------------------- + +The libbson package is available on recent versions of Debian and Ubuntu. If you have installed libmongoc, then libbson will have already been installed as a dependency. It is also possible to install libbson without libmongoc. + +.. code-block:: none + + $ apt-get install libbson-1.0 + +On Fedora, a libbson package is available in the default repositories and can be installed with: + +.. code-block:: none + + $ dnf install libbson + +On recent Red Hat systems, such as CentOS and RHEL 7, a libbson package +is available in the `EPEL `_ repository. To check +which version is available, see `https://apps.fedoraproject.org/packages/libbson `_. +The package can be installed with: + +.. code-block:: none + + $ yum install libbson + +Building on Unix +---------------- + +Prerequisites for libmongoc +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +OpenSSL is required for authentication or for SSL connections to MongoDB. Kerberos or LDAP support requires Cyrus SASL. + +To install all optional dependencies on RedHat / Fedora: + +.. code-block:: none + + $ sudo yum install cmake openssl-devel cyrus-sasl-devel + +On Debian / Ubuntu: + +.. code-block:: none + + $ sudo apt-get install cmake libssl-dev libsasl2-dev + +On FreeBSD: + +.. code-block:: none + + $ su -c 'pkg install cmake openssl cyrus-sasl' + +Prerequisites for libbson +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The only prerequisite for building libbson is ``cmake``. The command lines above can be adjusted to install only ``cmake``. + +Building from a release tarball +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Unless you intend to contribute to mongo-c-driver and/or libbson, you will want to build from a release tarball. + +The most recent release of libmongoc and libbson, both of which are included in mongo-c-driver, is |release| and can be :release:`downloaded here <>`. The instructions in this document utilize ``cmake``'s out-of-source build feature to keep build artifacts separate from source files. + +The following snippet will download and extract the driver, and configure it: + +.. parsed-literal:: + + $ wget |release_download| + $ tar xzf mongo-c-driver-|release|.tar.gz + $ cd mongo-c-driver-|release| + $ mkdir cmake-build + $ cd cmake-build + $ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. + +The ``-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF`` option is recommended, see :doc:`init-cleanup`. Another useful ``cmake`` option is ``-DCMAKE_BUILD_TYPE=Release`` for a release optimized build and ``-DCMAKE_BUILD_TYPE=Debug`` for a debug build. For a list of all configure options, run ``cmake -L ..``. + +If ``cmake`` completed successfully, you will see a considerable amount of output describing your build configuration. The final line of output should look something like this: + +.. parsed-literal:: + + -- Build files have been written to: /home/user/mongo-c-driver-|release|/cmake-build + +If ``cmake`` concludes with anything different, then there is likely an error or some other problem with the build. Review the output to identify and correct the problem. + +mongo-c-driver contains a copy of libbson, in case your system does not already have libbson installed. The build will detect if libbson is not installed and use the bundled libbson. + +Additionally, it is possible to build only libbson by setting the ``-DENABLE_MONGOC=OFF`` option: + +.. parsed-literal:: + + $ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_MONGOC=OFF .. + +A build configuration description similar to the one above will be displayed, though with fewer entries. Once the configuration is complete, the selected items can be built and installed with these commands: + +.. code-block:: none + + $ make + $ sudo make install + +There are two ways to uninstall the components that have been installed. The first is to invoke the uninstall program directly. On Linux/Unix: + +.. code-block:: none + + $ sudo /usr/local/share/mongo-c-driver/uninstall.sh + +On Windows: + +.. code-block:: none + + C:\Users\user> C:\mongo-c-driver\share\mongo-c-driver\uninstall.bat + +The second way to uninstall is from within the build directory, assuming that it is in the exact same state as when the install command was invoked: + +.. code-block:: none + + $ sudo make uninstall + +The second approach simply invokes the uninstall program referenced in the first approach. + +Building from git +^^^^^^^^^^^^^^^^^ + +Clone the repository and build the current master or a particular release tag: + +.. code-block:: none + + $ git clone https://github.com/mongodb/mongo-c-driver.git + $ cd mongo-c-driver + $ git checkout x.y.z # To build a particular release + $ mkdir cmake-build + $ cd cmake-build + $ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. + $ make + $ sudo make install + +Generating the documentation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Install `Sphinx `_, then: + +.. code-block:: none + + $ cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON .. + $ make mongoc-doc + +To build only the libbson documentation: + +.. code-block:: none + + $ cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON .. + $ make bson-doc + +The ``-DENABLE_MAN_PAGES=ON`` and ``-DENABLE_HTML_DOCS=ON`` can also be added as options to a normal build from a release tarball or from git so that the documentation is built at the same time as other components. + +Building on macOS +----------------- + +Install the XCode Command Line Tools:: + + $ xcode-select --install + +The ``cmake`` utility is also required. First `install Homebrew according to its instructions `_, then:: + + $ brew install cmake + +Download the latest release tarball: + +.. parsed-literal:: + + $ curl -LO |release_download| + $ tar xzf mongo-c-driver-|release|.tar.gz + $ cd mongo-c-driver-|release| + +Build and install the driver: + +.. code-block:: none + + $ mkdir cmake-build + $ cd cmake-build + $ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. + +All of the same variations described above (e.g., building only libbson, building documentation, etc.) are available when building on macOS. + +.. _build-on-windows: + +Building on Windows with Visual Studio +-------------------------------------- + +Building on Windows requires Windows Vista or newer and Visual Studio 2010 or newer. Additionally, ``cmake`` is required to generate Visual Studio project files. + +Let's start by generating Visual Studio project files. The following assumes we are compiling for 64-bit Windows using Visual Studio 2015 Express, which can be freely downloaded from Microsoft. We will be utilizing ``cmake``'s out-of-source build feature to keep build artifacts separate from source files. + +.. parsed-literal:: + + cd mongo-c-driver-|release| + mkdir cmake-build + cd cmake-build + cmake -G "Visual Studio 14 2015 Win64" \\ + "-DCMAKE_INSTALL_PREFIX=C:\\mongo-c-driver" \\ + "-DCMAKE_PREFIX_PATH=C:\\mongo-c-driver" \\ + .. + +(Run ``cmake -LH ..`` for a list of other options.) + +Now that we have project files generated, we can either open the project in Visual Studio or compile from the command line. Let's build using the command line program ``msbuild.exe``: + +.. code-block:: none + + msbuild.exe /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj + +Visual Studio's default build type is ``Debug``, but we recommend a release build with debug info for production use. Now that libmongoc and libbson are compiled, let's install them using msbuild. It will be installed to the path specified by ``CMAKE_INSTALL_PREFIX``. + +.. code-block:: none + + msbuild.exe INSTALL.vcxproj + +You should now see libmongoc and libbson installed in ``C:\mongo-c-driver`` + +To use the driver libraries in your program, see :doc:`visual-studio-guide`. + +Building on Windows with MinGW-W64 and MSYS2 +-------------------------------------------- + +Install MSYS2 from `msys2.github.io `_. Choose the x86_64 version, not i686. + +Open ``c:\msys64\ming64_shell.bat`` (not the msys2_shell). Install dependencies: + +.. code-block:: none + + pacman --noconfirm -Syu + pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake + pacman --noconfirm -S mingw-w64-x86_64-extra-cmake-modules make tar + pacman --noconfirm -S mingw64/mingw-w64-x86_64-cyrus-sasl + +Download and untar the latest tarball, enter its directory, and build with CMake: + +.. code-block:: none + + CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="C:/mongo-c-driver" .. + make diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/libbson-objects.inv b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/libbson-objects.inv new file mode 100644 index 0000000..755ef01 Binary files /dev/null and b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/libbson-objects.inv differ diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/lifecycle.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/lifecycle.rst new file mode 100644 index 0000000..a647908 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/lifecycle.rst @@ -0,0 +1,32 @@ +Object Lifecycle +================ + +This page documents the order of creation and destruction for libmongoc's main struct types. + +Clients and pools +----------------- + +Call :symbol:`mongoc_init()` once, before calling any other libmongoc functions, and call :symbol:`mongoc_cleanup()` once before your program exits. + +A program that uses libmongoc from multiple threads should create a :symbol:`mongoc_client_pool_t` with :symbol:`mongoc_client_pool_new()`. Each thread acquires a :symbol:`mongoc_client_t` from the pool with :symbol:`mongoc_client_pool_pop()` and returns it with :symbol:`mongoc_client_pool_push()` when the thread is finished using it. To destroy the pool, first return all clients, then call :symbol:`mongoc_client_pool_destroy()`. + +If your program uses libmongoc from only one thread, create a :symbol:`mongoc_client_t` directly with :symbol:`mongoc_client_new()` or :symbol:`mongoc_client_new_from_uri()`. Destroy it with :symbol:`mongoc_client_destroy()`. + +Databases, collections, and related objects +------------------------------------------- + +You can create a :symbol:`mongoc_database_t` or :symbol:`mongoc_collection_t` from a :symbol:`mongoc_client_t`, and create a :symbol:`mongoc_cursor_t` or :symbol:`mongoc_bulk_operation_t` from a :symbol:`mongoc_collection_t`. + +Each of these objects must be destroyed before the client they were created from, but their lifetimes are otherwise independent. + +GridFS objects +-------------- + +You can create a :symbol:`mongoc_gridfs_t` from a :symbol:`mongoc_client_t`, create a :symbol:`mongoc_gridfs_file_t` or :symbol:`mongoc_gridfs_file_list_t` from a :symbol:`mongoc_gridfs_t`, create a :symbol:`mongoc_gridfs_file_t` from a :symbol:`mongoc_gridfs_file_list_t`, and create a :symbol:`mongoc_stream_t` from a :symbol:`mongoc_gridfs_file_t`. + +Each of these objects depends on the object it was created from. Always destroy GridFS objects in the reverse of the order they were created. The sole exception is that a :symbol:`mongoc_gridfs_file_t` need not be destroyed before the :symbol:`mongoc_gridfs_file_list_t` it was created from. + +Sessions +-------- + +.. include:: includes/session-lifecycle.txt diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/logging.rst b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/logging.rst new file mode 100644 index 0000000..07d284d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/logging.rst @@ -0,0 +1,130 @@ +:man_page: mongoc_logging + +Logging +======= + +MongoDB C driver Logging Abstraction + +Synopsis +-------- + +.. code-block:: c + + typedef enum { + MONGOC_LOG_LEVEL_ERROR, + MONGOC_LOG_LEVEL_CRITICAL, + MONGOC_LOG_LEVEL_WARNING, + MONGOC_LOG_LEVEL_MESSAGE, + MONGOC_LOG_LEVEL_INFO, + MONGOC_LOG_LEVEL_DEBUG, + MONGOC_LOG_LEVEL_TRACE, + } mongoc_log_level_t; + + #define MONGOC_ERROR(...) + #define MONGOC_CRITICAL(...) + #define MONGOC_WARNING(...) + #define MONGOC_MESSAGE(...) + #define MONGOC_INFO(...) + #define MONGOC_DEBUG(...) + + typedef void (*mongoc_log_func_t) (mongoc_log_level_t log_level, + const char *log_domain, + const char *message, + void *user_data); + + void + mongoc_log_set_handler (mongoc_log_func_t log_func, void *user_data); + void + mongoc_log (mongoc_log_level_t log_level, + const char *log_domain, + const char *format, + ...) BSON_GNUC_PRINTF (3, 4); + const char * + mongoc_log_level_str (mongoc_log_level_t log_level); + void + mongoc_log_default_handler (mongoc_log_level_t log_level, + const char *log_domain, + const char *message, + void *user_data); + void + mongoc_log_trace_enable (void); + void + mongoc_log_trace_disable (void); + +The MongoDB C driver comes with an abstraction for logging that you can use in your application, or integrate with an existing logging system. + +Macros +------ + +To make logging a little less painful, various helper macros are provided. See the following example. + +.. code-block:: c + + #undef MONGOC_LOG_DOMAIN + #define MONGOC_LOG_DOMAIN "my-custom-domain" + + MONGOC_WARNING ("An error occurred: %s", strerror (errno)); + +Custom Log Handlers +------------------- + +The default log handler prints a timestamp and the log message to ``stdout``, or to ``stderr`` for warnings, critical messages, and errors. + You can override the handler with ``mongoc_log_set_handler()``. + Your handler function is called in a mutex for thread safety. + +For example, you could register a custom handler to suppress messages at INFO level and below: + +.. code-block:: c + + void + my_logger (mongoc_log_level_t log_level, + const char *log_domain, + const char *message, + void *user_data) + { + /* smaller values are more important */ + if (log_level < MONGOC_LOG_LEVEL_INFO) { + mongoc_log_default_handler (log_level, log_domain, message, user_data); + } + } + + int + main (int argc, char *argv[]) + { + mongoc_init (); + mongoc_log_set_handler (my_logger, NULL); + + /* ... your code ... */ + + mongoc_cleanup (); + return 0; + } + +To restore the default handler: + +.. code-block:: c + + mongoc_log_set_handler (mongoc_log_default_handler, NULL); + +Disable logging +--------------- + +To disable all logging, including warnings, critical messages and errors, provide an empty log handler: + +.. code-block:: c + + mongoc_log_set_handler (NULL, NULL); + +Tracing +------- + +If compiling your own copy of the MongoDB C driver, consider configuring with ``-DENABLE_TRACING=ON`` to enable function tracing and hex dumps of network packets to ``STDERR`` and ``STDOUT`` during development and debugging. + +This is especially useful when debugging what may be going on internally in the driver. + +Trace messages can be enabled and disabled by calling ``mongoc_log_trace_enable()`` and ``mongoc_log_trace_disable()`` + +.. note:: + + Compiling the driver with ``-DENABLE_TRACING=ON`` will affect its performance. Disabling tracing with ``mongoc_log_trace_disable()`` significantly reduces the overhead, but cannot remove it completely. + diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/CMakeLists.txt b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/CMakeLists.txt new file mode 100644 index 0000000..f155c23 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/CMakeLists.txt @@ -0,0 +1,3 @@ +set_dist_list (src_libmongoc_doc_man_DIST + CMakeLists.txt +) diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_advanced_connections.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_advanced_connections.3 new file mode 100644 index 0000000..6858ca6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_advanced_connections.3 @@ -0,0 +1,316 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_ADVANCED_CONNECTIONS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_advanced_connections \- Advanced Connections +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +The following guide contains information specific to certain types of MongoDB configurations. +.sp +For an example of connecting to a simple standalone server, see the Tutorial\&. To establish a connection with authentication options enabled, see the Authentication page. +.SH CONNECTING TO A REPLICA SET +.sp +Connecting to a \fI\%replica set\fP is much like connecting to a standalone MongoDB server. Simply specify the replica set name using the \fB?replicaSet=myreplset\fP URI option. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + + mongoc_init (); + + /* Create our MongoDB Client */ + client = mongoc_client_new ( + "mongodb://host01:27017,host02:27017,host03:27017/?replicaSet=myreplset"); + + /* Do some work */ + /* TODO */ + + /* Clean up */ + mongoc_client_destroy (client); + mongoc_cleanup (); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +Multiple hostnames can be specified in the MongoDB connection string URI, with a comma separating hosts in the seed list. +.sp +It is recommended to use a seed list of members of the replica set to allow the driver to connect to any node. +.UNINDENT +.UNINDENT +.SH CONNECTING TO A SHARDED CLUSTER +.sp +To connect to a \fI\%sharded cluster\fP, specify the \fBmongos\fP nodes the client should connect to. The C Driver will automatically detect that it has connected to a \fBmongos\fP sharding server. +.sp +If more than one hostname is specified, a seed list will be created to attempt failover between the \fBmongos\fP instances. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +Specifying the \fBreplicaSet\fP parameter when connecting to a \fBmongos\fP sharding server is invalid. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + + mongoc_init (); + + /* Create our MongoDB Client */ + client = mongoc_client_new ("mongodb://myshard01:27017/"); + + /* Do something with client ... */ + + /* Free the client */ + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return 0; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CONNECTING TO AN IPV6 ADDRESS +.sp +The MongoDB C Driver will automatically resolve IPv6 addresses from host names. However, to specify an IPv6 address directly, wrap the address in \fB[]\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_uri_t *uri = mongoc_uri_new ("mongodb://[::1]:27017"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CONNECTING WITH IPV4 AND IPV6 +.sp +If connecting to a hostname that has both IPv4 and IPv6 DNS records, the behavior follows \fI\%RFC\-6555\fP\&. A connection to the IPv6 address is attempted first. If IPv6 fails, then a connection is attempted to the IPv4 address. If the connection attempt to IPv6 does not complete within 250ms, then IPv4 is tried in parallel. Whichever succeeds connection first cancels the other. The successful DNS result is cached for 10 minutes. +.sp +As a consequence, attempts to connect to a mongod only listening on IPv4 may be delayed if there are both A (IPv4) and AAAA (IPv6) DNS records associated with the host. +.sp +To avoid a delay, configure hostnames to match the MongoDB configuration. That is, only create an A record if the mongod is only listening on IPv4. +.SH CONNECTING TO A UNIX DOMAIN SOCKET +.sp +On UNIX\-like systems, the C Driver can connect directly to a MongoDB server using a UNIX domain socket. Pass the URL\-encoded path to the socket, which \fImust\fP be suffixed with \fB\&.sock\fP\&. For example, to connect to a domain socket at \fB/tmp/mongodb\-27017.sock\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_uri_t *uri = mongoc_uri_new ("mongodb://%2Ftmp%2Fmongodb\-27017.sock"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Include username and password like so: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_uri_t *uri = mongoc_uri_new ("mongodb://user:pass@%2Ftmp%2Fmongodb\-27017.sock"); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH CONNECTING TO A SERVER OVER SSL +.sp +These are instructions for configuring TLS/SSL connections. +.sp +To run a server locally (on port 27017, for example): +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongod \-\-port 27017 \-\-sslMode requireSSL \-\-sslPEMKeyFile server.pem \-\-sslCAFile ca.pem +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Add \fB/?ssl=true\fP to the end of a client URI. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = NULL; +client = mongoc_client_new ("mongodb://localhost:27017/?ssl=true"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +MongoDB requires client certificates by default, unless the \fB\-\-sslAllowConnectionsWithoutCertificates\fP is provided. The C Driver can be configured to present a client certificate using a \fBmongoc_ssl_opt_t\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_ssl_opt_t *ssl_default = mongoc_ssl_opt_get_default (); +mongoc_ssl_opt_t ssl_opts = { 0 }; + +/* optionally copy in a custom trust directory or file; otherwise the default is used. */ +memcpy (&ssl_opts, ssl_default, sizeof ssl_opts); +ssl_opts.pem_file = "client.pem" + +mongoc_client_set_ssl_opts (client, &ssl_opts); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The client certificate provided by \fBpem_file\fP must be issued by one of the server trusted Certificate Authorities listed in \fB\-\-sslCAFile\fP, or issued by a CA in the native certificate store on the server when omitted. +.sp +To verify the server certificate against a specific CA, provide a PEM armored file with a CA certificate, or concatenated list of CA certificates using the \fBca_file\fP option, or \fBc_rehash\fP directory structure of CAs, pointed to using the \fBca_dir\fP option. When no \fBca_file\fP or \fBca_dir\fP is provided, the driver will use CAs provided by the native platform certificate store. +.sp +See mongoc_ssl_opt_t for more information on the various SSL related options. +.SH COMPRESSING DATA TO AND FROM MONGODB +.sp +MongoDB 3.4 added Snappy compression support, and zlib compression in 3.6. +To enable compression support the client must be configured with which compressors to use: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = NULL; +client = mongoc_client_new ("mongodb://localhost:27017/?compressors=snappy,zlib"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBcompressors\fP option specifies the priority order of compressors the +client wants to use. Messages are compressed if the client and server share any +compressors in common. +.sp +Note that the compressor used by the server might not be the same compressor as +the client used. For example, if the client uses the connection string +\fBcompressors=zlib,snappy\fP the client will use \fBzlib\fP compression to send +data (if possible), but the server might still reply using \fBsnappy\fP, +depending on how the server was configured. +.sp +The driver must be built with zlib and/or snappy support to enable compression +support, any unknown (or not compiled in) compressor value will be ignored. +.SH ADDITIONAL CONNECTION OPTIONS +.sp +The full list of connection options can be found in the \fBmongoc_uri_t\fP docs. +.sp +Certain socket/connection related options are not configurable: +.TS +center; +|l|l|l|. +_ +T{ +Option +T} T{ +Description +T} T{ +Value +T} +_ +T{ +SO_KEEPALIVE +T} T{ +TCP Keep Alive +T} T{ +Enabled +T} +_ +T{ +TCP_KEEPIDLE +T} T{ +How long a connection needs to remain idle before TCP +starts sending keepalive probes +T} T{ +300 seconds +T} +_ +T{ +TCP_KEEPINTVL +T} T{ +The time in seconds between TCP probes +T} T{ +10 seconds +T} +_ +T{ +TCP_KEEPCNT +T} T{ +How many probes to send, without acknowledgement, +before dropping the connection +T} T{ +9 probes +T} +_ +T{ +TCP_NODELAY +T} T{ +Send packets as soon as possible or buffer small +packets (Nagle algorithm) +T} T{ +Enabled (no buffering) +T} +_ +.TE +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_aggregate.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_aggregate.3 new file mode 100644 index 0000000..caaa7c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_aggregate.3 @@ -0,0 +1,324 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_AGGREGATE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_aggregate \- Aggregation Framework Examples +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +This document provides a number of practical examples that display the capabilities of the aggregation framework. +.sp +The \fI\%Aggregations using the Zip Codes Data Set\fP examples uses a publicly available data set of all zipcodes and populations in the United States. These data are available at: \fI\%zips.json\fP\&. +.SH REQUIREMENTS +.sp +Let\(aqs check if everything is installed. +.sp +Use the following command to load zips.json data set into mongod instance: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongoimport \-\-drop \-d test \-c zipcodes zips.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Let\(aqs use the MongoDB shell to verify that everything was imported successfully. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongo test +connecting to: test +> db.zipcodes.count() +29467 +> db.zipcodes.findOne() +{ + "_id" : "35004", + "city" : "ACMAR", + "loc" : [ + \-86.51557, + 33.584132 + ], + "pop" : 6055, + "state" : "AL" +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AGGREGATIONS USING THE ZIP CODES DATA SET +.sp +Each document in this collection has the following form: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ + "_id" : "35004", + "city" : "Acmar", + "state" : "AL", + "pop" : 6055, + "loc" : [\-86.51557, 33.584132] +} +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In these documents: +.INDENT 0.0 +.IP \(bu 2 +The \fB_id\fP field holds the zipcode as a string. +.IP \(bu 2 +The \fBcity\fP field holds the city name. +.IP \(bu 2 +The \fBstate\fP field holds the two letter state abbreviation. +.IP \(bu 2 +The \fBpop\fP field holds the population. +.IP \(bu 2 +The \fBloc\fP field holds the location as a \fB[latitude, longitude]\fP array. +.UNINDENT +.SH STATES WITH POPULATIONS OVER 10 MILLION +.sp +To get all states with a population greater than 10 million, use the following aggregation pipeline: +aggregation1.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +static void +print_pipeline (mongoc_collection_t *collection) +{ + mongoc_cursor_t *cursor; + bson_error_t error; + const bson_t *doc; + bson_t *pipeline; + char *str; + + pipeline = BCON_NEW ("pipeline", + "[", + "{", + "$group", + "{", + "_id", + "$state", + "total_pop", + "{", + "$sum", + "$pop", + "}", + "}", + "}", + "{", + "$match", + "{", + "total_pop", + "{", + "$gte", + BCON_INT32 (10000000), + "}", + "}", + "}", + "]"); + + cursor = mongoc_collection_aggregate ( + collection, MONGOC_QUERY_NONE, pipeline, NULL, NULL); + + while (mongoc_cursor_next (cursor, &doc)) { + str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\en", str); + bson_free (str); + } + + if (mongoc_cursor_error (cursor, &error)) { + fprintf (stderr, "Cursor Failure: %s\en", error.message); + } + + mongoc_cursor_destroy (cursor); + bson_destroy (pipeline); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = + "mongodb://localhost:27017/?appname=aggregation\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "zipcodes"); + + print_pipeline (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You should see a result like the following: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : "PA", "total_pop" : 11881643 } +{ "_id" : "OH", "total_pop" : 10847115 } +{ "_id" : "NY", "total_pop" : 17990455 } +{ "_id" : "FL", "total_pop" : 12937284 } +{ "_id" : "TX", "total_pop" : 16986510 } +{ "_id" : "IL", "total_pop" : 11430472 } +{ "_id" : "CA", "total_pop" : 29760021 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The above aggregation pipeline is build from two pipeline operators: \fB$group\fP and \fB$match\fP\&. +.sp +The \fB$group\fP pipeline operator requires _id field where we specify grouping; remaining fields specify how to generate composite value and must use one of the group aggregation functions: \fB$addToSet\fP, \fB$first\fP, \fB$last\fP, \fB$max\fP, \fB$min\fP, \fB$avg\fP, \fB$push\fP, \fB$sum\fP\&. The \fB$match\fP pipeline operator syntax is the same as the read operation query syntax. +.sp +The \fB$group\fP process reads all documents and for each state it creates a separate document, for example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : "WA", "total_pop" : 4866692 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBtotal_pop\fP field uses the $sum aggregation function to sum the values of all pop fields in the source documents. +.sp +Documents created by \fB$group\fP are piped to the \fB$match\fP pipeline operator. It returns the documents with the value of \fBtotal_pop\fP field greater than or equal to 10 million. +.SH AVERAGE CITY POPULATION BY STATE +.sp +To get the first three states with the greatest average population per city, use the following aggregation: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +pipeline = BCON_NEW ("pipeline", "[", + "{", "$group", "{", "_id", "{", "state", "$state", "city", "$city", "}", "pop", "{", "$sum", "$pop", "}", "}", "}", + "{", "$group", "{", "_id", "$_id.state", "avg_city_pop", "{", "$avg", "$pop", "}", "}", "}", + "{", "$sort", "{", "avg_city_pop", BCON_INT32 (\-1), "}", "}", + "{", "$limit", BCON_INT32 (3) "}", +"]"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This aggregate pipeline produces: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : "DC", "avg_city_pop" : 303450.0 } +{ "_id" : "FL", "avg_city_pop" : 27942.29805615551 } +{ "_id" : "CA", "avg_city_pop" : 27735.341099720412 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The above aggregation pipeline is build from three pipeline operators: \fB$group\fP, \fB$sort\fP and \fB$limit\fP\&. +.sp +The first \fB$group\fP operator creates the following documents: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : { "state" : "WY", "city" : "Smoot" }, "pop" : 414 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Note, that the \fB$group\fP operator can\(aqt use nested documents except the \fB_id\fP field. +.sp +The second \fB$group\fP uses these documents to create the following documents: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : "FL", "avg_city_pop" : 27942.29805615551 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +These documents are sorted by the \fBavg_city_pop\fP field in descending order. Finally, the \fB$limit\fP pipeline operator returns the first 3 documents from the sorted set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_destroy.3 new file mode 100644 index 0000000..84656ef --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_destroy.3 @@ -0,0 +1,55 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_CALLBACKS_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_callbacks_destroy \- mongoc_apm_callbacks_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_callbacks_destroy (mongoc_apm_callbacks_t *callbacks); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Free a \fBmongoc_apm_callbacks_t\fP\&. Does nothing if \fBcallbacks\fP is NULL. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_new.3 new file mode 100644 index 0000000..4aab231 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_new.3 @@ -0,0 +1,58 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_CALLBACKS_NEW" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_callbacks_new \- mongoc_apm_callbacks_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_apm_callbacks_t * +mongoc_apm_callbacks_new (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Create a struct to hold event\-notification callbacks. +.SH RETURNS +.sp +A new \fBmongoc_apm_callbacks_t\fP you must free with \fBmongoc_apm_callbacks_destroy\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_t.3 new file mode 100644 index 0000000..2c99947 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_callbacks_t.3 @@ -0,0 +1,48 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_CALLBACKS_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_callbacks_t \- mongoc_apm_callbacks_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Notification callbacks +.SH SYNOPSIS +.sp +Used to receive notification of events, such as when a MongoDB command begins, succeeds, or fails. +.sp +Create a \fBmongoc_apm_callbacks_t\fP with \fBmongoc_apm_callbacks_new\fP, set callbacks on it, then pass it to \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_command_name.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_command_name.3 new file mode 100644 index 0000000..77eac04 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_command_name.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_COMMAND_NAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_command_name \- mongoc_apm_command_failed_get_command_name() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +mongoc_apm_command_failed_get_command_name ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A string that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_context.3 new file mode 100644 index 0000000..572d735 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_context \- mongoc_apm_command_failed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_command_failed_get_context ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_duration.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_duration.3 new file mode 100644 index 0000000..e9bee2b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_duration.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_DURATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_duration \- mongoc_apm_command_failed_get_duration() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_failed_get_duration ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs duration in microseconds. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs duration. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_error.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_error.3 new file mode 100644 index 0000000..43f8d8a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_error.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_ERROR" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_error \- mongoc_apm_command_failed_get_error() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_command_failed_get_error (const mongoc_apm_command_failed_t *event, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Copies this event\(aqs error info. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP to receive the event\(aqs error info. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_host.3 new file mode 100644 index 0000000..cb14559 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_host.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_host \- mongoc_apm_command_failed_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_command_failed_get_host (const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_operation_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_operation_id.3 new file mode 100644 index 0000000..111ad86 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_operation_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_OPERATION_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_operation_id \- mongoc_apm_command_failed_get_operation_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_failed_get_operation_id ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs operation id. This number correlates all the commands in a bulk operation, or all the "find" and "getMore" commands required to stream a large query result. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs operation id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_reply.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_reply.3 new file mode 100644 index 0000000..1ce3ad5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_reply.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_REPLY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_reply \- mongoc_apm_command_failed_get_reply() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_apm_command_failed_get_reply ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns the server\(aqs reply to a command that failed. The reply contains details about why the command failed. If no server reply was received, such as in the event of a network error, then the reply is a valid empty BSON document. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_request_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_request_id.3 new file mode 100644 index 0000000..fc9bfb2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_request_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_REQUEST_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_request_id \- mongoc_apm_command_failed_get_request_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_failed_get_request_id ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs wire\-protocol request id. Use this number to correlate client\-side events with server log messages. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs request id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_server_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_server_id.3 new file mode 100644 index 0000000..bf3605b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_get_server_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_GET_SERVER_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_get_server_id \- mongoc_apm_command_failed_get_server_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +mongoc_apm_command_failed_get_server_id ( + const mongoc_apm_command_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs server id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs server id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_t.3 new file mode 100644 index 0000000..526d858 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_failed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_FAILED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_failed_t \- mongoc_apm_command_failed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Command\-failed event +.SH SYNOPSIS +.sp +An event notification sent when the driver fails to execute a MongoDB command. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command.3 new file mode 100644 index 0000000..3b242fe --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_COMMAND" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_command \- mongoc_apm_command_started_get_command() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_apm_command_started_get_command ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs command. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command_name.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command_name.3 new file mode 100644 index 0000000..511f874 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_command_name.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_COMMAND_NAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_command_name \- mongoc_apm_command_started_get_command_name() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +mongoc_apm_command_started_get_command_name ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A string that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_context.3 new file mode 100644 index 0000000..f441cf0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_context \- mongoc_apm_command_started_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_command_started_get_context ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_database_name.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_database_name.3 new file mode 100644 index 0000000..6171735 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_database_name.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_DATABASE_NAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_database_name \- mongoc_apm_command_started_get_database_name() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +mongoc_apm_command_started_get_database_name ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs database name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A string that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_host.3 new file mode 100644 index 0000000..9b1e390 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_host.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_host \- mongoc_apm_command_started_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_command_started_get_host (const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_operation_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_operation_id.3 new file mode 100644 index 0000000..2372e77 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_operation_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_OPERATION_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_operation_id \- mongoc_apm_command_started_get_operation_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_started_get_operation_id ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs operation id. This number correlates all the commands in a bulk operation, or all the "find" and "getMore" commands required to stream a large query result. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs operation id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_request_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_request_id.3 new file mode 100644 index 0000000..3bddf59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_request_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_REQUEST_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_request_id \- mongoc_apm_command_started_get_request_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_started_get_request_id ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs wire\-protocol request id. Use this number to correlate client\-side events with server log messages. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs request id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_server_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_server_id.3 new file mode 100644 index 0000000..b99fa1a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_get_server_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_GET_SERVER_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_get_server_id \- mongoc_apm_command_started_get_server_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +mongoc_apm_command_started_get_server_id ( + const mongoc_apm_command_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs server id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs server id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_t.3 new file mode 100644 index 0000000..4a3525d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_started_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_STARTED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_started_t \- mongoc_apm_command_started_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Command\-started event +.SH SYNOPSIS +.sp +An event notification sent when the driver begins executing a MongoDB command. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_command_name.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_command_name.3 new file mode 100644 index 0000000..fb70ecd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_command_name.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_COMMAND_NAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_command_name \- mongoc_apm_command_succeeded_get_command_name() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const char * +mongoc_apm_command_succeeded_get_command_name ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs command name. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A string that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_context.3 new file mode 100644 index 0000000..68630de --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_context \- mongoc_apm_command_succeeded_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_command_succeeded_get_context ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_duration.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_duration.3 new file mode 100644 index 0000000..c6eb74a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_duration.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_DURATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_duration \- mongoc_apm_command_succeeded_get_duration() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_succeeded_get_duration ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs duration in microseconds. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs duration. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_host.3 new file mode 100644 index 0000000..3ddd581 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_host.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_host \- mongoc_apm_command_succeeded_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_command_succeeded_get_host ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_operation_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_operation_id.3 new file mode 100644 index 0000000..c441086 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_operation_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_OPERATION_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_operation_id \- mongoc_apm_command_succeeded_get_operation_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_succeeded_get_operation_id ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs operation id. This number correlates all the commands in a bulk operation, or all the "find" and "getMore" commands required to stream a large query result. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs operation id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_reply.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_reply.3 new file mode 100644 index 0000000..25335fc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_reply.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_REPLY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_reply \- mongoc_apm_command_succeeded_get_reply() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_apm_command_succeeded_get_reply ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs reply. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_request_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_request_id.3 new file mode 100644 index 0000000..4d1b35a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_request_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_REQUEST_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_request_id \- mongoc_apm_command_succeeded_get_request_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_command_succeeded_get_request_id ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs wire\-protocol request id. Use this number to correlate client\-side events with server log messages. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs request id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_server_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_server_id.3 new file mode 100644 index 0000000..13053c9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_get_server_id.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_GET_SERVER_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_get_server_id \- mongoc_apm_command_succeeded_get_server_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +mongoc_apm_command_succeeded_get_server_id ( + const mongoc_apm_command_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs server id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_command_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs server id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_t.3 new file mode 100644 index 0000000..cfba5f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_command_succeeded_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_COMMAND_SUCCEEDED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_command_succeeded_t \- mongoc_apm_command_succeeded_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Command\-succeeded event +.SH SYNOPSIS +.sp +An event notification sent when the driver successfully executes a MongoDB command. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_context.3 new file mode 100644 index 0000000..886143b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_get_context \- mongoc_apm_server_changed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_changed_get_context ( + const mongoc_apm_server_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_host.3 new file mode 100644 index 0000000..756c4f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_host.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_get_host \- mongoc_apm_server_changed_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_changed_get_host (const mongoc_apm_server_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_new_description.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_new_description.3 new file mode 100644 index 0000000..0639b87 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_new_description.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_GET_NEW_DESCRIPTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_get_new_description \- mongoc_apm_server_changed_get_new_description() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_server_description_t * +mongoc_apm_server_changed_get_new_description ( + const mongoc_apm_server_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs new description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_server_description_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_previous_description.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_previous_description.3 new file mode 100644 index 0000000..0c36572 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_previous_description.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_GET_PREVIOUS_DESCRIPTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_get_previous_description \- mongoc_apm_server_changed_get_previous_description() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_server_description_t * +mongoc_apm_server_changed_get_previous_description ( + const mongoc_apm_server_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs previous description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_server_description_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_topology_id.3 new file mode 100644 index 0000000..cf9c99e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_get_topology_id \- mongoc_apm_server_changed_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_server_changed_get_topology_id ( + const mongoc_apm_server_changed_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_changed_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_t.3 new file mode 100644 index 0000000..133e0e4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_changed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CHANGED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_changed_t \- mongoc_apm_server_changed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Server\-changed event +.SH SYNOPSIS +.sp +An event notification sent when the driver observes a change in status of a server it is connected to. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_context.3 new file mode 100644 index 0000000..7479906 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_context.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CLOSED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_closed_get_context \- mongoc_apm_server_closed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_closed_get_context (const mongoc_apm_server_closed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_closed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_host.3 new file mode 100644 index 0000000..5534235 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_host.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CLOSED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_closed_get_host \- mongoc_apm_server_closed_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_closed_get_host (const mongoc_apm_server_closed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_closed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_topology_id.3 new file mode 100644 index 0000000..851375a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CLOSED_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_closed_get_topology_id \- mongoc_apm_server_closed_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_server_closed_get_topology_id ( + const mongoc_apm_server_closed_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_closed_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_t.3 new file mode 100644 index 0000000..3fe2d07 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_closed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_CLOSED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_closed_t \- mongoc_apm_server_closed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Server\-closed event +.SH SYNOPSIS +.sp +An event notification sent when the driver stops monitoring a server and removes its \fBmongoc_server_description_t\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_context.3 new file mode 100644 index 0000000..c8c059b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_FAILED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_failed_get_context \- mongoc_apm_server_heartbeat_failed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_heartbeat_failed_get_context ( + const mongoc_apm_server_heartbeat_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_duration.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_duration.3 new file mode 100644 index 0000000..cc2941d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_duration.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_FAILED_GET_DURATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_failed_get_duration \- mongoc_apm_server_heartbeat_failed_get_duration() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_server_heartbeat_failed_get_duration ( + const mongoc_apm_server_heartbeat_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs duration in microseconds. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs duration. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_error.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_error.3 new file mode 100644 index 0000000..7c361f9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_error.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_FAILED_GET_ERROR" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_failed_get_error \- mongoc_apm_server_heartbeat_failed_get_error() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_server_heartbeat_failed_get_error ( + const mongoc_apm_server_heartbeat_failed_t *event, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Copies this event\(aqs error info. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_failed_t\fP\&. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP to receive the event\(aqs error info. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_host.3 new file mode 100644 index 0000000..909f4fd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_get_host.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_FAILED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_failed_get_host \- mongoc_apm_server_heartbeat_failed_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_heartbeat_failed_get_host ( + const mongoc_apm_server_heartbeat_failed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_failed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_t.3 new file mode 100644 index 0000000..ca89d31 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_failed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_FAILED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_failed_t \- mongoc_apm_server_heartbeat_failed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Heartbeat\-failed event +.SH SYNOPSIS +.sp +An event notification sent when the driver failed to send an "isMaster" command to check the status of a server. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_context.3 new file mode 100644 index 0000000..3af0a59 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_STARTED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_started_get_context \- mongoc_apm_server_heartbeat_started_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_heartbeat_started_get_context ( + const mongoc_apm_server_heartbeat_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_host.3 new file mode 100644 index 0000000..015da37 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_get_host.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_STARTED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_started_get_host \- mongoc_apm_server_heartbeat_started_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_heartbeat_started_get_host ( + const mongoc_apm_server_heartbeat_started_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_started_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_t.3 new file mode 100644 index 0000000..65eb84b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_started_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_STARTED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_started_t \- mongoc_apm_server_heartbeat_started_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Heartbeat\-started event +.SH SYNOPSIS +.sp +An event notification sent when the driver begins executing an "isMaster" command to check the status of a server. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_context.3 new file mode 100644 index 0000000..2b181d8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_SUCCEEDED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_succeeded_get_context \- mongoc_apm_server_heartbeat_succeeded_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_heartbeat_succeeded_get_context ( + const mongoc_apm_server_heartbeat_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_duration.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_duration.3 new file mode 100644 index 0000000..559ab9a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_duration.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_SUCCEEDED_GET_DURATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_succeeded_get_duration \- mongoc_apm_server_heartbeat_succeeded_get_duration() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_apm_server_heartbeat_succeeded_get_duration ( + const mongoc_apm_server_heartbeat_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs duration in microseconds. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs duration. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_host.3 new file mode 100644 index 0000000..412ef9e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_host.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_SUCCEEDED_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_succeeded_get_host \- mongoc_apm_server_heartbeat_succeeded_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_heartbeat_succeeded_get_host ( + const mongoc_apm_server_heartbeat_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_reply.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_reply.3 new file mode 100644 index 0000000..f78e653 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_get_reply.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_SUCCEEDED_GET_REPLY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_succeeded_get_reply \- mongoc_apm_server_heartbeat_succeeded_get_reply() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_apm_server_heartbeat_succeeded_get_reply ( + const mongoc_apm_server_heartbeat_succeeded_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs reply. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_heartbeat_succeeded_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_t.3 new file mode 100644 index 0000000..c08c3c9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_heartbeat_succeeded_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_HEARTBEAT_SUCCEEDED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_heartbeat_succeeded_t \- mongoc_apm_server_heartbeat_succeeded_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Heartbeat\-succeeded event +.SH SYNOPSIS +.sp +An event notification sent when the driver completes an "isMaster" command to check the status of a server. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_context.3 new file mode 100644 index 0000000..000563c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_OPENING_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_opening_get_context \- mongoc_apm_server_opening_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_server_opening_get_context ( + const mongoc_apm_server_opening_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_opening_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_host.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_host.3 new file mode 100644 index 0000000..1388905 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_host.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_OPENING_GET_HOST" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_opening_get_host \- mongoc_apm_server_opening_get_host() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_host_list_t * +mongoc_apm_server_opening_get_host (const mongoc_apm_server_opening_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs host. This \fBmongoc_host_list_t\fP is \fInot\fP part of a linked list, it is solely the server for this event. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_opening_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_host_list_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_topology_id.3 new file mode 100644 index 0000000..d3f4dd5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_OPENING_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_opening_get_topology_id \- mongoc_apm_server_opening_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_server_opening_get_topology_id ( + const mongoc_apm_server_opening_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_server_opening_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_t.3 new file mode 100644 index 0000000..6ac6133 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_server_opening_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SERVER_OPENING_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_server_opening_t \- mongoc_apm_server_opening_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Server\-opening event +.SH SYNOPSIS +.sp +An event notification sent when the driver adds a \fBmongoc_server_description_t\fP for a new server it was not monitoring before. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_failed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_failed_cb.3 new file mode 100644 index 0000000..923c808 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_failed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_COMMAND_FAILED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_command_failed_cb \- mongoc_apm_set_command_failed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_command_failed_cb_t) ( + const mongoc_apm_command_failed_t *event); + +void +mongoc_apm_set_command_failed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_command_failed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver fails to execute a MongoDB operation. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_command_failed_t\fP whenever a MongoDB operation fails. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_started_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_started_cb.3 new file mode 100644 index 0000000..760aace --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_started_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_COMMAND_STARTED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_command_started_cb \- mongoc_apm_set_command_started_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_command_started_cb_t) ( + const mongoc_apm_command_started_t *event); + +void +mongoc_apm_set_command_started_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_command_started_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver starts a MongoDB operation. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_command_started_t\fP whenever the driver begins a MongoDB operation. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_succeeded_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_succeeded_cb.3 new file mode 100644 index 0000000..1ed7f7c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_command_succeeded_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_COMMAND_SUCCEEDED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_command_succeeded_cb \- mongoc_apm_set_command_succeeded_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_command_succeeded_cb_t) ( + const mongoc_apm_command_succeeded_t *event); + +void +mongoc_apm_set_command_succeeded_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_command_succeeded_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver completes a MongoDB operation. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_command_succeeded_t\fP whenever the driver completes a MongoDB operation. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_changed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_changed_cb.3 new file mode 100644 index 0000000..fc23c35 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_changed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_CHANGED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_changed_cb \- mongoc_apm_set_server_changed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_changed_cb_t) ( + const mongoc_apm_server_changed_t *event); + +void +mongoc_apm_set_server_changed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_changed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver observes a change in status of a server it is connected to. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_changed_t\fP whenever the driver observes a change in status of a server it is connected to. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_closed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_closed_cb.3 new file mode 100644 index 0000000..64fca42 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_closed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_CLOSED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_closed_cb \- mongoc_apm_set_server_closed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_closed_cb_t) ( + const mongoc_apm_server_closed_t *event); + +void +mongoc_apm_set_server_closed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_closed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver stops monitoring a server and removes its \fBmongoc_server_description_t\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_closed_t\fP whenever the driver stops monitoring a server and removes its \fBmongoc_server_description_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_failed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_failed_cb.3 new file mode 100644 index 0000000..5afb9bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_failed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_HEARTBEAT_FAILED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_heartbeat_failed_cb \- mongoc_apm_set_server_heartbeat_failed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_heartbeat_failed_cb_t) ( + const mongoc_apm_server_heartbeat_failed_t *event); + +void +mongoc_apm_set_server_heartbeat_failed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_heartbeat_failed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver fails to send an "isMaster" command to check the status of a server. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_heartbeat_failed_t\fP whenever the driver fails to send an "isMaster" command to check the status of a server. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_started_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_started_cb.3 new file mode 100644 index 0000000..9c919d0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_started_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_HEARTBEAT_STARTED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_heartbeat_started_cb \- mongoc_apm_set_server_heartbeat_started_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_heartbeat_started_cb_t) ( + const mongoc_apm_server_heartbeat_started_t *event); + +void +mongoc_apm_set_server_heartbeat_started_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_heartbeat_started_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver begins executing an "isMaster" command to check the status of a server. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_heartbeat_started_t\fP whenever the driver begins executing an "isMaster" command to check the status of a server. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_succeeded_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_succeeded_cb.3 new file mode 100644 index 0000000..d01a31e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_heartbeat_succeeded_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_HEARTBEAT_SUCCEEDED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_heartbeat_succeeded_cb \- mongoc_apm_set_server_heartbeat_succeeded_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_heartbeat_succeeded_cb_t) ( + const mongoc_apm_server_heartbeat_succeeded_t *event); + +void +mongoc_apm_set_server_heartbeat_succeeded_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_heartbeat_succeeded_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver completes an "isMaster" command to check the status of a server. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_heartbeat_succeeded_t\fP whenever the driver completes an "isMaster" command to check the status of a server. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_opening_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_opening_cb.3 new file mode 100644 index 0000000..94365c6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_server_opening_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_SERVER_OPENING_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_server_opening_cb \- mongoc_apm_set_server_opening_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_server_opening_cb_t) ( + const mongoc_apm_server_opening_t *event); + +void +mongoc_apm_set_server_opening_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_server_opening_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver adds a \fBmongoc_server_description_t\fP for a new server it was not monitoring before. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_server_opening_t\fP whenever the driver adds a \fBmongoc_server_description_t\fP for a new server it was not monitoring before. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_changed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_changed_cb.3 new file mode 100644 index 0000000..52b0dc7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_changed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_TOPOLOGY_CHANGED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_topology_changed_cb \- mongoc_apm_set_topology_changed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_topology_changed_cb_t) ( + const mongoc_apm_topology_changed_t *event); + +void +mongoc_apm_set_topology_changed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_topology_changed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver observes a change in any of the servers it is connected to or a change in the overall server topology. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_topology_changed_t\fP whenever the driver observes a change in any of the servers it is connected to or a change in the overall server topology. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_closed_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_closed_cb.3 new file mode 100644 index 0000000..4069e6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_closed_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_TOPOLOGY_CLOSED_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_topology_closed_cb \- mongoc_apm_set_topology_closed_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_topology_closed_cb_t) ( + const mongoc_apm_topology_closed_t *event); + +void +mongoc_apm_set_topology_closed_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_topology_closed_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver stops monitoring a server topology and destroys its \fBmongoc_topology_description_t\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_topology_closed_t\fP whenever the driver stops monitoring a server topology and destroys its \fBmongoc_topology_description_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_opening_cb.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_opening_cb.3 new file mode 100644 index 0000000..95bb6b4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_set_topology_opening_cb.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_SET_TOPOLOGY_OPENING_CB" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_set_topology_opening_cb \- mongoc_apm_set_topology_opening_cb() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef void (*mongoc_apm_topology_opening_cb_t) ( + const mongoc_apm_topology_opening_t *event); + +void +mongoc_apm_set_topology_opening_cb (mongoc_apm_callbacks_t *callbacks, + mongoc_apm_topology_opening_cb_t cb); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Receive an event notification whenever the driver initializes a \fBmongoc_topology_description_t\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcb\fP: A function to call with a \fBmongoc_apm_topology_opening_t\fP whenever the driver initializes a \fBmongoc_topology_description_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_context.3 new file mode 100644 index 0000000..dff073f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CHANGED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_changed_get_context \- mongoc_apm_topology_changed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_topology_changed_get_context ( + const mongoc_apm_topology_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_new_description.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_new_description.3 new file mode 100644 index 0000000..145e4c2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_new_description.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CHANGED_GET_NEW_DESCRIPTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_changed_get_new_description \- mongoc_apm_topology_changed_get_new_description() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_topology_description_t * +mongoc_apm_topology_changed_get_new_description ( + const mongoc_apm_topology_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs new description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_topology_description_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_previous_description.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_previous_description.3 new file mode 100644 index 0000000..fa863a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_previous_description.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CHANGED_GET_PREVIOUS_DESCRIPTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_changed_get_previous_description \- mongoc_apm_topology_changed_get_previous_description() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_topology_description_t * +mongoc_apm_topology_changed_get_previous_description ( + const mongoc_apm_topology_changed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs previous description. The data is only valid in the scope of the callback that receives this event; copy it if it will be accessed after the callback returns. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_changed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_topology_description_t\fP that should not be modified or freed. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_topology_id.3 new file mode 100644 index 0000000..b9673a3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CHANGED_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_changed_get_topology_id \- mongoc_apm_topology_changed_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_topology_changed_get_topology_id ( + const mongoc_apm_topology_changed_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_changed_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_t.3 new file mode 100644 index 0000000..2303edf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_changed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CHANGED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_changed_t \- mongoc_apm_topology_changed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Topology\-changed event +.SH SYNOPSIS +.sp +An event notification sent when the driver observes a change in any of the servers it is connected to or a change in the overall server topology. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_context.3 new file mode 100644 index 0000000..4992ee7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CLOSED_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_closed_get_context \- mongoc_apm_topology_closed_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_topology_closed_get_context ( + const mongoc_apm_topology_closed_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_closed_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_topology_id.3 new file mode 100644 index 0000000..64048c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CLOSED_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_closed_get_topology_id \- mongoc_apm_topology_closed_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_topology_closed_get_topology_id ( + const mongoc_apm_topology_closed_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_closed_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_t.3 new file mode 100644 index 0000000..d1bfa39 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_closed_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_CLOSED_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_closed_t \- mongoc_apm_topology_closed_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Topology\-closed event +.SH SYNOPSIS +.sp +An event notification sent when the driver stops monitoring a server topology and destroys its \fBmongoc_topology_description_t\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_context.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_context.3 new file mode 100644 index 0000000..a60210f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_context.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_OPENING_GET_CONTEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_opening_get_context \- mongoc_apm_topology_opening_get_context() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void * +mongoc_apm_topology_opening_get_context ( + const mongoc_apm_topology_opening_t *event); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs context. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_opening_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The pointer passed with \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_topology_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_topology_id.3 new file mode 100644 index 0000000..8ed78c0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_get_topology_id.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_OPENING_GET_TOPOLOGY_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_opening_get_topology_id \- mongoc_apm_topology_opening_get_topology_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_apm_topology_opening_get_topology_id ( + const mongoc_apm_topology_opening_t *event, bson_oid_t *topology_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns this event\(aqs topology id. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBevent\fP: A \fBmongoc_apm_topology_opening_t\fP\&. +.IP \(bu 2 +\fBtopology_id\fP: A \fI\%bson_oid_t\fP to receive the event\(aqs topology_id. +.UNINDENT +.SH RETURNS +.sp +The event\(aqs topology id. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_t.3 new file mode 100644 index 0000000..cda51e3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_apm_topology_opening_t.3 @@ -0,0 +1,46 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APM_TOPOLOGY_OPENING_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_apm_topology_opening_t \- mongoc_apm_topology_opening_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Topology\-opening event +.SH SYNOPSIS +.sp +An event notification sent when the driver initializes a \fBmongoc_topology_description_t\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_application_performance_monitoring.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_application_performance_monitoring.3 new file mode 100644 index 0000000..c70f780 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_application_performance_monitoring.3 @@ -0,0 +1,629 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_APPLICATION_PERFORMANCE_MONITORING" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_application_performance_monitoring \- Application Performance Monitoring (APM) +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +The MongoDB C Driver allows you to monitor all the MongoDB operations the driver executes. This event\-notification system conforms to two MongoDB driver specs: +.INDENT 0.0 +.IP \(bu 2 +\fI\%Command Monitoring\fP: events related to all application operations. +.IP \(bu 2 +\fI\%SDAM Monitoring\fP: events related to the driver\(aqs Server Discovery And Monitoring logic. +.UNINDENT +.sp +To receive notifications, create a \fBmongoc_apm_callbacks_t\fP with \fBmongoc_apm_callbacks_new\fP, set callbacks on it, then pass it to \fBmongoc_client_set_apm_callbacks\fP or \fBmongoc_client_pool_set_apm_callbacks\fP\&. +.SH COMMAND-MONITORING EXAMPLE +example\-command\-monitoring.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-command\-monitoring.c \-o example\-command\-monitoring \e + * $(pkg\-config \-\-cflags \-\-libs libmongoc\-1.0) */ + +/* ./example\-command\-monitoring [CONNECTION_STRING] */ + +#include +#include + + +typedef struct { + int started; + int succeeded; + int failed; +} stats_t; + + +void +command_started (const mongoc_apm_command_started_t *event) +{ + char *s; + + s = bson_as_relaxed_extended_json ( + mongoc_apm_command_started_get_command (event), NULL); + printf ("Command %s started on %s:\en%s\en\en", + mongoc_apm_command_started_get_command_name (event), + mongoc_apm_command_started_get_host (event)\->host, + s); + + ((stats_t *) mongoc_apm_command_started_get_context (event))\->started++; + + bson_free (s); +} + + +void +command_succeeded (const mongoc_apm_command_succeeded_t *event) +{ + char *s; + + s = bson_as_relaxed_extended_json ( + mongoc_apm_command_succeeded_get_reply (event), NULL); + printf ("Command %s succeeded:\en%s\en\en", + mongoc_apm_command_succeeded_get_command_name (event), + s); + + ((stats_t *) mongoc_apm_command_succeeded_get_context (event))\->succeeded++; + + bson_free (s); +} + + +void +command_failed (const mongoc_apm_command_failed_t *event) +{ + bson_error_t error; + + mongoc_apm_command_failed_get_error (event, &error); + printf ("Command %s failed:\en\e"%s\e"\en\en", + mongoc_apm_command_failed_get_command_name (event), + error.message); + + ((stats_t *) mongoc_apm_command_failed_get_context (event))\->failed++; +} + + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_apm_callbacks_t *callbacks; + stats_t stats = {0}; + mongoc_collection_t *collection; + bson_error_t error; + const char *uri_string = + "mongodb://127.0.0.1/?appname=cmd\-monitoring\-example"; + mongoc_uri_t *uri; + const char *collection_name = "test"; + bson_t *docs[2]; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + callbacks = mongoc_apm_callbacks_new (); + mongoc_apm_set_command_started_cb (callbacks, command_started); + mongoc_apm_set_command_succeeded_cb (callbacks, command_succeeded); + mongoc_apm_set_command_failed_cb (callbacks, command_failed); + mongoc_client_set_apm_callbacks ( + client, callbacks, (void *) &stats /* context pointer */); + + collection = mongoc_client_get_collection (client, "test", collection_name); + mongoc_collection_drop (collection, NULL); + + docs[0] = BCON_NEW ("_id", BCON_INT32 (0)); + docs[1] = BCON_NEW ("_id", BCON_INT32 (1)); + mongoc_collection_insert_many ( + collection, (const bson_t **) docs, 2, NULL, NULL, NULL); + + /* duplicate key error on the second insert */ + mongoc_collection_insert_one (collection, docs[0], NULL, NULL, NULL); + + mongoc_collection_destroy (collection); + mongoc_apm_callbacks_destroy (callbacks); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + + printf ("started: %d\ensucceeded: %d\enfailed: %d\en", + stats.started, + stats.succeeded, + stats.failed); + + bson_destroy (docs[0]); + bson_destroy (docs[1]); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This example program prints: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +Command drop started on 127.0.0.1: +{ "drop" : "test" } + +Command drop succeeded: +{ "ns" : "test.test", "nIndexesWas" : 1, "ok" : 1.0 } + +Command insert started on 127.0.0.1: +{ + "insert" : "test", + "ordered" : true, + "documents" : [ + { "_id" : 0 }, { "_id" : 1 } + ] +} + +Command insert succeeded: +{ "n" : 2, "ok" : 1.0 } + +Command insert started on 127.0.0.1: +{ + "insert" : "test", + "ordered" : true, + "documents" : [ + { "_id" : 0 } + ] +} + +Command insert succeeded: +{ + "n" : 0, + "writeErrors" : [ + { "index" : 0, "code" : 11000, "errmsg" : "duplicate key" } + ], + "ok" : 1.0 +} + +started: 3 +succeeded: 3 +failed: 0 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The output has been edited and formatted for clarity. Depending on your server configuration, messages may include metadata like database name, logical session ids, or cluster times that are not shown here. +.sp +The final "insert" command is considered successful, despite the writeError, because the server replied to the overall command with \fB"ok": 1\fP\&. +.SH SDAM MONITORING EXAMPLE +example\-sdam\-monitoring.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-sdam\-monitoring.c \-o example\-sdam\-monitoring \e + * $(pkg\-config \-\-cflags \-\-libs libmongoc\-1.0) */ + +/* ./example\-sdam\-monitoring [CONNECTION_STRING] */ + +#include +#include + + +typedef struct { + int server_changed_events; + int server_opening_events; + int server_closed_events; + int topology_changed_events; + int topology_opening_events; + int topology_closed_events; + int heartbeat_started_events; + int heartbeat_succeeded_events; + int heartbeat_failed_events; +} stats_t; + + +static void +server_changed (const mongoc_apm_server_changed_t *event) +{ + stats_t *context; + const mongoc_server_description_t *prev_sd, *new_sd; + + context = (stats_t *) mongoc_apm_server_changed_get_context (event); + context\->server_changed_events++; + + prev_sd = mongoc_apm_server_changed_get_previous_description (event); + new_sd = mongoc_apm_server_changed_get_new_description (event); + + printf ("server changed: %s %s \-> %s\en", + mongoc_apm_server_changed_get_host (event)\->host_and_port, + mongoc_server_description_type (prev_sd), + mongoc_server_description_type (new_sd)); +} + + +static void +server_opening (const mongoc_apm_server_opening_t *event) +{ + stats_t *context; + + context = (stats_t *) mongoc_apm_server_opening_get_context (event); + context\->server_opening_events++; + + printf ("server opening: %s\en", + mongoc_apm_server_opening_get_host (event)\->host_and_port); +} + + +static void +server_closed (const mongoc_apm_server_closed_t *event) +{ + stats_t *context; + + context = (stats_t *) mongoc_apm_server_closed_get_context (event); + context\->server_closed_events++; + + printf ("server closed: %s\en", + mongoc_apm_server_closed_get_host (event)\->host_and_port); +} + + +static void +topology_changed (const mongoc_apm_topology_changed_t *event) +{ + stats_t *context; + const mongoc_topology_description_t *prev_td; + const mongoc_topology_description_t *new_td; + mongoc_server_description_t **prev_sds; + size_t n_prev_sds; + mongoc_server_description_t **new_sds; + size_t n_new_sds; + size_t i; + mongoc_read_prefs_t *prefs; + + context = (stats_t *) mongoc_apm_topology_changed_get_context (event); + context\->topology_changed_events++; + + prev_td = mongoc_apm_topology_changed_get_previous_description (event); + prev_sds = mongoc_topology_description_get_servers (prev_td, &n_prev_sds); + new_td = mongoc_apm_topology_changed_get_new_description (event); + new_sds = mongoc_topology_description_get_servers (new_td, &n_new_sds); + + printf ("topology changed: %s \-> %s\en", + mongoc_topology_description_type (prev_td), + mongoc_topology_description_type (new_td)); + + if (n_prev_sds) { + printf (" previous servers:\en"); + for (i = 0; i < n_prev_sds; i++) { + printf (" %s %s\en", + mongoc_server_description_type (prev_sds[i]), + mongoc_server_description_host (prev_sds[i])\->host_and_port); + } + } + + if (n_new_sds) { + printf (" new servers:\en"); + for (i = 0; i < n_new_sds; i++) { + printf (" %s %s\en", + mongoc_server_description_type (new_sds[i]), + mongoc_server_description_host (new_sds[i])\->host_and_port); + } + } + + prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); + + /* it is safe, and unfortunately necessary, to cast away const here */ + if (mongoc_topology_description_has_readable_server ( + (mongoc_topology_description_t *) new_td, prefs)) { + printf (" secondary AVAILABLE\en"); + } else { + printf (" secondary UNAVAILABLE\en"); + } + + if (mongoc_topology_description_has_writable_server ( + (mongoc_topology_description_t *) new_td)) { + printf (" primary AVAILABLE\en"); + } else { + printf (" primary UNAVAILABLE\en"); + } + + mongoc_read_prefs_destroy (prefs); + mongoc_server_descriptions_destroy_all (prev_sds, n_prev_sds); + mongoc_server_descriptions_destroy_all (new_sds, n_new_sds); +} + + +static void +topology_opening (const mongoc_apm_topology_opening_t *event) +{ + stats_t *context; + + context = (stats_t *) mongoc_apm_topology_opening_get_context (event); + context\->topology_opening_events++; + + printf ("topology opening\en"); +} + + +static void +topology_closed (const mongoc_apm_topology_closed_t *event) +{ + stats_t *context; + + context = (stats_t *) mongoc_apm_topology_closed_get_context (event); + context\->topology_closed_events++; + + printf ("topology closed\en"); +} + + +static void +server_heartbeat_started (const mongoc_apm_server_heartbeat_started_t *event) +{ + stats_t *context; + + context = + (stats_t *) mongoc_apm_server_heartbeat_started_get_context (event); + context\->heartbeat_started_events++; + + printf ("%s heartbeat started\en", + mongoc_apm_server_heartbeat_started_get_host (event)\->host_and_port); +} + + +static void +server_heartbeat_succeeded ( + const mongoc_apm_server_heartbeat_succeeded_t *event) +{ + stats_t *context; + char *reply; + + context = + (stats_t *) mongoc_apm_server_heartbeat_succeeded_get_context (event); + context\->heartbeat_succeeded_events++; + + reply = bson_as_canonical_extended_json ( + mongoc_apm_server_heartbeat_succeeded_get_reply (event), NULL); + + printf ( + "%s heartbeat succeeded: %s\en", + mongoc_apm_server_heartbeat_succeeded_get_host (event)\->host_and_port, + reply); + + bson_free (reply); +} + + +static void +server_heartbeat_failed (const mongoc_apm_server_heartbeat_failed_t *event) +{ + stats_t *context; + bson_error_t error; + + context = (stats_t *) mongoc_apm_server_heartbeat_failed_get_context (event); + context\->heartbeat_failed_events++; + mongoc_apm_server_heartbeat_failed_get_error (event, &error); + + printf ("%s heartbeat failed: %s\en", + mongoc_apm_server_heartbeat_failed_get_host (event)\->host_and_port, + error.message); +} + + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_apm_callbacks_t *cbs; + stats_t stats = {0}; + const char *uri_string = + "mongodb://127.0.0.1/?appname=sdam\-monitoring\-example"; + mongoc_uri_t *uri; + bson_t cmd = BSON_INITIALIZER; + bson_t reply; + bson_error_t error; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + cbs = mongoc_apm_callbacks_new (); + mongoc_apm_set_server_changed_cb (cbs, server_changed); + mongoc_apm_set_server_opening_cb (cbs, server_opening); + mongoc_apm_set_server_closed_cb (cbs, server_closed); + mongoc_apm_set_topology_changed_cb (cbs, topology_changed); + mongoc_apm_set_topology_opening_cb (cbs, topology_opening); + mongoc_apm_set_topology_closed_cb (cbs, topology_closed); + mongoc_apm_set_server_heartbeat_started_cb (cbs, server_heartbeat_started); + mongoc_apm_set_server_heartbeat_succeeded_cb (cbs, + server_heartbeat_succeeded); + mongoc_apm_set_server_heartbeat_failed_cb (cbs, server_heartbeat_failed); + mongoc_client_set_apm_callbacks ( + client, cbs, (void *) &stats /* context pointer */); + + /* the driver connects on demand to perform first operation */ + BSON_APPEND_INT32 (&cmd, "buildinfo", 1); + mongoc_client_command_simple (client, "admin", &cmd, NULL, &reply, &error); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + + printf ("Events:\en" + " server changed: %d\en" + " server opening: %d\en" + " server closed: %d\en" + " topology changed: %d\en" + " topology opening: %d\en" + " topology closed: %d\en" + " heartbeat started: %d\en" + " heartbeat succeeded: %d\en" + " heartbeat failed: %d\en", + stats.server_changed_events, + stats.server_opening_events, + stats.server_closed_events, + stats.topology_changed_events, + stats.topology_opening_events, + stats.topology_closed_events, + stats.heartbeat_started_events, + stats.heartbeat_succeeded_events, + stats.heartbeat_failed_events); + + bson_destroy (&cmd); + bson_destroy (&reply); + mongoc_apm_callbacks_destroy (cbs); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Start a 3\-node replica set on localhost with set name "rs" and start the program: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +\&./example\-sdam\-monitoring "mongodb://localhost:27017,localhost:27018/?replicaSet=rs" +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This example program prints something like: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +topology opening +topology changed: Unknown \-> ReplicaSetNoPrimary + secondary UNAVAILABLE + primary UNAVAILABLE +server opening: localhost:27017 +server opening: localhost:27018 +localhost:27017 heartbeat started +localhost:27018 heartbeat started +localhost:27017 heartbeat succeeded: { ... reply ... } +server changed: localhost:27017 Unknown \-> RSPrimary +server opening: localhost:27019 +topology changed: ReplicaSetNoPrimary \-> ReplicaSetWithPrimary + new servers: + RSPrimary localhost:27017 + secondary UNAVAILABLE + primary AVAILABLE +localhost:27019 heartbeat started +localhost:27018 heartbeat succeeded: { ... reply ... } +server changed: localhost:27018 Unknown \-> RSSecondary +topology changed: ReplicaSetWithPrimary \-> ReplicaSetWithPrimary + previous servers: + RSPrimary localhost:27017 + new servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + secondary AVAILABLE + primary AVAILABLE +localhost:27019 heartbeat succeeded: { ... reply ... } +server changed: localhost:27019 Unknown \-> RSSecondary +topology changed: ReplicaSetWithPrimary \-> ReplicaSetWithPrimary + previous servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + new servers: + RSPrimary localhost:27017 + RSSecondary localhost:27018 + RSSecondary localhost:27019 + secondary AVAILABLE + primary AVAILABLE +topology closed + +Events: + server changed: 3 + server opening: 3 + server closed: 0 + topology changed: 4 + topology opening: 1 + topology closed: 1 + heartbeat started: 3 + heartbeat succeeded: 3 + heartbeat failed: 0 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The driver connects to the mongods on ports 27017 and 27018, which were specified in the URI, and determines which is primary. It also discovers the third member, "localhost:27019", and adds it to the topology. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_authentication.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_authentication.3 new file mode 100644 index 0000000..b17cf93 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_authentication.3 @@ -0,0 +1,304 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_AUTHENTICATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_authentication \- Authentication +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +This guide covers the use of authentication options with the MongoDB C Driver. Ensure that the MongoDB server is also properly configured for authentication before making a connection. For more information, see the \fI\%MongoDB security documentation\fP\&. +.sp +The MongoDB C driver supports several authentication mechanisms through the use of MongoDB connection URIs. +.sp +By default, if a username and password are provided as part of the connection string (and an optional authentication database), they are used to connect via the default authentication mechanism of the server. +.sp +To select a specific authentication mechanism other than the default, see the list of supported mechanism below. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Currently supported values for the authMechanism connection string option are: +.INDENT 0.0 +.IP \(bu 2 +\fI\%SCRAM\-SHA\-1\fP +.IP \(bu 2 +\fI\%MONGODB\-CR (deprecated)\fP +.IP \(bu 2 +\fI\%GSSAPI\fP +.IP \(bu 2 +\fI\%PLAIN\fP +.IP \(bu 2 +\fI\%X509\fP +.UNINDENT +.SH BASIC AUTHENTICATION (SCRAM-SHA-256) +.sp +MongoDB 4.0 introduces support for authenticating using the SCRAM protocol +with the more secure SHA\-256 hash described in \fI\%RFC 7677\fP\&. Using this authentication mechanism +means that the password is never actually sent over the wire when +authenticating, but rather a computed proof that the client password is the +same as the password the server knows. In MongoDB 4.0, the C driver can +determine the correct default authentication mechanism for users with stored +SCRAM\-SHA\-1 and SCRAM\-SHA\-256 credentials: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authSource=mydb"); +/* the correct authMechanism is negotiated between the driver and server. */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Alternatively, SCRAM\-SHA\-256 can be explicitly specified as an authMechanism. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM\-SHA\-256&authSource=mydb"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Passwords for SCRAM\-SHA\-256 undergo the preprocessing step known as SASLPrep +specified in \fI\%RFC 4013\fP\&. SASLPrep will +only be performed for passwords containing non\-ASCII characters. SASLPrep +requires libicu. If libicu is not available, attempting to authenticate over +SCRAM\-SHA\-256 with non\-ASCII passwords will result in error. +.sp +Usernames \fInever\fP undergo SASLPrep. +.sp +By default, when building the C driver libicu is linked if available. This can +be changed with the \fBENABLE_ICU\fP cmake option. To specify an installation +path of libicu, specify \fBICU_ROOT\fP as a cmake option. See the +\fI\%FindICU\fP documentation +for more information. +.SH BASIC AUTHENTICATION (SCRAM-SHA-1) +.sp +The default authentication mechanism before MongoDB 4.0 is \fBSCRAM\-SHA\-1\fP (\fI\%RFC 5802\fP). Using this authentication mechanism means that the password is never actually sent over the wire when authenticating, but rather a computed proof that the client password is the same as the password the server knows. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM\-SHA\-1&authSource=mydb"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBSCRAM\-SHA\-1\fP authenticates against the \fBadmin\fP database by default. If the user is created in another database, then specifying the authSource is required. +.UNINDENT +.UNINDENT +.SH LEGACY AUTHENTICATION (MONGODB-CR) +.sp +The MONGODB\-CR authMechanism is deprecated and will no longer function in MongoDB 4.0. Instead, specify no authMechanism and the driver +will use an authentication mechanism compatible with your server. +.SH GSSAPI (KERBEROS) AUTHENTICATION +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +Kerberos support requires compiling the driver against \fBcyrus\-sasl\fP on UNIX\-like environments. On Windows, configure the driver to build against the Windows Native SSPI. +.UNINDENT +.UNINDENT +.sp +\fBGSSAPI\fP (Kerberos) authentication is available in the Enterprise Edition of MongoDB. To authenticate using \fBGSSAPI\fP, the MongoDB C driver must be installed with SASL support. +.sp +On UNIX\-like environments, run the \fBkinit\fP command before using the following authentication methods: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ kinit mongodbuser@EXAMPLE.COM +mongodbuser@EXAMPLE.COM\(aqs Password: +$ klistCredentials cache: FILE:/tmp/krb5cc_1000 + Principal: mongodbuser@EXAMPLE.COM + + Issued Expires Principal +Feb 9 13:48:51 2013 Feb 9 23:48:51 2013 krbtgt/EXAMPLE.COM@EXAMPLE.COM +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Now authenticate using the MongoDB URI. \fBGSSAPI\fP authenticates against the \fB$external\fP virtual database, so a database does not need to be specified in the URI. Note that the Kerberos principal \fImust\fP be URL\-encoded: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client; + +client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo\-server.example.com/?authMechanism=GSSAPI"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBGSSAPI\fP authenticates against the \fB$external\fP database, so specifying the authSource database is not required. +.UNINDENT +.UNINDENT +.sp +The driver supports these GSSAPI properties: +.INDENT 0.0 +.IP \(bu 2 +\fBCANONICALIZE_HOST_NAME\fP: This might be required with Cyrus\-SASL when the hosts report different hostnames than what is used in the Kerberos database. The default is "false". +.IP \(bu 2 +\fBSERVICE_NAME\fP: Use a different service name than the default, "mongodb". +.UNINDENT +.sp +Set properties in the URL: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client; + +client = mongoc_client_new ("mongodb://mongodbuser%40EXAMPLE.COM@mongo\-server.example.com/?authMechanism=GSSAPI&" + "authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +If you encounter errors such as \fBInvalid net address\fP, check if the application is behind a NAT (Network Address Translation) firewall. If so, create a ticket that uses \fBforwardable\fP and \fBaddressless\fP Kerberos tickets. This can be done by passing \fB\-f \-A\fP to \fBkinit\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ kinit \-f \-A mongodbuser@EXAMPLE.COM +.ft P +.fi +.UNINDENT +.UNINDENT +.SH SASL PLAIN AUTHENTICATION +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +The MongoDB C Driver must be compiled with SASL support in order to use \fBSASL PLAIN\fP authentication. +.UNINDENT +.UNINDENT +.sp +MongoDB Enterprise Edition supports the \fBSASL PLAIN\fP authentication mechanism, initially intended for delegating authentication to an LDAP server. Using the \fBSASL PLAIN\fP mechanism is very similar to the challenge response mechanism with usernames and passwords. This authentication mechanism uses the \fB$external\fP virtual database for \fBLDAP\fP support: +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBSASL PLAIN\fP is a clear\-text authentication mechanism. It is strongly recommended to connect to MongoDB using SSL with certificate validation when using the \fBPLAIN\fP mechanism. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client; + +client = mongoc_client_new ("mongodb://user:password@example.com/?authMechanism=PLAIN"); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBPLAIN\fP authenticates against the \fB$external\fP database, so specifying the authSource database is not required. +.SH X.509 CERTIFICATE AUTHENTICATION +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +The MongoDB C Driver must be compiled with SSL support for X.509 authentication support. Once this is done, start a server with the following options: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongod \-\-sslMode requireSSL \-\-sslPEMKeyFile server.pem \-\-sslCAFile ca.pem +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The \fBMONGODB\-X509\fP mechanism authenticates a username derived from the distinguished subject name of the X.509 certificate presented by the driver during SSL negotiation. This authentication method requires the use of SSL connections with certificate validation. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client; +mongoc_ssl_opt_t ssl_opts = { 0 }; + +ssl_opts.pem_file = "mycert.pem"; +ssl_opts.pem_pwd = "mycertpassword"; +ssl_opts.ca_file = "myca.pem"; +ssl_opts.ca_dir = "trust_dir"; +ssl_opts.weak_cert_validation = false; + +client = mongoc_client_new ("mongodb://x509_derived_username@localhost/?authMechanism=MONGODB\-X509"); +mongoc_client_set_ssl_opts (client, &ssl_opts); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBMONGODB\-X509\fP authenticates against the \fB$external\fP database, so specifying the authSource database is not required. For more information on the x509_derived_username, see the MongoDB server \fI\%x.509 tutorial\fP\&. +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +The MongoDB C Driver will attempt to determine the x509 derived username when none is provided, and as of MongoDB 3.4 providing the username is not required at all. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_basic_troubleshooting.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_basic_troubleshooting.3 new file mode 100644 index 0000000..55a2be2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_basic_troubleshooting.3 @@ -0,0 +1,138 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BASIC_TROUBLESHOOTING" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_basic_troubleshooting \- Basic Troubleshooting +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH TROUBLESHOOTING CHECKLIST +.sp +The following is a short list of things to check when you have a problem. +.INDENT 0.0 +.IP \(bu 2 +Did you call \fBmongoc_init()\fP in \fBmain()\fP? If not, you will likely see a segfault. +.IP \(bu 2 +Have you leaked any clients or cursors as can be found with \fBmongoc\-stat \fP? +.IP \(bu 2 +Have packets been delivered to the server? See egress bytes from \fBmongoc\-stat \fP\&. +.IP \(bu 2 +Does \fBvalgrind\fP show any leaks? Ensure you call \fBmongoc_cleanup()\fP at the end of your process to cleanup lingering allocations from the MongoDB C driver. +.IP \(bu 2 +If compiling your own copy of MongoDB C Driver, consider using the cmake option \fB\-DENABLE_TRACING=ON\fP to enable function tracing and hex dumps of network packets to \fBSTDERR\fP and \fBSTDOUT\fP\&. +.UNINDENT +.SH PERFORMANCE COUNTERS +.sp +The MongoDB C driver comes with an optional unique feature to help developers and sysadmins troubleshoot problems in production. +Performance counters are available for each process using the driver. +If available, the counters can be accessed outside of the application process via a shared memory segment. +This means that you can graph statistics about your application process easily from tools like Munin or Nagios. +Your author often uses \fBwatch \-\-interval=0.5 \-d mongoc\-stat $PID\fP to monitor an application. +.sp +Performance counters are only available on Linux platforms supporting shared memory segments. +On supported platforms they are enabled by default. +Applications can be built without the counters by specifying the cmake option \fB\-DENABLE_SHM_COUNTERS=OFF\fP\&. Additionally, if +performance counters are already compiled, they can be disabled at runtime by specifying the environment variable \fBMONGOC_DISABLE_SHM\fP\&. +.sp +Performance counters keep track of the following: +.INDENT 0.0 +.IP \(bu 2 +Active and Disposed Cursors +.IP \(bu 2 +Active and Disposed Clients, Client Pools, and Socket Streams. +.IP \(bu 2 +Number of operations sent and received, by type. +.IP \(bu 2 +Bytes transferred and received. +.IP \(bu 2 +Authentication successes and failures. +.IP \(bu 2 +Number of wire protocol errors. +.UNINDENT +.sp +To access counters for a given process, simply provide the process id to the \fBmongoc\-stat\fP program installed with the MongoDB C Driver. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongoc\-stat 22203 + Operations : Egress Total : The number of sent operations. : 13247 + Operations : Ingress Total : The number of received operations. : 13246 + Operations : Egress Queries : The number of sent Query operations. : 13247 + Operations : Ingress Queries : The number of received Query operations. : 0 + Operations : Egress GetMore : The number of sent GetMore operations. : 0 + Operations : Ingress GetMore : The number of received GetMore operations. : 0 + Operations : Egress Insert : The number of sent Insert operations. : 0 + Operations : Ingress Insert : The number of received Insert operations. : 0 + Operations : Egress Delete : The number of sent Delete operations. : 0 + Operations : Ingress Delete : The number of received Delete operations. : 0 + Operations : Egress Update : The number of sent Update operations. : 0 + Operations : Ingress Update : The number of received Update operations. : 0 + Operations : Egress KillCursors : The number of sent KillCursors operations. : 0 + Operations : Ingress KillCursors : The number of received KillCursors operations. : 0 + Operations : Egress Msg : The number of sent Msg operations. : 0 + Operations : Ingress Msg : The number of received Msg operations. : 0 + Operations : Egress Reply : The number of sent Reply operations. : 0 + Operations : Ingress Reply : The number of received Reply operations. : 13246 + Cursors : Active : The number of active cursors. : 1 + Cursors : Disposed : The number of disposed cursors. : 13246 + Clients : Active : The number of active clients. : 1 + Clients : Disposed : The number of disposed clients. : 0 + Streams : Active : The number of active streams. : 1 + Streams : Disposed : The number of disposed streams. : 0 + Streams : Egress Bytes : The number of bytes sent. : 794931 + Streams : Ingress Bytes : The number of bytes received. : 589694 + Streams : N Socket Timeouts : The number of socket timeouts. : 0 + Client Pools : Active : The number of active client pools. : 1 + Client Pools : Disposed : The number of disposed client pools. : 0 + Protocol : Ingress Errors : The number of protocol errors on ingress. : 0 + Auth : Failures : The number of failed authentication requests. : 0 + Auth : Success : The number of successful authentication requests. : 0 +.ft P +.fi +.UNINDENT +.UNINDENT +.SH SUBMITTING A BUG REPORT +.sp +Think you\(aqve found a bug? Want to see a new feature in the MongoDB C driver? Please open a case in our issue management tool, JIRA: +.INDENT 0.0 +.IP \(bu 2 +\fI\%Create an account and login\fP\&. +.IP \(bu 2 +Navigate to \fI\%the CDRIVER project\fP\&. +.IP \(bu 2 +Click \fICreate Issue\fP \- Please provide as much information as possible about the issue type and how to reproduce it. +.UNINDENT +.sp +Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are \fIpublic\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk.3 new file mode 100644 index 0000000..0597b1c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk.3 @@ -0,0 +1,1002 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk \- Bulk Write Operations +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +This tutorial explains how to take advantage of MongoDB C driver bulk write operation features. Executing write operations in batches reduces the number of network round trips, increasing write throughput. +.SH BULK INSERT +.sp +First we need to fetch a bulk operation handle from the \fBmongoc_collection_t\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_bulk_operation_t *bulk = + mongoc_collection_create_bulk_operation_with_opts (collection, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +We can now start inserting documents to the bulk operation. These will be buffered until we execute the operation. +.sp +The bulk operation will coalesce insertions as a single batch for each consecutive call to \fBmongoc_bulk_operation_insert()\fP\&. This creates a pipelined effect when possible. +.sp +To execute the bulk operation and receive the result we call \fBmongoc_bulk_operation_execute()\fP\&. +bulk1.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include +#include + +static void +bulk1 (mongoc_collection_t *collection) +{ + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *doc; + bson_t reply; + char *str; + bool ret; + int i; + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL); + + for (i = 0; i < 10000; i++) { + doc = BCON_NEW ("i", BCON_INT32 (i)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + } + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + fprintf (stderr, "Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk1\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "test"); + + bulk1 (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example \fBreply\fP document: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{"nInserted" : 10000, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [] + "writeConcernErrors" : [] } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH MIXED BULK WRITE OPERATIONS +.sp +MongoDB C driver also supports executing mixed bulk write operations. A batch of insert, update, and remove operations can be executed together using the bulk write operations API. +.SH ORDERED BULK WRITE OPERATIONS +.sp +Ordered bulk write operations are batched and sent to the server in the order provided for serial execution. The \fBreply\fP document describes the type and count of operations performed. +bulk2.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include +#include + +static void +bulk2 (mongoc_collection_t *collection) +{ + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *query; + bson_t *doc; + bson_t *opts; + bson_t reply; + char *str; + bool ret; + int i; + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL); + + /* Remove everything */ + query = bson_new (); + mongoc_bulk_operation_remove (bulk, query); + bson_destroy (query); + + /* Add a few documents */ + for (i = 1; i < 4; i++) { + doc = BCON_NEW ("_id", BCON_INT32 (i)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + } + + /* {_id: 1} => {$set: {foo: "bar"}} */ + query = BCON_NEW ("_id", BCON_INT32 (1)); + doc = BCON_NEW ("$set", "{", "foo", BCON_UTF8 ("bar"), "}"); + mongoc_bulk_operation_update_many_with_opts (bulk, query, doc, NULL, &error); + bson_destroy (query); + bson_destroy (doc); + + /* {_id: 4} => {\(aq$inc\(aq: {\(aqj\(aq: 1}} (upsert) */ + opts = BCON_NEW ("upsert", BCON_BOOL (true)); + query = BCON_NEW ("_id", BCON_INT32 (4)); + doc = BCON_NEW ("$inc", "{", "j", BCON_INT32 (1), "}"); + mongoc_bulk_operation_update_many_with_opts (bulk, query, doc, opts, &error); + bson_destroy (query); + bson_destroy (doc); + bson_destroy (opts); + + /* replace {j:1} with {j:2} */ + query = BCON_NEW ("j", BCON_INT32 (1)); + doc = BCON_NEW ("j", BCON_INT32 (2)); + mongoc_bulk_operation_replace_one_with_opts (bulk, query, doc, NULL, &error); + bson_destroy (query); + bson_destroy (doc); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk2\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "test"); + + bulk2 (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example \fBreply\fP document: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "nInserted" : 3, + "nMatched" : 2, + "nModified" : 2, + "nRemoved" : 10000, + "nUpserted" : 1, + "upserted" : [{"index" : 5, "_id" : 4}], + "writeErrors" : [] + "writeConcernErrors" : [] } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBindex\fP field in the \fBupserted\fP array is the 0\-based index of the upsert operation; in this example, the sixth operation of the overall bulk operation was an upsert, so its index is 5. +.SH UNORDERED BULK WRITE OPERATIONS +.sp +Unordered bulk write operations are batched and sent to the server in \fIarbitrary order\fP where they may be executed in parallel. Any errors that occur are reported after all operations are attempted. +.sp +In the next example the first and third operations fail due to the unique constraint on \fB_id\fP\&. Since we are doing unordered execution the second and fourth operations succeed. +bulk3.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include +#include + +static void +bulk3 (mongoc_collection_t *collection) +{ + bson_t opts = BSON_INITIALIZER; + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *query; + bson_t *doc; + bson_t reply; + char *str; + bool ret; + + /* false indicates unordered */ + BSON_APPEND_BOOL (&opts, "ordered", false); + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts); + bson_destroy (&opts); + + /* Add a document */ + doc = BCON_NEW ("_id", BCON_INT32 (1)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + /* remove {_id: 2} */ + query = BCON_NEW ("_id", BCON_INT32 (2)); + mongoc_bulk_operation_remove_one (bulk, query); + bson_destroy (query); + + /* insert {_id: 3} */ + doc = BCON_NEW ("_id", BCON_INT32 (3)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + /* replace {_id:4} {\(aqi\(aq: 1} */ + query = BCON_NEW ("_id", BCON_INT32 (4)); + doc = BCON_NEW ("i", BCON_INT32 (1)); + mongoc_bulk_operation_replace_one (bulk, query, doc, false); + bson_destroy (query); + bson_destroy (doc); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); + bson_destroy (&opts); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk3\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "test"); + + bulk3 (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example \fBreply\fP document: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "nInserted" : 0, + "nMatched" : 1, + "nModified" : 1, + "nRemoved" : 1, + "nUpserted" : 0, + "writeErrors" : [ + { "index" : 0, + "code" : 11000, + "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 }" }, + { "index" : 2, + "code" : 11000, + "errmsg" : "E11000 duplicate key error index: test.test.$_id_ dup key: { : 3 }" } ], + "writeConcernErrors" : [] } + +Error: E11000 duplicate key error index: test.test.$_id_ dup key: { : 1 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBbson_error_t\fP domain is \fBMONGOC_ERROR_COMMAND\fP and its code is 11000. +.SH BULK OPERATION BYPASSING DOCUMENT VALIDATION +.sp +This feature is only available when using MongoDB 3.2 and later. +.sp +By default bulk operations are validated against the schema, if any is defined. In certain cases however it may be necessary to bypass the document validation. +bulk5.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include +#include + +static void +bulk5_fail (mongoc_collection_t *collection) +{ + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *doc; + bson_t reply; + char *str; + bool ret; + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL); + + /* Two inserts */ + doc = BCON_NEW ("_id", BCON_INT32 (31)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + doc = BCON_NEW ("_id", BCON_INT32 (32)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + /* The above documents do not comply to the schema validation rules + * we created previously, so this will result in an error */ + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); +} + +static void +bulk5_success (mongoc_collection_t *collection) +{ + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *doc; + bson_t reply; + char *str; + bool ret; + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, NULL); + + /* Allow this document to bypass document validation. + * NOTE: When authentication is enabled, the authenticated user must have + * either the "dbadmin" or "restore" roles to bypass document validation */ + mongoc_bulk_operation_set_bypass_document_validation (bulk, true); + + /* Two inserts */ + doc = BCON_NEW ("_id", BCON_INT32 (31)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + doc = BCON_NEW ("_id", BCON_INT32 (32)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); +} + +int +main (int argc, char *argv[]) +{ + bson_t *options; + bson_error_t error; + mongoc_client_t *client; + mongoc_collection_t *collection; + mongoc_database_t *database; + const char *uri_string = "mongodb://localhost/?appname=bulk5\-example"; + mongoc_uri_t *uri; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + database = mongoc_client_get_database (client, "testasdf"); + + /* Create schema validator */ + options = BCON_NEW ( + "validator", "{", "number", "{", "$gte", BCON_INT32 (5), "}", "}"); + collection = + mongoc_database_create_collection (database, "collname", options, &error); + + if (collection) { + bulk5_fail (collection); + bulk5_success (collection); + mongoc_collection_destroy (collection); + } else { + fprintf (stderr, "Couldn\(aqt create collection: \(aq%s\(aq\en", error.message); + } + + bson_free (options); + mongoc_uri_destroy (uri); + mongoc_database_destroy (database); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Running the above example will result in: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "nInserted" : 0, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [ + { "index" : 0, + "code" : 121, + "errmsg" : "Document failed validation" } ] } + +Error: Document failed validation + +{ "nInserted" : 2, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [] } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBbson_error_t\fP domain is \fBMONGOC_ERROR_COMMAND\fP\&. +.SH BULK OPERATION WRITE CONCERNS +.sp +By default bulk operations are executed with the \fBwrite_concern\fP of the collection they are executed against. A custom write concern can be passed to the \fBmongoc_collection_create_bulk_operation_with_opts()\fP method. Write concern errors (e.g. wtimeout) will be reported after all operations are attempted, regardless of execution order. +bulk4.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include +#include + +static void +bulk4 (mongoc_collection_t *collection) +{ + bson_t opts = BSON_INITIALIZER; + mongoc_write_concern_t *wc; + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *doc; + bson_t reply; + char *str; + bool ret; + + wc = mongoc_write_concern_new (); + mongoc_write_concern_set_w (wc, 4); + mongoc_write_concern_set_wtimeout (wc, 100); /* milliseconds */ + mongoc_write_concern_append (wc, &opts); + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts); + + /* Two inserts */ + doc = BCON_NEW ("_id", BCON_INT32 (10)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + doc = BCON_NEW ("_id", BCON_INT32 (11)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); + mongoc_write_concern_destroy (wc); + bson_destroy (&opts); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk4\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "test"); + + bulk4 (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Example \fBreply\fP document and error message: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "nInserted" : 2, + "nMatched" : 0, + "nModified" : 0, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [], + "writeConcernErrors" : [ + { "code" : 64, + "errmsg" : "waiting for replication timed out" } +] } + +Error: waiting for replication timed out +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBbson_error_t\fP domain is \fBMONGOC_ERROR_WRITE_CONCERN\fP if there are write concern errors and no write errors. Write errors indicate failed operations, so they take precedence over write concern errors, which mean merely that the write concern is not satisfied \fIyet\fP\&. +.SH SETTING COLLATION ORDER +.sp +This feature is only available when using MongoDB 3.4 and later. +bulk\-collation.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +bulk_collation (mongoc_collection_t *collection) +{ + mongoc_bulk_operation_t *bulk; + bson_t *opts; + bson_t *doc; + bson_t *selector; + bson_t *update; + bson_error_t error; + bson_t reply; + char *str; + uint32_t ret; + + /* insert {_id: "one"} and {_id: "One"} */ + bulk = mongoc_collection_create_bulk_operation_with_opts ( + collection, NULL); + doc = BCON_NEW ("_id", BCON_UTF8 ("one")); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + doc = BCON_NEW ("_id", BCON_UTF8 ("One")); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + /* "One" normally sorts before "one"; make "one" come first */ + opts = BCON_NEW ("collation", + "{", + "locale", + BCON_UTF8 ("en_US"), + "caseFirst", + BCON_UTF8 ("lower"), + "}"); + + /* set x=1 on the document with _id "One", which now sorts after "one" */ + update = BCON_NEW ("$set", "{", "x", BCON_INT64 (1), "}"); + selector = BCON_NEW ("_id", "{", "$gt", BCON_UTF8 ("one"), "}"); + mongoc_bulk_operation_update_one_with_opts ( + bulk, selector, update, opts, &error); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + bson_destroy (update); + bson_destroy (selector); + bson_destroy (opts); + mongoc_bulk_operation_destroy (bulk); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk\-collation"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "db", "collection"); + bulk_collation (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Running the above example will result in: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "nInserted" : 2, + "nMatched" : 1, + "nModified" : 1, + "nRemoved" : 0, + "nUpserted" : 0, + "writeErrors" : [ ] +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH UNACKNOWLEDGED BULK WRITES +.sp +Set "w" to zero for an unacknowledged write. The driver sends unacknowledged writes using the legacy opcodes \fBOP_INSERT\fP, \fBOP_UPDATE\fP, and \fBOP_DELETE\fP\&. +bulk6.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +bulk6 (mongoc_collection_t *collection) +{ + bson_t opts = BSON_INITIALIZER; + mongoc_write_concern_t *wc; + mongoc_bulk_operation_t *bulk; + bson_error_t error; + bson_t *doc; + bson_t *selector; + bson_t reply; + char *str; + bool ret; + + wc = mongoc_write_concern_new (); + mongoc_write_concern_set_w (wc, 0); + mongoc_write_concern_append (wc, &opts); + + bulk = mongoc_collection_create_bulk_operation_with_opts (collection, &opts); + + doc = BCON_NEW ("_id", BCON_INT32 (10)); + mongoc_bulk_operation_insert (bulk, doc); + bson_destroy (doc); + + selector = BCON_NEW ("_id", BCON_INT32 (11)); + mongoc_bulk_operation_remove_one (bulk, selector); + bson_destroy (selector); + + ret = mongoc_bulk_operation_execute (bulk, &reply, &error); + + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + + if (!ret) { + printf ("Error: %s\en", error.message); + } + + bson_destroy (&reply); + mongoc_bulk_operation_destroy (bulk); + mongoc_write_concern_destroy (wc); + bson_destroy (&opts); +} + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + const char *uri_string = "mongodb://localhost/?appname=bulk6\-example"; + mongoc_uri_t *uri; + bson_error_t error; + + mongoc_init (); + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + collection = mongoc_client_get_collection (client, "test", "test"); + + bulk6 (collection); + + mongoc_uri_destroy (uri); + mongoc_collection_destroy (collection); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBreply\fP document is empty: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ } +.ft P +.fi +.UNINDENT +.UNINDENT +.SH FURTHER READING +.sp +See the \fI\%Driver Bulk API Spec\fP, which describes bulk write operations for all MongoDB drivers. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete.3 new file mode 100644 index 0000000..5fa9c68 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_DELETE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_delete \- mongoc_bulk_operation_delete() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_delete (mongoc_bulk_operation_t *bulk, + const bson_t *selector); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Deletes documents as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.SH DEPRECATED +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function is deprecated and should not be used in new code. +.UNINDENT +.UNINDENT +.sp +Please use \fBmongoc_bulk_operation_remove()\fP instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.sp +\fBmongoc_bulk_operation_remove_one_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete_one.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete_one.3 new file mode 100644 index 0000000..9ed2560 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_delete_one.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_DELETE_ONE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_delete_one \- mongoc_bulk_operation_delete_one() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_delete_one (mongoc_bulk_operation_t *bulk, + const bson_t *selector); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Delete a single document as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.SH DEPRECATED +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function is deprecated and should not be used in new code. +.UNINDENT +.UNINDENT +.sp +Please use \fBmongoc_bulk_operation_remove_one()\fP instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_one_with_opts()\fP +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_destroy.3 new file mode 100644 index 0000000..0950ba7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_destroy.3 @@ -0,0 +1,57 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_destroy \- mongoc_bulk_operation_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_destroy (mongoc_bulk_operation_t *bulk); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Destroys a \fBmongoc_bulk_operation_t\fP and frees the structure. Does nothing if \fBbulk\fP is NULL. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_execute.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_execute.3 new file mode 100644 index 0000000..38ebac5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_execute.3 @@ -0,0 +1,87 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_EXECUTE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_execute \- mongoc_bulk_operation_execute() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function executes all operations queued into the bulk operation. Unless \fBordered: false\fP was specified in the \fBopts\fP passed to \fBmongoc_collection_create_bulk_operation_with_opts()\fP, then forward progress will be stopped upon the first error. +.sp +It is only valid to call \fBmongoc_bulk_operation_execute()\fP once. The \fBmongoc_bulk_operation_t\fP must be destroyed afterwards. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBreply\fP is always initialized, even upon failure. Callers \fImust\fP call \fI\%bson_destroy()\fP to release this potential allocation. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBreply\fP: An uninitialized \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +\fBBulk Write Operations\fP +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +On success, returns the server id used. On failure, returns 0 and sets \fBerror\fP\&. +.sp +A write concern timeout or write concern error is considered a failure. +.sp +The \fBreply\fP document counts operations and collects error information. See Bulk Write Operations for examples. +.sp +See also \fBmongoc_bulk_operation_get_hint\fP, which gets the id of the server used even if the operation failed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_hint.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_hint.3 new file mode 100644 index 0000000..9bb9bba --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_hint.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_GET_HINT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_get_hint \- mongoc_bulk_operation_get_hint() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +uint32_t +mongoc_bulk_operation_get_hint (const mongoc_bulk_operation_t *bulk); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Retrieves the opaque id of the server used for the operation. +.sp +(The function name includes the old term "hint" for the sake of backward compatibility, but we now call this number a "server id".) +.sp +This number is zero until the driver actually uses a server in \fBmongoc_bulk_operation_execute\fP\&. The server id is the same number as the return value of a successful \fBmongoc_bulk_operation_execute\fP, so \fBmongoc_bulk_operation_get_hint\fP is useful mainly in case \fBmongoc_bulk_operation_execute\fP fails and returns zero. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_write_concern.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_write_concern.3 new file mode 100644 index 0000000..829d4f7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_get_write_concern.3 @@ -0,0 +1,61 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_GET_WRITE_CONCERN" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_get_write_concern \- mongoc_bulk_operation_get_write_concern() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_write_concern_t * +mongoc_bulk_operation_get_write_concern (const mongoc_bulk_operation_t *bulk); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Fetches the write concern to be used for \fBbulk\fP\&. +.SH RETURNS +.sp +A \fBmongoc_write_concern_t\fP that should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert.3 new file mode 100644 index 0000000..8d2a64c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_INSERT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_insert \- mongoc_bulk_operation_insert() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_insert (mongoc_bulk_operation_t *bulk, + const bson_t *document); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Queue an insert of a single document into a bulk operation. The insert is not performed until \fBmongoc_bulk_operation_execute()\fP is called. +.sp +This function is superseded by \fBmongoc_bulk_operation_insert_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +bulk +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert_with_opts.3 new file mode 100644 index 0000000..e378a40 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_insert_with_opts.3 @@ -0,0 +1,76 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_INSERT_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_insert_with_opts \- mongoc_bulk_operation_insert_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_insert_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *document, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Queue an insert of a single document into a bulk operation. The insert is not performed until \fBmongoc_bulk_operation_execute()\fP is called. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.UNINDENT +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove.3 new file mode 100644 index 0000000..1dd1bdb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REMOVE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_remove \- mongoc_bulk_operation_remove() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_remove (mongoc_bulk_operation_t *bulk, + const bson_t *selector); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Remove documents as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +This function is superseded by \fBmongoc_bulk_operation_remove_one_with_opts()\fP and \fBmongoc_bulk_operation_remove_many_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP\&. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_one()\fP +.sp +\fBmongoc_bulk_operation_remove_one_with_opts()\fP +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_many_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_many_with_opts.3 new file mode 100644 index 0000000..77b0d6c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_many_with_opts.3 @@ -0,0 +1,81 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REMOVE_MANY_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_remove_many_with_opts \- mongoc_bulk_operation_remove_many_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_remove_many_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Delete documents as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove()\fP +.sp +\fBmongoc_bulk_operation_remove_one_with_opts()\fP +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one.3 new file mode 100644 index 0000000..f8efde5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one.3 @@ -0,0 +1,70 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REMOVE_ONE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_remove_one \- mongoc_bulk_operation_remove_one() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_remove_one (mongoc_bulk_operation_t *bulk, + const bson_t *selector); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Remove a single document as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +This function is superseded by \fBmongoc_bulk_operation_remove_one_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_one_with_opts()\fP +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one_with_opts.3 new file mode 100644 index 0000000..4e086f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_remove_one_with_opts.3 @@ -0,0 +1,81 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REMOVE_ONE_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_remove_one_with_opts \- mongoc_bulk_operation_remove_one_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_remove_one_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Remove a single document as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_one()\fP +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one.3 new file mode 100644 index 0000000..94f79e7 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one.3 @@ -0,0 +1,81 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REPLACE_ONE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_replace_one \- mongoc_bulk_operation_replace_one() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_replace_one (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + bool upsert); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Replace a single document as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +This function is superseded by \fBmongoc_bulk_operation_replace_one_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the replacement document. +.IP \(bu 2 +\fBupsert\fP: \fBtrue\fP if this should be an \fBupsert\fP\&. +.UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBdocument\fP may not contain fields with keys containing \fB\&.\fP or \fB$\fP\&. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_replace_one_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one_with_opts.3 new file mode 100644 index 0000000..f98b21c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_replace_one_with_opts.3 @@ -0,0 +1,95 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_REPLACE_ONE_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_replace_one_with_opts \- mongoc_bulk_operation_replace_one_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_replace_one_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Replace a single document as part of a bulk operation. This only queues the operation. To execute it, call \fBmongoc_bulk_operation_execute()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the replacement document. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP any errors that may have occurred. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBupsert\fP: If true, insert a document if none match \fBselector\fP\&. +.UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBdocument\fP may not contain fields with keys containing \fB\&.\fP or \fB$\fP\&. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_remove_many_with_opts()\fP +.sp +\fBmongoc_bulk_operation_insert()\fP +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_bypass_document_validation.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_bypass_document_validation.3 new file mode 100644 index 0000000..dc79fc4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_bypass_document_validation.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_SET_BYPASS_DOCUMENT_VALIDATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_set_bypass_document_validation \- mongoc_bulk_operation_set_bypass_document_validation() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_set_bypass_document_validation ( + mongoc_bulk_operation_t *bulk, bool bypass); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBbypass\fP: A boolean. +.UNINDENT +.SH DESCRIPTION +.sp +Will bypass document validation for all operations part of this bulk\&. +.SH SEE ALSO +.sp +bulk_operation_bypassing_document_validation +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_hint.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_hint.3 new file mode 100644 index 0000000..69adec9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_set_hint.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_SET_HINT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_set_hint \- mongoc_bulk_operation_set_hint() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_set_hint (const mongoc_bulk_operation_t *bulk, + uint32_t server_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBserver_id\fP: An opaque id identifying the server to use. +.UNINDENT +.SH DESCRIPTION +.sp +Specifies which server to use for the operation. This function has an effect only if called before \fBmongoc_bulk_operation_execute\fP\&. +.sp +(The function name includes the old term "hint" for the sake of backward compatibility, but we now call this number a "server id".) +.sp +Use \fBmongoc_bulk_operation_set_hint\fP only for building a language driver that wraps the C Driver. When writing applications in C, leave the server id unset and allow the driver to choose a suitable server for the bulk operation. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_t.3 new file mode 100644 index 0000000..f996e3d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_t.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_t \- mongoc_bulk_operation_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Bulk Write Operations +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct _mongoc_bulk_operation_t mongoc_bulk_operation_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The opaque type \fBmongoc_bulk_operation_t\fP provides an abstraction for submitting multiple write operations as a single batch. +.sp +After adding all of the write operations to the \fBmongoc_bulk_operation_t\fP, call \fBmongoc_bulk_operation_execute()\fP to execute the operation. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +It is only valid to call \fBmongoc_bulk_operation_execute()\fP once. The \fBmongoc_bulk_operation_t\fP must be destroyed afterwards. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBBulk Write Operations\fP +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update.3 new file mode 100644 index 0000000..78a1138 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_UPDATE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_update \- mongoc_bulk_operation_update() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_update (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + bool upsert); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function queues an update as part of a bulk operation. This does not execute the operation. To execute the entirety of the bulk operation call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +\fBdocument\fP MUST only contain fields whose key starts with \fB$\fP\&. See the update document specification for more details. +.sp +This function is superseded by \fBmongoc_bulk_operation_update_one_with_opts()\fP and \fBmongoc_bulk_operation_update_many_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which documents to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the update document. +.IP \(bu 2 +\fBupsert\fP: \fBtrue\fP if an \fBupsert\fP should be performed. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_update_one_with_opts()\fP +.sp +\fBmongoc_bulk_operation_update_many_with_opts()\fP +.SH ERRORS +.sp +Errors are propagated via \fBmongoc_bulk_operation_execute()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_many_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_many_with_opts.3 new file mode 100644 index 0000000..5a7debc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_many_with_opts.3 @@ -0,0 +1,95 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_UPDATE_MANY_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_update_many_with_opts \- mongoc_bulk_operation_update_many_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_update_many_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function queues an update as part of a bulk operation. This does not execute the operation. To execute the entirety of the bulk operation call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBdocument\fP MUST only contain fields whose key starts with \fB$\fP\&. See the update document specification for more details. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which documents to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the update document. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP any errors that may have occurred. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBupsert\fP: If true, insert a document if none match \fBselector\fP\&. +.IP \(bu 2 +\fBarrayFilters\fP: An array of filters specifying to which array elements an update should apply. +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_update_one_with_opts()\fP +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if there is a server or network error or if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one.3 new file mode 100644 index 0000000..63f0d20 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one.3 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_UPDATE_ONE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_update_one \- mongoc_bulk_operation_update_one() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_bulk_operation_update_one (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + bool upsert); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function queues an update as part of a bulk operation. It will only modify a single document on the MongoDB server. This function does not execute the operation. To execute the entirety of the bulk operation call \fBmongoc_bulk_operation_execute()\fP\&. +.sp +This function is superseded by \fBmongoc_bulk_operation_update_one_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the update document. +.IP \(bu 2 +\fBupsert\fP: \fBtrue\fP if an \fBupsert\fP should be performed. +.UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBdocument\fP \fImust only\fP contain fields whose key starts with \fB$\fP\&. See the update document specification for more details. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_update()\fP +.sp +\fBmongoc_bulk_operation_update_one_with_opts()\fP +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one_with_opts.3 new file mode 100644 index 0000000..011c66b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_bulk_operation_update_one_with_opts.3 @@ -0,0 +1,95 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_BULK_OPERATION_UPDATE_ONE_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_bulk_operation_update_one_with_opts \- mongoc_bulk_operation_update_one_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_bulk_operation_update_one_with_opts (mongoc_bulk_operation_t *bulk, + const bson_t *selector, + const bson_t *document, + const bson_t *opts, + bson_error_t *error); /* OUT */ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function queues an update as part of a bulk operation. It will only modify a single document on the MongoDB server. This function does not execute the operation. To execute the entirety of the bulk operation call \fBmongoc_bulk_operation_execute()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBbulk\fP: A \fBmongoc_bulk_operation_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP that selects which document to remove. +.IP \(bu 2 +\fBdocument\fP: A \fI\%bson_t\fP containing the update document. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP any errors that may have occurred. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBupsert\fP: If true, insert a document if none match \fBselector\fP\&. +.IP \(bu 2 +\fBarrayFilters\fP: An array of filters specifying to which array elements an update should apply. +.UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBdocument\fP \fImust only\fP contain fields whose key starts with \fB$\fP\&. See the update document specification for more details. +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_bulk_operation_update_many_with_opts()\fP +.SH ERRORS +.sp +Operation errors are propagated via \fBmongoc_bulk_operation_execute()\fP, while argument validation errors are reported by the \fBerror\fP argument. +.SH RETURNS +.sp +Returns true on success, and false if there is a server or network error or if passed invalid arguments. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_destroy.3 new file mode 100644 index 0000000..46e38e1 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_destroy.3 @@ -0,0 +1,57 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CHANGE_STREAM_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_change_stream_destroy \- mongoc_change_stream_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_change_stream_destroy (mongoc_change_stream_t *stream); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Destroys a change stream and associated data. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstream\fP: An allocated \fBmongoc_change_stream_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_error_document.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_error_document.3 new file mode 100644 index 0000000..442fd57 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_error_document.3 @@ -0,0 +1,70 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CHANGE_STREAM_ERROR_DOCUMENT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_change_stream_error_document \- mongoc_change_stream_error_document() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_change_stream_error_document (mongoc_change_stream_t *stream, + bson_error_t *err, + const bson_t **reply); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Checks if an error has occurred when creating or iterating over a change stream. +.sp +Similar to \fBmongoc_cursor_error_document\fP if the error has occurred +client\-side then the \fBreply\fP will be set to an empty BSON document. If the +error occurred server\-side, \fBreply\fP is set to the server\(aqs reply document. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstream\fP: A \fBmongoc_change_stream_t\fP\&. +.IP \(bu 2 +\fBerr\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBreply\fP: A location for a \fI\%bson_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A boolean indicating if there was an error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_next.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_next.3 new file mode 100644 index 0000000..5718c24 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_next.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CHANGE_STREAM_NEXT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_change_stream_next \- mongoc_change_stream_next() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_change_stream_next (mongoc_change_stream_t *stream, + const bson_t **bson); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function iterates the underlying cursor, setting \fBbson\fP to the next +document. This will block for a maximum of \fBmaxAwaitTimeMS\fP milliseconds as +specified in the options when created, or the default timeout if omitted. Data +may be returned before the timeout. If no data is returned this function returns +\fBfalse\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBstream\fP: A \fBmongoc_change_stream_t\fP obtained from \fBmongoc_collection_watch\fP\&. +.IP \(bu 2 +\fBbson\fP: The location for the resulting document. +.UNINDENT +.SH RETURNS +.sp +A boolean indicating whether or not there was another document in the stream. +.sp +Similar to \fBmongoc_cursor_next\fP the lifetime of \fBbson\fP is until the +next call to \fBmongoc_change_stream_next\fP, so it needs to be copied to +extend the lifetime. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_t.3 new file mode 100644 index 0000000..65bbfdb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_change_stream_t.3 @@ -0,0 +1,444 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CHANGE_STREAM_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_change_stream_t \- mongoc_change_stream_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +typedef struct _mongoc_change_stream_t mongoc_change_stream_t; +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBmongoc_change_stream_t\fP is a handle to a change stream. A collection +change stream can be obtained using \fBmongoc_collection_watch\fP\&. +.sp +It is recommended to use a \fBmongoc_change_stream_t\fP and its functions instead of a raw aggregation with a \fB$changeStream\fP stage. For more information see the \fI\%MongoDB Manual Entry on Change Streams\fP\&. +.SH EXAMPLE +example\-collection\-watch.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +int +main () +{ + bson_t empty = BSON_INITIALIZER; + const bson_t *doc; + bson_t *to_insert = BCON_NEW ("x", BCON_INT32 (1)); + const bson_t *err_doc; + bson_error_t error; + const char *uri_string; + mongoc_uri_t *uri; + mongoc_client_t *client; + mongoc_collection_t *coll; + mongoc_change_stream_t *stream; + mongoc_write_concern_t *wc = mongoc_write_concern_new (); + bson_t opts = BSON_INITIALIZER; + bool r; + + mongoc_init (); + + uri_string = "mongodb://" + "localhost:27017,localhost:27018,localhost:" + "27019/db?replicaSet=rs0"; + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + coll = mongoc_client_get_collection (client, "db", "coll"); + stream = mongoc_collection_watch (coll, &empty, NULL); + + mongoc_write_concern_set_wmajority (wc, 10000); + mongoc_write_concern_append (wc, &opts); + r = mongoc_collection_insert_one (coll, to_insert, &opts, NULL, &error); + if (!r) { + fprintf (stderr, "Error: %s\en", error.message); + return EXIT_FAILURE; + } + + while (mongoc_change_stream_next (stream, &doc)) { + char *as_json = bson_as_relaxed_extended_json (doc, NULL); + fprintf (stderr, "Got document: %s\en", as_json); + bson_free (as_json); + } + + if (mongoc_change_stream_error_document (stream, &error, &err_doc)) { + if (!bson_empty (err_doc)) { + fprintf (stderr, + "Server Error: %s\en", + bson_as_relaxed_extended_json (err_doc, NULL)); + } else { + fprintf (stderr, "Client Error: %s\en", error.message); + } + return EXIT_FAILURE; + } + + bson_destroy (to_insert); + mongoc_write_concern_destroy (wc); + bson_destroy (&opts); + mongoc_change_stream_destroy (stream); + mongoc_collection_destroy (coll); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Starting and Resuming +.sp +All \fBwatch\fP functions accept two options to indicate where a change stream should start returning changes from: \fBstartAtOperationTime\fP and \fBresumeAfter\fP\&. +.sp +All changes returned by \fBmongoc_change_stream_next\fP include a resume token in the \fB_id\fP field. This resume token is automatically cached in libmongoc. +In the event of an error, libmongoc attempts to recreate the change stream starting where it left off by passing the resume token. +libmongoc only attempts to resume once, but client applications can cache this resume token and use it for their own resume logic by passing it as the option \fBresumeAfter\fP\&. +.sp +Additionally, change streams can start returning changes at an operation time by using the \fBstartAtOperationTime\fP field. This can be the timestamp returned in the \fBoperationTime\fP field of a command reply. +.sp +\fBstartAtOperationTime\fP and \fBresumeAfter\fP are mutually exclusive options. Setting them both will result in a server error. +.sp +The following example implements custom resuming logic, persisting the resume token in a file. +example\-resume.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include + +/* An example implementation of custom resume logic in a change stream. +* example\-resume starts a client\-wide change stream and persists the resume +* token in a file "resume\-token.json". On restart, if "resume\-token.json" +* exists, the change stream starts watching after the persisted resume token. +* +* This behavior allows a user to exit example\-resume, and restart it later +* without missing any change events. +*/ +#include + +static const char *RESUME_TOKEN_PATH = "resume\-token.json"; + +static bool +_save_resume_token (const bson_t *doc) +{ + FILE *file_stream; + bson_iter_t iter; + bson_t resume_token_doc; + char *as_json = NULL; + size_t as_json_len; + ssize_t r, n_written; + const bson_value_t *resume_token; + + if (!bson_iter_init_find (&iter, doc, "_id")) { + fprintf (stderr, "reply does not contain operationTime."); + return false; + } + resume_token = bson_iter_value (&iter); + /* store the resume token in a document, { resumeAfter: } + * which we can later append easily. */ + file_stream = fopen (RESUME_TOKEN_PATH, "w+"); + if (!file_stream) { + fprintf (stderr, "failed to open %s for writing\en", RESUME_TOKEN_PATH); + return false; + } + bson_init (&resume_token_doc); + BSON_APPEND_VALUE (&resume_token_doc, "resumeAfter", resume_token); + as_json = bson_as_canonical_extended_json (&resume_token_doc, &as_json_len); + bson_destroy (&resume_token_doc); + n_written = 0; + while (n_written < as_json_len) { + r = fwrite ((void *) (as_json + n_written), + sizeof (char), + as_json_len \- n_written, + file_stream); + if (r == \-1) { + fprintf (stderr, "failed to write to %s\en", RESUME_TOKEN_PATH); + bson_free (as_json); + fclose (file_stream); + return false; + } + n_written += r; + } + + bson_free (as_json); + fclose (file_stream); + return true; +} + +bool +_load_resume_token (bson_t *opts) +{ + bson_error_t error; + bson_json_reader_t *reader; + bson_t doc; + + /* if the file does not exist, skip. */ + if (\-1 == access (RESUME_TOKEN_PATH, R_OK)) { + return true; + } + reader = bson_json_reader_new_from_file (RESUME_TOKEN_PATH, &error); + if (!reader) { + fprintf (stderr, + "failed to open %s for reading: %s\en", + RESUME_TOKEN_PATH, + error.message); + return false; + } + + bson_init (&doc); + if (\-1 == bson_json_reader_read (reader, &doc, &error)) { + fprintf (stderr, "failed to read doc from %s\en", RESUME_TOKEN_PATH); + bson_destroy (&doc); + bson_json_reader_destroy (reader); + return false; + } + + printf ("found cached resume token in %s, resuming change stream.\en", + RESUME_TOKEN_PATH); + + bson_concat (opts, &doc); + bson_destroy (&doc); + bson_json_reader_destroy (reader); + return true; +} + +int +main () +{ + int exit_code = EXIT_FAILURE; + const char *uri_string; + mongoc_uri_t *uri = NULL; + bson_error_t error; + mongoc_client_t *client = NULL; + bson_t pipeline = BSON_INITIALIZER; + bson_t opts = BSON_INITIALIZER; + mongoc_change_stream_t *stream = NULL; + const bson_t *doc; + + const int max_time = 30; /* max amount of time, in seconds, that + mongoc_change_stream_next can block. */ + + mongoc_init (); + uri_string = "mongodb://localhost:27017/db?replicaSet=rs0"; + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + goto cleanup; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + goto cleanup; + } + + if (!_load_resume_token (&opts)) { + goto cleanup; + } + BSON_APPEND_INT64 (&opts, "maxAwaitTimeMS", max_time * 1000); + + printf ("listening for changes on the client (max %d seconds).\en", max_time); + stream = mongoc_client_watch (client, &pipeline, &opts); + + while (mongoc_change_stream_next (stream, &doc)) { + char *as_json; + + as_json = bson_as_canonical_extended_json (doc, NULL); + printf ("change received: %s\en", as_json); + bson_free (as_json); + if (!_save_resume_token (doc)) { + goto cleanup; + } + } + + exit_code = EXIT_SUCCESS; + +cleanup: + mongoc_uri_destroy (uri); + bson_destroy (&pipeline); + bson_destroy (&opts); + mongoc_change_stream_destroy (stream); + mongoc_client_destroy (client); + mongoc_cleanup (); + return exit_code; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The following example shows using \fBstartAtOperationTime\fP to synchronize a change stream with another operation. +example\-start\-at\-optime.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* An example of starting a change stream with startAtOperationTime. */ +#include + +int +main () +{ + int exit_code = EXIT_FAILURE; + const char *uri_string; + mongoc_uri_t *uri = NULL; + bson_error_t error; + mongoc_client_t *client = NULL; + mongoc_collection_t *coll = NULL; + bson_t pipeline = BSON_INITIALIZER; + bson_t opts = BSON_INITIALIZER; + mongoc_change_stream_t *stream = NULL; + bson_iter_t iter; + const bson_t *doc; + bson_value_t cached_operation_time = {0}; + int i; + bool r; + + mongoc_init (); + uri_string = "mongodb://localhost:27017/db?replicaSet=rs0"; + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + goto cleanup; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + goto cleanup; + } + + /* insert five documents. */ + coll = mongoc_client_get_collection (client, "db", "coll"); + for (i = 0; i < 5; i++) { + bson_t reply; + bson_t *insert_cmd = BCON_NEW ("insert", + "coll", + "documents", + "[", + "{", + "x", + BCON_INT64 (i), + "}", + "]"); + + r = mongoc_collection_write_command_with_opts ( + coll, insert_cmd, NULL, &reply, &error); + bson_destroy (insert_cmd); + if (!r) { + bson_destroy (&reply); + fprintf (stderr, "failed to insert: %s\en", error.message); + goto cleanup; + } + if (i == 0) { + /* cache the operation time in the first reply. */ + if (bson_iter_init_find (&iter, &reply, "operationTime")) { + bson_value_copy (bson_iter_value (&iter), &cached_operation_time); + } else { + fprintf (stderr, "reply does not contain operationTime."); + bson_destroy (&reply); + goto cleanup; + } + } + bson_destroy (&reply); + } + + /* start a change stream at the first returned operationTime. */ + BSON_APPEND_VALUE (&opts, "startAtOperationTime", &cached_operation_time); + stream = mongoc_collection_watch (coll, &pipeline, &opts); + + /* since the change stream started at the operation time of the first + * insert, the five inserts are returned. */ + printf ("listening for changes on db.coll:\en"); + while (mongoc_change_stream_next (stream, &doc)) { + char *as_json; + + as_json = bson_as_canonical_extended_json (doc, NULL); + printf ("change received: %s\en", as_json); + bson_free (as_json); + } + + exit_code = EXIT_SUCCESS; + +cleanup: + mongoc_uri_destroy (uri); + bson_destroy (&pipeline); + bson_destroy (&opts); + if (cached_operation_time.value_type) { + bson_value_destroy (&cached_operation_time); + } + mongoc_change_stream_destroy (stream); + mongoc_collection_destroy (coll); + mongoc_client_destroy (client); + mongoc_cleanup (); + return exit_code; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_check_version.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_check_version.3 new file mode 100644 index 0000000..df4b09d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_check_version.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CHECK_VERSION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_check_version \- mongoc_check_version() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_check_version (int required_major, + int required_minor, + int required_micro); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBrequired_major\fP: The minimum major version required. +.IP \(bu 2 +\fBrequired_minor\fP: The minimum minor version required. +.IP \(bu 2 +\fBrequired_micro\fP: The minimum micro version required. +.UNINDENT +.SH RETURNS +.sp +True if libmongoc\(aqs version is greater than or equal to the required version. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_cleanup.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_cleanup.3 new file mode 100644 index 0000000..f995d60 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_cleanup.3 @@ -0,0 +1,55 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLEANUP" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_cleanup \- mongoc_cleanup() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_cleanup (void); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DESCRIPTION +.sp +Initialize the MongoDB C Driver by calling \fBmongoc_init\fP exactly once at the beginning of your program. It is responsible for initializing global state such as process counters, SSL, and threading primitives. +.sp +Call \fBmongoc_cleanup\fP exactly once at the end of your program to release all memory and other resources allocated by the driver. You must not call any other MongoDB C Driver functions after \fBmongoc_cleanup\fP\&. Note that \fBmongoc_init\fP does \fBnot\fP reinitialize the driver after \fBmongoc_cleanup\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command.3 new file mode 100644 index 0000000..bd8c054 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command.3 @@ -0,0 +1,91 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_COMMAND" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_command \- mongoc_client_command() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_cursor_t * +mongoc_client_command (mongoc_client_t *client, + const char *db_name, + mongoc_query_flags_t flags, + uint32_t skip, + uint32_t limit, + uint32_t batch_size, + const bson_t *query, + const bson_t *fields, + const mongoc_read_prefs_t *read_prefs); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function is superseded by \fBmongoc_client_command_with_opts()\fP, \fBmongoc_client_read_command_with_opts()\fP, \fBmongoc_client_write_command_with_opts()\fP, and \fBmongoc_client_read_write_command_with_opts()\fP\&. +.SH DESCRIPTION +.sp +This function creates a cursor which will execute the command when \fBmongoc_cursor_next\fP is called on it. The client\(aqs read preference, read concern, and write concern are not applied to the command, and \fBmongoc_cursor_next\fP will not check the server response for a write concern error or write concern timeout. +.sp +If \fBmongoc_cursor_next()\fP returns \fBfalse\fP, then retrieve error details with \fBmongoc_cursor_error()\fP or \fBmongoc_cursor_error_document()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBflags\fP: Unused. +.IP \(bu 2 +\fBskip\fP: Unused. +.IP \(bu 2 +\fBlimit\fP: Unused. +.IP \(bu 2 +\fBbatch_size\fP: Unused. +.IP \(bu 2 +\fBquery\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBfields\fP: Unused. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. Otherwise, the command uses mode \fBMONGOC_READ_PRIMARY\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_cursor_t\fP\&. +.sp +The cursor should be freed with \fBmongoc_cursor_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple.3 new file mode 100644 index 0000000..543d03d --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple.3 @@ -0,0 +1,87 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_COMMAND_SIMPLE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_command_simple \- mongoc_client_command_simple() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_command_simple (mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This is a simplified interface to \fBmongoc_client_command()\fP\&. It returns the first document from the result cursor into \fBreply\fP\&. The client\(aqs read preference, read concern, and write concern are not applied to the command. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBreply\fP is always set, and should be released with \fI\%bson_destroy()\fP\&. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. Otherwise, the command uses mode \fBMONGOC_READ_PRIMARY\fP\&. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +This function does not check the server response for a write concern error or write concern timeout. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple_with_server_id.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple_with_server_id.3 new file mode 100644 index 0000000..600a0cf --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_simple_with_server_id.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_COMMAND_SIMPLE_WITH_SERVER_ID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_command_simple_with_server_id \- mongoc_client_command_simple_with_server_id() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_command_simple_with_server_id ( + mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + uint32_t server_id bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function executes a command on a specific server, using the database and command specification provided. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. +.IP \(bu 2 +\fBserver_id\fP: An opaque id specifying which server to use. +.IP \(bu 2 +\fBreply\fP: An optional location for a \fI\%bson_t\fP which will store the server\(aqs reply. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or a \fBNULL\fP\&. +.UNINDENT +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +This function does not check the server response for a write concern error or write concern timeout. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_with_opts.3 new file mode 100644 index 0000000..21a1624 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_command_with_opts.3 @@ -0,0 +1,151 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_COMMAND_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_command_with_opts \- mongoc_client_command_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_command_with_opts ( + mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Execute a command on the server, interpreting \fBopts\fP according to the MongoDB server version. To send a raw command to the server without any of this logic, use \fBmongoc_client_command_simple\fP\&. +.sp +Read preferences, read and write concern, and collation can be overridden by various sources. The highest\-priority sources for these options are listed first: +.TS +center; +|l|l|l|l|. +_ +T{ +Read Preferences +T} T{ +Read Concern +T} T{ +Write Concern +T} T{ +Collation +T} +_ +T{ +\fBread_prefs\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +Transaction +T} T{ +Transaction +T} T{ +T} +_ +T{ +\fBclient\fP +T} T{ +T} T{ +T} T{ +T} +_ +.TE +.sp +In a transaction, read concern and write concern are prohibited in \fBopts\fP and the read preference must be primary or NULL. +See the example for transactions and for the "distinct" command with opts\&. +.sp +\fBreply\fP is always initialized, and must be freed with \fI\%bson_destroy()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.sp +Consult \fI\%the MongoDB Manual entry on Database Commands\fP for each command\(aqs arguments. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +The reply is not parsed for a write concern timeout or write concern error. +.SH EXAMPLE +.sp +See the example code for \fBmongoc_client_read_command_with_opts\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_destroy.3 new file mode 100644 index 0000000..1dcf0bc --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_destroy.3 @@ -0,0 +1,57 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_destroy \- mongoc_client_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_destroy (mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Release all resources associated with \fBclient\fP and free the structure. Does nothing if \fBclient\fP is NULL. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_find_databases_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_find_databases_with_opts.3 new file mode 100644 index 0000000..8fdd562 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_find_databases_with_opts.3 @@ -0,0 +1,76 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_FIND_DATABASES_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_find_databases_with_opts \- mongoc_client_find_databases_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_cursor_t * +mongoc_client_find_databases_with_opts (mongoc_client_t *client, + const bson_t *opts); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Fetches a cursor containing documents, each corresponding to a database on this MongoDB server. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.SH ERRORS +.sp +Use \fBmongoc_cursor_error\fP on the returned cursor to check for errors. +.SH RETURNS +.sp +A cursor where each result corresponds to the server\(aqs representation of a database. +.sp +The cursor functions \fBmongoc_cursor_set_limit\fP, \fBmongoc_cursor_set_batch_size\fP, and \fBmongoc_cursor_set_max_await_time_ms\fP have no use on the returned cursor. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_collection.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_collection.3 new file mode 100644 index 0000000..0b7c9d6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_collection.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_COLLECTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_collection \- mongoc_client_get_collection() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_collection_t * +mongoc_client_get_collection (mongoc_client_t *client, + const char *db, + const char *collection); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get a newly allocated \fBmongoc_collection_t\fP for the collection named \fBcollection\fP in the database named \fBdb\fP\&. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +Collections are automatically created on the MongoDB server upon insertion of the first document. There is no need to create a collection manually. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb\fP: The name of the database containing the collection. +.IP \(bu 2 +\fBcollection\fP: The name of the collection. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_collection_t\fP that should be freed with \fBmongoc_collection_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database.3 new file mode 100644 index 0000000..788a1b9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database.3 @@ -0,0 +1,69 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_DATABASE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_database \- mongoc_client_get_database() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_database_t * +mongoc_client_get_database (mongoc_client_t *client, const char *name); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get a newly allocated \fBmongoc_database_t\fP for the database named \fBname\fP\&. +.sp +\fBTIP:\fP +.INDENT 0.0 +.INDENT 3.5 +Databases are automatically created on the MongoDB server upon insertion of the first document into a collection. There is no need to create a database manually. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBname\fP: The name of the database. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_database_t\fP that should be freed with \fBmongoc_database_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names.3 new file mode 100644 index 0000000..ffd2c47 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names.3 @@ -0,0 +1,73 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_DATABASE_NAMES" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_database_names \- mongoc_client_get_database_names() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char ** +mongoc_client_get_database_names (mongoc_client_t *client, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. +.sp +Please use \fBmongoc_client_get_database_names_with_opts()\fP instead. +.SH DESCRIPTION +.sp +This function queries the MongoDB server for a list of known databases. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +A \fBNULL\fP terminated vector of \fBNULL\-byte\fP terminated strings. The result should be freed with \fI\%bson_strfreev()\fP\&. +.sp +\fBNULL\fP is returned upon failure and \fBerror\fP is set. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names_with_opts.3 new file mode 100644 index 0000000..f4bdbe8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_database_names_with_opts.3 @@ -0,0 +1,102 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_DATABASE_NAMES_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_database_names_with_opts \- mongoc_client_get_database_names_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +char ** +mongoc_client_get_database_names_with_opts (mongoc_client_t *client, + const bson_t *opts, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function queries the MongoDB server for a list of known databases. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +A \fBNULL\fP terminated vector of \fBNULL\-byte\fP terminated strings. The result should be freed with \fI\%bson_strfreev()\fP\&. +.sp +\fBNULL\fP is returned upon failure and \fBerror\fP is set. +.SH EXAMPLES +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ + bson_error_t error; + char **strv; + unsigned i; + + if ((strv = mongoc_client_get_database_names_with_opts (client, NULL, &error))) { + for (i = 0; strv[i]; i++) + printf ("%s\en", strv[i]); + bson_strfreev (strv); + } else { + fprintf (stderr, "Command failed: %s\en", error.message); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_default_database.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_default_database.3 new file mode 100644 index 0000000..fd261cd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_default_database.3 @@ -0,0 +1,88 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_DEFAULT_DATABASE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_default_database \- mongoc_client_get_default_database() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_database_t * +mongoc_client_get_default_database (mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get the database named in the MongoDB connection URI, or \fBNULL\fP if the URI specifies none. +.sp +Useful when you want to choose which database to use based only on the URI in a configuration file. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_database_t\fP that should be freed with \fBmongoc_database_destroy()\fP\&. +.SH EXAMPLE +Default Database Example.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* default database is "db_name" */ +mongoc_client_t *client = mongoc_client_new ("mongodb://host/db_name"); +mongoc_database_t *db = mongoc_client_get_default_database (client); + +assert (!strcmp ("db_name", mongoc_database_get_name (db))); + +mongoc_database_destroy (db); +mongoc_client_destroy (client); + +/* no default database */ +client = mongoc_client_new ("mongodb://host/"); +db = mongoc_client_get_default_database (client); + +assert (!db); + +mongoc_client_destroy (client); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_gridfs.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_gridfs.3 new file mode 100644 index 0000000..42eb355 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_gridfs.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_GRIDFS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_gridfs \- mongoc_client_get_gridfs() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_gridfs_t * +mongoc_client_get_gridfs (mongoc_client_t *client, + const char *db, + const char *prefix, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBmongoc_client_get_gridfs()\fP function shall create a new \fBmongoc_gridfs_t\fP\&. The \fBdb\fP parameter is the name of the database which the gridfs instance should exist in. The \fBprefix\fP parameter corresponds to the gridfs collection namespacing; its default is "fs", thus the default GridFS collection names are "fs.files" and "fs.chunks". +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb\fP: The database name. +.IP \(bu 2 +\fBprefix\fP: Optional prefix for gridfs collection names or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +On success, returns a \fBmongoc_gridfs_t\fP you must free with \fBmongoc_gridfs_destroy()\fP\&. Returns \fBNULL\fP upon failure and sets \fBerror\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_bson_size.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_bson_size.3 new file mode 100644 index 0000000..bb5b057 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_bson_size.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_MAX_BSON_SIZE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_max_bson_size \- mongoc_client_get_max_bson_size() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int32_t +mongoc_client_get_max_bson_size (mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBmongoc_client_get_max_bson_size()\fP returns the maximum bson document size allowed by the cluster. Until a connection has been made, this will be the default of 16Mb. +.SH DEPRECATED +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function is deprecated and should not be used in new code. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The server provided max bson size, or 16Mb if no connection has been established. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_message_size.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_message_size.3 new file mode 100644 index 0000000..61af239 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_max_message_size.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_MAX_MESSAGE_SIZE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_max_message_size \- mongoc_client_get_max_message_size() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int32_t +mongoc_client_get_max_message_size (mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBmongoc_client_get_max_message_size()\fP returns the maximum message size allowed by the cluster. Until a connection has been made, this will be the default of 40Mb. +.SH DEPRECATED +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +This function is deprecated and should not be used in new code. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +The server provided max message size, or 40Mb if no connection has been established. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_concern.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_concern.3 new file mode 100644 index 0000000..05805c8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_concern.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_READ_CONCERN" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_read_concern \- mongoc_client_get_read_concern() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_read_concern_t * +mongoc_client_get_read_concern (const mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Retrieve the default read concern configured for the client instance. The result should not be modified or freed. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_read_concern_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_prefs.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_prefs.3 new file mode 100644 index 0000000..a530260 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_read_prefs.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_READ_PREFS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_read_prefs \- mongoc_client_get_read_prefs() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_read_prefs_t * +mongoc_client_get_read_prefs (const mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Retrieves the default read preferences configured for the client instance. The result should not be modified or freed. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_read_prefs_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_description.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_description.3 new file mode 100644 index 0000000..4346e73 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_description.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_SERVER_DESCRIPTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_server_description \- mongoc_client_get_server_description() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_server_description_t * +mongoc_client_get_server_description (mongoc_client_t *client, + uint32_t server_id); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get information about the server specified by \fBserver_id\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBserver_id\fP: An opaque id specifying the server. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_server_description_t\fP that must be freed with \fBmongoc_server_description_destroy\fP\&. If the server is no longer in the topology, returns NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_descriptions.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_descriptions.3 new file mode 100644 index 0000000..dac1f39 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_descriptions.3 @@ -0,0 +1,97 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_SERVER_DESCRIPTIONS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_server_descriptions \- mongoc_client_get_server_descriptions() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_server_description_t ** +mongoc_client_get_server_descriptions (const mongoc_client_t *client, + size_t *n); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Fetches an array of \fBmongoc_server_description_t\fP structs for all known servers in the topology. Returns no servers until the client connects. Returns a single server if the client is directly connected, or all members of a replica set if the client\(aqs MongoDB URI includes a "replicaSet" option, or all known mongos servers if the MongoDB URI includes a list of them. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +show_servers (const mongoc_client_t *client) +{ + bson_t *b = BCON_NEW ("ping", BCON_INT32 (1)); + bson_error_t error; + bool r; + mongoc_server_description_t **sds; + size_t i, n; + + /* ensure client has connected */ + r = mongoc_client_command_simple (client, "db", b, NULL, NULL, &error); + if (!r) { + MONGOC_ERROR ("could not connect: %s\en", error.message); + return; + } + + sds = mongoc_client_get_server_descriptions (client, &n); + + for (i = 0; i < n; ++i) { + printf ("%s\en", mongoc_server_description_host (sds[i])\->host_and_port); + } + + mongoc_server_descriptions_destroy_all (sds, n); + bson_destroy (&b); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBn\fP: Receives the length of the descriptions array. +.UNINDENT +.SH RETURNS +.sp +A newly allocated array that must be freed with \fBmongoc_server_descriptions_destroy_all\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_status.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_status.3 new file mode 100644 index 0000000..dc9aa41 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_server_status.3 @@ -0,0 +1,77 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_SERVER_STATUS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_server_status \- mongoc_client_get_server_status() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_get_server_status (mongoc_client_t *client, + mongoc_read_prefs_t *read_prefs, + bson_t *reply, + bson_error_t *error) BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Queries the server for the current server status. The result is stored in \fBreply\fP\&. +.sp +\fBreply\fP is always initialized, even in the case of failure. Always call \fI\%bson_destroy()\fP to release it. +.SH DEPRECATED +.sp +This helper function is deprecated and should not be used in new code. Run the \fI\%serverStatus\fP command directly with \fBmongoc_client_read_command_with_opts()\fP instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP\&. +.IP \(bu 2 +\fBreply\fP: A location for the result \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_uri.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_uri.3 new file mode 100644 index 0000000..c59df15 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_uri.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_URI" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_uri \- mongoc_client_get_uri() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_uri_t * +mongoc_client_get_uri (const mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Fetches the \fBmongoc_uri_t\fP used to create the client. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_uri_t\fP that should not be modified or freed. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_write_concern.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_write_concern.3 new file mode 100644 index 0000000..42dffae --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_get_write_concern.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_GET_WRITE_CONCERN" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_get_write_concern \- mongoc_client_get_write_concern() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_write_concern_t * +mongoc_client_get_write_concern (const mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Retrieve the default write concern configured for the client instance. The result should not be modified or freed. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_write_concern_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new.3 new file mode 100644 index 0000000..0fb2016 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_NEW" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_new \- mongoc_client_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t * +mongoc_client_new (const char *uri_string); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Creates a new \fBmongoc_client_t\fP using the URI string provided. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBuri_string\fP: A string containing the MongoDB connection URI. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_client_t\fP if the URI parsed successfully, otherwise \fBNULL\fP\&. +.SH SEE ALSO +.sp +\fBmongoc_client_new_from_uri()\fP +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new_from_uri.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new_from_uri.3 new file mode 100644 index 0000000..50fad66 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_new_from_uri.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_NEW_FROM_URI" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_new_from_uri \- mongoc_client_new_from_uri() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t * +mongoc_client_new_from_uri (const mongoc_uri_t *uri); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Creates a new \fBmongoc_client_t\fP using the \fBmongoc_uri_t\fP provided. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBuri\fP: A \fBmongoc_uri_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_client_t\fP that should be freed with \fBmongoc_client_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_destroy.3 new file mode 100644 index 0000000..30d18b4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_destroy.3 @@ -0,0 +1,57 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_destroy \- mongoc_client_pool_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_pool_destroy (mongoc_client_pool_t *pool); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Release all resources associated with \fBpool\fP, including freeing the structure. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_max_size.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_max_size.3 new file mode 100644 index 0000000..7c62df4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_max_size.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_MAX_SIZE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_max_size \- mongoc_client_pool_max_size() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_pool_min_size (mongoc_client_pool_t *pool, + uint32_t max_pool_size); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function sets the maximum number of pooled connections available from a \fBmongoc_client_pool_t\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBmax_pool_size\fP: The maximum number of connections which shall be available from the pool. +.UNINDENT +.SH THREAD SAFETY +.sp +This function is safe to call from multiple threads. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_min_size.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_min_size.3 new file mode 100644 index 0000000..c06944f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_min_size.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_MIN_SIZE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_min_size \- mongoc_client_pool_min_size() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_pool_min_size (mongoc_client_pool_t *pool, + uint32_t min_pool_size) + BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function sets the \fImaximum\fP number of idle clients to be kept in the pool. Any idle clients in excess of the maximum are destroyed. This function is deprecated because its behavior does not match what developers expect from a "minimum pool size", and its actual behavior is likely to hurt performance. +.sp +Applications should not call this function, they should instead accept the default behavior, which is to keep all idle clients that are pushed into the pool. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBmin_pool_size\fP: The number of idle clients to keep in the pool. +.UNINDENT +.SH THREAD SAFETY +.sp +This function is safe to call from multiple threads. +.sp +Subsequent calls to \fBmongoc_client_pool_push\fP respect the new minimum size, and close the least recently used \fBmongoc_client_t\fP if the minimum size is exceeded. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_new.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_new.3 new file mode 100644 index 0000000..e4ecf8f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_new.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_NEW" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_new \- mongoc_client_pool_new() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_pool_t * +mongoc_client_pool_new (const mongoc_uri_t *uri); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function creates a new \fBmongoc_client_pool_t\fP using the \fBmongoc_uri_t\fP provided. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBuri\fP: A \fBmongoc_uri_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_client_pool_t\fP that should be freed with \fBmongoc_client_pool_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_pop.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_pop.3 new file mode 100644 index 0000000..1928605 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_pop.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_POP" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_pop \- mongoc_client_pool_pop() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t * +mongoc_client_pool_pop (mongoc_client_pool_t *pool); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Retrieve a \fBmongoc_client_t\fP from the client pool, or create one. The total number of clients that can be created from this pool is limited by the URI option "maxPoolSize", default 100. If this number of clients has been created and all are in use, \fBmongoc_client_pool_pop\fP blocks until another thread returns a client with \fBmongoc_client_pool_push\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_client_t\fP\&. +.SH THREAD SAFETY +.sp +This function is safe to call from multiple threads. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_push.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_push.3 new file mode 100644 index 0000000..20836c8 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_push.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_PUSH" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_push \- mongoc_client_pool_push() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_pool_push (mongoc_client_pool_t *pool, mongoc_client_t *client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function returns a \fBmongoc_client_t\fP back to the client pool. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.UNINDENT +.SH THREAD SAFETY +.sp +This function is safe to call from multiple threads. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_apm_callbacks.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_apm_callbacks.3 new file mode 100644 index 0000000..33d6f12 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_apm_callbacks.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_SET_APM_CALLBACKS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_set_apm_callbacks \- mongoc_client_pool_set_apm_callbacks() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_pool_set_apm_callbacks (mongoc_client_pool_t *pool, + mongoc_apm_callbacks_t *callbacks, + void *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Register a set of callbacks to receive Application Performance Monitoring events. +.sp +The callbacks are copied by the pool and may be destroyed at any time after. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBcallbacks\fP: A \fBmongoc_apm_callbacks_t\fP\&. +.IP \(bu 2 +\fBcontext\fP: Optional pointer to include with each event notification. +.UNINDENT +.SH RETURNS +.sp +Returns true on success. If any arguments are invalid, returns false and logs an error. +.SH THREAD SAFETY +.sp +This function can only be called once on a pool, and must be called before the first call to \fBmongoc_client_pool_pop\fP\&. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_appname.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_appname.3 new file mode 100644 index 0000000..24b1498 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_appname.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_SET_APPNAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_set_appname \- mongoc_client_pool_set_appname() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_pool_set_appname (mongoc_client_pool_t *pool, const char *appname) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function is identical to \fBmongoc_client_set_appname()\fP except for client pools. +.sp +Also note that \fBmongoc_client_set_appname()\fP cannot be called on a client retrieved from a client pool. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBappname\fP: The application name, of length at most \fBMONGOC_HANDSHAKE_APPNAME_MAX\fP\&. +.UNINDENT +.SH RETURNS +.sp +Returns true if appname was set. If appname is too long, returns false and logs an error. +.SH THREAD SAFETY +.sp +This function can only be called once on a pool, and must be called before the first call to \fBmongoc_client_pool_pop\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_error_api.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_error_api.3 new file mode 100644 index 0000000..9756e4b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_error_api.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_SET_ERROR_API" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_set_error_api \- mongoc_client_pool_set_error_api() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_pool_set_error_api (mongoc_client_pool_t *client, + int32_t version); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Configure how the C Driver reports errors. See Setting the Error API Version\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBversion\fP: The version of the error API, either \fBMONGOC_ERROR_API_VERSION_LEGACY\fP or \fBMONGOC_ERROR_API_VERSION_2\fP\&. +.UNINDENT +.SH RETURNS +.sp +Returns true if the error API version was set, or logs an error message and returns false if \fBversion\fP is invalid. +.SH THREAD SAFETY +.sp +This function can only be called once on a pool, and must be called before the first call to \fBmongoc_client_pool_pop\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_ssl_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_ssl_opts.3 new file mode 100644 index 0000000..4335351 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_set_ssl_opts.3 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_SET_SSL_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_set_ssl_opts \- mongoc_client_pool_set_ssl_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#ifdef MONGOC_ENABLE_SSL +void +mongoc_client_pool_set_ssl_opts (mongoc_client_pool_t *pool, + const mongoc_ssl_opt_t *opts); +#endif +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function is identical to \fBmongoc_client_set_ssl_opts()\fP except for +client pools. It ensures that all clients retrieved from +\fBmongoc_client_pool_pop()\fP or \fBmongoc_client_pool_try_pop()\fP +are configured with the same SSL settings. +.sp +The \fBmongoc_ssl_opt_t\fP struct is copied by the pool along with the strings +it points to (\fBpem_file\fP, \fBpem_pwd\fP, \fBca_file\fP, \fBca_dir\fP, and +\fBcrl_file\fP) so they don\(aqt have to remain valid after the call to +\fBmongoc_client_pool_set_ssl_opts\fP\&. +.sp +A call to \fBmongoc_client_pool_set_ssl_opts\fP overrides all SSL options set +through the connection string with which the \fBmongoc_client_pool_t\fP was +constructed. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fBmongoc_ssl_opt_t\fP\&. +.UNINDENT +.SH THREAD SAFETY +.sp +This function can only be called once on a pool, and must be called before the first call to \fBmongoc_client_pool_pop\fP\&. +.SH AVAILABILITY +.sp +This feature requires that the MongoDB C driver was compiled with \fB\-DENABLE_SSL\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_t.3 new file mode 100644 index 0000000..e5eb065 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_t.3 @@ -0,0 +1,166 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_t \- mongoc_client_pool_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +A connection pool for multi\-threaded programs. See connection\-pooling\&. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct _mongoc_client_pool_t mongoc_client_pool_t +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBmongoc_client_pool_t\fP is the basis for multi\-threading in the MongoDB C driver. Since \fBmongoc_client_t\fP structures are not thread\-safe, this structure is used to retrieve a new \fBmongoc_client_t\fP for a given thread. This structure \fIis thread\-safe\fP\&. +.SH EXAMPLE +example\-pool.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-pool.c \-o example\-pool $(pkg\-config \-\-cflags \-\-libs + * libmongoc\-1.0) */ + +/* ./example\-pool [CONNECTION_STRING] */ + +#include +#include +#include + +static pthread_mutex_t mutex; +static bool in_shutdown = false; + +static void * +worker (void *data) +{ + mongoc_client_pool_t *pool = data; + mongoc_client_t *client; + bson_t ping = BSON_INITIALIZER; + bson_error_t error; + bool r; + + BSON_APPEND_INT32 (&ping, "ping", 1); + + while (true) { + client = mongoc_client_pool_pop (pool); + /* Do something with client. If you are writing an HTTP server, you + * probably only want to hold onto the client for the portion of the + * request performing database queries. + */ + r = mongoc_client_command_simple ( + client, "admin", &ping, NULL, NULL, &error); + + if (!r) { + fprintf (stderr, "%s\en", error.message); + } + + mongoc_client_pool_push (pool, client); + + pthread_mutex_lock (&mutex); + if (in_shutdown || !r) { + pthread_mutex_unlock (&mutex); + break; + } + + pthread_mutex_unlock (&mutex); + } + + bson_destroy (&ping); + return NULL; +} + +int +main (int argc, char *argv[]) +{ + const char *uri_string = "mongodb://127.0.0.1/?appname=pool\-example"; + mongoc_uri_t *uri; + bson_error_t error; + mongoc_client_pool_t *pool; + pthread_t threads[10]; + unsigned i; + void *ret; + + pthread_mutex_init (&mutex, NULL); + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + pool = mongoc_client_pool_new (uri); + mongoc_client_pool_set_error_api (pool, 2); + + for (i = 0; i < 10; i++) { + pthread_create (&threads[i], NULL, worker, pool); + } + + sleep (10); + pthread_mutex_lock (&mutex); + in_shutdown = true; + pthread_mutex_unlock (&mutex); + + for (i = 0; i < 10; i++) { + pthread_join (threads[i], &ret); + } + + mongoc_client_pool_destroy (pool); + mongoc_uri_destroy (uri); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_try_pop.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_try_pop.3 new file mode 100644 index 0000000..43ce925 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_pool_try_pop.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_POOL_TRY_POP" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_pool_try_pop \- mongoc_client_pool_try_pop() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t * +mongoc_client_pool_try_pop (mongoc_client_pool_t *pool); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function is identical to \fBmongoc_client_pool_pop()\fP except it will return \fBNULL\fP instead of blocking for a client to become available. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBpool\fP: A \fBmongoc_client_pool_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_client_t\fP if one is immediately available, otherwise \fBNULL\fP\&. +.SH THREAD SAFETY +.sp +This function is safe to call from multiple threads. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_command_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_command_with_opts.3 new file mode 100644 index 0000000..4f7f2b2 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_command_with_opts.3 @@ -0,0 +1,295 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_READ_COMMAND_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_read_command_with_opts \- mongoc_client_read_command_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_read_command_with_opts (mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Execute a command on the server, applying logic that is specific to commands that read, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use \fBmongoc_client_command_simple\fP\&. +.sp +Use this function for commands that read such as "count" or "distinct". +.sp +Read preferences, read concern, and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in \fBopts\fP and the read preference must be primary or NULL. The highest\-priority sources for these options are listed first in the following table. No write concern is applied. +.TS +center; +|l|l|l|. +_ +T{ +Read Preferences +T} T{ +Read Concern +T} T{ +Collation +T} +_ +T{ +\fBread_prefs\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +Transaction +T} T{ +T} +_ +T{ +\fBclient\fP +T} T{ +T} T{ +T} +_ +.TE +.sp +See the example for transactions and for \fI\%the "distinct" command with opts\fP\&. +.sp +\fBreply\fP is always initialized, and must be freed with \fI\%bson_destroy()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.sp +Consult \fI\%the MongoDB Manual entry on Database Commands\fP for each command\(aqs arguments. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH EXAMPLE +example\-command\-with\-opts.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + +Demonstrates how to prepare options for mongoc_client_read_command_with_opts and +mongoc_client_write_command_with_opts. First it calls "cloneCollectionAsCapped" +command with "writeConcern" option, then "distinct" command with "collation" and +"readConcern" options, + +Start a MongoDB 3.4 replica set with \-\-enableMajorityReadConcern and insert two +documents: + +$ mongo +MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 1, y: "One"}) +WriteResult({ "nInserted" : 1 }) +MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 2, y: "Two"}) +WriteResult({ "nInserted" : 1 }) + +Build and run the example: + +gcc example\-command\-with\-opts.c \-o example\-command\-with\-opts $(pkg\-config +\-\-cflags \-\-libs libmongoc\-1.0) +\&./example\-command\-with\-opts [CONNECTION_STRING] +cloneCollectionAsCapped: { "ok" : 1 } +distinct: { "values" : [ 1, 2 ], "ok" : 1 } + +*/ + +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + const char *uri_string = "mongodb://127.0.0.1/?appname=client\-example"; + mongoc_uri_t *uri; + bson_t *cmd; + bson_t *opts; + mongoc_write_concern_t *write_concern; + mongoc_read_prefs_t *read_prefs; + mongoc_read_concern_t *read_concern; + bson_t reply; + bson_error_t error; + char *json; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + + cmd = BCON_NEW ("cloneCollectionAsCapped", + BCON_UTF8 ("my_collection"), + "toCollection", + BCON_UTF8 ("my_capped_collection"), + "size", + BCON_INT64 (1024 * 1024)); + + /* include write concern "majority" in command options */ + write_concern = mongoc_write_concern_new (); + mongoc_write_concern_set_wmajority (write_concern, 10000 /* wtimeoutMS */); + opts = bson_new (); + mongoc_write_concern_append (write_concern, opts); + + if (mongoc_client_write_command_with_opts ( + client, "test", cmd, opts, &reply, &error)) { + json = bson_as_canonical_extended_json (&reply, NULL); + printf ("cloneCollectionAsCapped: %s\en", json); + bson_free (json); + } else { + fprintf (stderr, "cloneCollectionAsCapped: %s\en", error.message); + } + + bson_free (cmd); + bson_free (opts); + + /* distinct values of "x" in "my_collection" where "y" sorts after "one" */ + cmd = BCON_NEW ("distinct", + BCON_UTF8 ("my_collection"), + "key", + BCON_UTF8 ("x"), + "query", + "{", + "y", + "{", + "$gt", + BCON_UTF8 ("one"), + "}", + "}"); + + read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); + + /* "One" normally sorts before "one"; make "One" sort after "one" */ + opts = BCON_NEW ("collation", + "{", + "locale", + BCON_UTF8 ("en_US"), + "caseFirst", + BCON_UTF8 ("lower"), + "}"); + + /* add a read concern to "opts" */ + read_concern = mongoc_read_concern_new (); + mongoc_read_concern_set_level (read_concern, + MONGOC_READ_CONCERN_LEVEL_MAJORITY); + + mongoc_read_concern_append (read_concern, opts); + + if (mongoc_client_read_command_with_opts ( + client, "test", cmd, read_prefs, opts, &reply, &error)) { + json = bson_as_canonical_extended_json (&reply, NULL); + printf ("distinct: %s\en", json); + bson_free (json); + } else { + fprintf (stderr, "distinct: %s\en", error.message); + } + + bson_destroy (cmd); + bson_destroy (opts); + bson_destroy (&reply); + mongoc_read_prefs_destroy (read_prefs); + mongoc_read_concern_destroy (read_concern); + mongoc_write_concern_destroy (write_concern); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_write_command_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_write_command_with_opts.3 new file mode 100644 index 0000000..54cc01c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_read_write_command_with_opts.3 @@ -0,0 +1,148 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_READ_WRITE_COMMAND_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_read_write_command_with_opts \- mongoc_client_read_write_command_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_read_write_command_with_opts ( + mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs /* UNUSED */, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Execute a command on the server, applying logic for commands that both read and write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use \fBmongoc_client_command_simple\fP\&. +.sp +Use this function for commands that both read and write, such as "mapReduce" with an output collection. +.sp +Read and write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in \fBopts\fP\&. The highest\-priority sources for these options are listed first in the following table. Read preferences are \fInot\fP applied. The write concern is omitted for MongoDB before 3.4. +.TS +center; +|l|l|l|. +_ +T{ +Read Concern +T} T{ +Write Concern +T} T{ +Collation +T} +_ +T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +Transaction +T} T{ +T} +_ +T{ +\fBclient\fP +T} T{ +\fBclient\fP +T} T{ +T} +_ +.TE +.sp +See the example for transactions and for the "distinct" command with opts\&. +.sp +\fBreply\fP is always initialized, and must be freed with \fI\%bson_destroy()\fP\&. +.sp +(The \fBmongoc_read_prefs_t\fP parameter was included by mistake when this function was introduced in libmongoc 1.5. A command that writes must not obey a read preference.) +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBread_prefs\fP: Ignored. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.sp +Consult \fI\%the MongoDB Manual entry on Database Commands\fP for each command\(aqs arguments. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +A write concern timeout or write concern error is considered a failure. +.SH EXAMPLE +.sp +See the example code for \fBmongoc_client_read_command_with_opts\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_select_server.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_select_server.3 new file mode 100644 index 0000000..1b2d7f4 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_select_server.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SELECT_SERVER" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_select_server \- mongoc_client_select_server() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_server_description_t * +mongoc_client_select_server (mongoc_client_t *client, + bool for_writes, + const mongoc_read_prefs_t *prefs, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Choose a server for an operation, according to the logic described in the Server Selection Spec. +.sp +Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher\-level functions automatically select a suitable server. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBfor_writes\fP: Whether to choose a server suitable for writes or reads. +.IP \(bu 2 +\fBprefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. If \fBfor_writes\fP is true, \fBprefs\fP must be NULL. Otherwise, use \fBprefs\fP to customize server selection, or pass NULL to use the read preference configured on the client. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_server_description_t\fP that must be freed with \fBmongoc_server_description_destroy\fP\&. If no suitable server is found, returns NULL and \fBerror\fP is filled out. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_abort_transaction.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_abort_transaction.3 new file mode 100644 index 0000000..baacb01 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_abort_transaction.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_ABORT_TRANSACTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_abort_transaction \- mongoc_client_session_abort_transaction() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_session_abort_transaction (mongoc_client_session_t *session, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Abort a multi\-document transaction. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH RETURN +.sp +Returns true if the transaction was aborted. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments, such as a session with no transaction in progress. Network or server errors are ignored. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_cluster_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_cluster_time.3 new file mode 100644 index 0000000..8e1b133 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_cluster_time.3 @@ -0,0 +1,62 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_ADVANCE_CLUSTER_TIME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_advance_cluster_time \- mongoc_client_session_advance_cluster_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_session_advance_cluster_time (mongoc_client_session_t *session, + const bson_t *cluster_time); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Advance the cluster time for a session. Has an effect only if the new cluster time is greater than the session\(aqs current cluster time. +.sp +Use \fBmongoc_client_session_advance_operation_time\fP and \fBmongoc_client_session_advance_cluster_time\fP to copy the operationTime and clusterTime from another session, ensuring subsequent operations in this session are causally consistent with the last operation in the other session +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcluster_time\fP: The session\(aqs new cluster time, as a \fI\%bson_t\fP like \fI{"cluster time": }\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_operation_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_operation_time.3 new file mode 100644 index 0000000..e947892 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_advance_operation_time.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_ADVANCE_OPERATION_TIME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_advance_operation_time \- mongoc_client_session_advance_operation_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_session_advance_operation_time (mongoc_client_session_t *session, + uint32_t timestamp, + uint32_t increment); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Advance the session\(aqs operation time, expressed as a BSON Timestamp with timestamp and increment components. Has an effect only if the new operation time is greater than the session\(aqs current operation time. +.sp +Use \fBmongoc_client_session_advance_operation_time\fP and \fBmongoc_client_session_advance_cluster_time\fP to copy the operationTime and clusterTime from another session, ensuring subsequent operations in this session are causally consistent with the last operation in the other session +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBtimestamp\fP: The new operationTime\(aqs timestamp component. +.IP \(bu 2 +\fBincrement\fP: The new operationTime\(aqs increment component. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_append.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_append.3 new file mode 100644 index 0000000..b95f66a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_append.3 @@ -0,0 +1,72 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_APPEND" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_append \- mongoc_client_session_append() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_session_append (const mongoc_client_session_t *client_session, + bson_t *opts, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient_session\fP: A pointer to a \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A pointer to a \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function appends a logical session id to command options. Use it to configure a session for any function that takes an options document, such as \fBmongoc_client_write_command_with_opts\fP\&. +.sp +It is an error to use a session for unacknowledged writes. +.SH RETURNS +.sp +Returns true on success. If any arguments are invalid, returns false and fills out \fBerror\fP\&. +.SH EXAMPLE +.sp +See the example code for \fBmongoc_client_session_t\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_commit_transaction.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_commit_transaction.3 new file mode 100644 index 0000000..ad8e997 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_commit_transaction.3 @@ -0,0 +1,68 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_COMMIT_TRANSACTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_commit_transaction \- mongoc_client_session_commit_transaction() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_session_commit_transaction (mongoc_client_session_t *session, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Commit a multi\-document transaction. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBreply\fP: An optional uninitialized \fI\%bson_t\fP to receive the server reply, or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH RETURN +.sp +Returns true if the transaction was committed. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments, such as a session with no transaction in progress, or if there is a server or network error. +.sp +If a \fBreply\fP is supplied, it is always initialized and must be freed with \fI\%bson_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_destroy.3 new file mode 100644 index 0000000..7f720fd --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_destroy.3 @@ -0,0 +1,59 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_destroy \- mongoc_client_session_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_session_destroy (mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +End a session, returning its session id to the pool, and free all client resources associated with the session. If a multi\-document transaction is in progress, abort it. Does nothing if \fBsession\fP is NULL. +.sp +See the example code for \fBmongoc_client_session_t\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_client.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_client.3 new file mode 100644 index 0000000..49590a0 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_client.3 @@ -0,0 +1,57 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_GET_CLIENT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_get_client \- mongoc_client_session_get_client() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t * +mongoc_client_session_get_client (const mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Returns the \fBmongoc_client_t\fP from which this session was created with \fBmongoc_client_start_session()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_cluster_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_cluster_time.3 new file mode 100644 index 0000000..e449039 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_cluster_time.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_GET_CLUSTER_TIME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_get_cluster_time \- mongoc_client_session_get_cluster_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_client_session_get_cluster_time (const mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get the session\(aqs clusterTime, as a BSON document. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP you must not modify or free. If the session has not been used for any operation and you have not called \fBmongoc_client_session_advance_cluster_time\fP, then the returned value is NULL. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_lsid.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_lsid.3 new file mode 100644 index 0000000..f253c44 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_lsid.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_GET_LSID" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_get_lsid \- mongoc_client_session_get_lsid() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const bson_t * +mongoc_client_session_get_lsid (mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get the server\-side "logical session ID" associated with this \fBmongoc_client_session_t\fP, as a BSON document. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fI\%bson_t\fP you must not modify or free. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_operation_time.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_operation_time.3 new file mode 100644 index 0000000..24549ea --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_operation_time.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_GET_OPERATION_TIME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_get_operation_time \- mongoc_client_session_get_operation_time() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_session_get_operation_time (const mongoc_client_session_t *session, + uint32_t *timestamp, + uint32_t *increment); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get the session\(aqs operationTime, expressed as a BSON Timestamp with timestamp and increment components. If the session has not been used for any operations, the timestamp and increment are 0. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBtimestamp\fP: A pointer to a \fBuint32_t\fP to receive the timestamp component. +.IP \(bu 2 +\fBincrement\fP: A pointer to a \fBuint32_t\fP to receive the increment component. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_opts.3 new file mode 100644 index 0000000..d5778f9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_get_opts.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_GET_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_get_opts \- mongoc_client_session_get_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +const mongoc_session_opt_t * +mongoc_client_session_get_opts (const mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Get a reference to the \fBmongoc_session_opt_t\fP with which this session was configured. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_session_opt_t\fP you must not modify or free. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_in_transaction.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_in_transaction.3 new file mode 100644 index 0000000..076b0b6 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_in_transaction.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_IN_TRANSACTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_in_transaction \- mongoc_client_session_in_transaction() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_session_in_transaction (const mongoc_client_session_t *session); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Check whether a multi\-document transaction is in progress for this session. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH RETURN +.sp +Returns true if a transaction was started and has not been committed or aborted, otherwise \fBfalse\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_start_transaction.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_start_transaction.3 new file mode 100644 index 0000000..f462793 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_start_transaction.3 @@ -0,0 +1,261 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_START_TRANSACTION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_start_transaction \- mongoc_client_session_start_transaction() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_session_start_transaction (mongoc_client_session_t *session, + const mongoc_transaction_opt_t *opts, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Start a multi\-document transaction for all following operations in this session. Any options provided in \fBopts\fP override options passed to \fBmongoc_session_opts_set_default_transaction_opts\fP, and options inherited from the \fBmongoc_client_t\fP\&. The \fBopts\fP argument is copied and can be freed after calling this function. +.sp +The transaction must be completed with \fBmongoc_client_session_commit_transaction\fP or \fBmongoc_client_session_abort_transaction\fP\&. An in\-progress transaction is automatically aborted by \fBmongoc_client_session_destroy\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBsession\fP: A \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fBmongoc_transaction_opt_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH RETURN +.sp +Returns true if the transaction was started. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments, such as a session with a transaction already in progress. +.SH EXAMPLE +.sp +The following example demonstrates how to use error labels to reliably execute a multi\-document transaction despite network errors and other transient failures. +example\-transaction.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-transaction.c \-o example\-transaction \e + * $(pkg\-config \-\-cflags \-\-libs libmongoc\-1.0) */ + +/* ./example\-transaction [CONNECTION_STRING] */ + +#include +#include + + +int +main (int argc, char *argv[]) +{ + int exit_code = EXIT_FAILURE; + + mongoc_client_t *client = NULL; + mongoc_database_t *database = NULL; + mongoc_collection_t *collection = NULL; + mongoc_client_session_t *session = NULL; + mongoc_session_opt_t *session_opts = NULL; + mongoc_transaction_opt_t *default_txn_opts = NULL; + mongoc_transaction_opt_t *txn_opts = NULL; + mongoc_read_concern_t *read_concern = NULL; + mongoc_write_concern_t *write_concern = NULL; + const char *uri_string = "mongodb://127.0.0.1/?appname=transaction\-example"; + mongoc_uri_t *uri; + bson_error_t error; + bson_t *doc = NULL; + bson_t *insert_opts = NULL; + int32_t i; + int64_t start; + bson_t reply = BSON_INITIALIZER; + char *reply_json; + bool r; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + MONGOC_ERROR ("failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + goto done; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + goto done; + } + + mongoc_client_set_error_api (client, 2); + database = mongoc_client_get_database (client, "example\-transaction"); + + /* inserting into a nonexistent collection normally creates it, but a + * collection can\(aqt be created in a transaction; create it now */ + collection = + mongoc_database_create_collection (database, "collection", NULL, &error); + + if (!collection) { + /* code 48 is NamespaceExists, see error_codes.err in mongodb source */ + if (error.code == 48) { + collection = mongoc_database_get_collection (database, "collection"); + } else { + MONGOC_ERROR ("Failed to create collection: %s", error.message); + goto done; + } + } + + /* a transaction\(aqs read preferences, read concern, and write concern can be + * set on the client, on the default transaction options, or when starting + * the transaction. for the sake of this example, set read concern on the + * default transaction options. */ + default_txn_opts = mongoc_transaction_opts_new (); + read_concern = mongoc_read_concern_new (); + mongoc_read_concern_set_level (read_concern, "snapshot"); + mongoc_transaction_opts_set_read_concern (default_txn_opts, read_concern); + session_opts = mongoc_session_opts_new (); + mongoc_session_opts_set_default_transaction_opts (session_opts, + default_txn_opts); + + session = mongoc_client_start_session (client, session_opts, &error); + if (!session) { + MONGOC_ERROR ("Failed to start session: %s", error.message); + goto done; + } + + /* in this example, set write concern when starting the transaction */ + txn_opts = mongoc_transaction_opts_new (); + write_concern = mongoc_write_concern_new (); + mongoc_write_concern_set_wmajority (write_concern, 1000 /* wtimeout */); + mongoc_transaction_opts_set_write_concern (txn_opts, write_concern); + + insert_opts = bson_new (); + if (!mongoc_client_session_append (session, insert_opts, &error)) { + MONGOC_ERROR ("Could not add session to opts: %s", error.message); + goto done; + } + +retry_transaction: + r = mongoc_client_session_start_transaction (session, txn_opts, &error); + if (!r) { + MONGOC_ERROR ("Failed to start transaction: %s", error.message); + goto done; + } + + /* insert two documents \- on error, retry the whole transaction */ + for (i = 0; i < 2; i++) { + doc = BCON_NEW ("_id", BCON_INT32 (i)); + bson_destroy (&reply); + r = mongoc_collection_insert_one ( + collection, doc, insert_opts, &reply, &error); + + bson_destroy (doc); + + if (!r) { + MONGOC_ERROR ("Insert failed: %s", error.message); + mongoc_client_session_abort_transaction (session, NULL); + + /* a network error, primary failover, or other temporary error in a + * transaction includes {"errorLabels": ["TransientTransactionError"]}, + * meaning that trying the entire transaction again may succeed + */ + if (mongoc_error_has_label (&reply, "TransientTransactionError")) { + goto retry_transaction; + } + + goto done; + } + + reply_json = bson_as_json (&reply, NULL); + printf ("%s\en", reply_json); + bson_free (reply_json); + } + + /* in case of transient errors, retry for 5 seconds to commit transaction */ + start = bson_get_monotonic_time (); + while (bson_get_monotonic_time () \- start < 5 * 1000 * 1000) { + bson_destroy (&reply); + r = mongoc_client_session_commit_transaction (session, &reply, &error); + if (r) { + /* success */ + break; + } else { + MONGOC_ERROR ("Warning: commit failed: %s", error.message); + if (mongoc_error_has_label (&reply, "TransientTransactionError")) { + goto retry_transaction; + } else if (mongoc_error_has_label (&reply, + "UnknownTransactionCommitResult")) { + /* try again to commit */ + continue; + } + + /* unrecoverable error trying to commit */ + break; + } + } + + exit_code = EXIT_SUCCESS; + +done: + bson_destroy (&reply); + bson_destroy (insert_opts); + mongoc_write_concern_destroy (write_concern); + mongoc_read_concern_destroy (read_concern); + mongoc_transaction_opts_destroy (txn_opts); + mongoc_transaction_opts_destroy (default_txn_opts); + mongoc_client_session_destroy (session); + mongoc_collection_destroy (collection); + mongoc_database_destroy (database); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return exit_code; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_t.3 new file mode 100644 index 0000000..1d0ab74 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_session_t.3 @@ -0,0 +1,205 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SESSION_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_session_t \- mongoc_client_session_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Use a session for a sequence of operations, optionally with causal consistency. See \fI\%the MongoDB Manual Entry for Causal Consistency\fP\&. +.SH SYNOPSIS +.sp +Start a session with \fBmongoc_client_start_session\fP, use the session for a sequence of operations and multi\-document transactions, then free it with \fBmongoc_client_session_destroy()\fP\&. Any \fBmongoc_cursor_t\fP or \fBmongoc_change_stream_t\fP using a session must be destroyed before the session, and a session must be destroyed before the \fBmongoc_client_t\fP it came from. +.sp +By default, sessions are \fI\%causally consistent\fP\&. To disable causal consistency, before starting a session create a \fBmongoc_session_opt_t\fP with \fBmongoc_session_opts_new()\fP and call \fBmongoc_session_opts_set_causal_consistency()\fP, then free the struct with \fBmongoc_session_opts_destroy\fP\&. +.sp +Unacknowledged writes are prohibited with sessions. +.sp +A \fBmongoc_client_session_t\fP must be used by only one thread at a time. Due to session pooling, \fBmongoc_client_start_session\fP may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout. +.SH EXAMPLE +example\-session.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-session.c \-o example\-session \e + * $(pkg\-config \-\-cflags \-\-libs libmongoc\-1.0) */ + +/* ./example\-session [CONNECTION_STRING] */ + +#include +#include + + +int +main (int argc, char *argv[]) +{ + int exit_code = EXIT_FAILURE; + + mongoc_client_t *client = NULL; + const char *uri_string = "mongodb://127.0.0.1/?appname=session\-example"; + mongoc_uri_t *uri = NULL; + mongoc_client_session_t *client_session = NULL; + mongoc_collection_t *collection = NULL; + bson_error_t error; + bson_t *selector = NULL; + bson_t *update = NULL; + bson_t *update_opts = NULL; + bson_t *find_opts = NULL; + mongoc_read_prefs_t *secondary = NULL; + mongoc_cursor_t *cursor = NULL; + const bson_t *doc; + char *str; + bool r; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + goto done; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + goto done; + } + + mongoc_client_set_error_api (client, 2); + + /* pass NULL for options \- by default the session is causally consistent */ + client_session = mongoc_client_start_session (client, NULL, &error); + if (!client_session) { + fprintf (stderr, "Failed to start session: %s\en", error.message); + goto done; + } + + collection = mongoc_client_get_collection (client, "test", "collection"); + selector = BCON_NEW ("_id", BCON_INT32 (1)); + update = BCON_NEW ("$inc", "{", "x", BCON_INT32 (1), "}"); + update_opts = bson_new (); + if (!mongoc_client_session_append (client_session, update_opts, &error)) { + fprintf (stderr, "Could not add session to opts: %s\en", error.message); + goto done; + } + + r = mongoc_collection_update_one ( + collection, selector, update, update_opts, NULL /* reply */, &error); + + if (!r) { + fprintf (stderr, "Update failed: %s\en", error.message); + goto done; + } + + bson_destroy (selector); + selector = BCON_NEW ("_id", BCON_INT32 (1)); + secondary = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); + + find_opts = BCON_NEW ("maxTimeMS", BCON_INT32 (2000)); + if (!mongoc_client_session_append (client_session, find_opts, &error)) { + fprintf (stderr, "Could not add session to opts: %s\en", error.message); + goto done; + }; + + /* read from secondary. since we\(aqre in a causally consistent session, the + * data is guaranteed to reflect the update we did on the primary. the query + * blocks waiting for the secondary to catch up, if necessary, or times out + * and fails after 2000 ms. + */ + cursor = mongoc_collection_find_with_opts ( + collection, selector, find_opts, secondary); + + while (mongoc_cursor_next (cursor, &doc)) { + str = bson_as_json (doc, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + if (mongoc_cursor_error (cursor, &error)) { + fprintf (stderr, "Cursor Failure: %s\en", error.message); + goto done; + } + + exit_code = EXIT_SUCCESS; + +done: + if (find_opts) { + bson_destroy (find_opts); + } + if (update) { + bson_destroy (update); + } + if (selector) { + bson_destroy (selector); + } + if (update_opts) { + bson_destroy (update_opts); + } + if (secondary) { + mongoc_read_prefs_destroy (secondary); + } + /* destroy cursor, collection, session before the client they came from */ + if (cursor) { + mongoc_cursor_destroy (cursor); + } + if (collection) { + mongoc_collection_destroy (collection); + } + if (client_session) { + mongoc_client_session_destroy (client_session); + } + if (uri) { + mongoc_uri_destroy (uri); + } + if (client) { + mongoc_client_destroy (client); + } + + mongoc_cleanup (); + + return exit_code; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_apm_callbacks.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_apm_callbacks.3 new file mode 100644 index 0000000..6635ac3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_apm_callbacks.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_APM_CALLBACKS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_apm_callbacks \- mongoc_client_set_apm_callbacks() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_set_apm_callbacks (mongoc_client_t *client, + mongoc_apm_callbacks_t *callbacks, + void *context); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Register a set of callbacks to receive Application Performance Monitoring events. +.sp +The callbacks are copied by the client and may be destroyed at any time after. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBcallbacks\fP: Optional \fBmongoc_apm_callbacks_t\fP\&. Pass NULL to clear all callbacks. +.IP \(bu 2 +\fBcontext\fP: Optional pointer to include with each event notification. +.UNINDENT +.SH RETURNS +.sp +Returns true on success. If any arguments are invalid, returns false and logs an error. +.SH SEE ALSO +.sp +Introduction to Application Performance Monitoring +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_appname.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_appname.3 new file mode 100644 index 0000000..2e82b4a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_appname.3 @@ -0,0 +1,74 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_APPNAME" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_appname \- mongoc_client_set_appname() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_set_appname (mongoc_client_t *client, const char *appname) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sets the application name for this client. This string, along with other internal driver details, is sent to the server as part of the initial connection handshake (\fI\%"isMaster"\fP). +.sp +\fBappname\fP is copied, and doesn\(aqt have to remain valid after the call to \fBmongoc_client_set_appname()\fP\&. +.sp +This function will log an error and return false in the following cases: +.INDENT 0.0 +.IP \(bu 2 +\fBappname\fP is longer than \fBMONGOC_HANDSHAKE_APPNAME_MAX\fP +.IP \(bu 2 +\fBclient\fP has already initiated a handshake +.IP \(bu 2 +\fBclient\fP is from a \fBmongoc_client_pool_t\fP +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBappname\fP: The application name, of length at most \fBMONGOC_HANDSHAKE_APPNAME_MAX\fP\&. +.UNINDENT +.SH RETURNS +.sp +true if the appname is set successfully. Otherwise, false. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_error_api.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_error_api.3 new file mode 100644 index 0000000..7d17739 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_error_api.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_ERROR_API" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_error_api \- mongoc_client_set_error_api() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_set_error_api (mongoc_client_t *client, int32_t version); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Configure how the C Driver reports errors. See Setting the Error API Version\&. +.sp +Do not use this function with pooled clients, see \fBmongoc_client_pool_set_error_api\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBversion\fP: The version of the error API, either \fBMONGOC_ERROR_API_VERSION_LEGACY\fP or \fBMONGOC_ERROR_API_VERSION_2\fP\&. +.UNINDENT +.SH RETURNS +.sp +Returns true on success. If any arguments are invalid, returns false and logs an error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_concern.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_concern.3 new file mode 100644 index 0000000..ac7bb6a --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_concern.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_READ_CONCERN" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_read_concern \- mongoc_client_set_read_concern() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_set_read_concern (mongoc_client_t *client, + const mongoc_read_concern_t *read_concern); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sets the read concern for the client. This only affects future operations, collections, and databases inheriting from \fBclient\fP\&. +.sp +The default read concern is MONGOC_READ_CONCERN_LEVEL_LOCAL. This is the correct read concern for the great majority of applications. +.sp +It is a programming error to call this function on a client from a \fBmongoc_client_pool_t\fP\&. For pooled clients, set the read concern with the MongoDB URI instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBread_concern\fP: A \fBmongoc_read_concern_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_prefs.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_prefs.3 new file mode 100644 index 0000000..ef22592 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_read_prefs.3 @@ -0,0 +1,66 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_READ_PREFS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_read_prefs \- mongoc_client_set_read_prefs() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_set_read_prefs (mongoc_client_t *client, + const mongoc_read_prefs_t *read_prefs); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sets the default read preferences to use with future operations upon \fBclient\fP\&. +.sp +The global default is to read from the replica set primary. +.sp +It is a programming error to call this function on a client from a \fBmongoc_client_pool_t\fP\&. For pooled clients, set the read preferences with the MongoDB URI instead. +.sp +Please see the MongoDB website for a description of \fI\%Read Preferences\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_ssl_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_ssl_opts.3 new file mode 100644 index 0000000..79965b5 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_ssl_opts.3 @@ -0,0 +1,78 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_SSL_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_ssl_opts \- mongoc_client_set_ssl_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#ifdef MONGOC_ENABLE_SSL +void +mongoc_client_set_ssl_opts (mongoc_client_t *client, + const mongoc_ssl_opt_t *opts); +#endif +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sets the SSL options to use when connecting to SSL enabled MongoDB servers. +.sp +The \fBmongoc_ssl_opt_t\fP struct is copied by the client along with the strings +it points to (\fBpem_file\fP, \fBpem_pwd\fP, \fBca_file\fP, \fBca_dir\fP, and +\fBcrl_file\fP) so they don\(aqt have to remain valid after the call to +\fBmongoc_client_set_ssl_opts\fP\&. +.sp +A call to \fBmongoc_client_set_ssl_opts\fP overrides all SSL options set through +the connection string with which the \fBmongoc_client_t\fP was constructed. +.sp +It is a programming error to call this function on a client from a +\fBmongoc_client_pool_t\fP\&. Instead, call +\fBmongoc_client_pool_set_ssl_opts\fP on the pool before popping any +clients. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fBmongoc_ssl_opt_t\fP\&. +.UNINDENT +.SH AVAILABILITY +.sp +This feature requires that the MongoDB C driver was compiled with \fB\-DENABLE_SSL\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_stream_initiator.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_stream_initiator.3 new file mode 100644 index 0000000..8c1ec7e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_stream_initiator.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_STREAM_INITIATOR" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_stream_initiator \- mongoc_client_set_stream_initiator() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_set_stream_initiator (mongoc_client_t *client, + mongoc_stream_initiator_t initiator, + void *user_data); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fBmongoc_client_set_stream_initiator()\fP function shall associate a given \fBmongoc_client_t\fP with a new stream initiator. This will completely replace the default transport (buffered TCP, possibly with TLS). The \fBinitiator\fP should fulfill the \fBmongoc_stream_t\fP contract. \fBuser_data\fP is passed through to the \fBinitiator\fP callback and may be used for whatever run time customization is necessary. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBinitiator\fP: A \fBmongoc_stream_initiator_t\fP\&. +.IP \(bu 2 +\fBuser_data\fP: User supplied pointer for callback function. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_write_concern.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_write_concern.3 new file mode 100644 index 0000000..28d71da --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_set_write_concern.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_SET_WRITE_CONCERN" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_set_write_concern \- mongoc_client_set_write_concern() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_client_set_write_concern (mongoc_client_t *client, + const mongoc_write_concern_t *write_concern); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sets the write concern for the client. This only affects future operations, collections, and databases inheriting from \fBclient\fP\&. +.sp +The default write concern is MONGOC_WRITE_CONCERN_W_DEFAULT: the driver blocks awaiting basic acknowledgement of write operations from MongoDB. This is the correct write concern for the great majority of applications. +.sp +It is a programming error to call this function on a client from a \fBmongoc_client_pool_t\fP\&. For pooled clients, set the write concern with the MongoDB URI instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBwrite_concern\fP: A \fBmongoc_write_concern_t\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_start_session.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_start_session.3 new file mode 100644 index 0000000..8a2cbe9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_start_session.3 @@ -0,0 +1,77 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_START_SESSION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_start_session \- mongoc_client_start_session() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_session_t * +mongoc_client_start_session (mongoc_client_t *client, + mongoc_session_opt_t *opts, + bson_error_t *error) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Create a session for a sequence of operations. +.sp +Start a session with \fBmongoc_client_start_session\fP, use the session for a sequence of operations and multi\-document transactions, then free it with \fBmongoc_client_session_destroy()\fP\&. Any \fBmongoc_cursor_t\fP or \fBmongoc_change_stream_t\fP using a session must be destroyed before the session, and a session must be destroyed before the \fBmongoc_client_t\fP it came from. +.sp +By default, sessions are \fI\%causally consistent\fP\&. To disable causal consistency, before starting a session create a \fBmongoc_session_opt_t\fP with \fBmongoc_session_opts_new()\fP and call \fBmongoc_session_opts_set_causal_consistency()\fP, then free the struct with \fBmongoc_session_opts_destroy\fP\&. +.sp +Unacknowledged writes are prohibited with sessions. +.sp +A \fBmongoc_client_session_t\fP must be used by only one thread at a time. Due to session pooling, \fBmongoc_client_start_session\fP may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBopts\fP: An optional \fBmongoc_session_opt_t\fP\&. +.IP \(bu 2 +\fBerror\fP: A \fI\%bson_error_t\fP\&. +.UNINDENT +.SH RETURNS +.sp +If successful, this function returns a newly allocated \fBmongoc_client_session_t\fP that should be freed with \fBmongoc_client_session_destroy()\fP when no longer in use. On error, returns NULL and sets \fBerror\fP\&. +.SH ERRORS +.sp +This function can fail if the driver is not built with crypto support, if \fBopts\fP is misconfigured, or if the session is configured with options that the server does not support. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_t.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_t.3 new file mode 100644 index 0000000..0f2b00e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_t.3 @@ -0,0 +1,161 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_T" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_t \- mongoc_client_t +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +A single\-threaded MongoDB connection. See connection\-pooling\&. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +typedef struct _mongoc_client_t mongoc_client_t; + +typedef mongoc_stream_t *(*mongoc_stream_initiator_t) ( + const mongoc_uri_t *uri, + const mongoc_host_list_t *host, + void *user_data, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBmongoc_client_t\fP is an opaque type that provides access to a MongoDB server, +replica set, or sharded cluster. It maintains management of underlying sockets +and routing to individual nodes based on \fBmongoc_read_prefs_t\fP or \fBmongoc_write_concern_t\fP\&. +.SH STREAMS +.sp +The underlying transport for a given client can be customized, wrapped or replaced by any implementation that fulfills \fBmongoc_stream_t\fP\&. A custom transport can be set with \fBmongoc_client_set_stream_initiator()\fP\&. +.SH THREAD SAFETY +.sp +\fBmongoc_client_t\fP is \fINOT\fP thread\-safe and should only be used from one thread at a time. When used in multi\-threaded scenarios, it is recommended that you use the thread\-safe \fBmongoc_client_pool_t\fP to retrieve a \fBmongoc_client_t\fP for your thread. +.SH EXAMPLE +example\-client.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* gcc example\-client.c \-o example\-client $(pkg\-config \-\-cflags \-\-libs + * libmongoc\-1.0) */ + +/* ./example\-client [CONNECTION_STRING [COLLECTION_NAME]] */ + +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + mongoc_collection_t *collection; + mongoc_cursor_t *cursor; + bson_error_t error; + const bson_t *doc; + const char *collection_name = "test"; + bson_t query; + char *str; + const char *uri_string = "mongodb://127.0.0.1/?appname=client\-example"; + mongoc_uri_t *uri; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + if (argc > 2) { + collection_name = argv[2]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + + bson_init (&query); + +#if 0 + bson_append_utf8 (&query, "hello", \-1, "world", \-1); +#endif + + collection = mongoc_client_get_collection (client, "test", collection_name); + cursor = mongoc_collection_find_with_opts ( + collection, + &query, + NULL, /* additional options */ + NULL); /* read prefs, NULL for default */ + + while (mongoc_cursor_next (cursor, &doc)) { + str = bson_as_canonical_extended_json (doc, NULL); + fprintf (stdout, "%s\en", str); + bson_free (str); + } + + if (mongoc_cursor_error (cursor, &error)) { + fprintf (stderr, "Cursor Failure: %s\en", error.message); + return EXIT_FAILURE; + } + + bson_destroy (&query); + mongoc_cursor_destroy (cursor); + mongoc_collection_destroy (collection); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_watch.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_watch.3 new file mode 100644 index 0000000..9ed470e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_watch.3 @@ -0,0 +1,102 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_WATCH" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_watch \- mongoc_client_watch() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_change_stream_t* +mongoc_client_watch (mongoc_client_t *client, + const bson_t *pipeline, + const bson_t *opts); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +A helper function to create a change stream. It is preferred to call this +function over using a raw aggregation to create a change stream. +.sp +This function uses the read preference and read concern of the client. If +the change stream needs to re\-establish connection, the same read preference +will be used. This may happen if the change stream encounters a resumable error. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +A change stream is only supported with majority read concern. +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBdb\fP: A \fBmongoc_client_t\fP specifying the client which the change stream listens to. +.IP \(bu 2 +\fBpipeline\fP: A \fI\%bson_t\fP representing an aggregation pipeline appended to the change stream. This may be an empty document. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing change stream options or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be \fBNULL\fP or a document consisting of any subset of the following +parameters: +.INDENT 0.0 +.IP \(bu 2 +\fBbatchSize\fP An \fBint32\fP representing number of documents requested to be returned on each call to \fBmongoc_change_stream_next\fP +.IP \(bu 2 +\fBresumeAfter\fP A \fBDocument\fP representing the logical starting point of the change stream. The \fB_id\fP field of any change received from a change stream can be used here. +.IP \(bu 2 +\fBstartAtOperationTime\fP A \fBTimestamp\fP\&. The change stream only provides changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here. +.IP \(bu 2 +\fBmaxAwaitTimeMS\fP An \fBint64\fP representing the maximum amount of time a call to \fBmongoc_change_stream_next\fP will block waiting for data +.IP \(bu 2 +\fBcollation\fP A \fI\%Collation Document\fP +.UNINDENT +.SH RETURNS +.sp +A newly allocated \fBmongoc_change_stream_t\fP which must be freed with +\fBmongoc_change_stream_destroy\fP when no longer in use. The returned +\fBmongoc_change_stream_t\fP is never \fBNULL\fP\&. If there is an error, it can +be retrieved with \fBmongoc_change_stream_error_document\fP, and subsequent +calls to \fBmongoc_change_stream_next\fP will return \fBfalse\fP\&. +.SH SEE ALSO +.sp +mongoc_database_watch +.sp +mongoc_collection_watch +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_write_command_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_write_command_with_opts.3 new file mode 100644 index 0000000..abec20e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_client_write_command_with_opts.3 @@ -0,0 +1,288 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_CLIENT_WRITE_COMMAND_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_client_write_command_with_opts \- mongoc_client_write_command_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_client_write_command_with_opts (mongoc_client_t *client, + const char *db_name, + const bson_t *command, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Execute a command on the server, applying logic that is specific to commands that write, and taking the MongoDB server version into account. To send a raw command to the server without any of this logic, use \fBmongoc_client_command_simple\fP\&. +.sp +Use this function for commands that write such as "drop" or "createRole" (but not for "insert", "update", or "delete", see \fI\%Basic Write Operations\fP). Write concern and collation can be overridden by various sources. In a transaction, read concern and write concern are prohibited in \fBopts\fP\&. The highest\-priority sources for these options are listed first in the following table. The write concern is omitted for MongoDB before 3.4. +.TS +center; +|l|l|. +_ +T{ +Write Concern +T} T{ +Collation +T} +_ +T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +T} +_ +T{ +\fBclient\fP +T} T{ +T} +_ +.TE +.sp +See the example for transactions and for the "distinct" command with opts\&. +.sp +\fBreply\fP is always initialized, and must be freed with \fI\%bson_destroy()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBclient\fP: A \fBmongoc_client_t\fP\&. +.IP \(bu 2 +\fBdb_name\fP: The name of the database to run the command on. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBclient\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.sp +Consult \fI\%the MongoDB Manual entry on Database Commands\fP for each command\(aqs arguments. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +A write concern timeout or write concern error is considered a failure. +.SH BASIC WRITE OPERATIONS +.sp +Do not use this function to call the basic write commands "insert", "update", and "delete". Those commands require special logic not implemented in \fBmongoc_client_write_command_with_opts\fP\&. For basic write operations use CRUD functions such as \fBmongoc_collection_insert_one\fP and the others described in the CRUD tutorial, or use the Bulk API\&. +.SH EXAMPLE +example\-command\-with\-opts.c.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* + +Demonstrates how to prepare options for mongoc_client_read_command_with_opts and +mongoc_client_write_command_with_opts. First it calls "cloneCollectionAsCapped" +command with "writeConcern" option, then "distinct" command with "collation" and +"readConcern" options, + +Start a MongoDB 3.4 replica set with \-\-enableMajorityReadConcern and insert two +documents: + +$ mongo +MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 1, y: "One"}) +WriteResult({ "nInserted" : 1 }) +MongoDB Enterprise replset:PRIMARY> db.my_collection.insert({x: 2, y: "Two"}) +WriteResult({ "nInserted" : 1 }) + +Build and run the example: + +gcc example\-command\-with\-opts.c \-o example\-command\-with\-opts $(pkg\-config +\-\-cflags \-\-libs libmongoc\-1.0) +\&./example\-command\-with\-opts [CONNECTION_STRING] +cloneCollectionAsCapped: { "ok" : 1 } +distinct: { "values" : [ 1, 2 ], "ok" : 1 } + +*/ + +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + mongoc_client_t *client; + const char *uri_string = "mongodb://127.0.0.1/?appname=client\-example"; + mongoc_uri_t *uri; + bson_t *cmd; + bson_t *opts; + mongoc_write_concern_t *write_concern; + mongoc_read_prefs_t *read_prefs; + mongoc_read_concern_t *read_concern; + bson_t reply; + bson_error_t error; + char *json; + + mongoc_init (); + + if (argc > 1) { + uri_string = argv[1]; + } + + uri = mongoc_uri_new_with_error (uri_string, &error); + if (!uri) { + fprintf (stderr, + "failed to parse URI: %s\en" + "error message: %s\en", + uri_string, + error.message); + return EXIT_FAILURE; + } + + client = mongoc_client_new_from_uri (uri); + if (!client) { + return EXIT_FAILURE; + } + + mongoc_client_set_error_api (client, 2); + + cmd = BCON_NEW ("cloneCollectionAsCapped", + BCON_UTF8 ("my_collection"), + "toCollection", + BCON_UTF8 ("my_capped_collection"), + "size", + BCON_INT64 (1024 * 1024)); + + /* include write concern "majority" in command options */ + write_concern = mongoc_write_concern_new (); + mongoc_write_concern_set_wmajority (write_concern, 10000 /* wtimeoutMS */); + opts = bson_new (); + mongoc_write_concern_append (write_concern, opts); + + if (mongoc_client_write_command_with_opts ( + client, "test", cmd, opts, &reply, &error)) { + json = bson_as_canonical_extended_json (&reply, NULL); + printf ("cloneCollectionAsCapped: %s\en", json); + bson_free (json); + } else { + fprintf (stderr, "cloneCollectionAsCapped: %s\en", error.message); + } + + bson_free (cmd); + bson_free (opts); + + /* distinct values of "x" in "my_collection" where "y" sorts after "one" */ + cmd = BCON_NEW ("distinct", + BCON_UTF8 ("my_collection"), + "key", + BCON_UTF8 ("x"), + "query", + "{", + "y", + "{", + "$gt", + BCON_UTF8 ("one"), + "}", + "}"); + + read_prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); + + /* "One" normally sorts before "one"; make "One" sort after "one" */ + opts = BCON_NEW ("collation", + "{", + "locale", + BCON_UTF8 ("en_US"), + "caseFirst", + BCON_UTF8 ("lower"), + "}"); + + /* add a read concern to "opts" */ + read_concern = mongoc_read_concern_new (); + mongoc_read_concern_set_level (read_concern, + MONGOC_READ_CONCERN_LEVEL_MAJORITY); + + mongoc_read_concern_append (read_concern, opts); + + if (mongoc_client_read_command_with_opts ( + client, "test", cmd, read_prefs, opts, &reply, &error)) { + json = bson_as_canonical_extended_json (&reply, NULL); + printf ("distinct: %s\en", json); + bson_free (json); + } else { + fprintf (stderr, "distinct: %s\en", error.message); + } + + bson_destroy (cmd); + bson_destroy (opts); + bson_destroy (&reply); + mongoc_read_prefs_destroy (read_prefs); + mongoc_read_concern_destroy (read_concern); + mongoc_write_concern_destroy (write_concern); + mongoc_uri_destroy (uri); + mongoc_client_destroy (client); + + mongoc_cleanup (); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_aggregate.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_aggregate.3 new file mode 100644 index 0000000..fc78e6e --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_aggregate.3 @@ -0,0 +1,215 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_AGGREGATE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_aggregate \- mongoc_collection_aggregate() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_cursor_t * +mongoc_collection_aggregate (mongoc_collection_t *collection, + mongoc_query_flags_t flags, + const bson_t *pipeline, + const bson_t *opts, + const mongoc_read_prefs_t *read_prefs) + BSON_GNUC_WARN_UNUSED_RESULT; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_query_flags_t\fP\&. +.IP \(bu 2 +\fBpipeline\fP: A \fI\%bson_t\fP, either a BSON array or a BSON document containing an array field named "pipeline". +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing options for the command, or \fBNULL\fP\&. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBwriteConcern\fP: For aggregations that include "$out", you can construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: Construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBbypassDocumentValidation\fP: Set to \fBtrue\fP to skip server\-side schema validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.IP \(bu 2 +\fBbatchSize\fP: To specify the number of documents to return in each batch of a response from the server, include an int "batchSize" field. +.UNINDENT +.sp +For a list of all options, see \fI\%the MongoDB Manual entry on the aggregate command\fP\&. +.SH DESCRIPTION +.sp +This function shall execute an aggregation query on the underlying collection. For more information on building aggregation pipelines, see \fI\%the MongoDB Manual entry on the aggregate command\fP\&. +.sp +Read preferences, read and write concern, and collation can be overridden by various sources. The highest\-priority sources for these options are listed first in the following table. In a transaction, read concern and write concern are prohibited in \fBopts\fP and the read preference must be primary or NULL. Write concern is applied from \fBopts\fP, or if \fBopts\fP has no write concern and the aggregation pipeline includes "$out", the write concern is applied from \fBcollection\fP\&. The write concern is omitted for MongoDB before 3.4. +.TS +center; +|l|l|l|l|. +_ +T{ +Read Preferences +T} T{ +Read Concern +T} T{ +Write Concern +T} T{ +Collation +T} +_ +T{ +\fBread_prefs\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +Transaction +T} T{ +Transaction +T} T{ +T} +_ +T{ +\fBcollection\fP +T} T{ +\fBcollection\fP +T} T{ +\fBcollection\fP +T} T{ +T} +_ +.TE +.sp +See the example for transactions and for the "distinct" command with opts\&. +.SH RETURNS +.sp +This function returns a newly allocated \fBmongoc_cursor_t\fP that should be freed with \fBmongoc_cursor_destroy()\fP when no longer in use. The returned \fBmongoc_cursor_t\fP is never \fBNULL\fP; if the parameters are invalid, the \fI\%bson_error_t\fP in the \fBmongoc_cursor_t\fP is filled out, and the \fBmongoc_cursor_t\fP is returned before the server is selected. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +Failure to handle the result of this function is a programming error. +.UNINDENT +.UNINDENT +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include + +static mongoc_cursor_t * +pipeline_query (mongoc_collection_t *collection) +{ + mongoc_cursor_t *cursor; + bson_t *pipeline; + + pipeline = BCON_NEW ("pipeline", + "[", + "{", + "$match", + "{", + "foo", + BCON_UTF8 ("A"), + "}", + "}", + "{", + "$match", + "{", + "bar", + BCON_BOOL (false), + "}", + "}", + "]"); + + cursor = mongoc_collection_aggregate ( + collection, MONGOC_QUERY_NONE, pipeline, NULL, NULL); + + bson_destroy (pipeline); + + return cursor; +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OTHER PARAMETERS +.sp +When using \fB$out\fP, the pipeline stage that writes, the write_concern field of the \fBmongoc_cursor_t\fP will be set to the \fBmongoc_write_concern_t\fP parameter, if it is valid, and applied to the write command when \fBmongoc_cursor_next()\fP is called. Pass any other parameters to the \fBaggregate\fP command, besides \fBpipeline\fP, as fields in \fBopts\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_write_concern_t *write_concern = mongoc_write_concern_new (); +mongoc_write_concern_set_w (write_concern, 3); + +pipeline = + BCON_NEW ("pipeline", "[", "{", "$out", BCON_UTF8 ("collection2"), "}", "]"); + +opts = BCON_NEW ("bypassDocumentValidation", BCON_BOOL (true)); +mongoc_write_concern_append (write_concern, opts); + +cursor = mongoc_collection_aggregate ( + collection1, MONGOC_QUERY_NONE, pipeline, opts, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command.3 new file mode 100644 index 0000000..1f0d77c --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command.3 @@ -0,0 +1,84 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COMMAND" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_command \- mongoc_collection_command() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_cursor_t * +mongoc_collection_command (mongoc_collection_t *collection, + mongoc_query_flags_t flags, + uint32_t skip, + uint32_t limit, + uint32_t batch_size, + const bson_t *command, + const bson_t *fields, + const mongoc_read_prefs_t *read_prefs) + BSON_GNUC_WARN_UNUSED_RESULT; +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This function is superseded by \fBmongoc_collection_command_with_opts()\fP, \fBmongoc_collection_read_command_with_opts()\fP, \fBmongoc_collection_write_command_with_opts()\fP, and \fBmongoc_collection_read_write_command_with_opts()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_query_flags_t\fP\&. +.IP \(bu 2 +\fBskip\fP: A uint32_t with the number of documents to skip or zero. +.IP \(bu 2 +\fBlimit\fP: A uint32_t with the max number of documents to return or zero. +.IP \(bu 2 +\fBbatch_size\fP: A uint32_t with the number of documents in each batch or zero. Default is 100. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command to execute. +.IP \(bu 2 +\fBfields\fP: A \fI\%bson_t\fP containing the fields to return or \fBNULL\fP\&. Not all commands support this option. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. Otherwise, the command uses mode \fBMONGOC_READ_PRIMARY\fP\&. +.UNINDENT +.SH RETURNS +.sp +A \fBmongoc_cursor_t\fP\&. +.sp +The cursor should be freed with \fBmongoc_cursor_destroy()\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_simple.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_simple.3 new file mode 100644 index 0000000..28cad28 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_simple.3 @@ -0,0 +1,119 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COMMAND_SIMPLE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_command_simple \- mongoc_collection_command_simple() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_command_simple (mongoc_collection_t *collection, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command to execute. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. Otherwise, the command uses mode \fBMONGOC_READ_PRIMARY\fP\&. +.IP \(bu 2 +\fBreply\fP: A location to initialize a \fI\%bson_t\fP\&. This should be on the stack. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This is a simplified version of \fBmongoc_collection_command()\fP that returns the first result document in \fBreply\fP\&. The collection\(aqs read preference, read concern, and write concern are not applied to the command. The parameter \fBreply\fP is initialized even upon failure to simplify memory management. +.sp +This function tries to unwrap an embedded error in the command when possible. The unwrapped error will be propagated via the \fBerror\fP parameter. Additionally, the result document is set in \fBreply\fP\&. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +This function does not check the server response for a write concern error or write concern timeout. +.SH EXAMPLE +.sp +The following is an example of executing the collection stats command. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_collection_stats (mongoc_collection_t *collection) +{ + bson_error_t error; + const char *name; + bson_t *cmd; + bson_t reply; + + name = mongoc_collection_get_name (collection); + cmd = BCON_NEW ("collStats", BCON_UTF8 (name)); + + if (mongoc_collection_command_simple ( + collection, cmd, NULL, &reply, &error)) { + str = bson_as_canonical_extended_json (&reply, NULL); + printf ("%s\en", str); + bson_free (str); + } else { + fprintf (stderr, "%s\en", error.message); + } + + bson_destroy (&reply); + bson_destroy (cmd); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_with_opts.3 new file mode 100644 index 0000000..0b1aee9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_command_with_opts.3 @@ -0,0 +1,148 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COMMAND_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_command_with_opts \- mongoc_collection_command_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_command_with_opts ( + mongoc_collection_t *collection, + const bson_t *command, + const mongoc_read_prefs_t *read_prefs, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Execute a command on the server, interpreting \fBopts\fP according to the MongoDB server version. To send a raw command to the server without any of this logic, use \fBmongoc_client_command_simple\fP\&. +.sp +Read preferences, read and write concern, and collation can be overridden by various sources. The highest\-priority sources for these options are listed first: +.TS +center; +|l|l|l|l|. +_ +T{ +Read Preferences +T} T{ +Read Concern +T} T{ +Write Concern +T} T{ +Collation +T} +_ +T{ +\fBread_prefs\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} T{ +\fBopts\fP +T} +_ +T{ +Transaction +T} T{ +Transaction +T} T{ +Transaction +T} T{ +T} +_ +T{ +\fBcollection\fP +T} T{ +T} T{ +T} T{ +T} +_ +.TE +.sp +In a transaction, read concern and write concern are prohibited in \fBopts\fP and the read preference must be primary or NULL. +See the example for transactions and for the "distinct" command with opts\&. +.sp +\fBreply\fP is always initialized, and must be freed with \fI\%bson_destroy()\fP\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBcommand\fP: A \fI\%bson_t\fP containing the command specification. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP containing additional options. +.IP \(bu 2 +\fBreply\fP: A location for the resulting document. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.sp +Consult \fI\%the MongoDB Manual entry on Database Commands\fP for each command\(aqs arguments. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +The reply is not parsed for a write concern timeout or write concern error. +.SH EXAMPLE +.sp +See the example code for \fBmongoc_client_read_command_with_opts\fP\&. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_copy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_copy.3 new file mode 100644 index 0000000..e0d530f --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_copy.3 @@ -0,0 +1,63 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COPY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_copy \- mongoc_collection_copy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_collection_t * +mongoc_collection_copy (mongoc_collection_t *collection); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +Performs a deep copy of the \fBcollection\fP struct and its configuration. Useful if you intend to call \fBmongoc_collection_set_write_concern\fP, \fBmongoc_collection_set_read_prefs\fP, or \fBmongoc_collection_set_read_concern\fP, and want to preserve an unaltered copy of the struct. +.sp +This function does \fInot\fP copy the contents of the collection on the MongoDB server; use the cloneCollection command for that purpose. +.SH RETURNS +.sp +A newly allocated \fBmongoc_collection_t\fP that should be freed with \fBmongoc_collection_destroy()\fP when no longer in use. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count.3 new file mode 100644 index 0000000..3cf3c2b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count.3 @@ -0,0 +1,125 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COUNT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_count \- mongoc_collection_count() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. +Use \fBmongoc_collection_count_documents\fP or \fBmongoc_collection_estimated_document_count\fP instead. +.sp +\fBmongoc_collection_count_documents\fP has similar performance to calling \fBmongoc_collection_count\fP with a non\-NULL \fBquery\fP, and is guaranteed to retrieve an accurate collection count. See migrating from deprecated count functions for details. +.sp +\fBmongoc_collection_estimated_document_count\fP has the same performance as calling \fBmongoc_collection_count\fP with a NULL \fBquery\fP, but is not guaranteed to retrieve an accurate collection count. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_collection_count (mongoc_collection_t *collection, + mongoc_query_flags_t flags, + const bson_t *query, + int64_t skip, + int64_t limit, + const mongoc_read_prefs_t *read_prefs, + bson_error_t *error) + BSON_GNUC_DEPRECATED_FOR (mongoc_collection_count_documents or + mongoc_collection_estimated_document_count); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_query_flags_t\fP\&. +.IP \(bu 2 +\fBquery\fP: A \fI\%bson_t\fP containing the query. +.IP \(bu 2 +\fBskip\fP: A int64_t, zero to ignore. +.IP \(bu 2 +\fBlimit\fP: A int64_t, zero to ignore. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall execute a count query on the underlying \(aqcollection\(aq. The bson \(aqquery\(aq is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. +.sp +For more information, see the \fI\%query reference\fP at the MongoDB website. +.sp +The \fBmongoc_read_concern_t\fP specified on the \fBmongoc_collection_t\fP will be used, if any. If \fBread_prefs\fP is NULL, the collection\(aqs read preferences are used. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +\-1 on failure, otherwise the number of documents counted. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_query_count (mongoc_collection_t *collection, bson_t *query) +{ + bson_error_t error; + int64_t count; + + count = mongoc_collection_count ( + collection, MONGOC_QUERY_NONE, query, 0, 0, NULL, &error); + + if (count < 0) { + fprintf (stderr, "Count failed: %s\en", error.message); + } else { + printf ("%" PRId64 " documents counted.\en", count); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_documents.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_documents.3 new file mode 100644 index 0000000..8d52058 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_documents.3 @@ -0,0 +1,163 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COUNT_DOCUMENTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_count_documents \- mongoc_collection_count_documents() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_collection_count_documents (mongoc_collection_t *collection, + const bson_t *filter, + const bson_t *opts, + const mongoc_read_prefs_t *read_prefs, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBfilter\fP: A \fI\%bson_t\fP containing the filter. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP, \fBNULL\fP to ignore. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBreply\fP: A location for an uninitialized \fI\%bson_t\fP to store the command reply, \fBNULL\fP to ignore. If not \fBNULL\fP, \fBreply\fP will be initialized. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.IP \(bu 2 +\fBskip\fP: An int specifying how many documents matching the \fBquery\fP should be skipped before counting. +.IP \(bu 2 +\fBlimit\fP: An int specifying the maximum number of documents to count. +.UNINDENT +.SH DESCRIPTION +.sp +This functions executes a count query on \fBcollection\fP\&. In contrast with \fBmongoc_collection_estimated_document_count()\fP, the count returned is guaranteed to be accurate. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +\-1 on failure, otherwise the number of documents counted. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_count (mongoc_collection_t *collection, bson_t *filter) +{ + bson_error_t error; + int64_t count; + bson_t* opts = BCON_NEW ("skip", BCON_INT64(5)); + + count = mongoc_collection_count_documents ( + collection, filter, opts, NULL, NULL, &error); + bson_destroy (opts); + + if (count < 0) { + fprintf (stderr, "Count failed: %s\en", error.message); + } else { + printf ("%" PRId64 " documents counted.\en", count); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH MIGRATING FROM DEPRECATED COUNT FUNCTIONS +.sp +When migrating to \fBmongoc_collection_count_documents\fP from the deprecated \fBmongoc_collection_count\fP or \fBmongoc_collection_count_with_opts\fP, the following query operators in the filter must be replaced: +.TS +center; +|l|l|. +_ +T{ +Operator +T} T{ +Replacement +T} +_ +T{ +$where +T} T{ +\fI\%$expr\fP +T} +_ +T{ +$near +T} T{ +\fI\%$geoWithin\fP with \fI\%$center\fP +T} +_ +T{ +$nearSphere +T} T{ +\fI\%$geoWithin\fP with \fI\%$centerSphere\fP +T} +_ +.TE +.sp +$expr requires MongoDB 3.6+ +.SH SEE ALSO +.sp +\fBmongoc_collection_estimated_document_count()\fP +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_with_opts.3 new file mode 100644 index 0000000..1a2b2b3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_count_with_opts.3 @@ -0,0 +1,192 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_COUNT_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_count_with_opts \- mongoc_collection_count_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. +Use \fBmongoc_collection_count_documents\fP or \fBmongoc_collection_estimated_document_count\fP instead. +.sp +\fBmongoc_collection_count_documents\fP has similar performance to calling \fBmongoc_collection_count\fP with a non\-NULL \fBquery\fP, and is guaranteed to retrieve an accurate collection count. See migrating from deprecated count functions for details. +.sp +\fBmongoc_collection_estimated_document_count\fP has the same performance as calling \fBmongoc_collection_count\fP with a NULL \fBquery\fP, but is not guaranteed to retrieve an accurate collection count. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_collection_count_with_opts (mongoc_collection_t *collection, + mongoc_query_flags_t flags, + const bson_t *query, + int64_t skip, + int64_t limit, + const bson_t *opts, + const mongoc_read_prefs_t *read_prefs, + bson_error_t *error) + BSON_GNUC_DEPRECATED_FOR (mongoc_collection_count_documents or + mongoc_collection_estimated_document_count); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_query_flags_t\fP\&. +.IP \(bu 2 +\fBquery\fP: A \fI\%bson_t\fP containing the query. +.IP \(bu 2 +\fBskip\fP: A int64_t, zero to ignore. +.IP \(bu 2 +\fBlimit\fP: A int64_t, zero to ignore. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP, \fBNULL\fP to ignore. +.IP \(bu 2 +\fBread_prefs\fP: An optional \fBmongoc_read_prefs_t\fP, otherwise uses the collection\(aqs read preference. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall execute a count query on the underlying \(aqcollection\(aq. The bson \(aqquery\(aq is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. +.sp +The \fBmongoc_read_concern_t\fP specified on the \fBmongoc_collection_t\fP will be used, if any. If \fBread_prefs\fP is NULL, the collection\(aqs read preferences are used. +.sp +In addition to the standard functionality available from mongoc_collection_count, this function allows the user to add arbitrary extra keys to the count. This pass through enables features such as hinting for counts. +.sp +For more information, see the \fI\%query reference\fP at the MongoDB website. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +\-1 on failure, otherwise the number of documents counted. +.SH EXAMPLES +Basic Counting.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_query_count (mongoc_collection_t *collection, bson_t *query) +{ + bson_error_t error; + int64_t count; + bson_t opts; + + bson_init (&opts); + BSON_APPEND_UTF8 (&opts, "hint", "_id_"); + + count = mongoc_collection_count_with_opts ( + collection, MONGOC_QUERY_NONE, query, 0, 0, &opts, NULL, &error); + + bson_destroy (&opts); + + if (count < 0) { + fprintf (stderr, "Count failed: %s\en", error.message); + } else { + printf ("%" PRId64 " documents counted.\en", count); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +Counting with Collation.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_query_count (mongoc_collection_t *collection, bson_t *query) +{ + bson_t *selector; + bson_t *opts; + bson_error_t error; + int64_t count; + + selector = BCON_NEW ("_id", "{", "$gt", BCON_UTF8 ("one"), "}"); + + /* "One" normally sorts before "one"; make "one" come first */ + opts = BCON_NEW ("collation", + "{", + "locale", + BCON_UTF8 ("en_US"), + "caseFirst", + BCON_UTF8 ("lower"), + "}"); + + count = mongoc_collection_count_with_opts ( + collection, MONGOC_QUERY_NONE, query, 0, 0, opts, NULL, &error); + + bson_destroy (selector); + bson_destroy (opts); + + if (count < 0) { + fprintf (stderr, "Count failed: %s\en", error.message); + } else { + printf ("%" PRId64 " documents counted.\en", count); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation.3 new file mode 100644 index 0000000..fbbbc89 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation.3 @@ -0,0 +1,97 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_CREATE_BULK_OPERATION" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_create_bulk_operation \- mongoc_collection_create_bulk_operation() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_bulk_operation_t * +mongoc_collection_create_bulk_operation ( + mongoc_collection_t *collection, + bool ordered, + const mongoc_write_concern_t *write_concern) BSON_GNUC_WARN_UNUSED_RESULT + BSON_GNUC_DEPRECATED_FOR (mongoc_collection_create_bulk_operation_with_opts); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. +.sp +Please use \fBmongoc_collection_create_bulk_operation_with_opts()\fP instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBordered\fP: If the operations must be performed in order. +.IP \(bu 2 +\fBwrite_concern\fP: An optional \fBmongoc_write_concern_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall begin a new bulk operation. After creating this you may call various functions such as \fBmongoc_bulk_operation_update()\fP, \fBmongoc_bulk_operation_insert()\fP and others. +.sp +After calling \fBmongoc_bulk_operation_execute()\fP the commands will be executed in as large as batches as reasonable by the client. +.sp +If \fBordered\fP is true, then processing will stop at the first error. +.sp +If \fBordered\fP is not true, then the bulk operation will attempt to continue processing even after the first failure. +.sp +\fBwrite_concern\fP contains the write concern for all operations in the bulk operation. If \fBNULL\fP, the collection\(aqs write concern is used. The global default is acknowledged writes: MONGOC_WRITE_CONCERN_W_DEFAULT. +.SH SEE ALSO +.sp +\fBBulk Write Operations\fP +.sp +\fBmongoc_bulk_operation_t\fP +.SH ERRORS +.sp +Errors are propagated when executing the bulk operation. +.SH RETURNS +.sp +A newly allocated \fBmongoc_bulk_operation_t\fP that should be freed with \fBmongoc_bulk_operation_destroy()\fP when no longer in use. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +Failure to handle the result of this function is a programming error. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation_with_opts.3 new file mode 100644 index 0000000..8856e8b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_bulk_operation_with_opts.3 @@ -0,0 +1,90 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_CREATE_BULK_OPERATION_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_create_bulk_operation_with_opts \- mongoc_collection_create_bulk_operation_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_bulk_operation_t * +mongoc_collection_create_bulk_operation_with_opts ( + mongoc_collection_t *collection, + const bson_t *opts) BSON_GNUC_WARN_UNUSED_RESULT; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBordered\fP: set to \fBfalse\fP to attempt to insert all documents, continuing after errors. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall begin a new bulk operation. After creating this you may call various functions such as \fBmongoc_bulk_operation_update()\fP, \fBmongoc_bulk_operation_insert()\fP and others. +.sp +After calling \fBmongoc_bulk_operation_execute()\fP the commands will be executed in as large as batches as reasonable by the client. +.SH SEE ALSO +.sp +\fBBulk Write Operations\fP +.sp +\fBmongoc_bulk_operation_t\fP +.SH ERRORS +.sp +Errors are propagated when executing the bulk operation. +.SH RETURNS +.sp +A newly allocated \fBmongoc_bulk_operation_t\fP that should be freed with \fBmongoc_bulk_operation_destroy()\fP when no longer in use. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +Failure to handle the result of this function is a programming error. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index.3 new file mode 100644 index 0000000..e1cdca3 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index.3 @@ -0,0 +1,67 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_CREATE_INDEX" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_create_index \- mongoc_collection_create_index() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_create_index (mongoc_collection_t *collection, + const bson_t *keys, + const mongoc_index_opt_t *opt, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. See create\-indexes\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBkeys\fP: A \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBopt\fP: A mongoc_index_opt_t. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index_with_opts.3 new file mode 100644 index 0000000..a95dc30 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_create_index_with_opts.3 @@ -0,0 +1,97 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_CREATE_INDEX_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_create_index_with_opts \- mongoc_collection_create_index_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_create_index_with_opts (mongoc_collection_t *collection, + const bson_t *keys, + const mongoc_index_opt_t *index_opts, + const bson_t *command_opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. See create\-indexes\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBkeys\fP: A \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBindex_opts\fP: A mongoc_index_opt_t. +.IP \(bu 2 +\fBreply\fP: An optional location for a \fI\%bson_t\fP which will store the server\(aqs reply. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBcommand_opts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function will request the creation of a new index. +.sp +This function will use the \fBcreateIndexes\fP command. +The server\(aqs reply is stored in \fBreply\fP\&. +.sp +If no write concern is provided in \fBcommand_opts\fP, the collection\(aqs write concern is used. +.sp +See \fBmongoc_index_opt_t\fP for options on creating indexes. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +\fBreply\fP is always initialized and must be destroyed with \fI\%bson_destroy()\fP\&. If the server is running an obsolete version of MongoDB then \fBreply\fP may be empty, though it will still be initialized. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete.3 new file mode 100644 index 0000000..2b9cf4b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete.3 @@ -0,0 +1,85 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DELETE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_delete \- mongoc_collection_delete() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +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) + BSON_GNUC_DEPRECATED_FOR (mongoc_collection_delete_one or + mongoc_collection_delete_many); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +Please use \fBmongoc_collection_delete_one()\fP or \fBmongoc_collection_delete_many()\fP instead. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_delete_flags_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP containing the query to match documents. +.IP \(bu 2 +\fBwrite_concern\fP: A \fBmongoc_write_concern_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall delete documents in the given \fBcollection\fP that match \fBselector\fP\&. The bson \fBselector\fP is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. +.sp +If you want to limit deletes to a single document, provide \fBMONGOC_DELETE_SINGLE_REMOVE\fP in \fBflags\fP\&. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.sp +A write concern timeout or write concern error is considered a failure. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_many.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_many.3 new file mode 100644 index 0000000..d4e7293 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_many.3 @@ -0,0 +1,90 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DELETE_MANY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_delete_many \- mongoc_collection_delete_many() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_delete_many (mongoc_collection_t *collection, + const bson_t *selector, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP containing the query to match documents. +.IP \(bu 2 +\fBreply\fP: Optional. An uninitialized \fI\%bson_t\fP populated with the delete result, or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.UNINDENT +.SH DESCRIPTION +.sp +This function removes all documents in the given \fBcollection\fP that match \fBselector\fP\&. +.sp +To delete at most one matching document, use \fBmongoc_collection_delete_one\fP\&. +.sp +If you pass a non\-NULL \fBreply\fP, it is filled out with the field "deletedCount". If there is a server error then \fBreply\fP contains either a "writeErrors" array with one subdocument or a "writeConcernErrors" array. The reply must be freed with \fI\%bson_destroy()\fP\&. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_one.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_one.3 new file mode 100644 index 0000000..7d88427 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_delete_one.3 @@ -0,0 +1,90 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DELETE_ONE" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_delete_one \- mongoc_collection_delete_one() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_delete_one (mongoc_collection_t *collection, + const bson_t *selector, + const bson_t *opts, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBselector\fP: A \fI\%bson_t\fP containing the query to match documents. +.IP \(bu 2 +\fBreply\fP: Optional. An uninitialized \fI\%bson_t\fP populated with the delete result, or \fBNULL\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBvalidate\fP: Construct a bitwise\-or of all desired \fI\%bson_validate_flags_t\fP\&. Set to \fBfalse\fP to skip client\-side validation of the provided BSON documents. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.UNINDENT +.SH DESCRIPTION +.sp +This function removes at most one document in the given \fBcollection\fP that matches \fBselector\fP\&. +.sp +To delete all matching documents, use \fBmongoc_collection_delete_many\fP\&. +.sp +If you pass a non\-NULL \fBreply\fP, it is filled out with the field "deletedCount". If there is a server error then \fBreply\fP contains either a "writeErrors" array with one subdocument or a "writeConcernErrors" array. The reply must be freed with \fI\%bson_destroy()\fP\&. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_destroy.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_destroy.3 new file mode 100644 index 0000000..eae4c7b --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_destroy.3 @@ -0,0 +1,65 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DESTROY" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_destroy \- mongoc_collection_destroy() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +void +mongoc_collection_destroy (mongoc_collection_t *collection); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall destroy a \fBmongoc_collection_t\fP and its associated resources. Does nothing if \fBcollection\fP is NULL. +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +Always destroy a \fBmongoc_cursor_t\fP created from a collection before destroying the collection. +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop.3 new file mode 100644 index 0000000..2b006bb --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop.3 @@ -0,0 +1,60 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DROP" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_drop \- mongoc_collection_drop() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_drop (mongoc_collection_t *collection, bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +For more information, see \fBmongoc_collection_drop_with_opts()\fP\&. This function is a thin wrapper, passing \fBNULL\fP in as \fI\%bson_t\fP parameter. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index.3 new file mode 100644 index 0000000..3d7fbb9 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index.3 @@ -0,0 +1,64 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DROP_INDEX" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_drop_index \- mongoc_collection_drop_index() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_drop_index (mongoc_collection_t *collection, + const char *index_name, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBindex_name\fP: A string containing the name of the index. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH DESCRIPTION +.sp +For more information, see \fBmongoc_collection_drop_with_opts()\fP\&. This function is a thin wrapper, passing \fBNULL\fP in as \fI\%bson_t\fP parameter. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index_with_opts.3 new file mode 100644 index 0000000..28ef219 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_index_with_opts.3 @@ -0,0 +1,85 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DROP_INDEX_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_drop_index_with_opts \- mongoc_collection_drop_index_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_drop_index_with_opts (mongoc_collection_t *collection, + const char *index_name, + const bson_t *opts, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBindex_name\fP: A string containing the name of the index. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.SH DESCRIPTION +.sp +This function requests than an index on \fBcollection\fP be dropped. +.sp +If no write concern is provided in \fBopts\fP, the collection\(aqs write concern is used. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns \fBtrue\fP if successful. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_with_opts.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_with_opts.3 new file mode 100644 index 0000000..782c885 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_drop_with_opts.3 @@ -0,0 +1,117 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_DROP_WITH_OPTS" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_drop_with_opts \- mongoc_collection_drop_with_opts() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_drop_with_opts (mongoc_collection_t *collection, + bson_t *opts, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBwriteConcern\fP: Construct a \fBmongoc_write_concern_t\fP and use \fBmongoc_write_concern_append\fP to add the write concern to \fBopts\fP\&. See the example code for \fBmongoc_client_write_command_with_opts\fP\&. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.UNINDENT +.SH DESCRIPTION +.sp +This function requests that a \fBcollection\fP be dropped, including all indexes associated with the \fBcollection\fP\&. +.sp +If no write concern is provided in \fBopts\fP, the collection\(aqs write concern is used. +.sp +If the collection does not exist, the server responds with an "ns not found" error. It is safe to ignore this error; set the Error API Version to 2 and ignore server error code 26: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_client_t *client; +mongoc_collection_t *collection; +bson_error_t error; +bool r; + +client = mongoc_client_new (NULL); +mongoc_client_set_error_api (client, 2); +collection = mongoc_client_get_collection (client, "db", "collection"); +r = mongoc_collection_drop_with_opts (collection, NULL /* opts */, &error); +if (r) { + printf ("Dropped.\en"); +} else { + printf ("Error message: %s\en", error.message); + if (error.domain == MONGOC_ERROR_SERVER && error.code == 26) { + printf ("Ignoring \(aqns not found\(aq error\en"); + } else { + fprintf (stderr, "Unrecognized error!\en"); + } +} + +mongoc_collection_destroy (collection); +mongoc_client_destroy (client); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In MongoDB 3.0 and older, the "ns not found" error code is the generic MONGOC_ERROR_QUERY_FAILURE; in this case check whether the error message is equal to the string "ns not found". +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +Returns true if the collection was successfully dropped. Returns \fBfalse\fP and sets \fBerror\fP if there are invalid arguments or a server or network error. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_ensure_index.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_ensure_index.3 new file mode 100644 index 0000000..2fb3297 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_ensure_index.3 @@ -0,0 +1,71 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_ENSURE_INDEX" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_ensure_index \- mongoc_collection_ensure_index() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bool +mongoc_collection_ensure_index (mongoc_collection_t *collection, + const bson_t *keys, + const mongoc_index_opt_t *opt, + bson_error_t *error) + BSON_GNUC_DEPRECATED; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. See create\-indexes\&. +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBkeys\fP: A \fI\%bson_t\fP\&. +.IP \(bu 2 +\fBopt\fP: A mongoc_index_opt_t. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_estimated_document_count.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_estimated_document_count.3 new file mode 100644 index 0000000..6a30402 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_estimated_document_count.3 @@ -0,0 +1,126 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_ESTIMATED_DOCUMENT_COUNT" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_estimated_document_count \- mongoc_collection_estimated_document_count() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +int64_t +mongoc_collection_estimated_document_count (mongoc_collection_t *collection, + const bson_t *opts, + const mongoc_read_prefs_t *read_prefs, + bson_t *reply, + bson_error_t *error); +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBopts\fP: A \fI\%bson_t\fP, \fBNULL\fP to ignore. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP or \fBNULL\fP\&. +.IP \(bu 2 +\fBreply\fP: A location for an uninitialized \fI\%bson_t\fP to store the command reply, \fBNULL\fP to ignore. If not \fBNULL\fP, \fBreply\fP will be initialized. +.IP \(bu 2 +\fBerror\fP: An optional location for a \fBbson_error_t\fP or \fBNULL\fP\&. +.UNINDENT +.sp +\fBopts\fP may be NULL or a BSON document with additional command options: +.INDENT 0.0 +.IP \(bu 2 +\fBreadConcern\fP: Construct a \fBmongoc_read_concern_t\fP and use \fBmongoc_read_concern_append\fP to add the read concern to \fBopts\fP\&. See the example code for \fBmongoc_client_read_command_with_opts\fP\&. Read concern requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBsessionId\fP: First, construct a \fBmongoc_client_session_t\fP with \fBmongoc_client_start_session\fP\&. You can begin a transaction with \fBmongoc_client_session_start_transaction\fP, optionally with a \fBmongoc_transaction_opt_t\fP that overrides the options inherited from \fBcollection\fP, and use \fBmongoc_client_session_append\fP to add the session to \fBopts\fP\&. See the example code for \fBmongoc_client_session_t\fP\&. +.IP \(bu 2 +\fBcollation\fP: Configure textual comparisons. See Setting Collation Order, and \fI\%the MongoDB Manual entry on Collation\fP\&. Collation requires MongoDB 3.2 or later, otherwise an error is returned. +.IP \(bu 2 +\fBserverId\fP: To target a specific server, include an int32 "serverId" field. Obtain the id by calling \fBmongoc_client_select_server\fP, then \fBmongoc_server_description_id\fP on its return value. +.IP \(bu 2 +\fBskip\fP: An int specifying how many documents matching the \fBquery\fP should be skipped before counting. +.IP \(bu 2 +\fBlimit\fP: An int specifying the maximum number of documents to count. +.UNINDENT +.SH DESCRIPTION +.sp +This functions executes a count query on \fBcollection\fP\&. In contrast with \fBmongoc_collection_count_documents()\fP, the count returned is \fInot\fP guaranteed to be accurate. +.SH ERRORS +.sp +Errors are propagated via the \fBerror\fP parameter. +.SH RETURNS +.sp +\-1 on failure, otherwise the number of documents counted. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_count (mongoc_collection_t *collection, bson_t *query) +{ + bson_error_t error; + int64_t count; + bson_t* opts = BCON_NEW ("skip", BCON_INT64(5)); + + count = mongoc_collection_estimated_document_count ( + collection, opts, NULL, NULL, &error); + bson_destroy (opts); + + if (count < 0) { + fprintf (stderr, "Count failed: %s\en", error.message); + } else { + printf ("%" PRId64 " documents counted.\en", count); + } +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH SEE ALSO +.sp +\fBmongoc_collection_count_documents()\fP +.SH AUTHOR +MongoDB, Inc +.SH COPYRIGHT +2017-present, MongoDB, Inc +.\" Generated by docutils manpage writer. +. diff --git a/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_find.3 b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_find.3 new file mode 100644 index 0000000..6e12c54 --- /dev/null +++ b/contrib/mongoc/mongo-c-driver-1.13.1/src/libmongoc/doc/man/mongoc_collection_find.3 @@ -0,0 +1,238 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOC_COLLECTION_FIND" "3" "Jan 24, 2019" "1.13.1" "MongoDB C Driver" +.SH NAME +mongoc_collection_find \- mongoc_collection_find() +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH DEPRECATED +.sp +This function is deprecated and should not be used in new code. +.sp +Use the more convenient \fBmongoc_collection_find_with_opts\fP instead. +.SH SYNOPSIS +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoc_cursor_t * +mongoc_collection_find (mongoc_collection_t *collection, + mongoc_query_flags_t flags, + uint32_t skip, + uint32_t limit, + uint32_t batch_size, + const bson_t *query, + const bson_t *fields, + const mongoc_read_prefs_t *read_prefs) + BSON_GNUC_DEPRECATED_FOR (mongoc_collection_find_with_opts) + BSON_GNUC_WARN_UNUSED_RESULT; +.ft P +.fi +.UNINDENT +.UNINDENT +.SH PARAMETERS +.INDENT 0.0 +.IP \(bu 2 +\fBcollection\fP: A \fBmongoc_collection_t\fP\&. +.IP \(bu 2 +\fBflags\fP: A \fBmongoc_query_flags_t\fP\&. +.IP \(bu 2 +\fBskip\fP: A uint32_t of number of documents to skip or 0. +.IP \(bu 2 +\fBlimit\fP: A uint32_t of max number of documents to return or 0. +.IP \(bu 2 +\fBbatch_size\fP: A uint32_t containing batch size of document result sets or 0 for default. Default is 100. +.IP \(bu 2 +\fBquery\fP: A \fI\%bson_t\fP containing the query and options to execute. +.IP \(bu 2 +\fBfields\fP: A \fI\%bson_t\fP containing fields to return or \fBNULL\fP\&. +.IP \(bu 2 +\fBread_prefs\fP: A \fBmongoc_read_prefs_t\fP or \fBNULL\fP for default read preferences. +.UNINDENT +.SH DESCRIPTION +.sp +This function shall execute a query on the underlying \fBcollection\fP\&. +.sp +If no options are necessary, \fBquery\fP can simply contain a query such as \fB{a:1}\fP\&. If you would like to specify options such as a sort order, the query must be placed inside of \fB{"$query": {}}\fP\&. See the example below for how to properly specify additional options to \fBquery\fP\&. +.SH RETURNS +.sp +A newly allocated \fBmongoc_cursor_t\fP that should be freed with \fBmongoc_cursor_destroy()\fP when no longer in use. +.SH EXAMPLE +Print All Documents in a Collection.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +#include +#include +#include + +static void +print_all_documents (mongoc_collection_t *collection) +{ + mongoc_cursor_t *cursor; + bson_error_t error; + const bson_t *doc; + char *str; + bson_t *query; + + query = BCON_NEW ("$query", + "{", + "foo", + BCON_INT32 (1), + "}", + "$orderby", + "{", + "bar", + BCON_INT32 (\-1), + "}"); + cursor = mongoc_collection_find ( + collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL); + + while (mongoc_cursor_next (cursor, &doc)) { + str = bson_as_canonical_extended_json (doc, NULL); + printf ("%s\en", str); + bson_free (str); + } + + if (mongoc_cursor_error (cursor, &error)) { + fprintf (stderr, "An error occurred: %s\en", error.message); + } + + mongoc_cursor_destroy (cursor); + bson_destroy (query); +} +.ft P +.fi +.UNINDENT +.UNINDENT +.SH THE "FIND" COMMAND +.sp +Queries have historically been sent as OP_QUERY wire protocol messages, but beginning in MongoDB 3.2 queries use \fI\%the "find" command\fP instead. +.sp +The driver automatically converts queries to the new "find" command syntax if needed, so this change is typically invisible to C Driver users. However, an application written exclusively for MongoDB 3.2 and later can choose to use the new syntax directly instead of relying on the driver to convert from the old syntax: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +/* MongoDB 3.2+ "find" command syntax */ +query = BCON_NEW ("filter", + "{", + "foo", + BCON_INT32 (1), + "}", + "sort", + "{", + "bar", + BCON_INT32 (\-1), + "}"); +cursor = mongoc_collection_find ( + collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL); +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The "find" command takes different options from the traditional OP_QUERY message. +.TS +center; +|l|l|l|. +_ +T{ +Query +T} T{ +\fB$query\fP +T} T{ +\fBfilter\fP +T} +_ +T{ +Sort +T} T{ +\fB$orderby\fP +T} T{ +\fBsort\fP +T} +_ +T{ +Show record location +T} T{ +\fB$showDiskLoc\fP +T} T{ +\fBshowRecordId\fP +T} +_ +T{ +Other $\-options +T} T{ +\fB$