Wash and trim the beans and cut them into 3/4-inch lengths (about 3 cups). Set aside.
Heat the oil in a wok or nonstick pan over medium-high heat. Add the mustard seeds and cover. When the mustard seeds have popped, toss in the dried red chili and curry leaves. After a few seconds, add the urad dhal and stir until the dhal turns pale gold. Add the onion and continue stirring until the dhal turns light brown and the onion becomes soft. Put in the green beans, salt, and 2 tablespoon water and stir over medium heat for 10 minutes. If the beans get too dry, sprinkle on 1 or 2 teaspoons of water. While the beans are still a little crunchy, add the coconut. Continue stirring for another 5 minutes, or until the beans are tender.