another mongodb improvement
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-05-11 08:30:34) dev
|
Version 2.00.0 (2012-05-11 14:51:42) dev
|
||||||
|
|||||||
+13
-14
@@ -4523,24 +4523,23 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
print "mongo_list_dicts=%s" % mongo_list_dicts
|
print "mongo_list_dicts=%s" % mongo_list_dicts
|
||||||
rows = []
|
rows = []
|
||||||
### populate row in proper order
|
### populate row in proper order
|
||||||
if mongo_list_dicts:
|
colnames = [field.name for field in fields]
|
||||||
def fix(id): return 'id' if id=='_id' else id
|
|
||||||
colnames = [fix(column) for column in mongo_list_dicts[0]]
|
|
||||||
else:
|
|
||||||
colnames = []
|
|
||||||
for k,record in enumerate(mongo_list_dicts):
|
for k,record in enumerate(mongo_list_dicts):
|
||||||
row=[]
|
row=[]
|
||||||
for column in record:
|
for colname in colnames:
|
||||||
if column == '_id' and \
|
column = '_id' if colname=='id' else colname
|
||||||
isinstance(record[column],pymongo.objectid.ObjectId):
|
if column in record:
|
||||||
value = int(str(record[column]),16)
|
if column == '_id' and isinstance(
|
||||||
elif column != '_id':
|
record[column],pymongo.objectid.ObjectId):
|
||||||
value = record[column]
|
value = int(str(record[column]),16)
|
||||||
|
elif column != '_id':
|
||||||
|
value = record[column]
|
||||||
|
else:
|
||||||
|
value = None
|
||||||
|
else:
|
||||||
|
value = None
|
||||||
row.append(value)
|
row.append(value)
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
|
|
||||||
table = self.db[tablename]
|
|
||||||
fields = [table[colname] for colname in colnames]
|
|
||||||
processor = attributes.get('processor',self.parse)
|
processor = attributes.get('processor',self.parse)
|
||||||
return processor(rows,fields,colnames,False)
|
return processor(rows,fields,colnames,False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user