Skip to content

Queries and live results

Barq query results are live. When the database changes, results can update.

const allTasks = barq.objects(Task);
const openTasks = allTasks.filtered('done == false');
const newestFirst = openTasks.sorted('createdAt', true);

@barq/react wraps live results in hooks.

import { useQuery } from '@barq/react';
function TaskList() {
const tasks = useQuery(Task);
return null;
}

The Native SDK exposes query and results APIs through barq_native/results.hpp and the main barq_native/sdk.hpp include.

Use results when a screen needs a collection that can change over time.