anchor.diff:  -type item() :: {ctx(), key(), value()}.
   -type design() :: binary().
   -type view() :: binary().
  +-type view_creation_opt() :: {update_min_changes, integer()} |
  +                             {replica_update_min_changes, integer()}.
  +-type view_creation_opts() :: [view_creation_opt()].
   -type view_opt() :: {descending, boolean()} |
                       {endkey, binary()} |
                       {endkey_docid, binary()} |
  
positive.code: -export([save/1, save/3, get/2, delete/2]).
  -export([get_counter/2, get_counter/3, update_counter/4]).
  -export([save_design_doc/3, get_design_doc/2, delete_design_doc/2]).
  -export([save_view_doc/3, save_spatial_view_doc/3, query_view/4]).
  
  -type ctx() :: #{bucket := couchbase_config:bucket(),
                   pool_mode => couchbase_pool:mode(),
  
negative.code: %% is equal to the view name.
  %% @end
  %%--------------------------------------------------------------------
  -spec save_spatial_view_doc(ctx(), view(), binary(), view_creation_opts()) -> ok | {error, term()}.
  save_spatial_view_doc(Ctx, ViewName, Function, Opts) ->
      EJson = {[
          {<<"spatial">>, {[
              {ViewName, Function}
          ]}},
          {<<"options">>, {[
              {<<"updateMinChanges">>, proplists:get_value(update_min_changes, Opts, ?UPDATE_MIN_CHANGES)},
              {<<"replicaUpdateMinChanges">>, proplists:get_value(replica_update_min_changes, Opts, ?REPLICA_UPDATE_MIN_CHANGES)}
          ]}}
      ]},
      save_design_doc(Ctx, ViewName, EJson).
  
  %%--------------------------------------------------------------------
  