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

Method first

mongoengine/queryset/base.py:294–304  ·  view source on GitHub ↗

Retrieve the first object matching the query.

(self)

Source from the content-addressed store, hash-verified

292 return self._document(**kwargs).save(force_insert=True)
293
294 def first(self):
295 """Retrieve the first object matching the query."""
296 queryset = self.clone()
297 if self._none or self._empty:
298 return None
299
300 try:
301 result = queryset[0]
302 except IndexError:
303 result = None
304 return result
305
306 def insert(
307 self, doc_or_docs, load_bulk=True, write_concern=None, signal_kwargs=None

Calls 1

cloneMethod · 0.95