Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16062

[Server] Example and commands error

    XMLWordPrintableJSON

Details

    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"} ) 

       
       

       

      Attachments

        Activity

          People

            ashley.brown@mongodb.com Ashley Brown
            2056154923h@gmail.com AX Hu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              40 weeks, 5 days ago

              Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified