Updates a document.
import { update, field, collection } from 'typesaurus'
type User = {
name: string,
address: {
country: string,
city: string
}
}
const users = collection<User>('users')
update(users, '00sHm46UWKObv2W7XK9e', { name: 'Sasha Koss' })
.then(() => console.log('Done!'))
// or using key paths:
update(users, '00sHm46UWKObv2W7XK9e', [
field('name', 'Sasha Koss'),
field(['address', 'city'], 'Moscow')
])
the collection to update document in
the id of the document to update
the document data to update
A promise that resolves when the operation is finished
Updates a document.
import { update, field, collection } from 'typesaurus'
type User = {
name: string,
address: {
country: string,
city: string
}
}
const users = collection<User>('users')
update(users, '00sHm46UWKObv2W7XK9e', { name: 'Sasha Koss' })
.then(() => console.log('Done!'))
// or using key paths:
update(users, '00sHm46UWKObv2W7XK9e', [
field('name', 'Sasha Koss'),
field(['address', 'city'], 'Moscow')
])
the reference to the document to set
the document data to update
A promise that resolves when the operation is finished
Updates a document.
import { update, field, collection } from 'typesaurus'
type User = {
name: string,
address: {
country: string,
city: string
}
}
const users = collection<User>('users')
update(users, '00sHm46UWKObv2W7XK9e', { name: 'Sasha Koss' })
.then(() => console.log('Done!'))
// or using key paths:
update(users, '00sHm46UWKObv2W7XK9e', [
field('name', 'Sasha Koss'),
field(['address', 'city'], 'Moscow')
])
the collection to update document in
the id of the document to update
the document data to update
A promise that resolves when the operation is finished
Updates a document.
import { update, field, collection } from 'typesaurus'
type User = {
name: string,
address: {
country: string,
city: string
}
}
const users = collection<User>('users')
update(users, '00sHm46UWKObv2W7XK9e', { name: 'Sasha Koss' })
.then(() => console.log('Done!'))
// or using key paths:
update(users, '00sHm46UWKObv2W7XK9e', [
field('name', 'Sasha Koss'),
field(['address', 'city'], 'Moscow')
])
the reference to the document to set
the document data to update
A promise that resolves when the operation is finished
Generated using TypeDoc
Type of the data passed to the update function. It extends the model making values optional and allow to set value object.