Skip to content

Commit dd356f0

Browse files
authored
docs: Display ES2017 usage by default (#2575)
NODE-2892
1 parent 8897259 commit dd356f0

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

docs/reference/content/tutorials/crud.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This tutorial covers both the basic CRUD methods and the specialized ``findAndMo
1818
as well as the new Bulk API methods for efficient bulk write operations.
1919

2020
<div class="pull-right">
21-
<input type="checkbox" checked="" class="distroPicker" data-toggle="toggle" data-on="ES2015" data-off="ES2017" data-offstyle="success">
21+
<input type="checkbox" checked="" class="distroPicker" data-toggle="toggle" data-on="ES2017" data-off="ES2015" data-offstyle="success">
2222
</div>
2323

2424

@@ -33,7 +33,7 @@ The ``insertOne`` and ``insertMany`` methods exist on the ``Collection`` class a
3333

3434

3535

36-
<section class="javascript5"><pre><code class="hljs">
36+
<section class="javascript5 hidden"><pre><code class="hljs">
3737
{{% myproject-connect %}}
3838

3939
// Insert a single document
@@ -52,7 +52,7 @@ The ``insertOne`` and ``insertMany`` methods exist on the ``Collection`` class a
5252
});
5353

5454
</code></pre></section>
55-
<section class="javascript6 hidden"><pre><code class="hljs">
55+
<section class="javascript6"><pre><code class="hljs">
5656
{{% js6-connect %}}
5757

5858
// Insert a single document
@@ -90,7 +90,7 @@ The ``insertOne`` and ``insertMany`` methods also accept a second argument which
9090
The following example shows how to serialize a passed-in function when writing to a
9191
[replica set](https://docs.mongodb.org/manual/core/replica-set-members/).
9292

93-
<section class="javascript5"><pre><code class="hljs">
93+
<section class="javascript5 hidden"><pre><code class="hljs">
9494
{{% myproject-connect %}}
9595

9696
// Insert a single document
@@ -108,7 +108,7 @@ The following example shows how to serialize a passed-in function when writing t
108108
});
109109
});
110110
</code></pre></section>
111-
<section class="javascript6 hidden"><pre><code class="hljs">
111+
<section class="javascript6"><pre><code class="hljs">
112112
{{% js6-connect %}}
113113

114114
// Insert a single document
@@ -140,7 +140,7 @@ when inserting documents with the ``insertMany`` method.
140140
The Decimal128 data type requires MongoDB server version 3.4 or higher.
141141
{{% /note %}}
142142

143-
<section class="javascript5"><pre><code class="hljs">
143+
<section class="javascript5 hidden"><pre><code class="hljs">
144144
const Long = require('mongodb').Long;
145145
const Decimal = require('mongodb').Decimal128;
146146

@@ -158,7 +158,7 @@ const Decimal = require('mongodb').Decimal128;
158158
});
159159

160160
</code></pre></section>
161-
<section class="javascript6 hidden"><pre><code class="hljs">
161+
<section class="javascript6"><pre><code class="hljs">
162162
const Long = require('mongodb').Long;
163163
const Decimal = require('mongodb').Decimal128;
164164

@@ -191,7 +191,7 @@ The above operation inserts the following documents into the
191191

192192
The ``updateOne`` and ``updateMany`` methods exist on the ``Collection`` class and are used to update and upsert documents.
193193

194-
<section class="javascript5"><pre><code class="hljs">
194+
<section class="javascript5 hidden"><pre><code class="hljs">
195195
{{% myproject-connect %}}
196196

197197
const col = db.collection('updates');
@@ -226,7 +226,7 @@ The ``updateOne`` and ``updateMany`` methods exist on the ``Collection`` class a
226226
});
227227
});
228228
</code></pre></section>
229-
<section class="javascript6 hidden"><pre><code class="hljs">
229+
<section class="javascript6"><pre><code class="hljs">
230230
{{% js6-connect %}}
231231

232232
// Get the updates collection
@@ -276,7 +276,7 @@ Just as for ``insert``, the ``update`` method allows you to specify a per operat
276276

277277
The ``deleteOne`` and ``deleteMany`` methods exist on the ``Collection`` class and are used to remove documents from MongoDB.
278278

279-
<section class="javascript5"><pre><code class="hljs">
279+
<section class="javascript5 hidden"><pre><code class="hljs">
280280
{{% myproject-connect %}}
281281

282282
const col = db.collection('removes');
@@ -300,7 +300,7 @@ The ``deleteOne`` and ``deleteMany`` methods exist on the ``Collection`` class a
300300
});
301301
});
302302
</code></pre></section>
303-
<section class="javascript6 hidden"><pre><code class="hljs">
303+
<section class="javascript6"><pre><code class="hljs">
304304
{{% js6-connect %}}
305305

306306
// Get the removes collection
@@ -343,7 +343,7 @@ allow the user to update or upsert a document and have the modified or existing
343343
methods, the operation takes a write lock for the duration of the operation in order to ensure the modification is
344344
[atomic](https://docs.mongodb.org/manual/core/write-operations-atomicity/).
345345

346-
<section class="javascript5"><pre><code class="hljs">
346+
<section class="javascript5 hidden"><pre><code class="hljs">
347347
{{% myproject-connect %}}
348348

349349
const col = db.collection('findAndModify');
@@ -371,7 +371,7 @@ methods, the operation takes a write lock for the duration of the operation in o
371371
});
372372
});
373373
</code></pre></section>
374-
<section class="javascript6 hidden"><pre><code class="hljs">
374+
<section class="javascript6"><pre><code class="hljs">
375375
{{% js6-connect %}}
376376

377377
// Get the findAndModify collection
@@ -414,7 +414,7 @@ The ``findOneAndUpdate`` method also accepts a third argument which can be an op
414414

415415
The ``findOneAndDelete`` function is designed to help remove a document.
416416

417-
<section class="javascript5"><pre><code class="hljs">
417+
<section class="javascript5 hidden"><pre><code class="hljs">
418418
{{% myproject-connect %}}
419419

420420
const col = db.collection('findAndModify');
@@ -435,7 +435,7 @@ The ``findOneAndDelete`` function is designed to help remove a document.
435435
});
436436
});
437437
</code></pre></section>
438-
<section class="javascript6 hidden"><pre><code class="hljs">
438+
<section class="javascript6"><pre><code class="hljs">
439439
{{% js6-connect %}}
440440

441441
// Get the findAndModify collection
@@ -471,7 +471,7 @@ Like ``findOneAndUpdate``, it allows an object of options to be passed in which
471471

472472
The ``bulkWrite`` function allows a simple set of bulk operations to run in a non-fluent way, in comparison to the bulk API discussed next.
473473

474-
<section class="javascript5"><pre><code class="hljs">
474+
<section class="javascript5 hidden"><pre><code class="hljs">
475475
{{% myproject-connect %}}
476476

477477
// Get the collection
@@ -498,7 +498,7 @@ The ``bulkWrite`` function allows a simple set of bulk operations to run in a no
498498
});
499499
});
500500
</code></pre></section>
501-
<section class="javascript6 hidden"><pre><code class="hljs">
501+
<section class="javascript6"><pre><code class="hljs">
502502
{{% js6-connect %}}
503503

504504
// Get the collection
@@ -540,7 +540,7 @@ The ``bulkWrite`` function takes an array of operations which can be objects of
540540

541541
Bulk write operations make it easy to write groups of operations together to MongoDB. There are some caveats and to get the best performance you need to be running against MongoDB version 2.6 or higher, which supports the new write commands. Bulk operations are split into *ordered* and *unordered* bulk operations. An *ordered* bulk operation guarantees the order of execution of writes while the *unordered* bulk operation makes no assumptions about the order of execution. In the Node.js driver the *unordered* bulk operations will group operations according to type and write them in parallel.
542542

543-
<section class="javascript5"><pre><code class="hljs">
543+
<section class="javascript5 hidden"><pre><code class="hljs">
544544
{{% myproject-connect %}}
545545

546546
const col = db.collection('bulkops');
@@ -566,7 +566,7 @@ Bulk write operations make it easy to write groups of operations together to Mon
566566
});
567567
});
568568
</code></pre></section>
569-
<section class="javascript6 hidden"><pre><code class="hljs">
569+
<section class="javascript6"><pre><code class="hljs">
570570
{{% js6-connect %}}
571571

572572
// Get the collection
@@ -641,7 +641,7 @@ The main method for querying the database is the ``find`` method.
641641

642642
The following example materializes all the documents from a query using the ``toArray`` method, but limits the number of returned results to two documents.
643643

644-
<section class="javascript5"><pre><code class="hljs">
644+
<section class="javascript5 hidden"><pre><code class="hljs">
645645
{{% myproject-connect %}}
646646

647647
const col = db.collection('find');
@@ -659,7 +659,7 @@ The following example materializes all the documents from a query using the ``to
659659
});
660660
});
661661
</code></pre></section>
662-
<section class="javascript6 hidden"><pre><code class="hljs">
662+
<section class="javascript6"><pre><code class="hljs">
663663
{{% js6-connect %}}
664664

665665
// Get the collection
@@ -715,7 +715,7 @@ More information can be found in the [Cursor API documentation](/node-mongodb-na
715715

716716
The following example uses the ``next`` method.
717717

718-
<section class="javascript5"><pre><code class="hljs">
718+
<section class="javascript5 hidden"><pre><code class="hljs">
719719
{{% myproject-connect %}}
720720

721721
const col = db.collection('find');
@@ -733,7 +733,7 @@ The following example uses the ``next`` method.
733733
});
734734
});
735735
</code></pre></section>
736-
<section class="javascript6 hidden">
736+
<section class="javascript6">
737737
In ECMAScript 6, The new `generator` functions allow for what is arguably a
738738
much cleaner and easier way to read iteration code.
739739

docs/reference/static/js/toggle-switch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ $(document).ready(function(){
22
$('.distroPicker').bootstrapToggle();
33
$('.distroPicker').change(function () {
44
if ($('.distroPicker').prop('checked')) {
5-
$('.javascript6').addClass('hidden');
6-
$('.javascript5').removeClass('hidden');
7-
} else {
85
$('.javascript5').addClass('hidden');
96
$('.javascript6').removeClass('hidden');
7+
} else {
8+
$('.javascript6').addClass('hidden');
9+
$('.javascript5').removeClass('hidden');
1010
}
1111
});
12-
});
12+
});

0 commit comments

Comments
 (0)