anchor.diff:          true ->
               Collection = type_to_collection(Type),
               Res = execute(Conn, fun() ->
  -                    SortOrder1 = case SortOrder of 
  -                        str_ascending -> 1;
  -                        num_ascending -> 1;
  -                        str_descending -> -1;
  -                        num_descending -> -1
  -                    end,
                       Selector = build_conditions(Conditions, 
  -                                                {Sort, SortOrder1}),
  +                                                {Sort, pack_sort_order(SortOrder)}),
                       mongo:find(Collection, Selector, [],
                                  Skip, Max) 
                   end),
  
positive.code:         false -> false
      end.
  
  datetime_to_now(DateTime) ->
      GSeconds = calendar:datetime_to_gregorian_seconds(DateTime),
      ESeconds = GSeconds - ?GREGORIAN_SECONDS_1970,
      {ESeconds div 1000000, ESeconds rem 1000000, 0}.
  
  pack_value({{_, _, _}, {_, _, _}} = Val) ->
      datetime_to_now(Val);
  pack_value(V) when is_binary(V) -> pack_value(binary_to_list(V));
  
negative.code:     end.
  
  
  save_record(Conn, Record) when is_tuple(Record) ->
      Type = element(1, Record),
      Collection = type_to_collection(Type),
  