Pleex
Search…
Insert
Insert to collections, by this method you can insert data with your schema's into your collection

insert({data}, schema, (success)=> {}, (error)=> {})

How to use:

1
my_collection.insert(
2
{key: value},
3
mySchema,
4
(success) => alert('Hoorai'),
5
(error) => alert(error)
6
);
Copied!

Arguments:

parameter
required
types
data
yes
object
schema
yes
schema variable
success callback
yes
function
failure callback
yes
function

Example:

1
import React,{useEffect} from 'react';
2
import {Text} from 'react-native';
3
import {Pleex} from 'pleex';
4
5
const App = () => {
6
7
// Create collection
8
const my_collection = Pleex.collection('myCollection');
9
10
// Create schema
11
const my_schema = Pleex.schema({
12
name: String,
13
age: Number,
14
logged: Boolean,
15
});
16
17
// Insert to my collection
18
my_collection.insert(
19
{
20
name: 'John',
21
age: 12,
22
logged: false
23
},
24
mySchema,
25
(success) => alert('success'),
26
(error) => alert(error)
27
);
28
29
return (
30
<>
31
<Text>Try Schemas</Text>
32
</>
33
);
34
35
};
36
37
export default App;
Copied!
Last modified 2yr ago