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

300
Views
¿Cómo usar firebase.firestore.FieldValue.serverTimestamp() ahora?

Estoy siguiendo un tutorial y firebase.firestore.FieldValue.serverTimestamp() se usa en el código para establecer la propiedad de timestamp de tiempo como la marca de tiempo del servidor.

 import firebase from "firebase";
 const someFunction = () => { addDoc(collection(db, `rooms/${roomId}/messages`), { message: input, name: user.displayName, timestamp: firebase.firestore.FieldValue.serverTimestamp(), }).then((res) => getMessagesData()); };

Pero me sale este error.

 Module not found: Can't resolve 'firebase' in ...

Supongo que firebase tenía algún tipo de actualización que no importamos con import firebase from "firebase"; ¿más? ¿Qué debo hacer para usar servertimestamp() ?

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

0

Para obtener una muestra actualizada, consulte la documentación sobre cómo agregar una marca de tiempo del lado del servidor , que contiene este fragmento

 import { updateDoc, serverTimestamp } from "firebase/firestore"; const docRef = doc(db, 'objects', 'some-id'); // Update the timestamp field with the value from the server const updateTimestamp = await updateDoc(docRef, { timestamp: serverTimestamp() });

La documentación tiene ejemplos en paralelo tanto para la nueva sintaxis modular v9 como para la sintaxis anterior que probablemente encontrará en muchos tutoriales de terceros, por lo que puede buscar cómo traducir el código a la sintaxis más nueva. La guía de actualización también es una buena manera de comenzar con eso.

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!