Closed cgatian closed 7 years ago
Hi @cgatian . The query-engine depends on pouch-find which supports the regex-syntax. See Regex with pouch-find.
I will make a test for this tomorrow so that I can tell you if its definitely working. Could you post your schema please to make sure it has nothing to do with it?
Thanks for the quick response. I'll test tomorrow morning. Thank you
@pubkey Hmm still no luck. Im using the hero schema found in the example apps.
RxDB.plugin(require('pouchdb-adapter-idb'));
RxDB.plugin(require('pouchdb-adapter-http'));
RxDB.plugin(require('pouchdb-replication'));
RxDB.plugin(require('pouchdb-find'));
this.db$ = Observable.fromPromise(
RxDB.create('heroesDB', 'idb', 'myLongAndStupidPassword', true) // create database
.then(db => db));
this.col$ =
this.db$
.mergeMap(db => db.collection('hero', heroSchema))
.filter(col => !!col)
.map(col => {
let c: RxCollection = <RxCollection>col;
c.sync(`http://localhost:5984/hero/`);
c.find({ name: { $regex: /c.*/ } })
.$
.filter(docs => docs !== null)
.subscribe(docs => {
docs.map(doc => console.log(doc.get('name')));
});
I'm a beginner to PouchDB and Mongo so I could be consuming this library incorrectly.
When I run the following query I return the correct number of results.
If I modify the where clause to use a regex all results are returned.
I'm referencing this documentation for the query syntax.
Thank you.