MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / batch_size

Method batch_size

mongoengine/queryset/base.py:962–978  ·  view source on GitHub ↗

Limit the number of documents returned in a single batch (each batch requires a round trip to the server). See https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html#pymongo.cursor.Cursor for details. :param size: desired size of each batch.

(self, size)

Source from the content-addressed store, hash-verified

960 return queryset
961
962 def batch_size(self, size):
963 """Limit the number of documents returned in a single batch (each
964 batch requires a round trip to the server).
965
966 See https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html#pymongo.cursor.Cursor
967 for details.
968
969 :param size: desired size of each batch.
970 """
971 queryset = self.clone()
972 queryset._batch_size = size
973
974 # If a cursor object has already been created, apply the batch size to it.
975 if queryset._cursor_obj:
976 queryset._cursor_obj.batch_size(queryset._batch_size)
977
978 return queryset
979
980 def distinct(self, field):
981 """Return a list of distinct values for a given field.

Callers 3

_cursorMethod · 0.80
test_batch_sizeMethod · 0.80

Calls 1

cloneMethod · 0.95

Tested by 2

test_batch_sizeMethod · 0.64