When you activate an event it will ONLY set it to "1" in the node event collection. So if you look in the gateway.db you should see something like this:
{"_id":xxxx,"updated":1437614100098,"rssi":61,"metrics":{"B1":{"label":"B1","value":"ON","updated":1437614100098,"pin":"1","graph":"1"}},"type":"SwitchMote","label":"My SwitchMote","events":{"switchMoteON_PM":1,"switchMoteOFF_AM":1},"descr":"This is my switchmote"}
Internally to the gateway.js script, there is a collection of events scheduled with javascript timers. When you enable/disable events that collection and the timers are kept in synch (or should be) with the new status and the DB statuses.