JVM - collection.query.stream()
Process query results as a stream.
import io.nitric.Nitric;import io.nitric.resources.CollectionPermission;class User {String name;int age;public User(String name, int age) {this.name = name;this.age = age;}}public class Application {public static void main(String[] args) {var profiles = Nitric.INSTANCE.collection("profiles", User.class).with(CollectionPermission.Read);var profileQuery = profiles.query().stream();Nitric.INSTANCE.run();}}
Examples
Streaming results from a query
import io.nitric.Nitric;import io.nitric.resources.CollectionPermission;class User {String name;int age;public User(String name, int age) {this.name = name;this.age = age;}}public class Application {public static void main(String[] args) {var profiles = Nitric.INSTANCE.collection("profiles", User.class).with(CollectionPermission.Read);var profileQuery = profiles.query().stream();while (profileQuery.hasNext()) {var user = profileQuery.next();System.out.println(user);}Nitric.INSTANCE.run();}}
See also
Last updated on Oct 11, 2024