Friday, 24 January 2020

Why firestore document is not creating nor updating data?

Problem

Firestore document is not creating nor updating data

let user = db.collection('users').doc(userId);
let data = {
    timestamp: FieldValue.serverTimestamp(),
        bounties : {
            [impressionId] : {
                timestamp: timestamp,
                amount: amount,
                currency: currency
        }
    }
};

user.set(data, {merge: true});

Expectation

The below example data should be use to create or update cloud firestore document

{
   "example-user-1": {
        "bounties": {
               "example-impression-1": {
                    "timestamp": "12315443",
                    "amount": 0.0,
                    "currency": "null"
               }
         }
   }
}

Results

The document is not created

{"domain":{"domain":null,"_events":{},"_eventsCount":1,"members":[]}}


from Why firestore document is not creating nor updating data?

No comments:

Post a Comment