我希望能够获取包含某个字符串的所有文档,但我似乎找不到解决方法...
例如,我有以下文档 ID:
vw_10
vw_11
bmw_12
vw_13
bmw_14
volvo_15
vw_16
如何获取包含字符串vw_的所有文档?
db.find({selector: {name: {$regext: '/vw_'}}});
目前它还处于BETA版本,但我们即将使用它发布生产应用程序。到目前为止,它已经非常稳定了。有关PouchDb Find的更多信息,请参见https://github.com/nolanlawson/pouchdb-find
$regex
,因为我遇到了这个错误:Error: unknown operator "$regext" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all
。 - Rehmat你最好拥有一个带有你想要搜索的关键字的视图。这可以确保该关键字被索引。否则,搜索可能会太慢。
startkey
和endkey
只能找到以给定序列开头的键。上述函数调用将无法找到'uvw_10'... - Philipp