Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 /// <param name="collectionName">The name of the output collection.</param>
 public MapReduceOutput(
     string collectionName
     )
 {
     this.mode           = MapReduceOutputMode.Replace;
     this.collectionName = collectionName;
 }
Ejemplo n.º 2
0
 public MapReduceOutputToCollectionOperation WithOutputMode(MapReduceOutputMode value)
 {
     return((_outputMode == value) ? this : new Builder(this)
     {
         _outputMode = value
     }.Build());
 }
Ejemplo n.º 3
0
        public void OutputMode_get_and_set_should_work(
            [Values(MapReduceOutputMode.Merge, MapReduceOutputMode.Reduce)]
            MapReduceOutputMode value)
        {
            var subject = new MapReduceOutputToCollectionOperation(_collectionNamespace, _outputCollectionNamespace, _mapFunction, _reduceFunction, _messageEncoderSettings);

            subject.OutputMode = value;
            var result = subject.OutputMode;

            result.Should().Be(value);
        }
        public void OutputMode_get_and_set_should_work(
#pragma warning disable CS0618 // Type or member is obsolete
            [Values(MapReduceOutputMode.Merge, MapReduceOutputMode.Reduce)]
            MapReduceOutputMode value)
        {
            var subject = new MapReduceOutputToCollectionOperation(_collectionNamespace, _outputCollectionNamespace, _mapFunction, _reduceFunction, _messageEncoderSettings);

            subject.OutputMode = value;
            var result = subject.OutputMode;

#pragma warning restore CS0618 // Type or member is obsolete

            result.Should().Be(value);
        }
Ejemplo n.º 5
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MapReduceOutputToCollectionOperation"/> class.
 /// </summary>
 /// <param name="collectionNamespace">The collection namespace.</param>
 /// <param name="outputCollectionNamespace">The output collection namespace.</param>
 /// <param name="mapFunction">The map function.</param>
 /// <param name="reduceFunction">The reduce function.</param>
 /// <param name="messageEncoderSettings">The message encoder settings.</param>
 public MapReduceOutputToCollectionOperation(
     CollectionNamespace collectionNamespace,
     CollectionNamespace outputCollectionNamespace,
     BsonJavaScript mapFunction,
     BsonJavaScript reduceFunction,
     MessageEncoderSettings messageEncoderSettings)
     : base(
         collectionNamespace,
         mapFunction,
         reduceFunction,
         messageEncoderSettings)
 {
     _outputCollectionNamespace = Ensure.IsNotNull(outputCollectionNamespace, nameof(outputCollectionNamespace));
     _outputMode = MapReduceOutputMode.Replace;
 }
Ejemplo n.º 6
0
 // constructors
 public MapReduceOutputToCollectionOperation(
     string databaseName,
     string collectionName,
     string outputCollectionName,
     BsonJavaScript mapFunction,
     BsonJavaScript reduceFunction,
     BsonDocument query = null)
     : base(
         databaseName,
         collectionName,
         mapFunction,
         reduceFunction,
         query)
 {
     _outputCollectionName = Ensure.IsNotNullOrEmpty(outputCollectionName, "outputCollectionName");
     _outputMode           = MapReduceOutputMode.Replace;
 }
Ejemplo n.º 7
0
        public static Core.Operations.MapReduceOutputMode ToCore(this MapReduceOutputMode outputMode)
        {
            switch (outputMode)
            {
            case MapReduceOutputMode.Merge:
                return(Core.Operations.MapReduceOutputMode.Merge);

            case MapReduceOutputMode.Reduce:
                return(Core.Operations.MapReduceOutputMode.Reduce);

            case MapReduceOutputMode.Replace:
                return(Core.Operations.MapReduceOutputMode.Replace);

            default:
                var message = string.Format("Invalid output mode: {0}.", outputMode);
                throw new ArgumentException(message, "outputMode");
            }
        }
Ejemplo n.º 8
0
 // constructors
 public Builder(MapReduceOutputToCollectionOperation other)
 {
     _collectionName       = other.CollectionName;
     _databaseName         = other.DatabaseName;
     _finalizeFunction     = other.FinalizeFunction;
     _javaScriptMode       = other.JavaScriptMode;
     _limit                = other.Limit;
     _mapFunction          = other.MapFunction;
     _nonAtomicOutput      = other.NonAtomicOutput;
     _outputCollectionName = other.OutputCollectionName;
     _outputDatabaseName   = other.OutputDatabaseName;
     _outputMode           = other.OutputMode;
     _query                = other.Query;
     _reduceFunction       = other.ReduceFunction;
     _scope                = other.Scope;
     _shardedOutput        = other.ShardedOutput;
     _sort    = other.Sort;
     _verbose = other.Verbose;
 }
Ejemplo n.º 9
0
 private MapReduceOutputToCollectionOperation(
     string collectionName,
     string databaseName,
     BsonJavaScript finalizeFunction,
     bool?javaScriptMode,
     long?limit,
     BsonJavaScript mapFunction,
     bool?nonAtomicOutput,
     string outputCollectionName,
     string outputDatabaseName,
     MapReduceOutputMode outputMode,
     BsonDocument query,
     BsonJavaScript reduceFunction,
     BsonDocument scope,
     bool?shardedOutput,
     BsonDocument sort,
     bool?verbose)
     : base(
         collectionName,
         databaseName,
         finalizeFunction,
         javaScriptMode,
         limit,
         mapFunction,
         query,
         reduceFunction,
         scope,
         sort,
         verbose)
 {
     _nonAtomicOutput      = nonAtomicOutput;
     _outputCollectionName = outputCollectionName;
     _outputDatabaseName   = outputDatabaseName;
     _outputMode           = outputMode;
     _shardedOutput        = shardedOutput;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 /// <param name="databaseName">The name of the database that will contain the output collection.</param>
 /// <param name="collectionName">The name of the output collection.</param>
 public MapReduceOutput(string databaseName, string collectionName)
 {
     _mode           = MapReduceOutputMode.Replace;
     _databaseName   = databaseName;
     _collectionName = collectionName;
 }
Ejemplo n.º 11
0
 // constructors
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 public MapReduceOutput()
 {
     _mode = MapReduceOutputMode.Inline;
 }
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 /// <param name="databaseName">The name of the database that will contain the output collection.</param>
 /// <param name="collectionName">The name of the output collection.</param>
 public MapReduceOutput(string databaseName, string collectionName)
 {
     _mode = MapReduceOutputMode.Replace;
     _databaseName = databaseName;
     _collectionName = collectionName;
 }
 // constructors
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 public MapReduceOutput()
 {
     _mode = MapReduceOutputMode.Inline;
 }
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 /// <param name="databaseName">The name of the database that will contain the output collection.</param>
 /// <param name="collectionName">The name of the output collection.</param>
 public MapReduceOutput(string databaseName, string collectionName)
 {
     this.mode = MapReduceOutputMode.Replace;
     this.databaseName = databaseName;
     this.collectionName = collectionName;
 }
 // constructors
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 public MapReduceOutput()
 {
     this.mode = MapReduceOutputMode.Inline;
 }
Ejemplo n.º 16
0
 // constructors
 /// <summary>
 /// Creates a new instance of the MapReduceOutput class.
 /// </summary>
 public MapReduceOutput()
 {
     this.mode = MapReduceOutputMode.Inline;
 }