Description
When fetching a map containing another map (lets call this sub_map), the sub_map is returned as an array and not as a map object. I would expect that the sub_map would be of the map type so that map methods can be used on it (such as riakc_map:fetch_keys(Map)
)
Code
Note: I am using the riak-erlang-client in elixir, hence the elixir syntax.
Example of creating the map:
map = :riakc_map.new()
map = :riakc_map.update({"map", :map}, fn(s) ->
:riakc_map.update({"map", :map}, fn(c) ->
c = :riakc_map.update({"set", :set},
fn(s) -> :riakc_set.add_element("biz", s) end,
c)
:riakc_map.update({"flag1", :flag},
fn(f) -> :riakc_flag.enable(f) end,
c)
end, s)
end, map)
:ok = :riakc_pb_socket.update_type(pid, {"maps", bucket}, key, :riakc_map.to_op(map))
example of fetching the map:
{:ok, map} = :riakc_pb_socket.fetch_type(pid, {"maps", bucket}, key)
sub_map = :riakc_map.fetch({"map", :map}, map)
at this point I would expect sub_map to be a map object which I can call fetch keys or fetch on, instead the object returned is an array, like so:
[{{"map", :map}, [{{"flag1", :flag}, true}, {{"set", :set}, ["biz"]}]}]
This seems incorrect as it seems to remove some of the value of using maps within maps, since the whole object will have to be recreated and re-updated in order to change any values.
Thanks in advance for any help you can provide.