insertMultiple
Insert multiple items with a single schema to collection
my_collection.insertMultiple(
[
{key: value},
{key: value}
],
schema,
() => // removed successfully,
(error) => alert(error)
);
parameter | required | types |
data (input) | yes | array of objects |
schema | yes | schema variable |
success callback | yes | function |
failure callback | yes | function |
import React,{useEffect} from 'react';
import {Text} from 'react-native';
import {Pleex} from 'pleex';
const App = () => {
// Create collection
const my_collection = Pleex.collection('myCollection');
// Create schema
const my_schema = Pleex.schema({
name: String,
});
// Insert to my collection
my_collection.insertMultiple(
[
{name: 'John'},
{name: 'Smith'},
{name: 'Sara'}
],
mySchema,
(success) => alert('success'),
(error) => alert(error)
);
return (
<>
<Text>Try Multiple insert</Text>
</>
);
};
export default App;
Last modified 3yr ago