Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RomikMakavana/7b8dd679ea4ed45defe7c9f27ca89f49 to your computer and use it in GitHub Desktop.
Save RomikMakavana/7b8dd679ea4ed45defe7c9f27ca89f49 to your computer and use it in GitHub Desktop.
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