示例#1
0
 /// <summary>
 ///     运行
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdRun_Click(object sender, EventArgs e)
 {
     var map = new BsonJavaScript(ctlMapFunction.Context);
     var reduce = new BsonJavaScript(ctlReduceFunction.Context);
     //TODO:这里可能会超时,失去响应
     //需要设置SocketTimeOut
     var args = new MapReduceArgs();
     args.MapFunction = map;
     args.ReduceFunction = reduce;
     if (!string.IsNullOrEmpty(ctlFinalizeFunction.Context))
     {
         args.FinalizeFunction = new BsonJavaScript(ctlFinalizeFunction.Context);
     }
     args.OutputMode = (MapReduceOutputMode)cmbOutputMode.SelectedIndex;
     if (!string.IsNullOrEmpty(txtOutputCollectionName.Text)) args.OutputCollectionName = txtOutputCollectionName.Text;
     if (NumLimit.Value != 0) args.Limit = (long)NumLimit.Value;
     args.JsMode = chkjsMode.Checked;
     args.Verbose = chkverbose.Checked;
     args.BypassDocumentValidation = chkbypassDocumentValidation.Checked;
     if (QueryDoc != null) args.Query = new QueryDocument(QueryDoc);
     if (mCollation != null) args.Collation = mCollation;
     try
     {
         var mMapReduceResult = RuntimeMongoDbContext.GetCurrentCollection().MapReduce(args);
         var frm = new frmDataView();
         frm.ShowDocument = mMapReduceResult.Response;
         frm.Title = "MapReduce Result";
         UIAssistant.OpenModalForm(frm, true, true);
     }
     catch (Exception ex)
     {
         Utility.ExceptionDeal(ex);
     }
 }
示例#2
0
 /// <summary>
 ///     显示这个Pipeline
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ViewInfoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var pipeline = new List<BsonDocument>();
     pipeline.Add(RuntimeMongoDbContext.GetCurrentCollectionInfo());
     var frm = new frmDataView();
     frm.ShowData = pipeline;
     frm.Title = "ViewInfo";
     UIAssistant.OpenModalForm(frm, true, true);
 }