select Sofa where colour in ['red', 'blue'] and purchase date between day1 , day2

17 views
Skip to first unread message

darth...@gmail.com

unread,
Aug 12, 2015, 2:05:20 AM8/12/15
to ektorp-discuss
I have the documents with that look sort of like this
Sofa{
 colour: red
 purcaseDate: 12/8/2015
}

im trying to create a view that can help me find Sofa that are certain colours and have been purchased between certain days
in sudo sql
select Sofa where colour in ['red', 'blue'] and purchase date between day1 , day2

but im having difficulty creating the equivalent in couchDB or ektorp

i can create view
[red, purchaseDate] = doc

but when quering it
i can either do
ComplexKey start = ComplexKey.of(query.getStartKey());
ComplexKey end = ComplexKey.of(query.getEndKey());
view2
.startKey(start).endKey(end);

OR

for(Object[] sample:query.getKeyValues()){
    keys
.add(ComplexKey.of(sample));
}
view2
.keys(keys);

How can i do both?
Reply all
Reply to author
Forward
0 new messages