From f96a26eebad7a5a1e645e504db17b74f8c640785 Mon Sep 17 00:00:00 2001 From: hax Date: Mon, 24 Apr 2023 23:25:21 +0800 Subject: [PATCH 1/2] list in JSON need ',' to split --- source/core/views/specify-collation.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/core/views/specify-collation.txt b/source/core/views/specify-collation.txt index e0d2b9a1382..7d898dc8346 100644 --- a/source/core/views/specify-collation.txt +++ b/source/core/views/specify-collation.txt @@ -19,8 +19,8 @@ Create a ``places`` collection with the following documents: .. code-block:: javascript db.places.insertMany([ - { _id: 1, category: "café" } - { _id: 2, category: "cafe" } + { _id: 1, category: "café" }, + { _id: 2, category: "cafe" }, { _id: 3, category: "cafE" } ]) @@ -30,10 +30,10 @@ level: .. code-block:: javascript db.createView( - "placesView", + "placesView", "places", [ { $project: { category: 1 } } ], - { collation: { locale: "fr", strength: 1 } } + { collation: { locale: "fr", strength: 1 } } ) The following operation uses the view's collation: From 8fd1fadaa761ff45708bb0f2fd0226a840a04efa Mon Sep 17 00:00:00 2001 From: hax Date: Mon, 24 Apr 2023 23:32:12 +0800 Subject: [PATCH 2/2] Collection.count() is deprecated, Using Collection.countDocuments() is better --- source/core/views/specify-collation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/views/specify-collation.txt b/source/core/views/specify-collation.txt index 7d898dc8346..8500ecb5188 100644 --- a/source/core/views/specify-collation.txt +++ b/source/core/views/specify-collation.txt @@ -40,7 +40,7 @@ The following operation uses the view's collation: .. code-block:: javascript - db.placesView.count( { category: "cafe" } ) + db.placesView.countDocuments( { category: "cafe" } ) The operation returns ``3``.