Các lượt nộp
    Danh sách bài
    Trang chủ
    Báo lỗi
    solution
    Đăng nhập
    Đăng nhập

    Đề bài: Airbnb giá/đánh giá hợp lệ

    Trong collection listingsAndReviews, truy vấn các listing có price > 200 và trường review_scores.review_scores_rating tồn tại.

    Yêu cầu hiển thị:

    • Chỉ hiển thị các trường name, price, review_scores.review_scores_rating (không hiển thị _id).
    • Sắp xếp theo price giảm dần; nếu cùng price thì theo _id tăng dần.
    • Chỉ lấy 10 kết quả đầu tiên.
    • Không cần lệnh use. Chương trình chỉ được in kết quả của một câu truy vấn này.
    • Định dạng đầu vào:

      Collection listingsAndReviews (dữ liệu mẫu sample_airbnb.listingsAndReviews) đã được nạp sẵn.

    • Định dạng đầu ra:

      Kết quả của câu find theo định dạng mongosh: một mảng 10 document. price có kiểu Decimal128; trường điểm hiển thị lồng trong review_scores. Ví dụ phần tử đầu:

      [
        {
          name: 'HS1-2人大床房+丰泽、苏宁、百脑汇+女人街+美食中心',
          price: Decimal128('11681.00'),
          review_scores: { review_scores_rating: 84 }
        },
        ...
      ]
      

    Ví dụ:

    Đầu vào:

    sample_airbnb.listingsAndReviews

    Đầu ra:

    [
      {
        name: 'HS1-2人大床房+丰泽、苏宁、百脑汇+女人街+美食中心',
        price: Decimal128('11681.00'),
        review_scores: { review_scores_rating: 84 }
      },
      {
        name: '`LM 三個睡房的整间公寓',
        price: Decimal128('10001.00'),
        review_scores: { review_scores_rating: 90 }
      },
      {
        name: 'Queen Yataklı Oda & Queen Room',
        price: Decimal128('7203.00'),
        review_scores: { review_scores_rating: 70 }
      },
      {
        name: 'Stunning Waterfront Marina bay house in Sai Kung',
        price: Decimal128('7002.00'),
        review_scores: { review_scores_rating: 94 }
      },
      {
        name: 'IPANEMA, Rio de Janeiro, Brasil',
        price: Decimal128('3730.00'),
        review_scores: { review_scores_rating: 83 }
      },
      {
        name: 'Cosy penthouse close to Barra beach',
        price: Decimal128('3544.00'),
        review_scores: { review_scores_rating: 80 }
      },
      {
        name: 'Beach Block 6bed Penthouse, Ipanema Best Location!',
        price: Decimal128('3253.00'),
        review_scores: { review_scores_rating: 88 }
      },
      {
        name: 'Kwun Tong D House Boat',
        price: Decimal128('2999.00'),
        review_scores: { review_scores_rating: 90 }
      },
      {
        name: '❤️ 6-BR APARTMENT w Kitchen + 2 Rooms!',
        price: Decimal128('2974.00'),
        review_scores: { review_scores_rating: 100 }
      },
      {
        name: 'Duplex Penthouse with Unique Rooftop Deck',
        price: Decimal128('2496.00'),
        review_scores: { review_scores_rating: 100 }
      }
    ]

    Chủ đề

    🗄️ Cơ sở dữ liệuMongodbSampledbTất cả môn học

    Đang tải editor...