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: Index cho dữ liệu địa lý đơn giản

    Thực hiện các bước sau: • Tạo index (tăng dần) cho trường depth • Truy vấn các vụ đắm tàu có depth > 100 • Chỉ in ra: feature_type, depth (không hiển thị _id) • Sắp xếp theo depth giảm dần

    Chương trình in đúng hai thứ: tên index vừa tạo và mảng kết quả truy vấn (không cần lệnh use).

    • Định dạng đầu vào:

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

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

      Dòng đầu là tên index, tiếp theo là mảng kết quả theo định dạng mongosh, ví dụ:

      depth_1
      [
        { feature_type: 'Wrecks - Submerged, nondangerous', depth: 1828.8 },
        ...
      ]
      

    Ví dụ:

    Đầu vào:

    sample_geospatial.shipwrecks

    Đầu ra:

    depth_1
    [
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 1828.8 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 504.7 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 179.2 },
      { feature_type: '', depth: 159.1 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 126.1 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 124.9 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 123.1 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 120.3 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 113.3 },
      { feature_type: 'Wrecks - Submerged, nondangerous', depth: 105.1 }
    ]

    Chủ đề

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

    Đang tải editor...