How to save a large array of objects in a native reaction using the-native-db-model reaction

storage.people.add_all(people_array, function(people_array){
  console.log("people_array",people_array)
});

people_array is about 1000 entries, and the limit may exceed in the future.

This method takes more than 5 minutes to save in db, so performance is too slow. Someone tell me how to continue the db structure.

Thanks in advance.

+4
source share
1 answer

Well, you will need to insert all the records into one object, and insert them in a row after row. If you want to do this, you will have to insert between the installation procedure. But it is recommended to insert one monolithic object once, as shown below.

storage.people.add(people_array, function(people_array){
 console.log("people_array",people_array)
});

This should reduce the time it takes to save records.

+2

Source: https://habr.com/ru/post/1649236/


All Articles