db.logout()버전 5.0부터 더 이상 사용되지 않습니다.
Attempting to use the
db.logout()method will write an error message to the log once per logout attempt.이 메서드는 향후 릴리스에서 제거될 예정입니다.
현재 인증 세션을 종료합니다. 현재 세션이 인증되지 않은 경우 이 함수는 효과가 없습니다.
참고
If you're not logged in and using authentication,
db.logout()has no effect.Because MongoDB allows users defined in one database to have privileges on another database, you must call
db.logout()while using the same database context that you authenticated to.If you authenticated to a database such as
usersor$external, you must issuedb.logout()against this database in order to successfully log out.예시
Use the
use <database-name>helper inmongosh, or the followingdb.getSiblingDB()method in an interactivemongoshsession or inmongoshshell scripts to change thedbobject:db = db.getSiblingDB('<database-name>') When you have set the database context and
dbobject, you can use thedb.logout()to log out of database as in the following operation:db.logout() db.logout()function provides a wrapper around the database commandlogout.
호환성
이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- 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.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전