Skip to content

How do I design the path to get the following data #201

Answered by the-mikedavis
leeyisoft asked this question in Q&A
Discussion options

You must be logged in to vote

You can lookup many paths in the store using khepri:get_many/3 with path patterns:

> khepri:get_many("/:s/1/*"). 
{ok,#{[s,<<"1">>,<<"andriod">>] =>
          {1,<<"andriod">>,<0.249.0>,<<"did2">>},
      [s,<<"1">>,<<"ios">>] =>
          {1,<<"ios">>,<0.249.0>,<<"did1">>}}}
> khepri:get_many("/:s/**").
{ok,#{[s,<<"1">>,<<"andriod">>] =>
          {1,<<"andriod">>,<0.249.0>,<<"did2">>},
      [s,<<"1">>,<<"ios">>] =>
          {1,<<"ios">>,<0.249.0>,<<"did1">>}}}

* matches any tree node and ** matches any path in the tree node. Also see the docs for khepri:get_many/3 and khepri_path:unix_pattern() in the documentation (https://rabbitmq.github.io/khepri/).

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by leeyisoft
Comment options

You must be logged in to vote
3 replies
@michaelklishin
Comment options

@leeyisoft
Comment options

@dumbbell
Comment options

Comment options

You must be logged in to vote
1 reply
@michaelklishin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #200 on April 24, 2023 13:46.