Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PouchDB get documents by ID with certain string in them

I would like to get all documents that contain a certain string in them, I can't seem to find a solution for it..

for example I have the following doc ids

vw_10
vw_11
bmw_12
vw_13
bmw_14
volvo_15
vw_16

how can I get allDocs with the string vw_ "in" it?

like image 361
Scratch. Avatar asked Jan 25 '15 15:01

Scratch.


1 Answers

Use batch fetch API:

db.allDocs({startkey: "vm_", endkey: "vm_\ufff0"})

Note: \ufff0 is the highest Unicode character which is used as sentinel to specify ranges for ordered strings.

like image 132
Kxepal Avatar answered Jan 02 '23 21:01

Kxepal