I am trying to set non-null values to a document in Firestore. There is a way to use Java map object to do this. Fields under custom objects in Cloud Firestore have null value. How to avoid this?The same approach using node js does not seem to work .
Here is my code snippet:
var map = new Map();
map.set('userName', 'hellokitty');
return db.collection('users').doc(uid)
.set(map)
.catch(error => {
throw new functions.https.HttpsError('unknown', error.message, error);
})
This code returns the following error message:
Error: Argument "data" is not a valid Document. Input is not a plain JavaScript object.
Does firestore supports use of javascript map objects? Is there anything I am missing here?
Just use a regular JavaScript object with properties that describe the document.
See the documentation.