What is the most efficient way to retrieve all documents from Firestore at once?

After subscribing to valueChanges, I initially receive an object of length 1, as shown in the console.log (image below), and shortly after that the object with all values. However, this is not what I need. I require getting all values from the start so that I can continue working with them. Can anyone offer assistance? Thank you.

return new Promise(resolve => {
   this.store.collection('Kontaktdaten',ref => ref.where('Ankunft', '>=', timeAnkunft))
        .valueChanges()
        .subscribe((persons) => {
          personsArray = persons;
          console.log(personsArray)
          personsArray.map((person,index,array) => {
            if(person.Ende > timeEndeBesuch) {
              array.splice(index,1);
            }
          })
          resolve(personsArray);   
        })
    })

Answer №1

Have you possibly activated disk caching? If so, the initial outcome might be retrieved from the local cache.

There is no foolproof way to prevent this, but you can identify if the data is from the local cache and potentially outdated by checking its

DocumentSnapshot.metadata.fromCache
attribute.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can we create drawings within an Angular2 component using canvas?

I have created a basic component using a canvas element, and I am currently resizing it with an Input property within the corresponding TypeScript class. My goal is to draw the canvas element directly inside the class. The following code snippet shows my ...

Error in the design of PrimeNg calendar rendering in Angular 2

I have implemented the primeNg module from primefaces in Angular 2 to create a timepicker. It seems to be working, but the design appears broken. Is there something else I need to add to correct the design? Below are the versions of the packages I used: P ...

Execute consecutive Angular2 functions in a sequential manner, one following the next

In my Angular2 project, I have a service that fetches data for dropdown menus on a form. However, when I call this service multiple times with different parameters in the form component initialization, only the last call seems to work, overriding the previ ...

I encounter an issue when trying to declare an enum in TypeScript

At line 26 in my typescript file, the code snippet below shows an enum definition: export enum ItemType { Case = 'Case', Study = 'Study', Project = 'Project', Item = 'Item', } I am currently using Visual Stu ...

Deploying an Angular application

I've been diligently working on a web application project and now I'm ready to deploy it to a production server. This project includes a Rest API in PHP 7.1 with Symfony and an Angular 2 client. When testing the application locally, everything r ...

Leveraging WebStorm's TypeScript support in conjunction with node_modules

Attempting to set up a TypeScript project in WebStorm to import a Node.js module has been a struggle. I made sure to download the necessary TypeScript definition in settings and specified --module commonjs in the compiler settings. However, I keep running ...

Implementing dynamic form fields in Angular 2 to efficiently store user input in a database

Currently, I am involved in a project using Angular 2. The task is to include fields with data from the database (specifically rows with the field value 'test8'). If users want to add new fields and values, they need to click the "Add new row" bu ...

How can I retrieve the page size of Syncfusion.Grid within an Angular application?

I am integrating Syncfusion into my Angular project. Whenever a paging event occurs, I need to retrieve the current page and page size of the grid. Below are the relevant code snippets: component.html: <ejs-grid #Grid class="data-grid" (recor ...

Tips on reusing the next-auth initFirestore object to retrieve additional information from Firestore

I have successfully set up a NextJS v13.4.2 project with next-auth v4.22.1 to enable users to authenticate using the 'Login with Google' button. Additionally, I am utilizing the next-auth Firebase adapter in my current setup. The relevant configu ...

Implementing Styled API in TypeScript with props: A Comprehensive Guide

I'm currently working on styling a component using the new styled API, not to be confused with StyleComponents. const FixedWidthCell = styled(TableCell)((props: { width: number }) => ({ width: props.width || 20, textAlign: "center", })) The i ...

I am having trouble locating the name 'React' within the function variable when using Typescript with generic arguments

Is there a way to store a typescript function with generic arguments in a variable? function identity<T>(arg: T): T { return arg; } I attempted to do it like this but got an error message saying Cannot find name 'React' const identity = ...

What is preventing my data from generating a table in BootsrapVue?

My Vue script looks like this: export default { name: 'app', components: { }, data(){ return{ image: null, isLoaded: false, items: [] } }, created(){ this.divtest() this.getTimeTable() }, methods ...

How to Showcase Images in an Ionic 2 App Using HTML Content

This amazing app was built with Ionic 2 technology. It leverages a REST API to retrieve data in JSON format. Interestingly, one of the fields sent from the server is HTML content. <div [innerHTML]="'<p>' + eventMoreDetails.DescriptionHt ...

Is it impossible to conceal the status code error message in Angular 4's HttpClient?

After sending a post auth request to the server, I added an error handler for the request but encountered the following error in the console: POST http://localhost:7777/auth 401 (Unauthorized) http://prntscr.com/hdjm6h I intentionally sent a 401 code ...

Is there a way to prevent the admin from invoking Firebase functions?

I currently have two triggers set up in my Firebase functions: user onUpdate owner onUpdate When the owner onUpdate trigger is activated, it performs an operation and updates the user document accordingly. The user onUpdate trigger is invoked by the pr ...

execute several actions within a single effect

I'm trying to find a way to combine multiple actions into one effect in Angular. Currently, I have to create two separate effects to achieve this: // first effect @Effect() action1$ = this.actions$ .ofType(CoreActionTypes.MY_ACTION) .map(res => ...

Testing React Components - The `useClient` function should only be used within the `WagmiConfig` component

In my Next.js app with TypeScript, Jest, and React testing library, I encountered an error while trying to test a component. The error message states that `useClient` must be used within `WagmiConfig`. This issue arises because the `useAccount` hook relies ...

Is it recommended to exclude the NGXS NgxsLoggerPluginModule for production deployments?

When developing, it's common to use the following imports: import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin'; import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin'; Is it recommended to remove these imp ...

Issue encountered with TinyMCE integration in Angular 2

As a newcomer to Angular 2, I recently attempted to integrate the TinyMCE editor into my project. I diligently followed the instructions outlined in this guide to create and implement the TinyMCE component: Despite meticulously following each step, I enc ...

Exploring React Native Expo: A guide on selecting multiple documents from a collection using Firebase queries

Currently, I am implementing Firebase to synchronize my pet listings on the application for display in the following format: (IMAGE) Name Breed Age Shelter https://i.stack.imgur.com/y7Rpr.png But I'm facing a challenge trying to code this out b ...