AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

문서 삭제

DeleteOne() 메서드를 사용하여 컬렉션 에서 문서 를 삭제 수 있습니다.

이 예시를 실행하는 방법에 대해 알아보려면 사용 예시를 읽어보세요.

다음 예시에서는 title이 'Twilight'인 movies 컬렉션의 문서를 매칭하여 일치하는 첫 번째 문서를 삭제합니다.

coll := client.Database("sample_mflix").Collection("movies")
filter := bson.D{{"title", "Twilight"}}
// Deletes the first document that has a "title" value of "Twilight"
result, err := coll.DeleteOne(context.TODO(), filter)
// Prints a message if any errors occur during the operation
if err != nil {
panic(err)
}

완전히 실행 가능한 예시확인합니다.

전체 예시를 실행하면 movies 컬렉션에서 다음 문서가 제거됩니다.

// result truncated
{ "_id": ObjectId("..."), ..., "title": "Twilight", ... }

문서를 찾는 방법에 대한 예는 문서 찾기를 참조하세요.

문서 삭제에 대한 자세한 내용은 문서 삭제를 참조하세요.

DeleteOne()