Skip to content

Commit 55be9d6

Browse files
committed
PYTHON-1316 Finish removing Database.system_js
1 parent 68a9ac9 commit 55be9d6

File tree

3 files changed

+5
-44
lines changed

3 files changed

+5
-44
lines changed

doc/changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ before upgrading from PyMongo 3.x.
1414
Breaking Changes in 4.0
1515
.......................
1616

17-
- Removed :meth:`~pymongo.database.Database.eval` and :class:`~pymongo.database.SystemJS`.
17+
- Removed :meth:`~pymongo.database.Database.eval`,
18+
:data:`~pymongo.database.Database.system_js` and
19+
:class:`~pymongo.database.SystemJS`.
1820
- Removed :mod:`~pymongo.thread_util`.
1921

2022
Issues Resolved

doc/migrate-to-pymongo4.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Database
4949
The "eval" method and SystemJS class are removed
5050
................................................
5151

52-
Removed :meth:`~pymongo.database.Database.eval` and
52+
Removed :meth:`~pymongo.database.Database.eval`,
53+
:data:`~pymongo.database.Database.system_js` and
5354
:class:`~pymongo.database.SystemJS`. The eval command was deprecated in
5455
MongoDB 3.0 and removed in MongoDB 4.2.
5556

test/test_database.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -881,48 +881,6 @@ def test_delete(self):
881881
db.test.delete_many({})
882882
self.assertFalse(db.test.find_one())
883883

884-
@client_context.require_no_auth
885-
@client_context.require_version_max(4, 1, 0)
886-
def test_system_js(self):
887-
db = self.client.pymongo_test
888-
db.system.js.delete_many({})
889-
890-
self.assertEqual(0, db.system.js.count_documents({}))
891-
db.system_js.add = "function(a, b) { return a + b; }"
892-
self.assertEqual('add', db.system.js.find_one()['_id'])
893-
self.assertEqual(1, db.system.js.count_documents({}))
894-
self.assertEqual(6, db.system_js.add(1, 5))
895-
del db.system_js.add
896-
self.assertEqual(0, db.system.js.count_documents({}))
897-
898-
db.system_js['add'] = "function(a, b) { return a + b; }"
899-
self.assertEqual('add', db.system.js.find_one()['_id'])
900-
self.assertEqual(1, db.system.js.count_documents({}))
901-
self.assertEqual(6, db.system_js['add'](1, 5))
902-
del db.system_js['add']
903-
self.assertEqual(0, db.system.js.count_documents({}))
904-
self.assertRaises(OperationFailure, db.system_js.add, 1, 5)
905-
906-
# TODO right now CodeWScope doesn't work w/ system js
907-
# db.system_js.scope = Code("return hello;", {"hello": 8})
908-
# self.assertEqual(8, db.system_js.scope())
909-
910-
self.assertRaises(OperationFailure, db.system_js.non_existant)
911-
912-
def test_system_js_list(self):
913-
db = self.client.pymongo_test
914-
db.system.js.delete_many({})
915-
self.assertEqual([], db.system_js.list())
916-
917-
db.system_js.foo = "function() { return 'blah'; }"
918-
self.assertEqual(["foo"], db.system_js.list())
919-
920-
db.system_js.bar = "function() { return 'baz'; }"
921-
self.assertEqual(set(["foo", "bar"]), set(db.system_js.list()))
922-
923-
del db.system_js.foo
924-
self.assertEqual(["bar"], db.system_js.list())
925-
926884
def test_command_response_without_ok(self):
927885
# Sometimes (SERVER-10891) the server's response to a badly-formatted
928886
# command document will have no 'ok' field. We should raise

0 commit comments

Comments
 (0)