Been recently trying to compress within a single Map
all the values that will go within my $set
clause when performing an upsert to MongoDB.
However, this was previously done with a single typed Map[String, Long]
which worked. However, since I know that $set
may contain (and does) different types I wanted to put in there multiple fields that I do need in the $set
clause.
I've tried the following without any success.
"$set" -> Document(
item.getAs[Map[String, _]]("mapField")
)
This complains already in the IDE with Cannot resolve overloaded method Document
.
Is there any way to accomplish this without using the ++
operator and thus having more columsn spread accross the DataFrame?