CloudJoin class final

Documents of another collection attached to each document a query loads: per item, the matching document of collection goes in field as (null when none; with many, a list of every match).

A document matches by id, a key template evaluated per item (${auth.uid}_${item.id}: the matching document's id), or else when its foreignField (empty: its id) equals the item's localField:

{"collection": "user_state", "as": "state", "id": "${auth.uid}_${item.id}"}
{"collection": "user_state", "as": "state", "localField": "id", "foreignField": "cardId"}

A runtime reads the matches with a few in queries (30 keys each, live, with the collection's rules applied), not one read per item.

Annotations
  • @immutable

Constructors

CloudJoin({required String collection, required String as, String id = '', String localField = 'id', String foreignField = '', bool many = false})
const

Properties

as → String
The field of each item that gets the match.
final
collection → String
The collection's path; may hold ${...}.
final
foreignField → String
The matching documents' field; empty: their id.
final
hashCode → int
The hash code for this object.
no setteroverride
id → String
A key template giving, per item (${item.*}), the matching document's id. Empty: localField and foreignField.
final
localField → String
The item's field compared (id: its document id).
final
many → bool
Every match, as a list, instead of the first.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

fromJson(Object? json) → CloudJoin?