anchor.diff:  -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]).
  +-export([save_view_doc/3, save_view_doc/4,
  +    save_spatial_view_doc/3, save_spatial_view_doc/4, query_view/4]).
   
   -type ctx() :: #{bucket := couchbase_config:bucket(),
                    pool_mode => couchbase_pool:mode(),
  
positive.code: 
  -export_type([ctx/0, key/0, value/0, item/0, design/0, view/0, view_opt/0]).
  
  %%%===================================================================
  %%% API
  %%%===================================================================
  
negative.code: 
  %%--------------------------------------------------------------------
  %% @doc
  %% @equiv save_view_doc(Ctx, ViewName, Function, []).
  %% @end
  %%--------------------------------------------------------------------
  -spec save_view_doc(ctx(), view(), binary()) -> ok | {error, term()}.
  save_view_doc(Ctx, ViewName, Function) ->
      save_view_doc(Ctx, ViewName, Function, []).
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Creates a design document with a single view. Name of design document is
  %% equal to the view name.
  %% @end
  %%--------------------------------------------------------------------
  -spec save_view_doc(ctx(), view(), binary(), view_creation_opts()) -> ok | {error, term()}.
  save_view_doc(Ctx, ViewName, Function, Opts) ->
      EJson = {[
          {<<"views">>, {[
              {ViewName, {[
                  {<<"map">>, 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).
  
  %%--------------------------------------------------------------------
  %% @doc
  %% @equiv save_spatial_view_doc(Ctx, ViewName, Function, []).
  %% @end
  %%--------------------------------------------------------------------
  -spec save_spatial_view_doc(ctx(), view(), binary()) -> ok | {error, term()}.
  save_spatial_view_doc(Ctx, ViewName, Function) ->
      save_spatial_view_doc(Ctx, ViewName, Function, []).
  
  %%--------------------------------------------------------------------
  %% @doc
  