File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
ravendb/tests/jvm_migrated_tests/client_tests/documents_tests/operations_tests Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ from ravendb import IndexQuery , DeleteByQueryOperation
2+ from ravendb .infrastructure .entities import User
3+ from ravendb .tests .test_base import TestBase
4+
5+
6+ class TestDeleteByQuery (TestBase ):
7+ def setUp (self ):
8+ super ().setUp ()
9+
10+ def test_can_delete_by_query (self ):
11+ with self .store .open_session () as session :
12+ session .store (User (age = 5 ))
13+ session .store (User (age = 10 ))
14+ session .save_changes ()
15+
16+ index_query = IndexQuery ("from users where age == 5" )
17+ operation = DeleteByQueryOperation (index_query )
18+ async_op = self .store .operations .send_async (operation )
19+
20+ async_op .wait_for_completion ()
21+
22+ with self .store .open_session () as session :
23+ self .assertEqual (1 , session .query (object_type = User ).count ())
You can’t perform that action at this time.
0 commit comments