Pattern Match Complex Key

Hi,

Say I have a map function thus:

function (doc, meta) { emit([doc.username,doc.createdDateTime]); }

which produces keys in the format of:

["bob","2013-01-30"] ["alice","2013-02-21"]

Is it at all possible to query with a wildcard on this? For example, I have tried this with no joy (no results returned from the query):

// key=["bob", "{}"] query.setKey(ComplexKey.of(username, ComplexKey.emptyObject()));

I have also tried a few permutations of this:

query.setKey(ComplexKey.of(username, "*"));

and

query.setKey(ComplexKey.of(username, ""));

Perhaps this isn’t possible at all?

Any help would be greatly appreciated :slight_smile: Thank you.

-=david=-

Normally it should work if you just specify the first element in the array, say [“Alice”]… have you tried that as well? I’d recommend to first create your query in the UI (since it’s quick to experiment) and then apply it to the Java code. On the Query object there is a method that shows you the “URI” representation of it so you can match it to the one you expect.

Let me know if you need anything else.

Hi,

Yes, tried that too. No keys were returned, i.e.,

query.setKey(ComplexKey.of(username));

Are you saying I should leave out the ComplexKey?

-=david=-