/// <summary>
        /// Writes criterion to specifed <seealso cref="JsonWriter"/>
        /// </summary>
        /// <param name="writer"></param>
        public void WriteTo(JsonWriter writer)
        {
            // $gt, $gte (>, >=) and $lt, $lte for number types:
            // {'fpath' : {'$gt' : number}, ...}
            writer.WriteStartObject();

            switch (_comparsion)
            {
            case Comparsion.Greater:
                writer.WritePropertyName("$gt");
                break;

            case Comparsion.GreaterOrEqual:
                writer.WritePropertyName("$gte");
                break;

            case Comparsion.Lower:
                writer.WritePropertyName("$lt");
                break;

            case Comparsion.LowerOrEqual:
                writer.WritePropertyName("$lte");
                break;
            }

            JsonValueWriter <TValue> .Write(writer, _value);

            writer.WriteEndObject();
        }
        public void WriteTo(JsonWriter writer)
        {
            //$begin String starts with prefix
            //{'fpath' : {'$begin' : prefix}}

            writer.WriteStartObject();
            writer.WritePropertyName("$begin");
            JsonValueWriter <string> .Write(writer, _value);

            writer.WriteEndObject();
        }
        public static void WriteArrayBaseCritertion <TValue>(this JsonWriter writer, string criterion, params TValue[] values)
        {
            writer.WriteStartObject();

            writer.WritePropertyName(criterion);

            writer.WriteStartArray();
            for (int i = 0; i < values.Length; i++)
            {
                JsonValueWriter <TValue> .Write(writer, values[i]);
            }
            writer.WriteEndArray();

            writer.WriteEndObject();
        }
 /// <summary>
 /// Writes criteria to specifed <seealso cref="JsonWriter"/>
 /// </summary>
 /// <param name="writer"></param>
 public void WriteTo(JsonWriter writer)
 {
     //Simple matching of String OR Number OR Array value:
     //{'fpath' : 'val', ...}
     JsonValueWriter <TValue> .Write(writer, _value);
 }