1. Learn
  2. /
  3. 课程
  4. /
  5. OpenAI API로 시작하는 임베딩 Introduction

Connected

道练习

컬렉션에서 항목 업데이트 및 삭제하기

문서를 벡터 데이터베이스에 저장했다고 해서, 컬렉션에 새로 추가하거나 기존 항목을 업데이트하지 못하는 것은 아니에요.

이 연습 문제에서는 new_data에 저장된 Netflix 신규 타이틀 두 개가 제공돼요:

[{"id": "s1001", "document": "Title: Cats & Dogs (Movie)\nDescription: A look at the top-secret, high-tech espionage war going on between cats and dogs, of which their human owners are blissfully unaware."},
 {"id": "s6884", "document": 'Title: Goosebumps 2: Haunted Halloween (Movie)\nDescription: Three teens spend their Halloween trying to stop a magical book, which brings characters from the "Goosebumps" novels to life.\nCategories: Children & Family Movies, Comedies'}]

이 ID들이 컬렉션에 이미 있는지 여부에 따라 데이터베이스에서 추가하거나 업데이트하게 될 거예요.

说明

100 XP
  • new_data에서 ID와 문서를 추출한 후, 하나의 메서드로 netflix_titles 컬렉션에 이미 존재하면 업데이트하고, 없으면 추가하세요.
  • 항목을 추가/업데이트한 뒤, ID가 's95'인 항목을 삭제하세요.