pouchdb-react-native icon indicating copy to clipboard operation
pouchdb-react-native copied to clipboard

Find is undefined...

Open to175 opened this issue 7 years ago ‱ 8 comments

Hello, I have an error when I try to find element by vi_part with db.find() Can you help me please ?

The code to call find : https://gist.github.com/to175/69e2fc3b647c7408d18a43d1fdb37964

My database : https://gist.github.com/to175/f4685e4124b749c864874fde37f43474

The error :

undefined is not a function (evaluating 'local_database_models.find({ selector: { vi_part: "SCBPX" } })') getCarModelsByViPart$ index.js:170:4 tryCatch runtime.js:62:44 invoke runtime.js:296:30 runtime.js:114:28 tryCatch runtime.js:62:44 invoke runtime.js:152:28 runtime.js:195:17 tryCallTwo core.js:45:7 doResolve core.js:200:23 Promise core.js:66:12 callInvokeWithMethodAndArg runtime.js:194:27 enqueue runtime.js:217:12 runtime.js:114:28 async runtime.js:241:8 getCarModelsByViPart index.js:165:8 SignView instantiate createClassProxy.js:94:29 constructClassInstance ReactNativeRenderer-dev.js:6569:28 updateClassComponent ReactNativeRenderer-dev.js:8733:31 beginWork ReactNativeRenderer-dev.js:9581:10 performUnitOfWork ReactNativeRenderer-dev.js:12924:25 workLoop ReactNativeRenderer-dev.js:12953:43 renderRoot ReactNativeRenderer-dev.js:12996:17 performWorkOnRoot ReactNativeRenderer-dev.js:13632:34 performWork ReactNativeRenderer-dev.js:13545:26 performSyncWork ReactNativeRenderer-dev.js:13506:16 requestWork ReactNativeRenderer-dev.js:13392:6 scheduleWorkImpl ReactNativeRenderer-dev.js:13259:24 scheduleWork ReactNativeRenderer-dev.js:13207:28 scheduleRootUpdate ReactNativeRenderer-dev.js:13930:17 _updateContainerAtExpirationTime ReactNativeRenderer-dev.js:13966:6 updateContainer ReactNativeRenderer-dev.js:13991:8 render ReactNativeRenderer-dev.js:14726:35 renderApplication renderApplication.js:49:21 run AppRegistry.js:102:10 runApplication AppRegistry.js:194:26 __callFunction MessageQueue.js:351:47 MessageQueue.js:116:26 __guardSafe MessageQueue.js:314:6 callFunctionReturnFlushedQueue MessageQueue.js:115:17

to175 avatar Sep 10 '18 08:09 to175

install pouchdb-find and add this to your code :

import PouchDB from 'pouchdb-react-native' import find from 'pouchdb-find';

PouchDB.plugin(find)

paulbx81 avatar Sep 11 '18 08:09 paulbx81

Thanks but why does the pouchdb-find page sais :

The pouchdb-find plugin is being incorporated into PouchDB itself.

The pouchdb-find is not only for react-native language ? Why it is not in pouchdb-react-native ?

to175 avatar Sep 11 '18 08:09 to175

Good question ^^ anyway my .find is too long, 2 or 3 seconds.. and it's instant on web browser

paulbx81 avatar Sep 11 '18 08:09 paulbx81

Thanks you,

What do you mean by your find is too long ? And why are you talking about web browser ? 😛

to175 avatar Sep 12 '18 08:09 to175

On my react-native app my .find() take 5 seconds if i try this .find on webBrowser (with the same database couchDB) the .find take 250ms

(sorry my english is bad i'm french)

paulbx81 avatar Sep 12 '18 08:09 paulbx81

Okay let's talk en français alors. Le .find() de ton application tu l'utilises grùce à pouchdb-react-native ou pouchdb-find ?

Quand tu dis que tu utilises un webbrowser tu veux dire que tu utilises la mĂȘme fonctione .find() mais sur une base de donnĂ©e rĂ©cupĂ©rĂ©e sur internet ? Genre en faisant db = PouchDB.create('http://....') ?

to175 avatar Sep 12 '18 09:09 to175

Merci ! 👍

J'ai une base donnée CouchDB qui contient des données.

J'utilise poouchdb-react-native sur mon application react-native pour interroger ma base de donnée couchDB.

Lorsque je fais un .find() sur mon application react-native vers cette base de donnée, la durée du .find() prend 5 secondes.

Si je fais un .find sur une page HTML en javascript en utilisant la librairie pouchDB et en ciblant la mĂȘme base de donnĂ©e CouchDB, la requĂȘte dure moins de 1 seconde.

(i ask the same couchDb database for the both .find() )

paulbx81 avatar Sep 12 '18 09:09 paulbx81

Merci pour les dĂ©tails 😄

J'ai du mal Ă  saisir les diffĂ©rences. Pour mon cas (base PouchDB locale sur mon app react-native), je suis obligĂ© d'utiliser le .find() de react native find ? ça va durer longtemps la requĂȘte tu penses ?

to175 avatar Sep 14 '18 09:09 to175