MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_min_query

Method test_min_query

test/test_collection.py:1881–1890  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1879 self.assertEqual(1, len(self.db.test.find({"query": {"$ne": None}}).to_list()))
1880
1881 def test_min_query(self):
1882 self.db.drop_collection("test")
1883 self.db.test.insert_many([{"x": 1}, {"x": 2}])
1884 self.db.test.create_index("x")
1885
1886 cursor = self.db.test.find({"$min": {"x": 2}, "$query": {}}, hint="x_1")
1887
1888 docs = cursor.to_list()
1889 self.assertEqual(1, len(docs))
1890 self.assertEqual(2, docs[0]["x"])
1891
1892 def test_numerous_inserts(self):
1893 # Ensure we don't exceed server's maxWriteBatchSize size limit.

Callers

nothing calls this directly

Calls 5

drop_collectionMethod · 0.45
insert_manyMethod · 0.45
create_indexMethod · 0.45
findMethod · 0.45
to_listMethod · 0.45

Tested by

no test coverage detected