일단 dbprac.py입니다.
from pymongo import MongoClient
client = MongoClient('mongodb+srv://nastro38:7Vuc4FNbtAkSOQwl@cluster0.d6wisgb.mongodb.net/?retryWrites=true&w=majority')
db = client.dbsparta
doc = {
'name':'bob',
'age':27
}
db.users.insert_one(doc)
// 여기서 참고하실 것은 조 위에 'test:sparta'라고 설정하지 않고 전 'nastro38:<password>'라고 되어있는데 패스워드는 '자동완성'된 것 복붙했습니다
//그리고 아래 부분은 에러메시지 입니다.
/Users/asphro/Desktop/sparta/pythonprac/venv/bin/python /Users/asphro/Desktop/sparta/pythonprac/dbprac.py
Traceback (most recent call last):
File "/Users/asphro/Desktop/sparta/pythonprac/dbprac.py", line 12, in <module>
db.users.insert_one(doc)
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/collection.py", line 621, in insert_one
self._insert_one(
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/collection.py", line 562, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1447, in _retryable_write
with self._tmp_session(session) as s:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1729, in _tmp_session
s = self._ensure_session(session)
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1712, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1657, in __start_session
self._topology._check_implicit_session_support()
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/topology.py", line 538, in _check_implicit_session_support
self._check_session_support()
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/topology.py", line 554, in _check_session_support
self._select_servers_loop(
File "/Users/asphro/Desktop/sparta/pythonprac/venv/lib/python3.8/site-packages/pymongo/topology.py", line 238, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: ac-vkgoyzg-shard-00-02.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108),ac-vkgoyzg-shard-00-01.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108),ac-vkgoyzg-shard-00-00.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108), Timeout: 30s, Topology Description: <TopologyDescription id: 6323013a2bcad29d3d0a6ae6, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-vkgoyzg-shard-00-00.d6wisgb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vkgoyzg-shard-00-00.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')>, <ServerDescription ('ac-vkgoyzg-shard-00-01.d6wisgb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vkgoyzg-shard-00-01.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')>, <ServerDescription ('ac-vkgoyzg-shard-00-02.d6wisgb.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-vkgoyzg-shard-00-02.d6wisgb.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')>]>
종료 코드 1(으)로 완료된 프로세스
// 이상 잘은 모르겠으나 mongo DB설정 과정에서 스파르타의 화면과 업데이트된 몽고 디비 가입 싸이트가 많이 달라서 최대한 비슷하게
하려고 했는데 에러가 난 모양입니다.
// 어떻게 고치면 좋을까요?