Saving Documents into Collections with SODA for In-Database JavaScript
You use SodaCollection.save()
and
saveAndGet()
to save documents into collections.
These methods are similar to methods insertOne()
and
insertOneAndGet()
except that, if the collection is configured with
client-assigned document keys, and the input document provides a key that already identifies
a document in the collection, then the input document replaces the existing document.
In contrast, methods insertOne()
and insertOneAndGet()
throw an exception in that case.
Parent topic: Using SODA for In-Database JavaScript