ok

alphons <alphons@heijden.com> 1 Sep 2024, 14:46
78116fae7686168056905e60883f0389ab36e1a3
22 files changed
  • src/ArgumentsParser/ParseHelper.cs
  • src/ArgumentsParser/Program.cs
  • src/BsonExtensions/BsonExtensions.csproj
  • src/BsonExtensions/BsonJsonExtensions.cs
  • src/BsonExtensions/BsonJsonSerializer.cs
  • src/BsonExtensions/Converters/BinaryDataBsonConverter.cs
  • src/BsonExtensions/Converters/BsonDocumentJsonConverter.cs
  • src/BsonExtensions/Converters/BsonDocumentsJsonConverter.cs
  • src/BsonExtensions/Converters/DateTimeBsonConverter.cs
  • src/BsonExtensions/Converters/GuidBsonConverter.cs
  • src/MongoCli/MongoCli.csproj
  • src/MongoCli/ParseHelper.cs
  • src/MongoCli/Program.cs
  • src/MongoExtensions.sln
  • src/MongoGui/Form1.Designer.cs
  • src/MongoGui/Form1.cs
  • src/MongoGui/MongoGui.csproj
  • src/MongoGui/OldStuff.cs
  • src/MongoGui/Program.cs
  • src/MongoTestWeb/LogicControllers/MongoController.cs
  • src/MongoTestWeb/MongoTestWeb.csproj
  • src/MongoTestWeb/Program.cs
diff --git a/src/ArgumentsParser/ParseHelper.cs b/src/ArgumentsParser/ParseHelper.cs
index 0914328..ab6b68a 100644
--- a/src/ArgumentsParser/ParseHelper.cs
+++ b/src/ArgumentsParser/ParseHelper.cs
@@ -1,179 +1,178 @@

using System.Text;
-namespace MongoTesting.ConsoleApp
+namespace MonoCli;
+
+public class FunctionArguments
{
- public class FunctionArguments
- {
- public string Name { get; set; }
- public List<string> Arguments { get; set; }
+ public string Name { get; set; }
+ public List<string> Arguments { get; set; }
- public bool IsFunction { get; set; }
+ public bool IsFunction { get; set; }
- public bool Complete { get; set; }
+ public bool Complete { get; set; }
- public FunctionArguments()
- {
- this.Name = string.Empty;
- this.Arguments = new();
- }
+ public FunctionArguments()
+ {
+ this.Name = string.Empty;
+ this.Arguments = [];
}
- public static class ParseHelper
+}
+public static class ParseHelper
+{
+ private enum PartEnum
{
- private enum PartEnum
- {
- Unknown,
- FunctionName, // alphonsnumeric and _
- Arguments,
- Parenthesis, // (
- SingleQuote, // '
- DoubleQuote, // "
- SquareBracket, // [
- CurlyBracket // {
- }
+ Unknown,
+ FunctionName, // alphonsnumeric and _
+ Arguments,
+ Parenthesis, // (
+ SingleQuote, // '
+ DoubleQuote, // "
+ SquareBracket, // [
+ CurlyBracket // {
+ }
- public static FunctionArguments ParseFunction(string s)
- {
- Stack<PartEnum> nivo = new();
+ public static FunctionArguments ParseFunction(string s)
+ {
+ Stack<PartEnum> nivo = new();
- nivo.Push(PartEnum.Unknown);
+ nivo.Push(PartEnum.Unknown);
- FunctionArguments fa = new();
+ FunctionArguments fa = new();
- StringBuilder sb = new();
+ StringBuilder sb = new();
- for (int intI = 0; intI < s.Length; intI++)
- {
- var c = s[intI];
+ for (int intI = 0; intI < s.Length; intI++)
+ {
+ var c = s[intI];
- switch (nivo.Peek())
- {
- default:
- break;
- case PartEnum.Unknown:
- if (char.IsWhiteSpace(c))
- continue;
+ switch (nivo.Peek())
+ {
+ default:
+ break;
+ case PartEnum.Unknown:
+ if (char.IsWhiteSpace(c))
+ continue;
+ if (c == '(')
+ {
+ fa.IsFunction = true;
+ nivo.Pop();
+ nivo.Push(PartEnum.Parenthesis);
+ continue; // function, so next char is exit
+ }
+ if (fa.Name.Length > 0) // already a name
+ {
+ nivo.Push(PartEnum.Arguments);
+ sb.Append(c);
+ }
+ else
+ {
+ nivo.Push(PartEnum.FunctionName);
+ fa.Name = $"{c}";
+ }
+ continue;
+ case PartEnum.FunctionName:
+ if (char.IsLetterOrDigit(c) || c == '_')
+ fa.Name += c;
+ else
+ {
+ nivo.Pop();
if (c == '(')
{
fa.IsFunction = true;
- nivo.Pop();
nivo.Push(PartEnum.Parenthesis);
- continue; // function, so next char is exit
}
- if (fa.Name.Length > 0) // already a name
+ }
+ continue;
+ case PartEnum.Arguments:
+ if (char.IsWhiteSpace(c))
+ {
+ var aa = sb.ToString().Trim();
+ if (aa.Length > 0)
{
- nivo.Push(PartEnum.Arguments);
- sb.Append(c);
- }
- else
- {
- nivo.Push(PartEnum.FunctionName);
- fa.Name = $"{c}";
+ fa.Arguments.Add(sb.ToString().Trim());
+ sb = new();
}
+ }
+ else
+ {
+ sb.Append(c);
+ }
+ continue;
+ }
+
+ switch (c)
+ {
+ default:
+ break;
+ case '\\':
+ sb.Append(c);
+ intI++;
+ c = s[intI]; // todo check boundaries
+ break;
+ case '(':
+ nivo.Push(PartEnum.Parenthesis);
+ break; ;
+ case ',':
+ if (nivo.Peek() == PartEnum.Parenthesis)
continue;
- case PartEnum.FunctionName:
- if (char.IsLetterOrDigit(c) || c == '_')
- fa.Name += c;
- else
- {
- nivo.Pop();
- if (c == '(')
- {
- fa.IsFunction = true;
- nivo.Push(PartEnum.Parenthesis);
- }
- }
+ break;
+ case ')':
+ if (nivo.Peek() == PartEnum.Parenthesis)
+ nivo.Pop();
+ if (nivo.Count <= 2)
continue;
- case PartEnum.Arguments:
- if (char.IsWhiteSpace(c))
- {
- var aa = sb.ToString().Trim();
- if (aa.Length > 0)
- {
- fa.Arguments.Add(sb.ToString().Trim());
- sb = new();
- }
- }
- else
- {
- sb.Append(c);
- }
+ break;
+ case '{':
+ nivo.Push(PartEnum.CurlyBracket);
+ break;
+ case '[':
+ nivo.Push(PartEnum.SquareBracket);
+ break;
+ case '\'':
+ if (nivo.Peek() == PartEnum.SingleQuote)
+ nivo.Pop();
+ else
+ nivo.Push(PartEnum.SingleQuote);
+ break;
+ case '\"':
+ if (nivo.Peek() == PartEnum.DoubleQuote)
+ nivo.Pop();
+ else
+ nivo.Push(PartEnum.DoubleQuote);
+ break;
+ case '}':
+ if (nivo.Peek() == PartEnum.CurlyBracket)
+ nivo.Pop();
+ if (nivo.Peek() == PartEnum.Parenthesis)
+ {
+ sb.Append(c);
+ fa.Arguments.Add(sb.ToString().Trim());
+ sb = new();
continue;
- }
-
- switch (c)
- {
- default:
- break;
- case '\\':
+ }
+ break;
+ case ']':
+ if (nivo.Peek() == PartEnum.SquareBracket)
+ nivo.Pop();
+ if (nivo.Peek() == PartEnum.Parenthesis)
+ {
sb.Append(c);
- intI++;
- c = s[intI]; // todo check boundaries
- break;
- case '(':
- nivo.Push(PartEnum.Parenthesis);
- break; ;
- case ',':
- if (nivo.Peek() == PartEnum.Parenthesis)
- continue;
- break;
- case ')':
- if (nivo.Peek() == PartEnum.Parenthesis)
- nivo.Pop();
- if (nivo.Count <= 2)
- continue;
- break;
- case '{':
- nivo.Push(PartEnum.CurlyBracket);
- break;
- case '[':
- nivo.Push(PartEnum.SquareBracket);
- break;
- case '\'':
- if (nivo.Peek() == PartEnum.SingleQuote)
- nivo.Pop();
- else
- nivo.Push(PartEnum.SingleQuote);
- break;
- case '\"':
- if (nivo.Peek() == PartEnum.DoubleQuote)
- nivo.Pop();
- else
- nivo.Push(PartEnum.DoubleQuote);
- break;
- case '}':
- if (nivo.Peek() == PartEnum.CurlyBracket)
- nivo.Pop();
- if (nivo.Peek() == PartEnum.Parenthesis)
- {
- sb.Append(c);
- fa.Arguments.Add(sb.ToString().Trim());
- sb = new();
- continue;
- }
- break;
- case ']':
- if (nivo.Peek() == PartEnum.SquareBracket)
- nivo.Pop();
- if (nivo.Peek() == PartEnum.Parenthesis)
- {
- sb.Append(c);
- fa.Arguments.Add(sb.ToString().Trim());
- sb = new();
- continue;
- }
- break;
- }
- sb.Append(c);
+ fa.Arguments.Add(sb.ToString().Trim());
+ sb = new();
+ continue;
+ }
+ break;
}
- var rest = sb.ToString().Trim();
- if (!string.IsNullOrWhiteSpace(rest))
- fa.Arguments.Add(rest);
+ sb.Append(c);
+ }
+ var rest = sb.ToString().Trim();
+ if (!string.IsNullOrWhiteSpace(rest))
+ fa.Arguments.Add(rest);
- fa.Complete = (nivo.Count < 2) || (nivo.Peek() == PartEnum.FunctionName) || (nivo.Peek() == PartEnum.Arguments);
+ fa.Complete = (nivo.Count < 2) || (nivo.Peek() == PartEnum.FunctionName) || (nivo.Peek() == PartEnum.Arguments);
- return fa;
- }
+ return fa;
}
}
diff --git a/src/ArgumentsParser/Program.cs b/src/ArgumentsParser/Program.cs
index 94e7eb4..5381810 100644
--- a/src/ArgumentsParser/Program.cs
+++ b/src/ArgumentsParser/Program.cs
@@ -1,6 +1,6 @@

-using MongoTesting.ConsoleApp;
+using MonoCli;
//Helper.Parse(" f ( { a:'b', c:\"d\", e: [ aa: 'bb' , i : 123 ] }, { a:'b', c:\"d\", e: [ aa: 'bb' , i : 123 ]} )");
@@ -10,11 +10,11 @@ using MongoTesting.ConsoleApp;
//var af2 = Helper.ParseFunction("f(a )");
-var s = string.Empty;
+string s;
s = " ls -al";
-s = " f( a";
-s = " insert { _id: 'abc' }";
+//s = " f( a";
+//s = " insert { _id: 'abc' }";
var af = ParseHelper.ParseFunction(s);
Console.WriteLine($"[{s}] Complete:{af.Complete} Function:{af.IsFunction} Name:{af.Name}");
diff --git a/src/BsonExtensions/BsonExtensions.csproj b/src/BsonExtensions/BsonExtensions.csproj
index 4ec5ab6..e22d656 100644
--- a/src/BsonExtensions/BsonExtensions.csproj
+++ b/src/BsonExtensions/BsonExtensions.csproj
@@ -13,7 +13,7 @@
<Description>Serialization Extensions to MvcCore for using Mongo</Description>
<PackageDescription>Serialization Extensions to MvcCore for using Mongo</PackageDescription>
<Version>1.0.9</Version>
- <PackageId>MongoExtensions</PackageId>
+ <PackageId>BsonExtensions</PackageId>
<Authors>alphons</Authors>
<AssemblyVersion>8.1.0.9</AssemblyVersion>
<FileVersion>8.1.0.9</FileVersion>
diff --git a/src/BsonExtensions/BsonJsonExtensions.cs b/src/BsonExtensions/BsonJsonExtensions.cs
index 2189485..560cfc3 100644
--- a/src/BsonExtensions/BsonJsonExtensions.cs
+++ b/src/BsonExtensions/BsonJsonExtensions.cs
@@ -6,10 +6,10 @@ using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Bson.Serialization;
-using MongoExtensions.Converters;
+using BsonExtensions.Converters;
-namespace MongoExtensions;
+namespace BsonExtensions;
public static class BsonJsonExtensions
{
/// <summary>
diff --git a/src/BsonExtensions/BsonJsonSerializer.cs b/src/BsonExtensions/BsonJsonSerializer.cs
index 4d0d3d1..b7f7734 100644
--- a/src/BsonExtensions/BsonJsonSerializer.cs
+++ b/src/BsonExtensions/BsonJsonSerializer.cs
@@ -5,9 +5,9 @@ using System.Text.Json;
using System.Globalization;
using MongoDB.Bson;
-using MongoExtensions.Converters;
+using BsonExtensions.Converters;
-namespace MongoExtensions;
+namespace BsonExtensions;
public class BsonJsonSerializer
{
diff --git a/src/BsonExtensions/Converters/BinaryDataBsonConverter.cs b/src/BsonExtensions/Converters/BinaryDataBsonConverter.cs
index adfbbfe..adf5ed4 100644
--- a/src/BsonExtensions/Converters/BinaryDataBsonConverter.cs
+++ b/src/BsonExtensions/Converters/BinaryDataBsonConverter.cs
@@ -2,7 +2,7 @@
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace MongoExtensions.Converters;
+namespace BsonExtensions.Converters;
public class BinaryDataBsonConverter : JsonConverter<byte[]>
{
diff --git a/src/BsonExtensions/Converters/BsonDocumentJsonConverter.cs b/src/BsonExtensions/Converters/BsonDocumentJsonConverter.cs
index 5a320a0..3d01889 100644
--- a/src/BsonExtensions/Converters/BsonDocumentJsonConverter.cs
+++ b/src/BsonExtensions/Converters/BsonDocumentJsonConverter.cs
@@ -3,7 +3,7 @@
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace MongoExtensions.Converters;
+namespace BsonExtensions.Converters;
public class BsonDocumentJsonConverter : JsonConverter<BsonDocument>
{
diff --git a/src/BsonExtensions/Converters/BsonDocumentsJsonConverter.cs b/src/BsonExtensions/Converters/BsonDocumentsJsonConverter.cs
index b2fab51..afbbcd2 100644
--- a/src/BsonExtensions/Converters/BsonDocumentsJsonConverter.cs
+++ b/src/BsonExtensions/Converters/BsonDocumentsJsonConverter.cs
@@ -2,7 +2,7 @@
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace MongoExtensions.Converters;
+namespace BsonExtensions.Converters;
public class BsonDocumentsJsonConverter : JsonConverter<List<BsonDocument>>
{
diff --git a/src/BsonExtensions/Converters/DateTimeBsonConverter.cs b/src/BsonExtensions/Converters/DateTimeBsonConverter.cs
index c7f3f83..660a045 100644
--- a/src/BsonExtensions/Converters/DateTimeBsonConverter.cs
+++ b/src/BsonExtensions/Converters/DateTimeBsonConverter.cs
@@ -2,7 +2,7 @@
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace MongoExtensions.Converters;
+namespace BsonExtensions.Converters;
public class DateTimeBsonConverter : JsonConverter<DateTime>
{
diff --git a/src/BsonExtensions/Converters/GuidBsonConverter.cs b/src/BsonExtensions/Converters/GuidBsonConverter.cs
index c31884c..f74d499 100644
--- a/src/BsonExtensions/Converters/GuidBsonConverter.cs
+++ b/src/BsonExtensions/Converters/GuidBsonConverter.cs
@@ -2,7 +2,7 @@
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace MongoExtensions.Converters;
+namespace BsonExtensions.Converters;
public class GuidBsonConverter : JsonConverter<Guid>
{
diff --git a/src/MongoCli/MongoCli.csproj b/src/MongoCli/MongoCli.csproj
index f694ac6..b39296c 100644
--- a/src/MongoCli/MongoCli.csproj
+++ b/src/MongoCli/MongoCli.csproj
@@ -14,7 +14,7 @@
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\MongoExtensions\MongoExtensions.csproj" />
+ <ProjectReference Include="..\BsonExtensions\BsonExtensions.csproj" />
<ProjectReference Include="..\InteractiveReadLine\InteractiveReadLine.csproj" />
</ItemGroup>
diff --git a/src/MongoCli/ParseHelper.cs b/src/MongoCli/ParseHelper.cs
index c8762b9..f35c8ed 100644
--- a/src/MongoCli/ParseHelper.cs
+++ b/src/MongoCli/ParseHelper.cs
@@ -1,7 +1,7 @@

using System.Text;
-namespace MongoExtensions.ConsoleApp;
+namespace MongoCli;
public class FunctionArguments
{
diff --git a/src/MongoCli/Program.cs b/src/MongoCli/Program.cs
index 96bad70..1007009 100644
--- a/src/MongoCli/Program.cs
+++ b/src/MongoCli/Program.cs
@@ -11,7 +11,9 @@ using InteractiveReadLine.KeyBehaviors;
using InteractiveReadLine;
using InteractiveReadLine.Tokenizing;
-namespace MongoExtensions.ConsoleApp;
+using BsonExtensions;
+
+namespace MongoCli;
class Program
{
@@ -33,7 +35,7 @@ class Program
private static BsonJsonSerializer.TypeSerializationEnum typeSerializationEnum = BsonJsonSerializer.TypeSerializationEnum.Colorize;
- private static readonly string[] autoCompleteWords = {
+ private static readonly string[] autoCompleteWords = [
"ls",
"rename",
"import",
@@ -63,10 +65,10 @@ class Program
"command",
"connect",
"createindex",
-"countdocuments" };
+"countdocuments" ];
- private static List<string> history = new();
+ private static readonly List<string> history = [];
private static string[] AutoComplete(TokenizedLine line)
{
diff --git a/src/MongoExtensions.sln b/src/MongoExtensions.sln
index 291d0c6..3138e9b 100644
--- a/src/MongoExtensions.sln
+++ b/src/MongoExtensions.sln
@@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoExtensions", "MongoExtensions\MongoExtensions.csproj", "{90F62535-46DC-4F19-93D2-0F9B5CD759DE}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BsonExtensions", "BsonExtensions\BsonExtensions.csproj", "{90F62535-46DC-4F19-93D2-0F9B5CD759DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArgumentsParser", "ArgumentsParser\ArgumentsParser.csproj", "{BAA644C1-4139-4203-8A98-F5C010693F05}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveReadLine", "InteractiveReadLine\InteractiveReadLine.csproj", "{33F7ADFD-1ED4-46F2-B2A0-17DA883FB02F}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mongo.MongoCli", "MongoExtensions.ConsoleApp\Mongo.MongoCli.csproj", "{E0864D4C-2F2A-4A1B-AAE1-02322F9C4CFF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoCli", "MongoCli\MongoCli.csproj", "{E0864D4C-2F2A-4A1B-AAE1-02322F9C4CFF}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mongo.CoreWeb", "MongoExtensions.CoreWeb\Mongo.CoreWeb.csproj", "{4D96BE7E-3C73-4348-BB4E-6DAEAB0713D3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoTestWeb", "MongoTestWeb\MongoTestWeb.csproj", "{4D96BE7E-3C73-4348-BB4E-6DAEAB0713D3}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mongo.WinApp", "MongoExtensions.WinApp\Mongo.WinApp.csproj", "{5F48F122-637F-4471-8D56-E58ACEADFF22}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoGui", "MongoGui\MongoGui.csproj", "{5F48F122-637F-4471-8D56-E58ACEADFF22}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/MongoGui/Form1.Designer.cs b/src/MongoGui/Form1.Designer.cs
index 5c51dd7..a9775d3 100644
--- a/src/MongoGui/Form1.Designer.cs
+++ b/src/MongoGui/Form1.Designer.cs
@@ -1,455 +1,454 @@
-namespace MongoTesting.WinApp
+namespace MongoGui;
+
+partial class Form1
{
- partial class Form1
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
{
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
+ components.Dispose();
}
+ base.Dispose(disposing);
+ }
- #region Windows Form Designer generated code
+ #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.txtConnectionString = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.txtInput = new System.Windows.Forms.RichTextBox();
- this.txtOutput = new System.Windows.Forms.RichTextBox();
- this.button6 = new System.Windows.Forms.Button();
- this.button7 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.button9 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.cmbDBName = new System.Windows.Forms.ComboBox();
- this.cmbCollectionName = new System.Windows.Forms.ComboBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.lblTotal = new System.Windows.Forms.Label();
- this.btnPrev = new System.Windows.Forms.Button();
- this.btnNxt = new System.Windows.Forms.Button();
- this.txtPage = new System.Windows.Forms.TextBox();
- this.txtPageLength = new System.Windows.Forms.TextBox();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.splitContainer1 = new System.Windows.Forms.SplitContainer();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.menuStrip1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
- this.splitContainer1.Panel1.SuspendLayout();
- this.splitContainer1.Panel2.SuspendLayout();
- this.splitContainer1.SuspendLayout();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(9, 25);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(22, 15);
- this.label1.TabIndex = 1;
- this.label1.Text = "DB";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(157, 25);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(25, 15);
- this.label2.TabIndex = 3;
- this.label2.Text = "Col";
- //
- // txtConnectionString
- //
- this.txtConnectionString.Location = new System.Drawing.Point(58, 12);
- this.txtConnectionString.Name = "txtConnectionString";
- this.txtConnectionString.Size = new System.Drawing.Size(307, 23);
- this.txtConnectionString.TabIndex = 6;
- this.txtConnectionString.Text = "mongodb://127.0.0.1:27017";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(13, 15);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(39, 15);
- this.label3.TabIndex = 5;
- this.label3.Text = "Server";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(6, 320);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 8;
- this.button1.Text = "ToList()";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.Button1_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(6, 210);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 9;
- this.button2.Text = "Insert";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.Button2_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(6, 51);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 10;
- this.button3.Text = "Find";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.Button3_Click);
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(6, 138);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 11;
- this.button4.Text = "Aggregate";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.Button4_Click);
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(6, 239);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 12;
- this.button5.Text = "Delete 1";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.Button5_Click);
- //
- // txtInput
- //
- this.txtInput.AcceptsTab = true;
- this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtConnectionString = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.button5 = new System.Windows.Forms.Button();
+ this.txtInput = new System.Windows.Forms.RichTextBox();
+ this.txtOutput = new System.Windows.Forms.RichTextBox();
+ this.button6 = new System.Windows.Forms.Button();
+ this.button7 = new System.Windows.Forms.Button();
+ this.button8 = new System.Windows.Forms.Button();
+ this.button9 = new System.Windows.Forms.Button();
+ this.button10 = new System.Windows.Forms.Button();
+ this.cmbDBName = new System.Windows.Forms.ComboBox();
+ this.cmbCollectionName = new System.Windows.Forms.ComboBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.lblTotal = new System.Windows.Forms.Label();
+ this.btnPrev = new System.Windows.Forms.Button();
+ this.btnNxt = new System.Windows.Forms.Button();
+ this.txtPage = new System.Windows.Forms.TextBox();
+ this.txtPageLength = new System.Windows.Forms.TextBox();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(9, 25);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(22, 15);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "DB";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(157, 25);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(25, 15);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Col";
+ //
+ // txtConnectionString
+ //
+ this.txtConnectionString.Location = new System.Drawing.Point(58, 12);
+ this.txtConnectionString.Name = "txtConnectionString";
+ this.txtConnectionString.Size = new System.Drawing.Size(307, 23);
+ this.txtConnectionString.TabIndex = 6;
+ this.txtConnectionString.Text = "mongodb://127.0.0.1:27017";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(13, 15);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(39, 15);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "Server";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(6, 320);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 8;
+ this.button1.Text = "ToList()";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.Button1_Click);
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(6, 210);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 9;
+ this.button2.Text = "Insert";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.Button2_Click);
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(6, 51);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(75, 23);
+ this.button3.TabIndex = 10;
+ this.button3.Text = "Find";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.Button3_Click);
+ //
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(6, 138);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(75, 23);
+ this.button4.TabIndex = 11;
+ this.button4.Text = "Aggregate";
+ this.button4.UseVisualStyleBackColor = true;
+ this.button4.Click += new System.EventHandler(this.Button4_Click);
+ //
+ // button5
+ //
+ this.button5.Location = new System.Drawing.Point(6, 239);
+ this.button5.Name = "button5";
+ this.button5.Size = new System.Drawing.Size(75, 23);
+ this.button5.TabIndex = 12;
+ this.button5.Text = "Delete 1";
+ this.button5.UseVisualStyleBackColor = true;
+ this.button5.Click += new System.EventHandler(this.Button5_Click);
+ //
+ // txtInput
+ //
+ this.txtInput.AcceptsTab = true;
+ this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.txtInput.DetectUrls = false;
- this.txtInput.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.txtInput.Location = new System.Drawing.Point(11, 114);
- this.txtInput.Name = "txtInput";
- this.txtInput.Size = new System.Drawing.Size(441, 526);
- this.txtInput.TabIndex = 13;
- this.txtInput.Text = "";
- //
- // txtOutput
- //
- this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ this.txtInput.DetectUrls = false;
+ this.txtInput.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.txtInput.Location = new System.Drawing.Point(11, 114);
+ this.txtInput.Name = "txtInput";
+ this.txtInput.Size = new System.Drawing.Size(441, 526);
+ this.txtInput.TabIndex = 13;
+ this.txtInput.Text = "";
+ //
+ // txtOutput
+ //
+ this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.txtOutput.DetectUrls = false;
- this.txtOutput.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.txtOutput.Location = new System.Drawing.Point(3, 40);
- this.txtOutput.Name = "txtOutput";
- this.txtOutput.ReadOnly = true;
- this.txtOutput.Size = new System.Drawing.Size(365, 600);
- this.txtOutput.TabIndex = 14;
- this.txtOutput.Text = "";
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(6, 109);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 15;
- this.button6.Text = "Sort";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.Button6_Click);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(6, 80);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(75, 23);
- this.button7.TabIndex = 16;
- this.button7.Text = "Project";
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.Button7_Click);
- //
- // button8
- //
- this.button8.Location = new System.Drawing.Point(6, 22);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(75, 23);
- this.button8.TabIndex = 17;
- this.button8.Text = "Count";
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.Button8_Click);
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(6, 268);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(75, 23);
- this.button9.TabIndex = 18;
- this.button9.Text = "Delete";
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.Button9_Click);
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(371, 12);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(75, 23);
- this.button10.TabIndex = 19;
- this.button10.Text = "Connect";
- this.button10.UseVisualStyleBackColor = true;
- this.button10.Click += new System.EventHandler(this.Button10_Click);
- //
- // cmbDBName
- //
- this.cmbDBName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbDBName.FormattingEnabled = true;
- this.cmbDBName.Location = new System.Drawing.Point(37, 22);
- this.cmbDBName.Name = "cmbDBName";
- this.cmbDBName.Size = new System.Drawing.Size(114, 23);
- this.cmbDBName.TabIndex = 20;
- this.cmbDBName.SelectedIndexChanged += new System.EventHandler(this.CmbDBName_SelectedIndexChanged);
- //
- // cmbCollectionName
- //
- this.cmbCollectionName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbCollectionName.FormattingEnabled = true;
- this.cmbCollectionName.Location = new System.Drawing.Point(188, 22);
- this.cmbCollectionName.Name = "cmbCollectionName";
- this.cmbCollectionName.Size = new System.Drawing.Size(247, 23);
- this.cmbCollectionName.TabIndex = 21;
- this.cmbCollectionName.SelectedIndexChanged += new System.EventHandler(this.CmbCollectionName_SelectedIndexChanged);
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.cmbDBName);
- this.groupBox1.Controls.Add(this.cmbCollectionName);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.label2);
- this.groupBox1.Enabled = false;
- this.groupBox1.Location = new System.Drawing.Point(11, 42);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(441, 66);
- this.groupBox1.TabIndex = 22;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "settings";
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ this.txtOutput.DetectUrls = false;
+ this.txtOutput.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.txtOutput.Location = new System.Drawing.Point(3, 40);
+ this.txtOutput.Name = "txtOutput";
+ this.txtOutput.ReadOnly = true;
+ this.txtOutput.Size = new System.Drawing.Size(365, 600);
+ this.txtOutput.TabIndex = 14;
+ this.txtOutput.Text = "";
+ //
+ // button6
+ //
+ this.button6.Location = new System.Drawing.Point(6, 109);
+ this.button6.Name = "button6";
+ this.button6.Size = new System.Drawing.Size(75, 23);
+ this.button6.TabIndex = 15;
+ this.button6.Text = "Sort";
+ this.button6.UseVisualStyleBackColor = true;
+ this.button6.Click += new System.EventHandler(this.Button6_Click);
+ //
+ // button7
+ //
+ this.button7.Location = new System.Drawing.Point(6, 80);
+ this.button7.Name = "button7";
+ this.button7.Size = new System.Drawing.Size(75, 23);
+ this.button7.TabIndex = 16;
+ this.button7.Text = "Project";
+ this.button7.UseVisualStyleBackColor = true;
+ this.button7.Click += new System.EventHandler(this.Button7_Click);
+ //
+ // button8
+ //
+ this.button8.Location = new System.Drawing.Point(6, 22);
+ this.button8.Name = "button8";
+ this.button8.Size = new System.Drawing.Size(75, 23);
+ this.button8.TabIndex = 17;
+ this.button8.Text = "Count";
+ this.button8.UseVisualStyleBackColor = true;
+ this.button8.Click += new System.EventHandler(this.Button8_Click);
+ //
+ // button9
+ //
+ this.button9.Location = new System.Drawing.Point(6, 268);
+ this.button9.Name = "button9";
+ this.button9.Size = new System.Drawing.Size(75, 23);
+ this.button9.TabIndex = 18;
+ this.button9.Text = "Delete";
+ this.button9.UseVisualStyleBackColor = true;
+ this.button9.Click += new System.EventHandler(this.Button9_Click);
+ //
+ // button10
+ //
+ this.button10.Location = new System.Drawing.Point(371, 12);
+ this.button10.Name = "button10";
+ this.button10.Size = new System.Drawing.Size(75, 23);
+ this.button10.TabIndex = 19;
+ this.button10.Text = "Connect";
+ this.button10.UseVisualStyleBackColor = true;
+ this.button10.Click += new System.EventHandler(this.Button10_Click);
+ //
+ // cmbDBName
+ //
+ this.cmbDBName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbDBName.FormattingEnabled = true;
+ this.cmbDBName.Location = new System.Drawing.Point(37, 22);
+ this.cmbDBName.Name = "cmbDBName";
+ this.cmbDBName.Size = new System.Drawing.Size(114, 23);
+ this.cmbDBName.TabIndex = 20;
+ this.cmbDBName.SelectedIndexChanged += new System.EventHandler(this.CmbDBName_SelectedIndexChanged);
+ //
+ // cmbCollectionName
+ //
+ this.cmbCollectionName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbCollectionName.FormattingEnabled = true;
+ this.cmbCollectionName.Location = new System.Drawing.Point(188, 22);
+ this.cmbCollectionName.Name = "cmbCollectionName";
+ this.cmbCollectionName.Size = new System.Drawing.Size(247, 23);
+ this.cmbCollectionName.TabIndex = 21;
+ this.cmbCollectionName.SelectedIndexChanged += new System.EventHandler(this.CmbCollectionName_SelectedIndexChanged);
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.cmbDBName);
+ this.groupBox1.Controls.Add(this.cmbCollectionName);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Enabled = false;
+ this.groupBox1.Location = new System.Drawing.Point(11, 42);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(441, 66);
+ this.groupBox1.TabIndex = 22;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "settings";
+ //
+ // groupBox2
+ //
+ this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Controls.Add(this.button8);
- this.groupBox2.Controls.Add(this.button2);
- this.groupBox2.Controls.Add(this.button3);
- this.groupBox2.Controls.Add(this.button9);
- this.groupBox2.Controls.Add(this.button4);
- this.groupBox2.Controls.Add(this.button1);
- this.groupBox2.Controls.Add(this.button5);
- this.groupBox2.Controls.Add(this.button7);
- this.groupBox2.Controls.Add(this.button6);
- this.groupBox2.Enabled = false;
- this.groupBox2.Location = new System.Drawing.Point(458, 42);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(89, 610);
- this.groupBox2.TabIndex = 23;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "shortcuts";
- //
- // lblTotal
- //
- this.lblTotal.AutoSize = true;
- this.lblTotal.Location = new System.Drawing.Point(243, 11);
- this.lblTotal.Name = "lblTotal";
- this.lblTotal.Size = new System.Drawing.Size(31, 15);
- this.lblTotal.TabIndex = 24;
- this.lblTotal.Text = "total";
- //
- // btnPrev
- //
- this.btnPrev.Location = new System.Drawing.Point(44, 7);
- this.btnPrev.Name = "btnPrev";
- this.btnPrev.Size = new System.Drawing.Size(26, 23);
- this.btnPrev.TabIndex = 25;
- this.btnPrev.Text = "<";
- this.btnPrev.UseVisualStyleBackColor = true;
- this.btnPrev.Click += new System.EventHandler(this.BtnPrev_Click);
- //
- // btnNxt
- //
- this.btnNxt.Location = new System.Drawing.Point(117, 7);
- this.btnNxt.Name = "btnNxt";
- this.btnNxt.Size = new System.Drawing.Size(26, 23);
- this.btnNxt.TabIndex = 26;
- this.btnNxt.Text = ">";
- this.btnNxt.UseVisualStyleBackColor = true;
- this.btnNxt.Click += new System.EventHandler(this.BtnNxt_Click);
- //
- // txtPage
- //
- this.txtPage.Location = new System.Drawing.Point(76, 8);
- this.txtPage.Name = "txtPage";
- this.txtPage.Size = new System.Drawing.Size(35, 23);
- this.txtPage.TabIndex = 27;
- this.txtPage.Text = "0";
- //
- // txtPageLength
- //
- this.txtPageLength.Location = new System.Drawing.Point(169, 8);
- this.txtPageLength.Name = "txtPageLength";
- this.txtPageLength.Size = new System.Drawing.Size(35, 23);
- this.txtPageLength.TabIndex = 28;
- this.txtPageLength.Text = "1";
- //
- // statusStrip1
- //
- this.statusStrip1.Location = new System.Drawing.Point(0, 679);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(1006, 22);
- this.statusStrip1.TabIndex = 29;
- this.statusStrip1.Text = "statusStrip1";
- //
- // menuStrip1
- //
- this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.groupBox2.Controls.Add(this.button8);
+ this.groupBox2.Controls.Add(this.button2);
+ this.groupBox2.Controls.Add(this.button3);
+ this.groupBox2.Controls.Add(this.button9);
+ this.groupBox2.Controls.Add(this.button4);
+ this.groupBox2.Controls.Add(this.button1);
+ this.groupBox2.Controls.Add(this.button5);
+ this.groupBox2.Controls.Add(this.button7);
+ this.groupBox2.Controls.Add(this.button6);
+ this.groupBox2.Enabled = false;
+ this.groupBox2.Location = new System.Drawing.Point(458, 42);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(89, 610);
+ this.groupBox2.TabIndex = 23;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "shortcuts";
+ //
+ // lblTotal
+ //
+ this.lblTotal.AutoSize = true;
+ this.lblTotal.Location = new System.Drawing.Point(243, 11);
+ this.lblTotal.Name = "lblTotal";
+ this.lblTotal.Size = new System.Drawing.Size(31, 15);
+ this.lblTotal.TabIndex = 24;
+ this.lblTotal.Text = "total";
+ //
+ // btnPrev
+ //
+ this.btnPrev.Location = new System.Drawing.Point(44, 7);
+ this.btnPrev.Name = "btnPrev";
+ this.btnPrev.Size = new System.Drawing.Size(26, 23);
+ this.btnPrev.TabIndex = 25;
+ this.btnPrev.Text = "<";
+ this.btnPrev.UseVisualStyleBackColor = true;
+ this.btnPrev.Click += new System.EventHandler(this.BtnPrev_Click);
+ //
+ // btnNxt
+ //
+ this.btnNxt.Location = new System.Drawing.Point(117, 7);
+ this.btnNxt.Name = "btnNxt";
+ this.btnNxt.Size = new System.Drawing.Size(26, 23);
+ this.btnNxt.TabIndex = 26;
+ this.btnNxt.Text = ">";
+ this.btnNxt.UseVisualStyleBackColor = true;
+ this.btnNxt.Click += new System.EventHandler(this.BtnNxt_Click);
+ //
+ // txtPage
+ //
+ this.txtPage.Location = new System.Drawing.Point(76, 8);
+ this.txtPage.Name = "txtPage";
+ this.txtPage.Size = new System.Drawing.Size(35, 23);
+ this.txtPage.TabIndex = 27;
+ this.txtPage.Text = "0";
+ //
+ // txtPageLength
+ //
+ this.txtPageLength.Location = new System.Drawing.Point(169, 8);
+ this.txtPageLength.Name = "txtPageLength";
+ this.txtPageLength.Size = new System.Drawing.Size(35, 23);
+ this.txtPageLength.TabIndex = 28;
+ this.txtPageLength.Text = "1";
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Location = new System.Drawing.Point(0, 679);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(1006, 22);
+ this.statusStrip1.TabIndex = 29;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
- this.menuStrip1.Location = new System.Drawing.Point(0, 0);
- this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(1006, 24);
- this.menuStrip1.TabIndex = 30;
- this.menuStrip1.Text = "menuStrip1";
- //
- // fileToolStripMenuItem
- //
- this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1006, 24);
+ this.menuStrip1.TabIndex = 30;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
- this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
- this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
- this.fileToolStripMenuItem.Text = "File";
- //
- // exitToolStripMenuItem
- //
- this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
- this.exitToolStripMenuItem.Text = "Exit";
- this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
- //
- // splitContainer1
- //
- this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer1.Location = new System.Drawing.Point(0, 24);
- this.splitContainer1.Name = "splitContainer1";
- //
- // splitContainer1.Panel1
- //
- this.splitContainer1.Panel1.Controls.Add(this.txtConnectionString);
- this.splitContainer1.Panel1.Controls.Add(this.label3);
- this.splitContainer1.Panel1.Controls.Add(this.txtInput);
- this.splitContainer1.Panel1.Controls.Add(this.button10);
- this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
- this.splitContainer1.Panel1.Controls.Add(this.groupBox2);
- this.splitContainer1.Panel1MinSize = 550;
- //
- // splitContainer1.Panel2
- //
- this.splitContainer1.Panel2.Controls.Add(this.btnPrev);
- this.splitContainer1.Panel2.Controls.Add(this.txtOutput);
- this.splitContainer1.Panel2.Controls.Add(this.lblTotal);
- this.splitContainer1.Panel2.Controls.Add(this.txtPageLength);
- this.splitContainer1.Panel2.Controls.Add(this.btnNxt);
- this.splitContainer1.Panel2.Controls.Add(this.txtPage);
- this.splitContainer1.Panel2MinSize = 400;
- this.splitContainer1.Size = new System.Drawing.Size(1006, 655);
- this.splitContainer1.SplitterDistance = 550;
- this.splitContainer1.SplitterWidth = 20;
- this.splitContainer1.TabIndex = 31;
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1006, 701);
- this.Controls.Add(this.splitContainer1);
- this.Controls.Add(this.statusStrip1);
- this.Controls.Add(this.menuStrip1);
- this.MainMenuStrip = this.menuStrip1;
- this.Name = "Form1";
- this.Text = "MongoDB - tester";
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.menuStrip1.ResumeLayout(false);
- this.menuStrip1.PerformLayout();
- this.splitContainer1.Panel1.ResumeLayout(false);
- this.splitContainer1.Panel1.PerformLayout();
- this.splitContainer1.Panel2.ResumeLayout(false);
- this.splitContainer1.Panel2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
- this.splitContainer1.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "File";
+ //
+ // exitToolStripMenuItem
+ //
+ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
+ this.exitToolStripMenuItem.Text = "Exit";
+ this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 24);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.txtConnectionString);
+ this.splitContainer1.Panel1.Controls.Add(this.label3);
+ this.splitContainer1.Panel1.Controls.Add(this.txtInput);
+ this.splitContainer1.Panel1.Controls.Add(this.button10);
+ this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
+ this.splitContainer1.Panel1.Controls.Add(this.groupBox2);
+ this.splitContainer1.Panel1MinSize = 550;
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.btnPrev);
+ this.splitContainer1.Panel2.Controls.Add(this.txtOutput);
+ this.splitContainer1.Panel2.Controls.Add(this.lblTotal);
+ this.splitContainer1.Panel2.Controls.Add(this.txtPageLength);
+ this.splitContainer1.Panel2.Controls.Add(this.btnNxt);
+ this.splitContainer1.Panel2.Controls.Add(this.txtPage);
+ this.splitContainer1.Panel2MinSize = 400;
+ this.splitContainer1.Size = new System.Drawing.Size(1006, 655);
+ this.splitContainer1.SplitterDistance = 550;
+ this.splitContainer1.SplitterWidth = 20;
+ this.splitContainer1.TabIndex = 31;
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1006, 701);
+ this.Controls.Add(this.splitContainer1);
+ this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "Form1";
+ this.Text = "MongoDB - tester";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel1.PerformLayout();
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
- #endregion
- private Label label1;
- private Label label2;
- private TextBox txtConnectionString;
- private Label label3;
- private Button button1;
- private Button button2;
- private Button button3;
- private Button button4;
- private Button button5;
- private RichTextBox txtInput;
- private RichTextBox txtOutput;
- private Button button6;
- private Button button7;
- private Button button8;
- private Button button9;
- private Button button10;
- private ComboBox cmbDBName;
- private ComboBox cmbCollectionName;
- private GroupBox groupBox1;
- private GroupBox groupBox2;
- private Label lblTotal;
- private Button btnPrev;
- private Button btnNxt;
- private TextBox txtPage;
- private TextBox txtPageLength;
- private StatusStrip statusStrip1;
- private MenuStrip menuStrip1;
- private ToolStripMenuItem fileToolStripMenuItem;
- private ToolStripMenuItem exitToolStripMenuItem;
- private SplitContainer splitContainer1;
}
+
+ #endregion
+ private Label label1;
+ private Label label2;
+ private TextBox txtConnectionString;
+ private Label label3;
+ private Button button1;
+ private Button button2;
+ private Button button3;
+ private Button button4;
+ private Button button5;
+ private RichTextBox txtInput;
+ private RichTextBox txtOutput;
+ private Button button6;
+ private Button button7;
+ private Button button8;
+ private Button button9;
+ private Button button10;
+ private ComboBox cmbDBName;
+ private ComboBox cmbCollectionName;
+ private GroupBox groupBox1;
+ private GroupBox groupBox2;
+ private Label lblTotal;
+ private Button btnPrev;
+ private Button btnNxt;
+ private TextBox txtPage;
+ private TextBox txtPageLength;
+ private StatusStrip statusStrip1;
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem fileToolStripMenuItem;
+ private ToolStripMenuItem exitToolStripMenuItem;
+ private SplitContainer splitContainer1;
}
\ No newline at end of file
diff --git a/src/MongoGui/Form1.cs b/src/MongoGui/Form1.cs
index d928480..b903aa5 100644
--- a/src/MongoGui/Form1.cs
+++ b/src/MongoGui/Form1.cs
@@ -2,386 +2,385 @@
using MongoDB.Bson;
using MongoDB.Driver;
-using MongoExtensions;
+using BsonExtensions;
using System.Text;
using System.Text.RegularExpressions;
-namespace MongoTesting.WinApp
+namespace MongoGui;
+
+public partial class Form1 : Form
{
- public partial class Form1 : Form
+ private MongoClient? client;
+
+ public Form1()
{
- private MongoClient? client;
+ InitializeComponent();
- public Form1()
- {
- InitializeComponent();
+ // pixels
+ this.txtInput.SelectionTabs = Enumerable.Range(1, 30).Select(x => x * 15).ToArray();
+ this.txtOutput.SelectionTabs = Enumerable.Range(1, 30).Select(x => x * 15).ToArray();
- // pixels
- this.txtInput.SelectionTabs = Enumerable.Range(1, 30).Select(x => x * 15).ToArray();
- this.txtOutput.SelectionTabs = Enumerable.Range(1, 30).Select(x => x * 15).ToArray();
+ this.Text += $" (MongoDB.MvcCore.BsonJsonSerializer: {typeof(BsonJsonSerializer).Assembly.GetName().Version})";
+ }
- this.Text += $" (MongoDB.MvcCore.BsonJsonSerializer: {typeof(BsonJsonSerializer).Assembly.GetName().Version})";
- }
+ private void TextBox1_KeyDown(object sender, KeyEventArgs e)
+ {
+ //if(e.KeyData == Keys.Enter)
+ //{
+ // e.Handled = true;
+ // MessageBox.Show(this.txtInput.Text);
+ //}
+ }
- private void TextBox1_KeyDown(object sender, KeyEventArgs e)
- {
- //if(e.KeyData == Keys.Enter)
- //{
- // e.Handled = true;
- // MessageBox.Show(this.txtInput.Text);
- //}
- }
+ private IMongoCollection<BsonDocument>? GetCollection()
+ {
+ if (this.client == null)
+ return default;
- private IMongoCollection<BsonDocument>? GetCollection()
- {
- if (this.client == null)
- return default;
+ var db = this.client.GetDatabase("" + this.cmbDBName.SelectedItem);
- var db = this.client.GetDatabase("" + this.cmbDBName.SelectedItem);
+ if (db == null)
+ return default;
- if (db == null)
- return default;
+ return db.GetCollection("" + this.cmbCollectionName.SelectedItem);
+ }
- return db.GetCollection("" + this.cmbCollectionName.SelectedItem);
- }
+ private void ShowOutput()
+ {
+ this.txtOutput.Text = GetCollection()?.Pretty(BsonJsonSerializer.TypeSerializationEnum.None);
+ }
- private void ShowOutput()
- {
- this.txtOutput.Text = GetCollection()?.Pretty(BsonJsonSerializer.TypeSerializationEnum.None);
- }
+ private void ShowOutput(List<BsonDocument> list)
+ {
+ this.txtOutput.Text = list.Pretty(BsonJsonSerializer.TypeSerializationEnum.None);
+ }
- private void ShowOutput(List<BsonDocument> list)
+ private string GetInput()
+ {
+ var sb = new StringBuilder();
+ var json = this.txtInput.Text.Trim();
+ var sr = new StringReader(json);
+ while(true)
{
- this.txtOutput.Text = list.Pretty(BsonJsonSerializer.TypeSerializationEnum.None);
+ var line = sr.ReadLine();
+ if (line == null)
+ break;
+ var i = line.IndexOf("//"); //strip comment
+ if (i >= 0)
+ line = line[..i];
+ sb.AppendLine(line);
}
- private string GetInput()
- {
- var sb = new StringBuilder();
- var json = this.txtInput.Text.Trim();
- var sr = new StringReader(json);
- while(true)
- {
- var line = sr.ReadLine();
- if (line == null)
- break;
- var i = line.IndexOf("//"); //strip comment
- if (i >= 0)
- line = line[..i];
- sb.AppendLine(line);
- }
+ return sb.ToString();
+ }
- return sb.ToString();
- }
+ private void Button1_Click(object sender, EventArgs e)
+ {
+ ShowOutput();
+ }
- private void Button1_Click(object sender, EventArgs e)
+ private async void Button2_Click(object sender, EventArgs e)
+ {
+ try
{
- ShowOutput();
- }
+ var json = GetInput();
- private async void Button2_Click(object sender, EventArgs e)
- {
- try
+ if (!string.IsNullOrWhiteSpace(json))
{
- var json = GetInput();
+ var collection = GetCollection();
- if (!string.IsNullOrWhiteSpace(json))
+ if (collection != null)
{
- var collection = GetCollection();
-
- if (collection != null)
- {
- if (json.StartsWith('['))
- await collection.InsertManyAsync(json);
- else
- await collection.InsertOneAsync(json);
- }
+ if (json.StartsWith('['))
+ await collection.InsertManyAsync(json);
+ else
+ await collection.InsertOneAsync(json);
}
-
- ShowOutput();
- }
- catch (Exception eee)
- {
- this.txtOutput.Text = eee.Message;
}
+
+ ShowOutput();
}
+ catch (Exception eee)
+ {
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- string Find = "{}";
+ string Find = "{}";
- private async void Button3_Click(object sender, EventArgs e)
+ private async void Button3_Click(object sender, EventArgs e)
+ {
+ try
{
- try
- {
- Find = GetInput();
+ Find = GetInput();
- if (string.IsNullOrWhiteSpace(Find))
- Find = "{}";
+ if (string.IsNullOrWhiteSpace(Find))
+ Find = "{}";
- var collection = GetCollection();
- if (collection != null)
- {
- var list = await collection.Find(Find).ToListAsync();
-
- ShowOutput(list);
- }
- }
- catch (Exception eee)
+ var collection = GetCollection();
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var list = await collection.Find(Find).ToListAsync();
+
+ ShowOutput(list);
}
}
-
- // aggregate
- private async void Button4_Click(object sender, EventArgs e)
+ catch (Exception eee)
{
- await AggregateAsync();
+ this.txtOutput.Text = eee.Message;
}
+ }
- private async Task AggregateAsync()
- {
- try
- {
- var json = GetInput();
+ // aggregate
+ private async void Button4_Click(object sender, EventArgs e)
+ {
+ await AggregateAsync();
+ }
- var collection = GetCollection();
+ private async Task AggregateAsync()
+ {
+ try
+ {
+ var json = GetInput();
- if (collection != null)
- {
- var list = await collection.AggregateAsync(json);
+ var collection = GetCollection();
- ShowOutput(await list.ToListAsync());
- }
- }
- catch(Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var list = await collection.AggregateAsync(json);
+
+ ShowOutput(await list.ToListAsync());
}
}
-
- private async void Button5_Click(object sender, EventArgs e)
+ catch(Exception eee)
{
- try
- {
- var filter = GetInput();
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- if (string.IsNullOrWhiteSpace(filter))
- filter = "{}";
+ private async void Button5_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var filter = GetInput();
- var collection = GetCollection();
+ if (string.IsNullOrWhiteSpace(filter))
+ filter = "{}";
- if (collection != null)
- {
- var deleteResult = await collection.DeleteOneAsync(filter);
+ var collection = GetCollection();
- ShowOutput();
- }
- }
- catch (Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var deleteResult = await collection.DeleteOneAsync(filter);
+
+ ShowOutput();
}
}
+ catch (Exception eee)
+ {
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- string Sort = "{}";
+ string Sort = "{}";
- string Project = "{}";
+ string Project = "{}";
- private async void Button7_Click(object sender, EventArgs e)
+ private async void Button7_Click(object sender, EventArgs e)
+ {
+ try
{
- try
- {
- Project = GetInput();
+ Project = GetInput();
- var collection = GetCollection();
-
- if (collection != null)
- {
- var list = await collection.Find(Find).Project(Project).ToListAsync();
+ var collection = GetCollection();
- ShowOutput(list);
- }
- }
- catch (Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var list = await collection.Find(Find).Project(Project).ToListAsync();
+
+ ShowOutput(list);
}
}
-
- private async void Button6_Click(object sender, EventArgs e)
+ catch (Exception eee)
{
- try
- {
- Sort = GetInput();
+ this.txtOutput.Text = eee.Message;
+ }
+ }
+ private async void Button6_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Sort = GetInput();
- var collection = GetCollection();
- if (collection != null)
- {
- var list = await collection.Find(Find).Project(Project).Sort(Sort).ToListAsync();
+ var collection = GetCollection();
- ShowOutput(list);
- }
- }
- catch (Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var list = await collection.Find(Find).Project(Project).Sort(Sort).ToListAsync();
+
+ ShowOutput(list);
}
}
+ catch (Exception eee)
+ {
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- private async void Button8_Click(object sender, EventArgs e)
+ private async void Button8_Click(object sender, EventArgs e)
+ {
+ try
{
- try
- {
- var filter = GetInput();
+ var filter = GetInput();
- if (string.IsNullOrWhiteSpace(filter))
- filter = "{}";
+ if (string.IsNullOrWhiteSpace(filter))
+ filter = "{}";
- var collection = GetCollection();
-
- if (collection != null)
- {
- var count = await collection.CountDocumentsAsync(filter);
+ var collection = GetCollection();
- this.txtOutput.Text = $"total:{count}";
- }
- }
- catch (Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ var count = await collection.CountDocumentsAsync(filter);
+
+ this.txtOutput.Text = $"total:{count}";
}
}
-
- private async void Button9_Click(object sender, EventArgs e)
+ catch (Exception eee)
{
- try
- {
- var filter = GetInput();
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- if (string.IsNullOrWhiteSpace(filter))
- filter = "{}";
+ private async void Button9_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var filter = GetInput();
- var collection = GetCollection();
+ if (string.IsNullOrWhiteSpace(filter))
+ filter = "{}";
- if (collection != null)
- {
- await collection.DeleteManyAsync(filter);
- }
+ var collection = GetCollection();
- ShowOutput();
- }
- catch (Exception eee)
+ if (collection != null)
{
- this.txtOutput.Text = eee.Message;
+ await collection.DeleteManyAsync(filter);
}
- }
- async private void Button10_Click(object sender, EventArgs e)
+ ShowOutput();
+ }
+ catch (Exception eee)
{
- this.client = new (this.txtConnectionString.Text);
+ this.txtOutput.Text = eee.Message;
+ }
+ }
- var names = await this.client.ListDatabaseNames().ToListAsync();
+ async private void Button10_Click(object sender, EventArgs e)
+ {
+ this.client = new (this.txtConnectionString.Text);
- this.cmbDBName.Items.Clear();
- this.cmbDBName.Items.AddRange([.. names]);
+ var names = await this.client.ListDatabaseNames().ToListAsync();
- this.groupBox1.Enabled = true;
- this.groupBox2.Enabled = true;
- }
+ this.cmbDBName.Items.Clear();
+ this.cmbDBName.Items.AddRange([.. names]);
- async private void CmbDBName_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.client == null)
- return;
+ this.groupBox1.Enabled = true;
+ this.groupBox2.Enabled = true;
+ }
- var db = this.client.GetDatabase("" + this.cmbDBName.SelectedItem);
- if (db == null)
- return;
+ async private void CmbDBName_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (this.client == null)
+ return;
- var names = await db.ListCollectionNames().ToListAsync();
- names.Sort();
+ var db = this.client.GetDatabase("" + this.cmbDBName.SelectedItem);
+ if (db == null)
+ return;
- this.cmbCollectionName.Items.Clear();
+ var names = await db.ListCollectionNames().ToListAsync();
+ names.Sort();
- this.cmbCollectionName.Items.AddRange([.. names]);
+ this.cmbCollectionName.Items.Clear();
- }
+ this.cmbCollectionName.Items.AddRange([.. names]);
- private async Task PageAsync(long Skip, long Take)
- {
- var s = this.txtInput.Text;
+ }
- s = MyRegex().Replace(s, $"skip: {Skip} ");
- s = MyRegex1().Replace(s, $"limit: {Take} ");
+ private async Task PageAsync(long Skip, long Take)
+ {
+ var s = this.txtInput.Text;
- this.txtInput.Text = s;
+ s = MyRegex().Replace(s, $"skip: {Skip} ");
+ s = MyRegex1().Replace(s, $"limit: {Take} ");
- await AggregateAsync();
- }
+ this.txtInput.Text = s;
+
+ await AggregateAsync();
+ }
- private long MaxRecords;
+ private long MaxRecords;
- async private void CmbCollectionName_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.txtInput.Text = @"[
+ async private void CmbCollectionName_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ this.txtInput.Text = @"[
{ $match: {} },
{ $skip: 0 },
{ $limit: 1 }
]";
- this.txtPage.Text = "0";
- this.txtPageLength.Text = "1";
- await PageAsync(0, 1);
+ this.txtPage.Text = "0";
+ this.txtPageLength.Text = "1";
+ await PageAsync(0, 1);
- var collection = GetCollection();
+ var collection = GetCollection();
- if (collection != null)
- {
- var count = await collection.EstimatedDocumentCountAsync();
- MaxRecords = count;
- this.lblTotal.Text = $"total: {count}";
- }
- }
-
- private async void BtnPrev_Click(object sender, EventArgs e)
+ if (collection != null)
{
- _ = long.TryParse(this.txtPage.Text, out long lngPageIndex);
- _ = long.TryParse(this.txtPageLength.Text, out long lngPageLength);
- lngPageIndex -= lngPageLength;
- if (lngPageIndex < 0)
- lngPageIndex = 0;
+ var count = await collection.EstimatedDocumentCountAsync();
+ MaxRecords = count;
+ this.lblTotal.Text = $"total: {count}";
+ }
+ }
- this.txtPage.Text = lngPageIndex.ToString();
+ private async void BtnPrev_Click(object sender, EventArgs e)
+ {
+ _ = long.TryParse(this.txtPage.Text, out long lngPageIndex);
+ _ = long.TryParse(this.txtPageLength.Text, out long lngPageLength);
+ lngPageIndex -= lngPageLength;
+ if (lngPageIndex < 0)
+ lngPageIndex = 0;
- await PageAsync(lngPageIndex, lngPageLength);
- }
+ this.txtPage.Text = lngPageIndex.ToString();
- private async void BtnNxt_Click(object sender, EventArgs e)
- {
- _ = long.TryParse(this.txtPage.Text, out long lngPageIndex);
- _ = long.TryParse(this.txtPageLength.Text, out long lngPageLength);
- lngPageIndex += lngPageLength;
- if (lngPageIndex >= MaxRecords)
- lngPageIndex = MaxRecords-1;
+ await PageAsync(lngPageIndex, lngPageLength);
+ }
- this.txtPage.Text = lngPageIndex.ToString();
+ private async void BtnNxt_Click(object sender, EventArgs e)
+ {
+ _ = long.TryParse(this.txtPage.Text, out long lngPageIndex);
+ _ = long.TryParse(this.txtPageLength.Text, out long lngPageLength);
+ lngPageIndex += lngPageLength;
+ if (lngPageIndex >= MaxRecords)
+ lngPageIndex = MaxRecords-1;
- await PageAsync(lngPageIndex, lngPageLength);
- }
+ this.txtPage.Text = lngPageIndex.ToString();
- private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ await PageAsync(lngPageIndex, lngPageLength);
+ }
- [GeneratedRegex("skip:[^}]*")]
- private static partial Regex MyRegex();
- [GeneratedRegex("limit:[^}]*")]
- private static partial Regex MyRegex1();
+ private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ this.Close();
}
+
+ [GeneratedRegex("skip:[^}]*")]
+ private static partial Regex MyRegex();
+ [GeneratedRegex("limit:[^}]*")]
+ private static partial Regex MyRegex1();
}
\ No newline at end of file
diff --git a/src/MongoGui/MongoGui.csproj b/src/MongoGui/MongoGui.csproj
index a11b40e..4fa57cc 100644
--- a/src/MongoGui/MongoGui.csproj
+++ b/src/MongoGui/MongoGui.csproj
@@ -22,7 +22,7 @@
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\MongoExtensions\MongoExtensions.csproj" />
+ <ProjectReference Include="..\BsonExtensions\BsonExtensions.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/MongoGui/OldStuff.cs b/src/MongoGui/OldStuff.cs
index 634c779..fe431d7 100644
--- a/src/MongoGui/OldStuff.cs
+++ b/src/MongoGui/OldStuff.cs
@@ -3,57 +3,57 @@ using MongoDB.Driver;
using MongoExtensions;
-namespace MongoTesting.ConsoleApp
+namespace MongoGui;
+
+internal class OldStuff
{
- internal class OldStuff
- {
- private static readonly MongoClient dbClient = new("mongodb://192.168.28.210:27017");
+ private static readonly MongoClient dbClient = new("mongodb://192.168.28.210:27017");
- private static async Task TransactionTest()
+ private static async Task TransactionTest()
+ {
+ if (dbClient != null)
{
- if (dbClient != null)
+ using var iSession = await dbClient.StartSessionAsync();
+ iSession.StartTransaction();
+ try
{
- using var iSession = await dbClient.StartSessionAsync();
- iSession.StartTransaction();
- try
- {
- // Deletes Updates Inserts
- await iSession.CommitTransactionAsync();
- }
- catch
- {
- await iSession.AbortTransactionAsync();
- }
+ // Deletes Updates Inserts
+ await iSession.CommitTransactionAsync();
+ }
+ catch
+ {
+ await iSession.AbortTransactionAsync();
}
}
+ }
- private static async Task Test0()
- {
- Console.WriteLine("The list of databases on this server is: ");
- Console.WriteLine(dbClient?.ListDatabases().ToList().Pretty());
+ private static async Task Test0()
+ {
+ Console.WriteLine("The list of databases on this server is: ");
+ Console.WriteLine(dbClient?.ListDatabases().ToList().Pretty());
- List<BsonDocument> result;
+ List<BsonDocument> result;
- var db = dbClient?.GetDatabase("acme");
+ var db = dbClient?.GetDatabase("acme");
- //await db.CreateCollectionAsync("Alphons");
+ //await db.CreateCollectionAsync("Alphons");
- var alphons = db?.GetCollection("Alphons");
+ var alphons = db?.GetCollection("Alphons");
- //var objectid = await alphons.InsertOneAsync(new { Name = "Alphonsje 2", Age = 55 });
+ //var objectid = await alphons.InsertOneAsync(new { Name = "Alphonsje 2", Age = 55 });
- Console.WriteLine(alphons?.Find("{}").ToList().Pretty());
+ Console.WriteLine(alphons?.Find("{}").ToList().Pretty());
- Console.WriteLine("The list of collections on database acme: ");
- Console.WriteLine(db?.ListCollections().Pretty());
+ Console.WriteLine("The list of collections on database acme: ");
+ Console.WriteLine(db?.ListCollections().Pretty());
- var collection = db?.GetCollection("posts");
+ var collection = db?.GetCollection("posts");
- var col = dbClient?.GetDatabase("sample_training").GetCollection("grades");
+ var col = dbClient?.GetDatabase("sample_training").GetCollection("grades");
- var goodscores = await col.Find(@"
+ var goodscores = await col.Find(@"
{
scores:
{
@@ -64,14 +64,14 @@ namespace MongoTesting.ConsoleApp
}
}
}")
- .ToListAsync();
+ .ToListAsync();
- Console.WriteLine(goodscores.Pretty());
+ Console.WriteLine(goodscores.Pretty());
- //var delResult11 = await col.DeleteOneAsync("{ 'student_id': 10001 }");
+ //var delResult11 = await col.DeleteOneAsync("{ 'student_id': 10001 }");
- var document = @"
+ var document = @"
{
'student_id': 10006,
'scores':
@@ -84,13 +84,13 @@ namespace MongoTesting.ConsoleApp
'class_id': 480
}";
- if (col != null)
- {
- var id = await col.InsertOneAsync(document);
- Console.WriteLine("Id = " + id);
- }
+ if (col != null)
+ {
+ var id = await col.InsertOneAsync(document);
+ Console.WriteLine("Id = " + id);
+ }
- var documents = @"[
+ var documents = @"[
{
'student_id': 10007,
'scores':
@@ -114,47 +114,47 @@ namespace MongoTesting.ConsoleApp
'class_id': 480
}]";
- if (col != null)
- {
- var ids = await col.InsertManyAsync(documents);
+ if (col != null)
+ {
+ var ids = await col.InsertManyAsync(documents);
- Console.WriteLine(string.Join(',', ids));
- }
+ Console.WriteLine(string.Join(',', ids));
+ }
- Console.Write(col.Find("{}").ToList().Pretty());
+ Console.Write(col.Find("{}").ToList().Pretty());
- var filter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
- var update = Builders<BsonDocument>.Update.Set("class_id", 483);
+ var filter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
+ var update = Builders<BsonDocument>.Update.Set("class_id", 483);
- var updResult = col?.UpdateOne(filter, update);
+ var updResult = col?.UpdateOne(filter, update);
- var x = 486;
- if (col != null)
- {
- var updResult2 = await col.UpdateOneAsync("{ student_id : 10000 }", $"{{ $set: {{ class_id : {x} }} }}");
- }
+ var x = 486;
+ if (col != null)
+ {
+ var updResult2 = await col.UpdateOneAsync("{ student_id : 10000 }", $"{{ $set: {{ class_id : {x} }} }}");
+ }
- if (collection != null)
- {
- var count = await collection.CountDocumentsAsync("{}");
- }
+ if (collection != null)
+ {
+ var count = await collection.CountDocumentsAsync("{}");
+ }
- var aaaa = new { views = new { _gt = 2 } };
+ var aaaa = new { views = new { _gt = 2 } };
- var cc = await collection
- .Find("{ views: { $gt: 2 } }").CountDocumentsAsync();
+ var cc = await collection
+ .Find("{ views: { $gt: 2 } }").CountDocumentsAsync();
- result = await collection
- .Find("{ views: { $gt: 2 } }")
- .Project("{ _id:0, title: 1, date: 1, views: 1 }")
- .Sort("{ _id: -1 }")
- .ToListAsync();
+ result = await collection
+ .Find("{ views: { $gt: 2 } }")
+ .Project("{ _id:0, title: 1, date: 1, views: 1 }")
+ .Sort("{ _id: -1 }")
+ .ToListAsync();
- Console.WriteLine(result.Pretty());
+ Console.WriteLine(result.Pretty());
- result = await collection
- .Find(@"
+ result = await collection
+ .Find(@"
{
comments:
{
@@ -164,13 +164,13 @@ namespace MongoTesting.ConsoleApp
}
}
}")
- .ToListAsync();
+ .ToListAsync();
- Console.WriteLine(result.Pretty());
+ Console.WriteLine(result.Pretty());
- if (collection != null)
- {
- var result3 = await collection.UpdateOneAsync("{ title: 'Post Two' }", @"
+ if (collection != null)
+ {
+ var result3 = await collection.UpdateOneAsync("{ title: 'Post Two' }", @"
{
$set:
{
@@ -178,81 +178,81 @@ namespace MongoTesting.ConsoleApp
category: 'Technology'
}
}");
- var mac = result3.MatchedCount;
- var moc = result3.ModifiedCount;
- }
+ var mac = result3.MatchedCount;
+ var moc = result3.ModifiedCount;
+ }
- //var highExamScoreFilter = Builders<BsonDocument>.Filter.ElemMatch<BsonValue>(
- // "scores", new BsonDocument {
- // { "type", "exam" },
- // { "score", new BsonDocument { { "$gte", 88 } } } });
+ //var highExamScoreFilter = Builders<BsonDocument>.Filter.ElemMatch<BsonValue>(
+ // "scores", new BsonDocument {
+ // { "type", "exam" },
+ // { "score", new BsonDocument { { "$gte", 88 } } } });
- //var highExamScores = collection.Find(highExamScoreFilter).ToList();
- //var cursor = collection.Find(highExamScoreFilter).ToCursor();
- //foreach (var document in cursor.ToEnumerable())
- //{
- // Console.WriteLine(document);
- //}
+ //var highExamScores = collection.Find(highExamScoreFilter).ToList();
+ //var cursor = collection.Find(highExamScoreFilter).ToCursor();
+ //foreach (var document in cursor.ToEnumerable())
+ //{
+ // Console.WriteLine(document);
+ //}
- //await collection.Find(highExamScoreFilter).ForEachAsync(document => Console.WriteLine(document));
+ //await collection.Find(highExamScoreFilter).ForEachAsync(document => Console.WriteLine(document));
- //var sort = Builders<BsonDocument>.Sort.Descending("student_id");
+ //var sort = Builders<BsonDocument>.Sort.Descending("student_id");
- //var highestScores = collection.Find(highExamScoreFilter).Sort(sort);
+ //var highestScores = collection.Find(highExamScoreFilter).Sort(sort);
- //var highestScore = collection.Find(highExamScoreFilter).Sort(sort).First();
+ //var highestScore = collection.Find(highExamScoreFilter).Sort(sort).First();
- //Console.WriteLine(highestScore);
+ //Console.WriteLine(highestScore);
- //var filter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
- //var update = Builders<BsonDocument>.Update.Set("class_id", 483);
+ //var filter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
+ //var update = Builders<BsonDocument>.Update.Set("class_id", 483);
- //collection.UpdateOne(filter, update);
+ //collection.UpdateOne(filter, update);
- //var arrayFilter = Builders<BsonDocument>.Filter.Eq("student_id", 10000)
- // & Builders<BsonDocument>.Filter.Eq("scores.type", "quiz");
+ //var arrayFilter = Builders<BsonDocument>.Filter.Eq("student_id", 10000)
+ // & Builders<BsonDocument>.Filter.Eq("scores.type", "quiz");
- //var arrayUpdate = Builders<BsonDocument>.Update.Set("scores.$.score", 84.92381029342834);
+ //var arrayUpdate = Builders<BsonDocument>.Update.Set("scores.$.score", 84.92381029342834);
- //collection.UpdateOne(arrayFilter, arrayUpdate);
+ //collection.UpdateOne(arrayFilter, arrayUpdate);
- //var deleteFilter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
+ //var deleteFilter = Builders<BsonDocument>.Filter.Eq("student_id", 10000);
- //collection.DeleteOne(deleteFilter);
+ //collection.DeleteOne(deleteFilter);
- //var deleteLowExamFilter = Builders<BsonDocument>.Filter.ElemMatch<BsonValue>("scores",
- // new BsonDocument { { "type", "exam" }, {"score", new BsonDocument { { "$lt", 60 }}}});
+ //var deleteLowExamFilter = Builders<BsonDocument>.Filter.ElemMatch<BsonValue>("scores",
+ // new BsonDocument { { "type", "exam" }, {"score", new BsonDocument { { "$lt", 60 }}}});
- //collection.DeleteMany(deleteLowExamFilter);
+ //collection.DeleteMany(deleteLowExamFilter);
- //var document = new BsonDocument
- //{
- // {
- // "student_id", 10000
- // },
- // {
- // "scores", new BsonArray
- // {
- // new BsonDocument { { "type", "exam" }, { "score", 88.12334193287023 } },
- // new BsonDocument { { "type", "quiz" }, { "score", 74.92381029342834 } },
- // new BsonDocument { { "type", "homework" }, { "score", 89.97929384290324 } },
- // new BsonDocument { { "type", "homework" }, { "score", 82.12931030513218 } }
- // }
- // },
- // {
- // "class_id", 480
- // }
- //};
- //await collection.InsertOneAsync(document);
+ //var document = new BsonDocument
+ //{
+ // {
+ // "student_id", 10000
+ // },
+ // {
+ // "scores", new BsonArray
+ // {
+ // new BsonDocument { { "type", "exam" }, { "score", 88.12334193287023 } },
+ // new BsonDocument { { "type", "quiz" }, { "score", 74.92381029342834 } },
+ // new BsonDocument { { "type", "homework" }, { "score", 89.97929384290324 } },
+ // new BsonDocument { { "type", "homework" }, { "score", 82.12931030513218 } }
+ // }
+ // },
+ // {
+ // "class_id", 480
+ // }
+ //};
+ //await collection.InsertOneAsync(document);
- }
+ }
- private static async Task Test1()
- {
- var forecast = @"
+ private static async Task Test1()
+ {
+ var forecast = @"
{
_id: 2,
title: '123 Department Report',
@@ -280,19 +280,19 @@ namespace MongoTesting.ConsoleApp
]
}
";
- var forecasts = dbClient?.GetDatabase("test1").GetCollection("forecasts");
+ var forecasts = dbClient?.GetDatabase("test1").GetCollection("forecasts");
- if (forecasts == null)
- return;
+ if (forecasts == null)
+ return;
- if (forecasts.CountDocuments() == 0)
- {
- var id = await forecasts.InsertOneAsync(forecast);
- }
+ if (forecasts.CountDocuments() == 0)
+ {
+ var id = await forecasts.InsertOneAsync(forecast);
+ }
- var userAccess = "[ 'STLW', 'G' ]";
+ var userAccess = "[ 'STLW', 'G' ]";
- var result = await forecasts.AggregateAsync(@"
+ var result = await forecasts.AggregateAsync(@"
[
{ $match: { year: 2014 } },
{ $redact: {
@@ -305,19 +305,19 @@ namespace MongoTesting.ConsoleApp
}
]");
- Console.WriteLine(result.Pretty());
- }
+ Console.WriteLine(result.Pretty());
+ }
- private static async Task Test2()
- {
- var accounts = dbClient?.GetDatabase("test1").GetCollection("accounts");
+ private static async Task Test2()
+ {
+ var accounts = dbClient?.GetDatabase("test1").GetCollection("accounts");
- if (accounts == null)
- return;
+ if (accounts == null)
+ return;
- //Console.WriteLine(accounts.Pretty());
+ //Console.WriteLine(accounts.Pretty());
- var account = @"
+ var account = @"
{
_id: 3,
level: 1,
@@ -347,12 +347,12 @@ namespace MongoTesting.ConsoleApp
},
status: 'A'
}";
- if (accounts.CountDocuments() == 2)
- {
- var id = await accounts.InsertOneAsync(account);
- }
+ if (accounts.CountDocuments() == 2)
+ {
+ var id = await accounts.InsertOneAsync(account);
+ }
- var result = await accounts.AggregateAsync(@"
+ var result = await accounts.AggregateAsync(@"
[
{ $match: { status: 'A' } },
{
@@ -365,30 +365,30 @@ namespace MongoTesting.ConsoleApp
}
}
]");
- Console.WriteLine(result.Pretty());
+ Console.WriteLine(result.Pretty());
- }
+ }
- private static async Task Test3()
- {
- var characters = dbClient?.GetDatabase("test1").GetCollection("characters");
+ private static async Task Test3()
+ {
+ var characters = dbClient?.GetDatabase("test1").GetCollection("characters");
- if (characters == null)
- return;
+ if (characters == null)
+ return;
- //var watchCursor = await characters.WatchAsync("[]", new ChangeStreamOptions() { FullDocument = ChangeStreamFullDocumentOption.UpdateLookup });
+ //var watchCursor = await characters.WatchAsync("[]", new ChangeStreamOptions() { FullDocument = ChangeStreamFullDocumentOption.UpdateLookup });
- //Console.WriteLine(watchCursor.ToList().Pretty());
+ //Console.WriteLine(watchCursor.ToList().Pretty());
- var deletedDocs = await characters.DeleteManyAsync("{}");
+ var deletedDocs = await characters.DeleteManyAsync("{}");
- var rr = await characters.InsertManyAsync(@"[
+ var rr = await characters.InsertManyAsync(@"[
{ 'char' : 'Londen', 'class' : 'monk', 'lvl' : 4 },
{ '_id' : 1, 'char' : 'Brisbane', 'class' : 'monk', 'lvl' : 4 },
{ '_id' : 2, 'char' : 'Eldon', 'class' : 'alchemist', 'lvl' : 3 },
{ '_id' : 3, 'char' : 'Meldane', 'class' : 'ranger', 'lvl' : 3 }]");
- var result = await characters.BulkWriteAsync(@"
+ var result = await characters.BulkWriteAsync(@"
[
{
insertOne: {
@@ -441,40 +441,40 @@ namespace MongoTesting.ConsoleApp
- }
+ }
- private static async Task Test4()
- {
+ private static async Task Test4()
+ {
- var orders = dbClient?.GetDatabase("test1").GetCollection("orders");
+ var orders = dbClient?.GetDatabase("test1").GetCollection("orders");
- if (orders == null)
- return;
+ if (orders == null)
+ return;
- //await orders.DeleteManyAsync("{}");
+ //await orders.DeleteManyAsync("{}");
- // var rr = await orders.InsertManyAsync(@"[
- // { _id: 0, name: 'Pepperoni', size: 'small', price: 19,
- // quantity: 10, date: ISODate( '2021-03-13T08:14:30Z' ) },
- // { _id: 1, name: 'Pepperoni', size: 'medium', price: 20,
- // quantity: 20, date : ISODate( '2021-03-13T09:13:24Z' ) },
- // { _id: 2, name: 'Pepperoni', size: 'large', price: 21,
- // quantity: 30, date : ISODate( '2021-03-17T09:22:12Z' ) },
- // { _id: 3, name: 'Cheese', size: 'small', price: 12,
- // quantity: 15, date : ISODate( '2021-03-13T11:21:39.736Z' ) },
- // { _id: 4, name: 'Cheese', size: 'medium', price: 13,
- // quantity:50, date : ISODate( '2022-01-12T21:23:13.331Z' ) },
- // { _id: 5, name: 'Cheese', size: 'large', price: 14,
- // quantity: 10, date : ISODate( '2022-01-12T05:08:13Z' ) },
- // { _id: 6, name: 'Vegan', size: 'small', price: 17,
- // quantity: 10, date : ISODate( '2021-01-13T05:08:13Z' ) },
- // { _id: 7, name: 'Vegan', size: 'medium', price: 18,
- // quantity: 10, date : ISODate( '2021-01-13T05:10:13Z' ) }
- //]");
+ // var rr = await orders.InsertManyAsync(@"[
+ // { _id: 0, name: 'Pepperoni', size: 'small', price: 19,
+ // quantity: 10, date: ISODate( '2021-03-13T08:14:30Z' ) },
+ // { _id: 1, name: 'Pepperoni', size: 'medium', price: 20,
+ // quantity: 20, date : ISODate( '2021-03-13T09:13:24Z' ) },
+ // { _id: 2, name: 'Pepperoni', size: 'large', price: 21,
+ // quantity: 30, date : ISODate( '2021-03-17T09:22:12Z' ) },
+ // { _id: 3, name: 'Cheese', size: 'small', price: 12,
+ // quantity: 15, date : ISODate( '2021-03-13T11:21:39.736Z' ) },
+ // { _id: 4, name: 'Cheese', size: 'medium', price: 13,
+ // quantity:50, date : ISODate( '2022-01-12T21:23:13.331Z' ) },
+ // { _id: 5, name: 'Cheese', size: 'large', price: 14,
+ // quantity: 10, date : ISODate( '2022-01-12T05:08:13Z' ) },
+ // { _id: 6, name: 'Vegan', size: 'small', price: 17,
+ // quantity: 10, date : ISODate( '2021-01-13T05:08:13Z' ) },
+ // { _id: 7, name: 'Vegan', size: 'medium', price: 18,
+ // quantity: 10, date : ISODate( '2021-01-13T05:10:13Z' ) }
+ //]");
- var list = await orders.AggregateAsync(@"[
+ var list = await orders.AggregateAsync(@"[
{
$match: { size: 'medium' }
},
@@ -482,10 +482,10 @@ namespace MongoTesting.ConsoleApp
$group: { _id: '$name', totalQuantity: { $sum: '$quantity' } }
}
]");
- Console.WriteLine(list.Pretty());
+ Console.WriteLine(list.Pretty());
- var list2 = await orders.AggregateAsync(@"[
+ var list2 = await orders.AggregateAsync(@"[
{
$match:
{
@@ -505,9 +505,8 @@ namespace MongoTesting.ConsoleApp
}
]");
- Console.WriteLine(list2.Pretty());
-
- }
+ Console.WriteLine(list2.Pretty());
}
+
}
diff --git a/src/MongoGui/Program.cs b/src/MongoGui/Program.cs
index 6455b41..7bd2471 100644
--- a/src/MongoGui/Program.cs
+++ b/src/MongoGui/Program.cs
@@ -1,15 +1,14 @@
-namespace MongoTesting.WinApp
+namespace MongoGui;
+
+internal static class Program
{
- internal static class Program
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
{
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
- }
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form1());
}
}
\ No newline at end of file
diff --git a/src/MongoTestWeb/LogicControllers/MongoController.cs b/src/MongoTestWeb/LogicControllers/MongoController.cs
index 25b2947..01e3b0b 100644
--- a/src/MongoTestWeb/LogicControllers/MongoController.cs
+++ b/src/MongoTestWeb/LogicControllers/MongoController.cs
@@ -2,10 +2,10 @@
// nuget MongoDB.Driver
using MongoDB.Driver;
-using MongoExtensions;
+using BsonExtensions;
-namespace MongoTesting.CoreWeb.LogicControllers
+namespace MongoTestWeb.LogicControllers
{
public class MongoController(IMongoClient mongo) : ControllerBase
{
diff --git a/src/MongoTestWeb/MongoTestWeb.csproj b/src/MongoTestWeb/MongoTestWeb.csproj
index de30784..6dc48c8 100644
--- a/src/MongoTestWeb/MongoTestWeb.csproj
+++ b/src/MongoTestWeb/MongoTestWeb.csproj
@@ -8,7 +8,7 @@
<PackageReference Include="netproxy" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\MongoExtensions\MongoExtensions.csproj" />
+ <ProjectReference Include="..\BsonExtensions\BsonExtensions.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/src/MongoTestWeb/Program.cs b/src/MongoTestWeb/Program.cs
index 0730cc5..e623b47 100644
--- a/src/MongoTestWeb/Program.cs
+++ b/src/MongoTestWeb/Program.cs
@@ -1,6 +1,6 @@
using MongoDB.Driver;
-using MongoExtensions;
+using BsonExtensions;
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{