   createdBy: 'createdBy'
   updatedAt: 'updatedAt'
   updatedBy: 'updatedBy'
+  systemId: '0'
 
 behaviour = (options = {}) ->
 
-  {createdAt, createdBy, updatedAt, updatedBy} =
+  {createdAt, createdBy, updatedAt, updatedBy, systemId} =
     _.defaults options, @options, defaults
 
   if ss?


      addAfDefs def if af?

    regEx = new RegExp "(#{SimpleSchema.RegEx.Id.source})|^0$"

    if createdBy
      def = definition[createdBy] =

  isLocalCollection = @collection._connection is null

  if Meteor.isServer or isLocalCollection
    @collection.before.insert (userId = systemId, doc) ->
      if createdAt
        doc[createdAt] = new Date
      if createdBy and not doc[createdBy]?
        doc[createdBy] = userId

    @collection.before.update (userId = systemId, doc, fieldNames, modifier,
      options) ->

      $set = modifier.$set ?= {}
