私はWebスクレーパーを構築しており、エンティティーにUUIDを割り当てようとしています。mongodbのUUIDの割り当てとWebスクレイパーの重複のチェック
一方のエンティティは、異なる時間に掻きすることができるので、私は以下のWebページ
// example document
{
"ent_eid_type": "ABC-123",
"ent_uid_type": "123e4567-aaa-123e456"
}
から抽出されたIDと共に初期のUUIDを格納するには、Aに見出されるすべてのIDフィールドのために実行されるコードであります削られた品目
# if the current ent_eid_type is a key in mongo...
if db_coll.find({ent_eid_type: ent_eid}).count() > 0:
# return the uid value
ent_uid = db_coll.find({ent_uid_type: ent_uid })
else:
# create a fresh uid
ent_uid = uuid.uuid4()
# store it with the current entity eid as key, and uid as value
db_coll.insert({ent_eid_type: ent_eid, ent_uid_type: ent_uid})
# update the current item with the stored uid for later use
item[ent_uid_type] = ent_uid
コンソールが返品KeyError: <pymongo.cursor.Cursor object at 0x104d41710>
です。 ent_uid
のカーソルを解析する方法がわからない
ヒント/ご提案ありがとうございます!