anchor.diff:           code_change/3]).
   
   -define(SERVER, ?MODULE).
  --define(COLLECTION_SERVERS, <<"servers">>).
  +-define(COLLECTION_SERVER, <<"server">>).
   -define(COLLECTION_DEVICE_PERMISSIONS, <<"user_device">>).
   -define(COLLECTION_USERS, <<"users">>).
   -define(COLLECTION_DEVICES, <<"devices">>).
  
positive.code:                        Key = #{<<"_id">> => id_to_objectid(Rec#server.id)},
                         Command = #{<<"$set">> => maps:remove(<<"_id">>, Map)},
                         {
                           mc_worker_api:update(Worker, ?COLLECTION_SERVERS, Key, Command),
                           mc_worker_api:find_one(Worker, ?COLLECTION_SERVERS, Key)
                         }
                 end,
      {Res, ResMap} = mongoc:transaction(Topology, Callback),
  
negative.code: do_create_server(#state{topology = Topology}, Rec) ->
      Map = to_map(server, Rec),
      Callback = fun(Worker) ->
                         mc_worker_api:insert(Worker, ?COLLECTION_SERVER, Map)
                 end,
      Item = mongoc:transaction(Topology, Callback),
      do_create_result(Item, server).
  