diff --git a/source/reference/method/db.collection.save.txt b/source/reference/method/db.collection.save.txt index 5a650855bb8..d34e00d2915 100644 --- a/source/reference/method/db.collection.save.txt +++ b/source/reference/method/db.collection.save.txt @@ -61,7 +61,7 @@ the ``item`` field set to ``book`` and ``qty`` field set to ``40``: .. code-block:: javascript - db.products.save( { item: "book", qty: 40 } ) + db.products.save({ item: "book", qty: 40 }) The inserted document includes an ``_id`` field with the generated ``ObjectId`` value: @@ -78,25 +78,23 @@ This example inserts a new document into the .. code-block:: javascript - db.bios.save( - { - name: { first: 'Guido', last: 'van Rossum'}, - birth: new Date('Jan 31, 1956'), - contribs: [ 'Python' ], - awards: [ - { - award: 'Award for the Advancement of Free Software', - year: 2001, - by: 'Free Software Foundation' - }, - { - award: 'NLUUG Award', - year: 2003, - by: 'NLUUG' - } - ] - } - ) + db.bios.save({ + name: { first: 'Guido', last: 'van Rossum'}, + birth: new Date('Jan 31, 1956'), + contribs: [ 'Python' ], + awards: [ + { + award: 'Award for the Advancement of Free Software', + year: 2001, + by: 'Free Software Foundation' + }, + { + award: 'NLUUG Award', + year: 2003, + by: 'NLUUG' + } + ] + }) The inserted document includes an ``_id`` field with the generated ``ObjectId`` value. @@ -124,7 +122,7 @@ to ``30``: .. code-block:: javascript - db.products.save( { _id: 100, item: "water", qty: 30 } ) + db.products.save({ _id: 100, item: "water", qty: 30 }) The operation results in the following new document in the ``products`` collection: @@ -144,21 +142,19 @@ This example creates a new document in the .. code-block:: javascript - db.bios.save( - { - _id: 10, - name: { first: 'Yukihiro', aka: 'Matz', last: 'Matsumoto'}, - birth: new Date('Apr 14, 1965'), - contribs: [ 'Ruby' ], - awards: [ - { - award: 'Award for the Advancement of Free Software', - year: '2011', - by: 'Free Software Foundation' - } - ] - } - ) + db.bios.save({ + _id: 10, + name: { first: 'Yukihiro', aka: 'Matz', last: 'Matsumoto'}, + birth: new Date('Apr 14, 1965'), + contribs: [ 'Ruby' ], + awards: [ + { + award: 'Award for the Advancement of Free Software', + year: '2011', + by: 'Free Software Foundation' + } + ] + }) Replace an Existing Document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~