fix mongo queries for conditional action + add a test with run action