Skip to content

Commit

Permalink
新版索引管理器雏形
Browse files Browse the repository at this point in the history
  • Loading branch information
magicdict committed Oct 26, 2016
1 parent 79babee commit 38b9cb4
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 281 deletions.
32 changes: 22 additions & 10 deletions FunctionForm/Operation/frmCollectionIndex.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 23 additions & 20 deletions FunctionForm/Operation/frmCollectionIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,51 +73,54 @@ private void cmdDelIndex_Click(object sender, EventArgs e)
/// <param name="e"></param>
private void cmdAddIndex_Click(object sender, EventArgs e)
{
var ascendingKey = new List<string>();
var descendingKey = new List<string>();
var geoSpatialKey = string.Empty;
//Index UIOption
var uiOption = new Operater.IndexOption();
uiOption.AscendingKey = new List<string>();
uiOption.DescendingKey = new List<string>();
uiOption.TextKey = new List<string>();

var firstKey = string.Empty;
var textKey = string.Empty;
for (var i = 0; i < 5; i++)
{
var ctl = (CtlIndexCreate) Controls.Find("ctlIndexCreate" + (i + 1), true)[0];
var ctl = (CtlIndexCreate)Controls.Find("ctlIndexCreate" + (i + 1), true)[0];
if (ctl.KeyName == string.Empty) continue;
firstKey = ctl.KeyName.Trim();
switch (ctl.IndexKeyType)
{
case EnumMgr.IndexType.Ascending:
ascendingKey.Add(ctl.KeyName.Trim());
case EnumMgr.IndexType.GeoSpatialHaystack:
uiOption.GeoSpatialHaystackKey = ctl.KeyName.Trim();
break;
case EnumMgr.IndexType.Descending:
descendingKey.Add(ctl.KeyName.Trim());
case EnumMgr.IndexType.GeoSpatialSpherical:
uiOption.GeoSpatialSphericalKey = ctl.KeyName.Trim();
break;
case EnumMgr.IndexType.GeoSpatial:
geoSpatialKey = ctl.KeyName.Trim();
uiOption.GeoSpatialKey = ctl.KeyName.Trim();
break;
case EnumMgr.IndexType.Ascending:
uiOption.AscendingKey.Add(ctl.KeyName.Trim());
break;
case EnumMgr.IndexType.Descending:
uiOption.DescendingKey.Add(ctl.KeyName.Trim());
break;
case EnumMgr.IndexType.Text:
textKey = ctl.KeyName.Trim();
uiOption.TextKey.Add(ctl.KeyName.Trim());
break;
default:
case EnumMgr.IndexType.Hashed:
uiOption.HashedKey = ctl.KeyName.Trim();
break;
}
}
//Index UIOption
var uiOption = new Operater.IndexOption();
uiOption.IsBackground = chkIsBackground.Checked;
uiOption.IsDropDups = chkIsDroppedDups.Checked;
uiOption.IsSparse = chkIsSparse.Checked;
uiOption.IsUnique = chkIsUnique.Checked;
uiOption.IsExpireData = chkExpireData.Checked;
//Partial Indexes
uiOption.IsPartial = chkPartialIndexes.Checked;
uiOption.Ttl = (int) numTTL.Value;
uiOption.AscendingKey = ascendingKey;
uiOption.DescendingKey = descendingKey;
uiOption.GeoSpatialKey = geoSpatialKey;
uiOption.Ttl = (int)numTTL.Value;
uiOption.FirstKey = firstKey;
uiOption.TextKey = textKey;
uiOption.IndexName = txtIndexName.Text;
//Partial Indexes
//Partial Condition
uiOption.PartialCondition = txtPartialIndexes.Text;
var strMessageTitle = string.Empty;
var strMessageContent = string.Empty;
Expand Down
3 changes: 2 additions & 1 deletion MongoCola/Release Note_Ver2.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CSharp Mongo Driver 2.4.0-beta1
5. ML插件化
6. 修正了切断连接无效的问题
7. NetCore和Net版本条件编译
8. BsonDocument树形表示优化

###聚合
1. $indexStats $stage,$sortByCount(From MongoDB3.4), $sample, $unwind
Expand All @@ -77,4 +78,4 @@ CSharp Mongo Driver 2.4.0-beta1

###mongobooster功能的借鉴
1. 增加了MongoDB官方文档的链接
2. BsonGuidRepresentation概念的引入
2. BsonGuidRepresentation概念的引入
69 changes: 11 additions & 58 deletions MongoGUICtl/ctlIndexCreate.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 3 additions & 21 deletions MongoGUICtl/ctlIndexCreate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,19 @@ public CtlIndexCreate()
GuiConfig.Translateform(Controls);
if (RuntimeMongoDbContext.GetCurrentCollection() != null)
{
foreach (
var fieldName in
MongoHelper.GetCollectionSchame(RuntimeMongoDbContext.GetCurrentCollection())
)
foreach (var fieldName in MongoHelper.GetCollectionSchame(RuntimeMongoDbContext.GetCurrentCollection()))
{
cmbKeyName.Items.Add(fieldName);
}
}
Common.Utility.FillComberWithEnum(cmbIndexKeyType, typeof(EnumMgr.IndexType), true);
}

public EnumMgr.IndexType IndexKeyType
{
get
{
if (radAscendingKey.Checked)
{
return EnumMgr.IndexType.Ascending;
}
if (radDescendingKey.Checked)
{
return EnumMgr.IndexType.Descending;
}
if (radGeoSpatial.Checked)
{
return EnumMgr.IndexType.GeoSpatial;
}
if (radText.Checked)
{
return EnumMgr.IndexType.Text;
}
return EnumMgr.IndexType.Ascending;
return (EnumMgr.IndexType)cmbIndexKeyType.SelectedIndex;
}
}

Expand Down
16 changes: 16 additions & 0 deletions MongoGUICtl/ctlTreeViewColumns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ private void treeView_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
if (mElement.Value != null)
{
if (mElement.Value.IsBsonDocument)
{
strColumnText = "{ " + mElement.Value.AsBsonDocument.ElementCount + " Fields }";
}
if (mElement.Value.IsBsonArray)
{
strColumnText = "{ " + mElement.Value.AsBsonArray.Count + " Items }";
}
if (!mElement.Value.IsBsonDocument && !mElement.Value.IsBsonArray)
{
strColumnText = GetDisplayString(ref mElement);
Expand All @@ -213,6 +221,14 @@ private void treeView_DrawNode(object sender, DrawTreeNodeEventArgs e)
if (mValue != null)
{
//Type这里已经有表示Type的标识了,这里就不重复显示了。
if (mValue.IsBsonDocument)
{
if (e.Node.Level > 0) strColumnText = "{ " + mValue.AsBsonDocument.ElementCount + " Fields }";
}
if (mValue.IsBsonArray)
{
if (e.Node.Level > 0) strColumnText = "{ " + mValue.AsBsonArray.Count + " Items }";
}
if (!mValue.IsBsonDocument && !mValue.IsBsonArray)
{
if (e.Node.Level > 0)
Expand Down
Loading

0 comments on commit 38b9cb4

Please sign in to comment.