The reference to a document
Firestore path
Creates a reference from a Firestore path.
The Firestore path
Reference to a document
Creates reference object to a document in given collection with given id.
import { ref, query, collection, where, Ref } from 'typesaurus'
type User = { name: string }
type Order = { user: Ref<User>, item: string }
const users = collection<User>('users')
const orders = collection<User>('orders')
query(orders, [where('user', '==', ref(users, '00sHm46UWKObv2W7XK9e')])
.then(userOrders => {
console.log(userOrders.length)
//=> 42
})
When id param is not passed it will be automatically generated:
import { ref, set, Ref } from 'typesaurus'
type User = { name: string }
const users = collection<User>('users')
const id = ref(users).id
set(users, id, {name: 'John Doe'})
The collection to create refernce in
The reference object
Creates Firestore document from a reference.
The reference to create Firestore document from
Firestore document
Generated using TypeDoc
Generates Firestore path from a reference.