thewei / react-native-store

A simple database base on react-native AsyncStorage.
https://github.com/thewei/react-native-store
Other
569 stars 74 forks source link

is it possible to replace entire model data? #23

Closed chandu0101 closed 8 years ago

chandu0101 commented 8 years ago

Hi, In my app i am backing up client data on server while restoring i want to copy server data to client, is there any API to directly replace all rows of model, instead of remove all and then adding one by one!.

kintsugi commented 8 years ago

Yes. By not passing a where filter (or any filter at all) the whole set of data for the model is used.

var userModel = reactNativeStore.model('user');
userModel.update ({/* new data */});
chandu0101 commented 8 years ago

perfect thanks :)