anchor.diff:  %% list of attributes and leaves it up to the server to create an id for it.
   %% The attributes should be a list of binary key/value tuples.
   create_document({Server, ServerPort}, Database, Attributes) when is_list(Server), is_integer(ServerPort), is_list(Attributes) ->
  -    create_document({Server, ServerPort}, Database, {struct, Attributes});
  -create_document({Server, ServerPort}, Database, {struct, _} = Obj) when is_list(Server), is_integer(ServerPort) ->
       Url = build_uri(Database),
  -    JSON = list_to_binary(mochijson2:encode(Obj)),
  +    JSON = list_to_binary(engejson:encode(Attributes)),
       raw_request("POST", Server, ServerPort, Url, JSON).
   
   %% @spec create_document(DBServer::server_address(), Database::string(), DocumentID::string(), Attributes::any()) ->  {json, Response::any()} | {raw, Other::any()}
  
positive.code: %% @todo Create a spec for this.
  invoke_multikey_view({Server, ServerPort}, Database, ViewClass, ViewId, Keys, Attributes) when is_list(Server), is_integer(ServerPort) ->
      Url = view_uri(Database, ViewClass, ViewId, Attributes),
      JSON = list_to_binary(mochijson2:encode({struct, [{keys, Keys}]})),
      raw_request("POST", Server, ServerPort, Url, JSON).
  
  %% @doc Return a list of document ids for a given view.
  %% @todo Create a spec for this.
  parse_view({json, {struct, [{<<"error">>, _Code}, {_, _Reason}]}}) ->
      {0, 0, []};
  parse_view({json, Structure}) ->
      {struct, Properties} = Structure,
      TotalRows = proplists:get_value(<<"total_rows">>, Properties, 0),
      Offset = proplists:get_value(<<"offset">>, Properties, 0),
      Data = proplists:get_value(<<"rows">>, Properties, []),
      Ids = [begin
          {struct, Bits} = Rec,
          Id = proplists:get_value(<<"id">>, Bits),
          case proplists:get_value(<<"value">>, Bits, []) of
              [] -> Id;
              {struct, RowValues} -> {Id, RowValues};
              _ -> Id
          end
      end || Rec <- Data],
      {TotalRows, Offset, Ids};
  parse_view(_Other) -> {0, 0, []}.
  
  
negative.code: delete_database({Server, ServerPort}, Database) when is_list(Server), is_integer(ServerPort) ->
      Url = build_uri(Database),
      case raw_request("DELETE", Server, ServerPort, Url, []) of
          {json, [{<<"ok">>, true}]} -> ok;
          Other -> {error, Other}
      end.
  
  