Closed narayanchoudhary closed 1 year ago
@narayanchoudhary you can pass a custom storage, it just need to respect this interface: https://github.com/antoniopresto/react-native-local-mongodb/blob/master/index.d.ts#L2-L15 https://github.com/antoniopresto/react-native-local-mongodb/blob/master/config/AsyncStorageMock.js#L6-L29 To be honest, I don't know if something changed in asyncStorage since last time I updated it.
I used this package @react-native-async-storage/async-storage
instead of @react-native-community/async-storage
and the problem solved and used the latest version also
This code was working
const Datastore = require('react-native-local-mongodb'); export const cashBooksDB = new Datastore({ filename: 'cashBooks9.scb', autoload: true, timestampData: true }); export const settingsDB = new Datastore({ filename: 'settings9.scb', autoload: true, timestampData: true, }); export const transactionsDB = new Datastore({ filename: 'simpleCashBook2.scb', autoload: true, timestampData: true });
then I upgraded this package's version from 2.2.9 to 4.0.0 which require you to add asycstorage in options the code works but the old data is getting wipeout
const Datastore = require('react-native-local-mongodb'); import AsyncStorage from '@react-native-community/async-storage'; export const cashBooksDB = new Datastore({ filename: 'cashBooks9.scb', autoload: true, timestampData: true, storage: AsyncStorage }); export const settingsDB = new Datastore({ filename: 'settings9.scb', autoload: true, timestampData: true, storage: AsyncStorage }); export const transactionsDB = new Datastore({ filename: 'simpleCashBook2.scb', autoload: true, timestampData: true, storage: AsyncStorage });
Can i pass somthing else in asycstorage? Where was it previously storing the data?