Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
How do I get database data using firebase/nuxtjs

I don't know how to get the data via

this.$fire.database

I've read the firebase docs but in firebase/nuxtJs different it becomes easier https://firebase.nuxtjs.org/

In firebase docs

import { getDatabase, ref, onValue} from "firebase/database";

const db = getDatabase();
const starCountRef = ref(db, 'posts/' + postId + '/starCount');
onValue(starCountRef, (snapshot) => {
  const data = snapshot.val();
  updateStarCount(postElement, data);
});


But when I call onValue, it doesn't find it

this.$fire.database.onValue()

nuxt.config.js file

  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    [
      '@nuxtjs/firebase',
      {
        config: {
          apiKey: "<private data>",
          authDomain: "<private data>",
          projectId: "<private data>",
          storageBucket: "<private data>",
          messagingSenderId: "<private data>",
          appId: "<private data>"
        },
        services: {
          auth: true, // Just as example. Can be any other service.
          database: {
            emulatorPort: 3000,
            emulatorHost: 'localhost',
          }
        },
      }
    ]
  ],
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Simply

this.$fire.database.ref('name').on("value", function(e) {
  console.log(e.val())
})

simple explanation :

ref("name")

in Realtime Database : enter image description here

Whenever the value is changed, the function will run

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!