{"id":1313,"date":"2024-03-06T10:45:05","date_gmt":"2024-03-06T08:45:05","guid":{"rendered":"http:\/\/www.lafabriquedecode.com\/blog\/?p=1313"},"modified":"2026-03-04T22:14:57","modified_gmt":"2026-03-04T20:14:57","slug":"mongodb-et-cplusplus","status":"publish","type":"post","link":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/","title":{"rendered":"Interroger un cluster MongoDB Atlas avec C++"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx.png\"><img loading=\"lazy\" width=\"1024\" height=\"546\" src=\"http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-1024x546.png\" alt=\"\" class=\"wp-image-1332\" srcset=\"http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-1024x546.png 1024w, http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-300x160.png 300w, http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-768x410.png 768w, http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-1536x819.png 1536w, http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-2048x1093.png 2048w, http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-624x333.png 624w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>J\u2019ai d\u00e9cid\u00e9 de me replonger dans <strong>C++<\/strong> le temps d\u2019un exercice propos\u00e9 aux \u00e9tudiants qui suivent ma formation sur <strong>MongoDB<\/strong> en \u00e9cole d\u2019ing\u00e9nieur. N\u2019ayant pas pratiqu\u00e9 ce langage depuis l\u2019\u00e9poque o\u00f9 la monnaie nationale \u00e9tait encore le franc, j\u2019ai renou\u00e9 avec plaisir avec le langage de <strong>Bjarne Stroustrup<\/strong>. Voici les diff\u00e9rentes \u00e9tapes qui m\u2019ont conduit \u00e0 \u00e9crire le code permettant d\u2019interroger, en C++, un cluster <strong>MongoDB<\/strong> h\u00e9berg\u00e9 sur <strong>Atlas<\/strong>.<\/p>\n\n\n\n<p>Tout d&rsquo;abord, il m&rsquo;a fallu installer le pilote (<em>driver<\/em>) d\u00e9di\u00e9 \u00e0 ce langage : <a href=\"https:\/\/mongocxx.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">mongocxx<\/a>.<br><\/p>\n\n\n\n<h2>Installation et compilation du pilote mongocxx<\/h2>\n\n\n\n<p>Rien de plus simple pour y parvenir :<\/p>\n\n\n\n<div class=\"wp-container-2 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-container-1 wp-block-group\"><div class=\"wp-block-group__inner-container\"><div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n    cd mongo-cxx-driver\n    mkdir build &amp;&amp; cd build\n    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\/usr\/local ..\n    make -j$(nproc)\n    sudo make install\n<\/pre><\/div><\/div><\/div>\n<\/div><\/div>\n\n\n\n<h2>Le programme principal<\/h2>\n\n\n\n<p>Une fois le driver install\u00e9, j&rsquo;ai pu commencer \u00e0 coder le petit programme pour acc\u00e9der  \u00e0 mon <em>cluster<\/em> Atlas et y ex\u00e9cuter toutes les requ\u00eates pr\u00e9par\u00e9es dans mon header <strong>exercices.hpp<\/strong> . Le voici :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;iostream&gt;\n#include &lt;bsoncxx\/json.hpp&gt;\n#include &lt;mongocxx\/client.hpp&gt;\n#include &lt;mongocxx\/instance.hpp&gt;\n#include &lt;mongocxx\/uri.hpp&gt;\n#include &lt;mongocxx\/exception\/exception.hpp&gt;\n#include &quot;exercices.hpp&quot; \n\nusing bsoncxx::to_json;\n\nint main() {\n\n    const std::string USERNAME      = &quot;mongosensei&quot;;\n    const std::string PASSWORD      = &quot;xxxxx&quot;;\n    const std::string DATABASE      = &quot;xxxxx&quot;;\n    const std::string COLLECTION    = &quot;salles&quot;;\n    const std::string ATLAS_CLUSTER = &quot;xxx.mongodb.net&quot;;\n\n    mongocxx::instance inst{};\n\n    try {\n        std::string uriString = &quot;mongodb+srv:\/\/&quot; + USERNAME + &quot;:&quot; + PASSWORD + &quot;@&quot; + ATLAS_CLUSTER + &quot;\/&quot; + DATABASE;\n        mongocxx::uri uri(uriString);\n        mongocxx::client conn(uri);\n\n        std::vector&lt;bsoncxx::document::value&gt; exercices = getExercices();\n\n        for (const auto&amp; exercice : exercices) {\n            auto numExercice = exercice&#91;&quot;num&quot;].get_int32();\n            auto filterDocument = exercice&#91;&quot;filtre&quot;].get_document();\n            auto projectionDocument = exercice&#91;&quot;options&quot;]&#91;&quot;projection&quot;].get_document();\n            \n            auto options = mongocxx::options::find{};\n            options.projection(projectionDocument.view());\n\n            auto collection = conn&#91;DATABASE]&#91;COLLECTION];\n            auto cursor = collection.find(filterDocument.view(), options);\n\n            int nbDocuments = 0;\n\n            for (auto&amp;&amp; doc : cursor) {\n                nbDocuments++;\n                std::cout &lt;&lt; bsoncxx::to_json(doc) &lt;&lt; std::endl;\n            }\n\n            std::cout &lt;&lt; &quot;Nb de documents pour l&#039;exercice &quot; &lt;&lt; numExercice &lt;&lt; &quot; : &quot; &lt;&lt; nbDocuments &lt;&lt; std::endl;\n        }\n\n    } catch (const mongocxx::exception&amp; e) {\n        std::cerr &lt;&lt; &quot;Erreur de connexion : &quot; &lt;&lt; e.what() &lt;&lt; std::endl;\n        return EXIT_FAILURE;\n    }\n\n    return EXIT_SUCCESS;\n}\n<\/pre><\/div>\n\n\n<p>Ce programme fait appel \u00e0 un fichier qui contient la solution \u00e0 chacun des exercices contenus dans le PDF dont le lien a \u00e9t\u00e9 donn\u00e9 plus haut. Voici ce \u00e0 quoi il ressemble :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#ifndef EXERCICES_HPP\n#define EXERCICES_HPP\n\n#include &lt;vector&gt;\n#include &lt;bsoncxx\/builder\/basic\/document.hpp&gt;\n\ntime_t parseDate(const std::string&amp; dateStr) {\n    std::tm tm = {};\n    strptime(dateStr.c_str(), &quot;%Y-%m-%d&quot;, &amp;tm);\n    return mktime(&amp;tm);\n}\n\nstd::vector&lt;bsoncxx::document::value&gt; getExercices() {\n    using bsoncxx::builder::basic::kvp;\n    using bsoncxx::builder::basic::make_document;\n    using bsoncxx::builder::basic::make_array;\n\n    std::string date_str = &quot;2021-11-15&quot;;\n    auto timestamp = std::chrono::milliseconds{parseDate(date_str) * 1000};\n\n    std::vector&lt;bsoncxx::document::value&gt; exercices = {\n        make_document(\n            kvp(&quot;num&quot;, 1),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;smac&quot;, true)\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, true),\n                    kvp(&quot;nom&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 2),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;capacite&quot;, make_document(\n                    kvp(&quot;$gt&quot;, bsoncxx::types::b_int64{1000})\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;nom&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 3),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;adresse.numero&quot;, make_document(\n                    kvp(&quot;$exists&quot;, false)\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 4),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;avis&quot;, make_document(\n                    kvp(&quot;$size&quot;, bsoncxx::types::b_int64{1})\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;nom&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 5),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;styles&quot;, &quot;blues&quot;)\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;styles&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 6),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;styles.0&quot;, &quot;blues&quot;)\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;styles&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 7),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;$and&quot;, make_array(\n                    make_document(\n                        kvp(&quot;adresse.codePostal&quot;, bsoncxx::types::b_regex{&quot;^84&quot;}),\n                        kvp(&quot;capacite&quot;, make_document(\n                            kvp(&quot;$lt&quot;, 500)\n                        ))\n                    )\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;adresse.ville&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 8),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;$or&quot;, make_array(\n                    make_document(\n                        kvp(&quot;_id&quot;, make_document(kvp(&quot;$mod&quot;, make_array(2, 0))))\n                    ),\n                    make_document(\n                        kvp(&quot;avis&quot;, make_document(\n                            kvp(&quot;$exists&quot;, false)\n                        ))\n                    )\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 9),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;avis&quot;, make_document(\n                    kvp(&quot;$elemMatch&quot;, make_document(\n                        kvp(&quot;note&quot;, make_document(\n                            kvp(&quot;$gte&quot;, 8),\n                            kvp(&quot;$lte&quot;, 10)\n                        ))\n                    ))\n                ))\n            )),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;nom&quot;, true)\n                ))\n            ))\n        ),\n        make_document(\n            kvp(&quot;num&quot;, 10),\n            kvp(&quot;filtre&quot;, make_document(\n                kvp(&quot;avis.date&quot;, make_document(\n                        kvp(&quot;$gt&quot;, bsoncxx::types::b_date{timestamp}\n                    ))\n                ))\n            ),\n            kvp(&quot;options&quot;, make_document(\n                kvp(&quot;projection&quot;, make_document(\n                    kvp(&quot;_id&quot;, false),\n                    kvp(&quot;nom&quot;, true)\n                ))\n            ))\n        ),\n    };\n\n    return exercices;\n}\n\n#endif \/\/ EXERCICES_HPP\n<\/pre><\/div>\n\n\n<p>La fonction <em>parseDate<\/em> est l\u00e0 pour nous faciliter la transformation des dates pour leur utilisation avec mes m\u00e9thodes de la lib BSON, elle ne sert ici qu&rsquo;une fois.<\/p>\n\n\n\n<p>Pour construire les documents, j&rsquo;ai utilis\u00e9 la version <strong>basic<\/strong> du builder BSON, la version <strong>stream<\/strong> \u00e9tant beaucoup moins lisible pour moi.<\/p>\n\n\n\n<h2>Compilation et ex\u00e9cution du code<\/h2>\n\n\n\n<p>J&rsquo;ai essay\u00e9 plusieurs solutions :<\/p>\n\n\n\n<ul><li>la compilation avec c++<\/li><li>la compilation avec g++<\/li><li>l&rsquo;installation de l&rsquo;outil pkg-config, MongoDB proposant un fichier .pc<\/li><\/ul>\n\n\n\n<p>D&rsquo;abord, la version avec pkg-config :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo apt install pkg-config\nexport LD_LIBRARY_PATH=\/usr\/local\/lib:$LD_LIBRARY_PATH\nc++ -o mongo_exercices --std=c++11 mongo_exercices.cpp $(pkg-config --cflags --libs libmongocxx)\n.\/mongo_exercices\n<\/pre><\/div>\n\n\n<p>Ensuite la version avec g++, qui marche aussi avec c++ :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ng++ -o mongo_exercices mongo_exercices.cpp -lmongocxx -lbsoncxx -std=c++11 \\\n    -I\/usr\/local\/include\/mongocxx\/v_noabi \\\n    -I\/usr\/local\/include\/bsoncxx\/v_noabi \\\n    -I\/usr\/local\/include\/bsoncxx\/v_noabi\/bsoncxx\/third_party\/mnmlstc \\\n    -L\/usr\/local\/lib -Wl,-rpath=\/usr\/local\/lib \\\n    &amp;&amp; .\/mongo_exercices\n<\/pre><\/div>\n\n\n<p>Voici la sortie produite par notre ex\u00e9cutable :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n{ &quot;_id&quot; : 1, &quot;nom&quot; : &quot;AJMI Jazz Club&quot; }\n{ &quot;_id&quot; : 2, &quot;nom&quot; : &quot;Paloma&quot; }\nNb de documents pour l&#039;exercice 1 : 2\n{ &quot;nom&quot; : &quot;Paloma&quot; }\nNb de documents pour l&#039;exercice 2 : 1\n{ &quot;_id&quot; : 3 }\n{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;65e08cc6fa1cb047c0a5e5ea&quot; } }\nNb de documents pour l&#039;exercice 3 : 2\n{ &quot;_id&quot; : 2, &quot;nom&quot; : &quot;Paloma&quot; }\nNb de documents pour l&#039;exercice 4 : 1\n{ &quot;styles&quot; : &#91; &quot;jazz&quot;, &quot;soul&quot;, &quot;funk&quot;, &quot;blues&quot; ] }\n{ &quot;styles&quot; : &#91; &quot;blues&quot;, &quot;rock&quot; ] }\nNb de documents pour l&#039;exercice 5 : 2\n{ &quot;styles&quot; : &#91; &quot;blues&quot;, &quot;rock&quot; ] }\nNb de documents pour l&#039;exercice 6 : 1\n{ &quot;adresse&quot; : { &quot;ville&quot; : &quot;Avignon&quot; } }\n{ &quot;adresse&quot; : { &quot;ville&quot; : &quot;Le Thor&quot; } }\nNb de documents pour l&#039;exercice 7 : 2\n{ &quot;_id&quot; : 2 }\n{ &quot;_id&quot; : 3 }\n{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;65e08cc6fa1cb047c0a5e5ea&quot; } }\nNb de documents pour l&#039;exercice 8 : 3\n{ &quot;nom&quot; : &quot;AJMI Jazz Club&quot; }\n{ &quot;nom&quot; : &quot;Paloma&quot; }\nNb de documents pour l&#039;exercice 9 : 2\n{ &quot;nom&quot; : &quot;AJMI Jazz Club&quot; }\n{ &quot;nom&quot; : &quot;Paloma&quot; }\nNb de documents pour l&#039;exercice 10 : 2\n\n<\/pre><\/div>\n\n\n<p>Pour pousser plus loin votre exp\u00e9rience avec C++, suivez <a href=\"https:\/\/mongocxx.org\/mongocxx-v3\/tutorial\/\" target=\"_blank\" rel=\"noreferrer noopener\">ce lien<\/a> !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>J\u2019ai d\u00e9cid\u00e9 de me replonger dans C++ le temps d\u2019un exercice propos\u00e9 aux \u00e9tudiants qui suivent ma formation sur MongoDB en \u00e9cole d\u2019ing\u00e9nieur. N\u2019ayant pas pratiqu\u00e9 ce langage depuis l\u2019\u00e9poque o\u00f9 la monnaie nationale \u00e9tait encore le franc, j\u2019ai renou\u00e9 avec plaisir avec le langage de Bjarne Stroustrup. Voici les diff\u00e9rentes \u00e9tapes qui m\u2019ont conduit [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[78,114,40,26,46,29],"tags":[115,117,87,116],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.6.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog<\/title>\n<meta name=\"description\" content=\"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog\" \/>\n<meta property=\"og:description\" content=\"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/\" \/>\n<meta property=\"og:site_name\" content=\"La Fabrique de code - Tech blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-06T08:45:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-04T20:14:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-1024x546.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@LaFabrique2Code\" \/>\n<meta name=\"twitter:site\" content=\"@LaFabrique2Code\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/\",\"url\":\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/\",\"name\":\"Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog\",\"isPartOf\":{\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/#website\"},\"datePublished\":\"2024-03-06T08:45:05+00:00\",\"dateModified\":\"2026-03-04T20:14:57+00:00\",\"author\":{\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/83863c048b82fd9ccf6407bddd241162\"},\"description\":\"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.\",\"breadcrumb\":{\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"http:\/\/www.lafabriquedecode.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Interroger un cluster MongoDB Atlas avec C++\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/#website\",\"url\":\"http:\/\/www.lafabriquedecode.com\/blog\/\",\"name\":\"La Fabrique de code - Tech blog\",\"description\":\"PHP objet, MySQL, Design Patterns, OOP...et plus !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.lafabriquedecode.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/83863c048b82fd9ccf6407bddd241162\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/fc2e1de7c8a1871b50ff9c6a6f8682a2?s=96&d=retro&r=g\",\"contentUrl\":\"http:\/\/0.gravatar.com\/avatar\/fc2e1de7c8a1871b50ff9c6a6f8682a2?s=96&d=retro&r=g\",\"caption\":\"admin\"},\"url\":\"http:\/\/www.lafabriquedecode.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog","description":"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/","og_locale":"fr_FR","og_type":"article","og_title":"Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog","og_description":"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.","og_url":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/","og_site_name":"La Fabrique de code - Tech blog","article_published_time":"2024-03-06T08:45:05+00:00","article_modified_time":"2026-03-04T20:14:57+00:00","og_image":[{"url":"http:\/\/www.lafabriquedecode.com\/blog\/wp-content\/uploads\/2024\/03\/AqgUzdgAbUVtDzoUrbKUfmnx-1024x546.png"}],"author":"admin","twitter_card":"summary","twitter_creator":"@LaFabrique2Code","twitter_site":"@LaFabrique2Code","twitter_misc":{"\u00c9crit par":"admin","Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/","url":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/","name":"Interroger un cluster MongoDB Atlas avec C++ - La Fabrique de code - Tech blog","isPartOf":{"@id":"http:\/\/www.lafabriquedecode.com\/blog\/#website"},"datePublished":"2024-03-06T08:45:05+00:00","dateModified":"2026-03-04T20:14:57+00:00","author":{"@id":"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/83863c048b82fd9ccf6407bddd241162"},"description":"Comment atteindre un cluster Atlas depuis un programme en C++ d\u00e9velopp\u00e9 avec les pilotes fournis par MongoDB.","breadcrumb":{"@id":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.lafabriquedecode.com\/blog\/2024\/03\/mongodb-et-cplusplus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"http:\/\/www.lafabriquedecode.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Interroger un cluster MongoDB Atlas avec C++"}]},{"@type":"WebSite","@id":"http:\/\/www.lafabriquedecode.com\/blog\/#website","url":"http:\/\/www.lafabriquedecode.com\/blog\/","name":"La Fabrique de code - Tech blog","description":"PHP objet, MySQL, Design Patterns, OOP...et plus !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.lafabriquedecode.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/83863c048b82fd9ccf6407bddd241162","name":"admin","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"http:\/\/www.lafabriquedecode.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/0.gravatar.com\/avatar\/fc2e1de7c8a1871b50ff9c6a6f8682a2?s=96&d=retro&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/fc2e1de7c8a1871b50ff9c6a6f8682a2?s=96&d=retro&r=g","caption":"admin"},"url":"http:\/\/www.lafabriquedecode.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/posts\/1313"}],"collection":[{"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":27,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1351,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions\/1351"}],"wp:attachment":[{"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.lafabriquedecode.com\/blog\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}