PouchDB快速搜索承诺不是构造函数

时间:2017-12-19 13:47:53

标签: typescript ionic-framework pouchdb

使用TS和Ionic 2,我安装了pouchdb-quick-search

npm install pouchdb-quick-search

使用插件,就像我使用pouchdb-find一样(完全正常)

import PouchDB from 'pouchdb';
import PouchDBFind from 'pouchdb-find';
import PouchDBQuickSearch from 'pouchdb-quick-search';

/*
...
*/

PouchDB.plugin(PouchDBFind);
PouchDB.plugin(PouchDBQuickSearch);

最后,使用搜索方法的方法与在quick-search的READ ME中解释得很好。

this.db.search({
  query: searchString,
  fields: ['field_1',
  'field_2',
  'field_3']
}).then(function (res){
  console.log(JSON.stringify(res));
  return true; //temporary
}).catch(...)

然而,当调用此方法时,我收到错误:

Promise is not a constructor

我认为在这种情况下快速搜索会比找到更有效率。

我在这里做错了吗?

0 个答案:

没有答案