I have a collection and i want to both create document and then add to its arrays values or if document exist only add the values to the arrays. Here what I've tried.
addMessage() {
if(this.message.length < 30 && this.message.length > 10) {
alert('ok')
var new= db.collection("messages").doc(this.alias)
new.set( {
messages: this.message,
date: Date.now()
})
} else {
alert('no')
}
when i use set like above it works BUT i want to add values to array so i try and use add but i get error "new.add is not a function"