Wildcard for composite keys

126 views
Skip to first unread message

Frederic Yesid Peña Sánchez

unread,
Feb 21, 2014, 11:26:31 AM2/21/14
to mobile-c...@googlegroups.com
Hi.

I'm trying to emit keys like this:

@{@"1",@"1",@"123-x"}
@{@"1",@"2",@"asdas"}
@{@"1",@"3",@"jdhs"}
@{@"1",@"4",@"s,djhdsf"}
@{@"1",@"5",@"s,jfd"}
@{@"1",@"6",@"shgas"}

I need to provide the first and last components of the key, and wildcard the middle. so my keys will be ordered by first and second components.

How could i achieve this?

Jens Alfke

unread,
Feb 21, 2014, 12:14:53 PM2/21/14
to mobile-c...@googlegroups.com
On Feb 21, 2014, at 8:26 AM, Frederic Yesid Peña Sánchez <freder...@gmail.com> wrote:

I'm trying to emit keys like this:

@{@"1",@"1",@"123-x"}
@{@"1",@"2",@"asdas"}
@{@"1",@"3",@"jdhs"}
@{@"1",@"4",@"s,djhdsf"}
@{@"1",@"5",@"s,jfd"}
@{@"1",@"6",@"shgas”}

I think you meant to use square brackets, right? These are meant to be arrays?

I need to provide the first and last components of the key, and wildcard the middle. so my keys will be ordered by first and second components.

Did you mean “first and third components”?

You can’t do this. Array keys are sorted by each component in turn, and you can only query for a range of keys in that sort order. So the lookup can’t ignore the intermediate array elements.

The best way to solve this is to create another view that emits only the key components you care about, and then query that view.

—Jens
Reply all
Reply to author
Forward
0 new messages