pub struct CollectionReference<'a> { /* private fields */ }Expand description
A reference to a collection in a Firestore database.
Implementations§
Source§impl<'a> CollectionReference<'a>
impl<'a> CollectionReference<'a>
Sourcepub fn doc(&self, document_id: &str) -> DocumentReference<'a>
pub fn doc(&self, document_id: &str) -> DocumentReference<'a>
Gets a DocumentReference for the document within the collection with the specified ID.
§Arguments
document_id- The ID of the document.
Sourcepub async fn list_documents(
&self,
) -> Result<ListDocumentsResponse, FirestoreError>
pub async fn list_documents( &self, ) -> Result<ListDocumentsResponse, FirestoreError>
Lists documents in this collection.
Sourcepub async fn add<T: Serialize>(
&self,
value: &T,
) -> Result<DocumentReference<'a>, FirestoreError>
pub async fn add<T: Serialize>( &self, value: &T, ) -> Result<DocumentReference<'a>, FirestoreError>
Adds a new document to this collection with an auto-generated ID.
§Arguments
value- The data to write to the new document.
Sourcepub fn where_filter<T: Serialize>(
&self,
field: &str,
op: FieldOperator,
value: T,
) -> Result<Query<'a>, FirestoreError>
pub fn where_filter<T: Serialize>( &self, field: &str, op: FieldOperator, value: T, ) -> Result<Query<'a>, FirestoreError>
Creates and returns a new Query with the additional filter.
Sourcepub fn order_by(&self, field: &str, direction: Direction) -> Query<'a>
pub fn order_by(&self, field: &str, direction: Direction) -> Query<'a>
Creates and returns a new Query that’s additionally sorted by the specified field.
Sourcepub fn limit(&self, limit: i32) -> Query<'a>
pub fn limit(&self, limit: i32) -> Query<'a>
Creates and returns a new Query that only returns the first matching documents.
Sourcepub fn offset(&self, offset: i32) -> Query<'a>
pub fn offset(&self, offset: i32) -> Query<'a>
Creates and returns a new Query that skips the first matching documents.
Sourcepub async fn listen(&self) -> Result<ListenStream, FirestoreError>
pub async fn listen(&self) -> Result<ListenStream, FirestoreError>
Listens to changes in the collection.
Trait Implementations§
Source§impl<'a> Clone for CollectionReference<'a>
impl<'a> Clone for CollectionReference<'a>
Source§fn clone(&self) -> CollectionReference<'a>
fn clone(&self) -> CollectionReference<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for CollectionReference<'a>
impl<'a> !RefUnwindSafe for CollectionReference<'a>
impl<'a> Send for CollectionReference<'a>
impl<'a> Sync for CollectionReference<'a>
impl<'a> Unpin for CollectionReference<'a>
impl<'a> !UnwindSafe for CollectionReference<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more