Exercises

Exercise 1

  • Using restaurants

  • Build a text index to the 'name' field.

  • Find restaurants whose names include 'Kyochon‘ Use text index

  • Print only borough and name fields

    { "borough" : "Queens", "name" : "Kyochon Chicken" }
    { "borough" : "Manhattan", "name" : "Kyochon" }

Exercise 2

  • Take a look the index information in map and countries collections.

  • Find universities in Korea.

    • Get geometry information in the countries collection.

    • keyword -properties.admin: “South Korea”

  • Return ten documents with sorting by “properties.name”, and show the name only.

    • Note that there is no ‘properties.name’ in a document; therefore, remove the document.

    [{'properties': {'name': 'GIST 광주 과학 기술원'}},
     {'properties': {'name': 'ICT폴리택대학'}},
     {'properties': {'name': 'KAIST 문지 캠퍼스'}},
     {'properties': {'name': 'KC대학교'}},
     {'properties': {'name': 'KT원주연수원'}},
     {'properties': {'name': 'U1대학교 아산캠퍼스'}},
     {'properties': {'name': '가천대학교 글로벌캠퍼스'}},
     {'properties': {'name': '가천대학교 메디컬캠퍼스'}},
     {'properties': {'name': '가톨릭관동대학교'}},
     {'properties': {'name': '가톨릭대학교 성신교정'}}]

  • Search the ‘properties.name’ that includes ‘서울대입구’

  • Using regular expression ($regex) or a text index.

  • Sort properties.name in ascending order and display only a name field as below.

    [{'properties': {'name': '서울대입구 삼성아파트'}},
     {'properties': {'name': '서울대입구 풍림아이원 1단지'}},
     {'properties': {'name': '서울대입구 풍림아이원 2단지'}}]

Last updated