new identifier and added creation folder logic
This commit is contained in:
@@ -16,5 +16,7 @@ class MongoManager:
|
||||
MongoManager.__instance = pymongo.MongoClient('127.0.0.1', 27017)
|
||||
db = MongoManager.__instance.AIC
|
||||
coll = db.metadata
|
||||
coll.create_index("filename",unique=True)
|
||||
coll.create_index([("loc", pymongo.GEO2D)])
|
||||
db.coll["identifier"]
|
||||
db.coll["location"]
|
||||
coll.create_index("identifier",unique=True)
|
||||
coll.create_index([("location", pymongo.GEO2D)])
|
||||
@@ -55,7 +55,7 @@ class ImageEndpoint:
|
||||
col = db.metadata
|
||||
metadata = None
|
||||
try:
|
||||
resp = col.find({"filename": identifier+".jpg"})
|
||||
resp = col.find({"identifier": identifier})
|
||||
metadata = resp[0]
|
||||
except:
|
||||
print("Could not find Metadata")
|
||||
@@ -94,6 +94,7 @@ class ImageEndpoint:
|
||||
col = db.metadata
|
||||
|
||||
try:
|
||||
metadata['identifier'] = identifier
|
||||
metadata['location'] = [metadata['longitude'],metadata['latitude']]
|
||||
col.insert_one(metadata)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user