diff --git a/db/define_test.go b/db/define_test.go index 59b2cfea..08528e05 100644 --- a/db/define_test.go +++ b/db/define_test.go @@ -601,7 +601,7 @@ func TestDefine(t *testing.T) { So(res[6].Result, ShouldHaveLength, 1) So(res[7].Result, ShouldHaveLength, 1) So(res[8].Result, ShouldHaveLength, 1) - So(res[9].Result, ShouldHaveLength, 4) + So(res[9].Result, ShouldHaveLength, 3) }) diff --git a/db/event.go b/db/event.go index c857679b..6e021a06 100644 --- a/db/event.go +++ b/db/event.go @@ -25,6 +25,14 @@ import ( // table, and executes them in name order. func (d *document) event(ctx context.Context, met method) (err error) { + // If this document has not changed + // then there is no need to perform + // any registered events. + + if ok := d.changed(); !ok { + return + } + // Get the event values specified // for this table, loop through // them, and compute the events.