Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find is undefined... #107

Open
to175 opened this issue Sep 10, 2018 · 8 comments
Open

Find is undefined... #107

to175 opened this issue Sep 10, 2018 · 8 comments

Comments

@to175
Copy link

to175 commented Sep 10, 2018

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
@paulbx81
Copy link

install pouchdb-find and add this to your code :

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

PouchDB.plugin(find)

@to175
Copy link
Author

to175 commented Sep 11, 2018

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 ?

@paulbx81
Copy link

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

@to175
Copy link
Author

to175 commented Sep 12, 2018

Thanks you,

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

@paulbx81
Copy link

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)

@to175
Copy link
Author

to175 commented Sep 12, 2018

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://....') ?

@paulbx81
Copy link

paulbx81 commented Sep 12, 2018

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() )

@to175
Copy link
Author

to175 commented Sep 14, 2018

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants