-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
To speed-up and simplify insert operation a user application can provide a generator or any other iterable object into the insert python API. In case of generator user should be aware to not overload insert with too many items. To avoid this it would be useful to add chunk_size, which will specify the size of iterable objects to insert as one bulk operation. For example, user can specify the following
gen = (
{'test_%s' % i: i} for i in range(0,100))
while True:
if not col.insert(itertools.islice(gen, 10)):
break
to create generator and ask insert to perform bulk operation on 10 elements.
For more discussion see the following thread
http://groups.google.com/group/mongodb-user/browse_thread/thread/740560d5215e4fbd