
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
github.com/gregoryesberci/realm-query-builder
Advanced tools
Is a powerful query builder for Realm.js, designed to simplify and enhance the querying experience for your Realm databases.
Immutable: All API operations that change the realm-query-builder object will return a new instance instead.
npm install --save realm-query-builder
# or
yarn add realm-query-builder
Some useful links for understanding and working with Realm queries:
These resources provide in-depth information on Realm query language and its usage, helping you make the most out of realm-query-builder.
import realmQueryBuilder from 'realm-query-builder';
const users = realmQueryBuilder(realm.objects('User'))
.equalTo('active', true)
.greaterThanOrEqualTo('age', 18)
.in('country', ['BR', 'AR', 'US'])
.distinct('name')
.result();
console.log(users);
import { RealmQueryBuilder } from 'realm-query-builder';
type User = {
age: number,
active: boolean,
}
class UserQuery extends RealmQueryBuilder<User & Realm.Object> {
active() {
return this.equalTo('active', true);
}
byAge(age: number) {
return this.equalTo('age', age);
}
}
const userQuery = () => new UserQuery(realm.objects<User>('User'));
const users = userQuery()
.active()
.byAge(18)
.distinct('country')
.result();
console.log(users);
where(field: string, condition: RealmConditionalOperator, value: any): thisAdds a filter to the query with the specified property, operator and value.
filtered(query: string, ...values: any[]): thisConcatenate the query as string, like realm Collection.filtered.
equalTo(field: string, value: any, caseInsensitive?: boolean): thisFilter the data by property that match a specified value.
notEqualTo(field: string, value: any, caseInsensitive?: boolean): thisEvaluates to true expression matches property value wildcard string expression. A wildcard string expression is a string that uses normal characters with two special wildcard characters:
For example, the wildcard string d?g matches dog, dig, and dug, but not ding, dg, or a dog.
like(field: string, value: string, caseInsensitive?: boolean): thisAn alias for where(field, 'LIKE' | 'LIKE[c]', value). If caseInsensitive: true, the operator applied will be LIKE[c].
contains(field: string, value: string, caseInsensitive?: boolean): thisAn alias for where(field, 'CONTAINS' | 'CONTAINS[c]', value). If caseInsensitive: true, the operator applied will be CONTAINS[c].
beginsWith(field: string, value: string, caseInsensitive?: boolean): thisAn alias for where(field, 'BEGINSWITH' | BEGINSWITH[c], value). If caseInsensitive, true the operator applied will be BEGINSWITH[c].
endsWith(field: string, value: string, caseInsensitive?: boolean): thisAn alias for where(field, 'ENDSWITH' | ENDSWITH[c], value). If caseInsensitive: true, the operator applied will be ENDSWITH[c].
greaterThan(field: string, value: RealmNumericValueType): thisAn alias for where(field, '>', value).
greaterThanOrEqualTo(field: string, value: RealmNumericValueType): thisAn alias for where(field, '>=', value).
lessThan(field: string, value: RealmNumericValueType): thisAn alias for where(field, '<', value).
lessThanOrEqualTo(field: string, value: RealmNumericValueType): thisAn alias for where(field, '<=', value).
between(field: string, start: RealmNumericValueType, end: RealmNumericValueType): thisA between condition, same as:
realmQueryBuilder(object)
.beginGroup()
.where(field, '>=', start)
.where(field, '<=', end)
.endGroup();
or(): thisJoin previous and next conditions with the OR operator.
and(): thisJoin previous and next conditions with the AND operator, the default operator is AND.
beginGroup(): thisBegins a group for combining filter conditions in the query. Use with endGroup() to close the group.
endGroup(): thisEnds a group for combining filter conditions in the query. Should be used after starting a group with beginGroup().
Example:
realmQueryBuilder(realm.objects('User'))
.equalTo('active', true)
.beginGroup()
.equalTo('canWrite', true)
.or()
.equalTo('admin', true)
.endGroup()
.result();
in(field: string, values: ReadonlyArray<any>): thisAdds an IN filter condition to the query, filtering objects where the specified property's value matches any of the values in the provided array.
Realm.js started supporting IN in version 10.20.0, it is applied with OR chains for more compatibility.
not(): thisImplements not operator for the next operation or group.
distinct(...fields: string[]): thisAdd DISTINCT suffix, see: Realm Query Language
sorted(field: string, order?: RealmQuerySort): thisCall the sorted method, see: sorted
limit(limit: number): thisAdd LIMIT suffix, see: Realm Query Language
clone(): thisCreate a clone of the current object.
truepredicate(): thisA predicate that always evaluates to TRUE.
falsepredicate(): thisA predicate that always evaluates to FALSE.
merge(query: RealmQueryBuilder<T>)): thisMerges the current query with another RealmQueryBuilder instance.
The operators sorted and limit are not merged.
Example:
const queryA = realmQueryBuilder(realm.objects('User'))
.equalTo('active', true)
.equalTo('admin', false)
.limit(10);
const queryB = realmQueryBuilder(realm.objects('User'))
.greaterThanOrEqualTo('age', 18)
.limit(20)
.or()
.beginGroup()
.merge(queryA)
.endGroup()
.result();
min<V extends RealmNumericValueType>(property?: string): V | nullCall realm.js min
max<V extends RealmNumericValueType>(property?: string): V | nullCall realm.js max
sum(property?: string): number | nullCall realm.js sum
avg(property?: string): numberCall realm.js avg
first(): T | undefinedGet the first result.
last(): T | undefinedGet the last result.
findBy(field: string, value: any): T | undefinedApply the where(field, '==', value) condition and return the first value.
size(): numberQuery the data and get the result's size, alias to result().length
result(): Realm.Results<T>Executes the query and returns the filtered results
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.