@@ -372,77 +372,14 @@ Stable API, you can redeploy it with the new MongoClient options
372
372
and be confident that future server upgrades won't negatively
373
373
impact your application.
374
374
375
- Example: :dbcommand:`count` Migration
376
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377
-
378
- This example shows how to migrate an application that implements the
379
- :dbcommand:`count` command to an alternative method of counting
380
- documents. Since the :dbcommand:`count` command does not belong to the
381
- Stable API, this application cannot use the Stable API until the
382
- :dbcommand:`count` command is removed from the code.
383
-
384
- Use the sample code to create a ``sales`` collection in
385
- :binary:`~bin.mongosh`:
386
-
387
- .. code-block:: javascript
388
-
389
- db.sales.insertMany([
390
- { "_id" : 1, "item" : "abc", "price" : 10, "quantity" : 2, "date" : ISODate("2021-01-01T08:00:00Z") },
391
- { "_id" : 2, "item" : "jkl", "price" : 20, "quantity" : 1, "date" : ISODate("2021-02-03T09:00:00Z") },
392
- { "_id" : 3, "item" : "xyz", "price" : 5, "quantity" : 5, "date" : ISODate("2021-02-03T09:05:00Z") },
393
- { "_id" : 4, "item" : "abc", "price" : 10, "quantity" : 10, "date" : ISODate("2021-02-15T08:00:00Z") },
394
- { "_id" : 5, "item" : "xyz", "price" : 5, "quantity" : 10, "date" : ISODate("2021-02-15T09:05:00Z") },
395
- { "_id" : 6, "item" : "xyz", "price" : 5, "quantity" : 5, "date" : ISODate("2021-02-15T12:05:10Z") },
396
- { "_id" : 7, "item" : "xyz", "price" : 5, "quantity" : 10, "date" : ISODate("2021-02-15T14:12:12Z") },
397
- { "_id" : 8, "item" : "abc", "price" : 10, "quantity" : 5, "date" : ISODate("2021-03-16T20:20:13Z") }
398
- ])
399
-
400
- Stable API Error Response
401
- ~~~~~~~~~~~~~~~~~~~~~~~~~
402
-
403
- For example, issuing ``db.sales.count()`` results in this error:
404
-
405
- .. code-block:: javascript
406
- :copyable: false
407
-
408
- {
409
- "ok" : 0,
410
- "errmsg" : "Provided apiStrict:true, but the command count is not in API Version 1",
411
- "code" : 323,
412
- "codeName" : "APIStrictError"
413
- }
414
-
415
- However, the :dbcommand:`aggregate` command is
416
- :ref:`in the Stable API <api-v1-command-list>` and can be used to
417
- obtain a count. Use the sample code to obtain a count from the ``sales``
418
- collection in :binary:`~bin.mongosh`:
419
-
420
- .. code-block:: javascript
421
-
422
- db.sales.aggregate([
423
- {
424
- $group: {
425
- _id: null,
426
- count: { $count: { } }
427
- }
428
- }
429
- ])
430
-
431
- This results in a document where the ``count`` field contains the
432
- number of documents in the collection:
433
-
434
- .. code-block:: javascript
435
-
436
- { "_id" : null, "count" : 8 }
437
-
438
375
How To Use Commands and Features Outside of the Stable API
439
376
----------------------------------------------------------
440
377
441
378
To use commands and features outside of the Stable API, you can
442
379
connect to your deployment with a *non-strict* client. By default,
443
380
clients are *non-strict*.
444
381
445
- Use the sample code to create a *non-strict* client:
382
+ To create a *non-strict* client, use the following sample code :
446
383
447
384
.. tabs-drivers::
448
385
@@ -571,8 +508,8 @@ Use the sample code to create a *non-strict* client:
571
508
:end-before: End Versioned API Example 3
572
509
573
510
Using this non-strict client allows you to run commands outside of the
574
- Stable API. For example, this non-strict client now allows you to
575
- use the :dbcommand:`count ` command once again .
511
+ Stable API. For example, this non-strict client allows you to run the
512
+ :dbcommand:`createUser ` command.
576
513
577
514
.. important::
578
515
@@ -581,49 +518,13 @@ use the :dbcommand:`count` command once again.
581
518
582
519
.. _api-v1-command-list:
583
520
584
- API V1 Commands
585
- ---------------
586
-
587
- API V1 protects you from API-breaking changes
588
- for the following commands:
589
-
590
- - :dbcommand:`abortTransaction`
591
- - :dbcommand:`aggregate` (with limitations) [#stable-api-command-limitations]_
592
- - :dbcommand:`authenticate`
593
- - :dbcommand:`collMod`
594
- - :dbcommand:`commitTransaction`
595
- - :dbcommand:`create` (with limitations) [#stable-api-command-limitations]_
596
- - :dbcommand:`createIndexes` (with limitations) [#stable-api-command-limitations]_
597
- - :dbcommand:`delete`
598
- - :dbcommand:`drop`
599
- - :dbcommand:`dropDatabase`
600
- - :dbcommand:`dropIndexes`
601
- - :dbcommand:`endSessions`
602
- - :dbcommand:`explain` (with limitations) [#stable-api-explain]_
603
- - :dbcommand:`find` (with limitations) [#stable-api-command-limitations]_
604
- - :dbcommand:`findAndModify`
605
- - :dbcommand:`getMore`
606
- - :dbcommand:`insert`
607
- - :dbcommand:`hello`
608
- - :dbcommand:`killCursors`
609
- - :dbcommand:`listCollections`
610
- - :dbcommand:`listDatabases`
611
- - :dbcommand:`listIndexes`
612
- - :dbcommand:`ping`
613
- - :dbcommand:`refreshSessions`
614
- - :dbcommand:`update`
615
-
616
- .. [#stable-api-command-limitations]
617
-
618
- API V1 may not support all available options for these commands.
619
- Refer to the specific command documentation for limitations specific
620
- to API V1.
621
-
622
- .. [#stable-api-explain]
623
-
624
- MongoDB does not guarantee that the output of the
625
- :dbcommand:`explain` command will conform to the same format in
626
- future API versions.
521
+ Stable API Commands
522
+ -------------------
523
+
524
+ The database commands included in Stable API V1 depend on the MongoDB
525
+ version you are using. To view the database commands included in the
526
+ Stable API and the MongoDB version they were introduced, see
527
+ :ref:`stable-api-changelog`.
627
528
628
529
Parameters
629
530
----------
@@ -695,8 +596,8 @@ ignored.
695
596
696
597
.. _api-error-responses:
697
598
698
- API Error Responses
699
- ~~~~~~~~~~~~~~~~~~~
599
+ Stable API Error Responses
600
+ --------------------------
700
601
701
602
This table shows error responses for problematic Stable API requests.
702
603
@@ -742,4 +643,5 @@ This table shows error responses for problematic Stable API requests.
742
643
:titlesonly:
743
644
:hidden:
744
645
745
- /reference/stable-api-reference
646
+ /reference/stable-api-reference
647
+ /reference/stable-api-changelog
0 commit comments