You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""use database[collectionName] to get a collection from the database"""
529
+
def__getitem__(self, col_or_doc_id):
530
+
"""use database[col_or_doc_id] to get a collection from the database"""
531
531
try:
532
-
returnself.collections[collectionName]
533
-
exceptKeyError:
534
-
self.reload()
532
+
col_name, doc_key=col_or_doc_id.split('/')
533
+
returnself.collections[col_name][doc_key]
534
+
exceptValueError:
535
535
try:
536
-
returnself.collections[collectionName]
536
+
returnself.collections[col_or_doc_id]
537
537
exceptKeyError:
538
-
raiseKeyError("Can't find any collection named : %s"%collectionName)
538
+
self.reload()
539
+
try:
540
+
returnself.collections[col_or_doc_id]
541
+
exceptKeyError:
542
+
raiseKeyError("Can't find any collection named : %s"%col_or_doc_id)
539
543
540
544
classDBHandle(Database):
541
545
"As the loading of a Database also triggers the loading of collections and graphs within. Only handles are loaded first. The full database are loaded on demand in a fully transparent manner."
0 commit comments