Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
Nuxt Firebase don't return the collection array

I've made a plugin , where i need to call my firebase database to loop all collections. But after setup , the function return me a object with firestore details , but no data. In page and component I use firestore() function to get the collections.

This is my plugin/getRoutes.js

const {db} =  require('@/plugins/firebase')
var self = {
    firestore: async function() {    
        const list = db.collection('wpProducts');
        console.log("list", list);
        return  list 
    }
        
  };

module.exports = self.firestore;

This return me in console.log this Object

    DocumentReference$1 {
  firestore: Firestore {
    _delegate: FirebaseFirestore$1 {
      type: 'firestore',
      _persistenceKey: '[DEFAULT]',
      _settings: [FirestoreSettings],
      _settingsFrozen: true,
      _app: [FirebaseAppImpl],
      _databaseId: [DatabaseId],
      _credentials: [FirebaseCredentialsProvider],
      _queue: [AsyncQueueImpl],
      _firestoreClient: [FirestoreClient]
    },
    _persistenceProvider: IndexedDbPersistenceProvider {},
    INTERNAL: { delete: [Function: delete] },
    _appCompat: FirebaseAppImpl {
      firebase_: [Object],
      isDeleted_: false,
      name_: '[DEFAULT]',
      automaticDataCollectionEnabled_: false,
      options_: [Object],
      container: [ComponentContainer]
    }
  },
  _delegate: DocumentReference {
    converter: null,
    _key: DocumentKey { path: [ResourcePath] },
    type: 'document',
    firestore: FirebaseFirestore$1 {
      type: 'firestore',
      _persistenceKey: '[DEFAULT]',
      _settings: [FirestoreSettings],
      _settingsFrozen: true,
      _app: [FirebaseAppImpl],
      _databaseId: [DatabaseId],
      _credentials: [FirebaseCredentialsProvider],
      _queue: [AsyncQueueImpl],
      _firestoreClient: [FirestoreClient]
    }
  },
  _userDataWriter: UserDataWriter {
    firestore: Firestore {
      _delegate: [FirebaseFirestore$1],
      _persistenceProvider: IndexedDbPersistenceProvider {},
      INTERNAL: [Object],
      _appCompat: [FirebaseAppImpl]
    }
  }
}

In the pages I use this function to get the data, and it work without problem.

import { db } from '~/plugins/firebase'
.....
  firestore() {
    return { 
      products: db.collection('wpProducts')`
    }
}

How i can get the same array of result ? i tryed to made some changes, but I will have the same result.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda