In node, working with firestore models can be tricky. When you use a new keyword to initialise an object, Firestore throws error.
There are two ways to solve this.
The simplest way to do it to stringify and parse JSON, but it won’t be effective when you are working with Date/Timestamp object.
firestore.collection('my-collection') .doc() .create(JSON.parse(JSON.stringify(data)))
To solve this I created a parse method.
This method is capable of converting to array as well as object to plain.
Hope this helps.