Comments (1)
Hi ! I have a similar issue:
On project 1 (WORKS):
import * as admin from 'firebase-admin';
item.date = new admin.firestore.Timestamp(timestampData);
await admin.firestore().collection('test').doc(test.id).update({ item: item });
"firebase-admin": "^9.8.0"
On project 2 (DOESN'T WORK):
import * as admin from 'firebase-admin';
const { Timestamp } = require('@google-cloud/firestore'); // Had to change here because previous one was making error
item.date = new Timestamp(timestampData);
await admin.firestore().collection('test').doc(test.id).update({ item: item });
Error: Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Value for argument "dataOrField" is not a valid Firestore document. Detected an object of type "Timestamp" that doesn't match the expected instance (found in field "item.date"). Please ensure that the Firestore types you are using are from the same NPM package.)
"firebase-admin": "^11.5.0"
In the end I followed this guy solution: https://stackoverflow.com/questions/68384853/firebase-firestore-timestamp-fromdate-is-undefined and save the date as a JS date
item.date = new Date(timestampData._seconds * 1000);
from fireorm.
Related Issues (20)
- Can't resolve 'class-validator' typescript HOT 1
- Support for BulkWriter HOT 2
- Getter methods decorated with @Ignore() are still saved HOT 2
- plainToClass is undefined HOT 2
- TypeError: classTransformer.plainToClass error when trying to find document from DB HOT 2
- Rename id in collection to _id HOT 2
- Feature Request: Support generic validation HOT 3
- The result of build has some nulls removed
- Error: Collection with name ClubPlayers has already been registered HOT 1
- how to parameterize the complex query options? HOT 1
- There is a way to auto query subcollections? HOT 2
- If we are inside a transaction, our subcollections should also be TransactionRepositories HOT 1
- Querying subcollection of subcollection seems to inject random doc number on its path HOT 1
- SubCollection does not create HOT 2
- Project Status HOT 2
- Querying missing fields HOT 3
- Add firestore timestamps to entities HOT 1
- Error: Firestore must be initialized first - on using customRepository HOT 2
- Feature Request: Graceful Handling of Duplicate Collections/Subcollections for Fireorm v >=0.18.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fireorm.