diff --git a/mongo/MongoDB/MongoDB.sln b/mongo/MongoDB/MongoDB.sln new file mode 100644 index 00000000000..bd445516f29 --- /dev/null +++ b/mongo/MongoDB/MongoDB.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB", "MongoDB\MongoDB.csproj", "{A4EE3030-13BE-4F04-A855-91CEEAA0B5D5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A4EE3030-13BE-4F04-A855-91CEEAA0B5D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4EE3030-13BE-4F04-A855-91CEEAA0B5D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4EE3030-13BE-4F04-A855-91CEEAA0B5D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4EE3030-13BE-4F04-A855-91CEEAA0B5D5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8D546EB3-FD9D-4A9C-A98C-381A74569D44} + EndGlobalSection +EndGlobal diff --git a/mongo/MongoDB/MongoDB/App.xaml b/mongo/MongoDB/MongoDB/App.xaml new file mode 100644 index 00000000000..a9cebd54c9f --- /dev/null +++ b/mongo/MongoDB/MongoDB/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/mongo/MongoDB/MongoDB/App.xaml.cs b/mongo/MongoDB/MongoDB/App.xaml.cs new file mode 100644 index 00000000000..847713ac3f2 --- /dev/null +++ b/mongo/MongoDB/MongoDB/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace MongoDB +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/mongo/MongoDB/MongoDB/AssemblyInfo.cs b/mongo/MongoDB/MongoDB/AssemblyInfo.cs new file mode 100644 index 00000000000..8b5504ecfbb --- /dev/null +++ b/mongo/MongoDB/MongoDB/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/mongo/MongoDB/MongoDB/MainWindow.xaml b/mongo/MongoDB/MongoDB/MainWindow.xaml new file mode 100644 index 00000000000..f78af26251b --- /dev/null +++ b/mongo/MongoDB/MongoDB/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/mongo/MongoDB/MongoDB/MainWindow.xaml.cs b/mongo/MongoDB/MongoDB/MainWindow.xaml.cs new file mode 100644 index 00000000000..f839861a089 --- /dev/null +++ b/mongo/MongoDB/MongoDB/MainWindow.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using MongoDB.Bson; +using MongoDB.Driver; + +namespace MongoDB +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + start(); + } + + public void start() + { + var connectionString = "mongodb+srv://dhkwon:dnehd0941@atlascluster.3wnpd3y.mongodb.net/AtlasCluster?retryWrites=true&w=majority"; + if (connectionString == null) + { + Console.WriteLine("You must set your 'MONGODB_URI' environmental variable. See\n\t https://www.mongodb.com/docs/drivers/csharp/current/quick-start/#set-your-connection-string"); + Environment.Exit(0); + } + var client = new MongoClient(connectionString); + var collection = client.GetDatabase("sample_mflix").GetCollection("movies"); + var filter = Builders.Filter.Eq("title", "Back to the Future"); + var document = collection.Find(filter).First(); + Console.WriteLine(document); + } + } +} diff --git a/mongo/MongoDB/MongoDB/MongoDB.csproj b/mongo/MongoDB/MongoDB/MongoDB.csproj new file mode 100644 index 00000000000..aba866be8f8 --- /dev/null +++ b/mongo/MongoDB/MongoDB/MongoDB.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + +