   if not updateAll and @ instanceof globals.Document._ReferenceField
     index = {}
     index["#{ @sourcePath }._id"] = 1
-    @sourceCollection._ensureIndex index if @sourceCollection._connection is Meteor.server
+    @sourceCollection._ensureIndex index if Meteor.isServer and @sourceCollection._connection is Meteor.server
 
     if @reverseName
       index = {}
       index["#{ @reverseName }._id"] = 1
-      @targetCollection._ensureIndex index if @targetCollection._connection is Meteor.server
+      @targetCollection._ensureIndex index if Meteor.isServer and @targetCollection._connection is Meteor.server
 
   initializing = true
 
   observers =
-    added: globals.Document._observerCallback (id, fields) =>
+    added: globals.Document._observerCallback @targetCollection, (id, fields) =>
       @updateSource id, fields if updateAll or not initializing
 
   unless updateAll
-    observers.changed = globals.Document._observerCallback (id, fields) =>
+    observers.changed = globals.Document._observerCallback @targetCollection, (id, fields) =>
       @updateSource id, fields
 
-    observers.removed = globals.Document._observerCallback (id) =>
+    observers.removed = globals.Document._observerCallback @targetCollection, (id) =>
       @removeSource id
 
   referenceFields = fieldsToProjection @fields

    # Setup observers only for local collections or server collection. Collections based
    # on a connection to some other primary collections should not have observers because
    # they should be setup at the location of primary collections, not here.
    for document in @list when document.Meta.collection._connection in [null, Meteor.server]
      if updateAll
        # For fields we pass updateAll on.
        setupTargetObservers document.Meta.fields


  queryFields = fieldsToProjection @fields
  @collection.find({}, fields: queryFields).observe
    added: globals.Document._observerCallback @collection, (document) =>
      @trigger document, null unless initializing

    changed: globals.Document._observerCallback @collection, (newDocument, oldDocument) =>
      @trigger newDocument, oldDocument

    removed: globals.Document._observerCallback @collection, (oldDocument) =>
      @trigger null, oldDocument

  initializing = false
