Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-61

add chunk_size into insert API

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 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

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            vkuznet Valentin Kuznetsov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: