Pleex
Search…
getItem
Find and get objects, this is for single results

getItem({key: value, ...} , (data)=> {}, (error)=> {})

How to use:

1
my_collection.getItem(
2
{key: value},
3
(data) => // data can access here,
4
(error) => alert(error)
5
);
Copied!

Arguments:

parameter
required
types
search object
yes
object
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
// Get all data saved
11
my_collection.getItem(
12
{ age: 12 },
13
(data) => // data can access here,
14
(error) => alert(error)
15
);
16
17
return (
18
<>
19
<Text>Try getItem api</Text>
20
</>
21
);
22
23
};
24
25
export default App;
Copied!

Tips:

  1. 1.
    if many items exists and matches with object you provide, getItem only return the last matched one.
  2. 2.
    to get list of matched items use getItems.
  3. 3.
    if pleex don't find anything its return undefined
Last modified 2yr ago