Ejemplo n.º 1
0
        /// <summary>
        ///   Retrieves the data.
        /// </summary>
        internal void RetrieveData()
        {
            if(Command.Command.ContainsKey("map") == false || Command.Command.ContainsKey("reduce") == false)
                throw new InvalidOperationException("Cannot execute without a map and reduce function");

            IsModifiable = false;

            try
            {
                Result = new MapReduceResult(_database.SendCommand(_rootType, Command.Command));
            }
            catch(MongoCommandException exception)
            {
                Result = new MapReduceResult(exception.Error);
                throw new MongoMapReduceException(exception);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoMapReduceException"/> class.
 /// </summary>
 /// <param name="exception">The exception.</param>
 public MongoMapReduceException(MongoCommandException exception)
     : base(exception.Message,exception.Error, exception.Command)
 {
     MapReduceResult = new MapReduceResult(exception.Error);
 }