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

commitTransaction(데이터베이스 명령)

commitTransaction

다중 문서 트랜잭션에서 작업으로 인한 변경 사항을 저장하고 트랜잭션을 종료합니다.

팁

In mongosh, this command can also be run through the Session.commitTransaction() and Session.withTransaction() helper methods.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

To run the commitTransaction, the command must be run against the admin database and run within a Session().

이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

참고

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

명령은 다음과 같은 구문을 가집니다:

db.adminCommand(
{
commitTransaction: 1,
txnNumber: <long>,
writeConcern: <document>,
autocommit: false,
comment: <any>
}
)

트랜잭션을 커밋할 때 세션은 트랜잭션 시작 시 지정된 쓰기 고려를 사용합니다. Session.startTransaction()을 참조하세요.

"w: 1" 쓰기 고려를 사용하여 커밋하는 경우 트랜잭션을 페일오버 발생 시 롤백할 수 있습니다.

트랜잭션이 커밋되면 트랜잭션에서 이루어진 모든 데이터 변경 사항이 저장되고 트랜잭션 외부에서 볼 수 있습니다. 즉, 트랜잭션은 다른 트랜잭션을 롤백하는 동안 다른 변경 사항을 커밋하지 않습니다.

트랜잭션이 커밋될 때까지 트랜잭션에서 변경된 데이터는 트랜잭션 외부에 표시되지 않습니다.

그러나 트랜잭션이 여러 샤드에 쓰기를 수행하는 경우, 모든 외부 읽기 작업이 커밋된 트랜잭션의 결과가 샤드 전체에 표시될 때까지 기다릴 필요는 없습니다. 예를 들어, 트랜잭션이 커밋되고 쓰기 1이 샤드 A에 표시되지만 쓰기 2가 샤드 B에 아직 표시되지 않는 경우, 읽기 고려 "local"의 외부 읽기는 쓰기 2를 보지 않고 쓰기 1의 결과를 읽을 수 있습니다.

이 페이지 평가하기

이 페이지의 내용