Created
March 2, 2023 10:57
-
-
Save RomikMakavana/7b8dd679ea4ed45defe7c9f27ca89f49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Realm from 'realm'; | |
const PersonSchema = { | |
name: 'Person', | |
properties: { | |
id: 'string', | |
name: 'string', | |
}, | |
}; | |
// Open the realm database | |
const realm = new Realm({ schema: [PersonSchema] }); | |
// Define the names to search for | |
const namesToSearch = ['Alice', 'Bob', 'Charlie']; | |
// Query the database for persons whose name is in the namesToSearch array | |
const persons = realm.objects('Person').filtered('name IN $0', namesToSearch); | |
// Do something with the matching persons | |
console.log(persons.length + ' persons found'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment