mongodb fix?
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.7 (2012-05-07 12:17:32) dev
|
Version 1.99.7 (2012-05-07 15:26:56) dev
|
||||||
|
|||||||
+10
-12
@@ -4674,7 +4674,7 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
withId=False
|
withId=False
|
||||||
tablename, mongoqry_dict , mongofields_dict, mongosort_list, limitby_limit, limitby_skip = self._select(query,fields,attributes)
|
tablename, mongoqry_dict , mongofields_dict, mongosort_list, limitby_limit, limitby_skip = self._select(query,fields,attributes)
|
||||||
for key in mongofields_dict.keys():
|
for key in mongofields_dict.keys():
|
||||||
if key == 'id':
|
if key == 'id'
|
||||||
withId = True
|
withId = True
|
||||||
break;
|
break;
|
||||||
try:
|
try:
|
||||||
@@ -4684,20 +4684,20 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
print "mongofields_dict=%s" % mongofields_dict
|
print "mongofields_dict=%s" % mongofields_dict
|
||||||
ctable = self.connection[tablename]
|
ctable = self.connection[tablename]
|
||||||
if count:
|
if count:
|
||||||
return {'count' : ctable.find(mongoqry_dict,mongofields_dict,skip=limitby_skip, limit=limitby_limit, sort=mongosort_list,snapshot=snapshot).count()}
|
return {'count' : ctable.find(mongoqry_dict,mongofields_dict,
|
||||||
|
skip=limitby_skip, limit=limitby_limit,
|
||||||
|
sort=mongosort_list,snapshot=snapshot).count()}
|
||||||
else:
|
else:
|
||||||
mongo_list_dicts = ctable.find(mongoqry_dict,mongofields_dict,skip=limitby_skip, limit=limitby_limit, sort=mongosort_list,snapshot=snapshot) # pymongo cursor object
|
mongo_list_dicts = ctable.find(mongoqry_dict,mongofields_dict,
|
||||||
|
skip=limitby_skip, limit=limitby_limit,
|
||||||
|
sort=mongosort_list,snapshot=snapshot) # pymongo cursor object
|
||||||
print "mongo_list_dicts=%s" % mongo_list_dicts
|
print "mongo_list_dicts=%s" % mongo_list_dicts
|
||||||
#if mongo_list_dicts.count() > 0: #
|
|
||||||
#colnames = mongo_list_dicts[0].keys() # assuming all docs have same "shape", grab colnames from first dictionary (aka row)
|
|
||||||
#else:
|
|
||||||
#colnames = mongofields_dict.keys()
|
|
||||||
#print "colnames = %s" % colnames
|
|
||||||
#rows = [row.values() for row in mongo_list_dicts]
|
|
||||||
rows = []
|
rows = []
|
||||||
|
columns = []
|
||||||
for record in mongo_list_dicts:
|
for record in mongo_list_dicts:
|
||||||
row=[]
|
row=[]
|
||||||
for column in record:
|
for column in record:
|
||||||
|
columns.append(column)
|
||||||
if withId and (column == '_id'):
|
if withId and (column == '_id'):
|
||||||
if isinstance(record[column],pymongo.objectid.ObjectId):
|
if isinstance(record[column],pymongo.objectid.ObjectId):
|
||||||
row.append( int(str(record[column]),16))
|
row.append( int(str(record[column]),16))
|
||||||
@@ -4707,10 +4707,8 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
elif not (column == '_id'):
|
elif not (column == '_id'):
|
||||||
row.append(record[column])
|
row.append(record[column])
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
#else the id is not supposed to be included. Work around error. mongo always sends key:(
|
|
||||||
|
|
||||||
processor = attributes.get('processor',self.parse)
|
processor = attributes.get('processor',self.parse)
|
||||||
return processor(rows,fields,mongofields_dict.keys(),False)
|
return processor(rows,columns,False)
|
||||||
|
|
||||||
def INVERT(self,first):
|
def INVERT(self,first):
|
||||||
#print "in invert first=%s" % first
|
#print "in invert first=%s" % first
|
||||||
|
|||||||
Reference in New Issue
Block a user