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

196
Views
Error when creating or overwriting a document in firebase

I am trying to add user or overwrite the user document in case the user already exists but I am getting this error:

FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore

What am I doing wrong?

import { auth, db }  from "../firebase"
import {doc, setDoc} from 'firebase/firestore'
import { useEffect } from "react";


unction MyApp({ Component, pageProps }) {

  useEffect(() => {
    if(user){
      setDoc(doc(db, 'users', user?.uid), {
        email : user.email,
        lastSeen: firebase.firestore.FieldValue.serverTimestamp(),
        photoURL : user.photoURL
      }, {merge: true});
    }
  }, [user])
}

export default MyApp
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

i was using the firebase v8 to call the serverTimestamp() method v8 module

firebase.firestore.FieldValue.serverTimestamp()

v9 module

 serverTimestamp()
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!