Details
-
Task
-
Resolution: Fixed
-
Critical - P2
-
currentVersion
-
Windows 10
Microsoft Edge 112.0.1722.48
Description
There are 2 errors in Create a View with Default Collation — MongoDB Manual.
Q1: The example blow is error: list in JSON need ","(See in attach file: image-2023-04-24-21-11-14-574.png):
db.places.insertMany([
|
{ _id: 1, category: "café" } |
{ _id: 2, category: "cafe" } |
{ _id: 3, category: "cafE" } |
])
|
It should be like below:
db.places.insertMany([
|
{ _id: 1, category: "café" }, |
{ _id: 2, category: "cafe" }, |
{ _id: 3, category: "cafE" } |
])
|
Q2: The command Collection.count() is deprecated(See in attach file: image-2023-04-24-21-34-42-499.png):
db.placesView.count( { category: "cafe" } ) |
I suggest to use Collection.countDocuments():
db.placesView.countDocuments( {category: "cafe"} ) |