Added config.h and modified gitignore

Database
L101 2024-02-02 09:34:03 +02:00
parent f302a89305
commit a736478453
2 changed files with 33 additions and 1 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files # User-specific files
config.h
*.rsuser *.rsuser
*.suo *.suo
*.user *.user

View File

@ -1,7 +1,38 @@
#include <iostream> #include <iostream>
#include <string>
#include "config.h"
//#include <bsoncxx/json.hpp>
//#include <mongocxx/client.hpp>
//#include <mongocxx/instance.hpp>
using namespace std; using namespace std;
string password = db_password;
int main() { int main() {
// Need properties zamenitel string database = "mongodb+srv://Danzan:<password>@testandlearnserverclust.54zdaqv.mongodb.net/?retryWrites=true&w=majority";
database.replace(21, 10, password);
cout << database;
//try
//{
// // Create an instance.
// mongocxx::instance inst{};
// const auto uri = mongocxx::uri{ "mongodb+srv://Danzan:<password>@testandlearnserverclust.54zdaqv.mongodb.net/?retryWrites=true&w=majority" };
// // Set the version of the Stable API on the client
// mongocxx::options::client client_options;
// const auto api = mongocxx::options::server_api{ mongocxx::options::server_api::version::k_version_1 };
// client_options.server_api_opts(api);
// // Setup the connection and get a handle on the "admin" database.
// mongocxx::client conn{ uri, client_options };
// mongocxx::database db = conn["admin"];
// // Ping the database.
// const auto ping_cmd = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("ping", 1));
// db.run_command(ping_cmd.view());
// std::cout << "Pinged your deployment. You successfully connected to MongoDB!" << std::endl;
//}
//catch (const std::exception& e)
//{
// // Handle errors
// std::cout << "Exception: " << e.what() << std::endl;
//}
return 0; return 0;
} }