vasern / vasern

Vasern is a fast, lightweight and open source data storage for React Native

Home Page:https://vasern.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: save is not defined

saibharani opened this issue · comments

I am trying to insert a document to Todos using this
Todos.insert({ name: this.state.name, note: "Using Vasern", completed: false },save=true)
but it gives error as save is not defined
if i remove save and try it executes but the added data is not reflected in Todos.get()
I am using it with React-native-v8 engine
and Thanks for this Library This actually supports external js engine like Hermes or v8 while famous db like Realm doesn't

Hey @saibharani, welcome to the group! I didn't know that Realm doesn't support Hermes, I guess they will do soon.

By the way, you don't need to set save=true. In the document, save=true means save is a boolean value, and is set to true by default. Sorry for the confusion

So you just need to Todos.insert({ name: this.state.name, note: "Using Vasern", completed: false })

but if I don't set save=true when I reload the app using
Todos.onLoaded(()=>{ var todoItem = Todos.get(); console.log(todoItem) })
it is not showing the new inserted document
and realm crashes when used with hermes or v8 they say of planning to support but they have not started any work on it and they depend a lot on native JSC so they may take time to support them and i think its better if you update Readme.md with the support info

Ah ok, to get all data, you'll need to use Todos.data() instead of Todos.get() since get is used to retrieve a specific record.

You can find information about using vasern in our Documentation

ok Thank you i got it and its working now
Thanks again for this database even though this is not related to this issue have you done any performance comparison between Realm and Varsen. Which is more performing when used with FlatList

@saibharani I have not done the benchmark between Vasern and Realm for using FlatList. To be honest, there are many differences between 2 databases (in term of APIs and the underlying backend)

If your application doesn't require intensive workloads (hundred of thousands of records) every time the app running, then Vasern is suitable for the app. Otherwise, you might see performance issue

P/s: the issue will be tackle sometimes in the future

Ok thanks for the support i am closing this issue