Presence.get_by_key returns inconsistent type: list or map

Presence.get_by_key/2 returns a empty List for nonexistent key:


but returns a Map when the key exists, for example:

  metas: [
    %{online_at: 1596170493, phx_ref: "Fia8m0t_MK8qfhrB"}

There’s also a test case to support these two cases: presence_test.exs#L60

But on the docs page, it says to return a List as well for existing keys:

iex> MyPresence.get_by_key("room:1", "user1")
[%{name: "User 1", metas: [%{device: "Desktop"}, %{device: "Mobile"}]}]

I found it a bit confusing. Apparently either the docs needs to be fixed, or the implementation code.

From the docs, the result should even be wrapped in a map with string keys.