From bf1b93da64a540b38d20e01abfdb6e28612c4f92 Mon Sep 17 00:00:00 2001 From: Allison Moore Date: Tue, 9 Dec 2014 15:12:33 -0500 Subject: [PATCH] improvements to set reference --- source/reference/operator/update/set.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/reference/operator/update/set.txt b/source/reference/operator/update/set.txt index 21b5f4864e3..6ff5a78038d 100644 --- a/source/reference/operator/update/set.txt +++ b/source/reference/operator/update/set.txt @@ -9,7 +9,7 @@ Definition .. update:: $set - The :update:`$set` operator replaces the value of a field to the + The :update:`$set` operator replaces the value of a field with the specified value. The :update:`$set` operator expression has the following form: @@ -23,11 +23,16 @@ Definition Behavior -------- -If the field does not exist, :update:`$set` will add the field with the -specified value. If you specify a dotted path for a non-existent field, -:update:`$set` will also create the embedded documents *as needed* to +If the field does not exist, :update:`$set` will add a new field with the +specified value, provided that the new field does not violate a type +constraint. +If you specify a dotted path for a non-existent field, +:update:`$set` will create the embedded documents *as needed* to fulfill the dotted path to the field. +If you specify multiple field-value pairs, :update:`$set` will update +or create each field. + Examples --------