Skip to content

Commit

Permalink
Support ObjectId-based document IDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar committed Aug 1, 2016
1 parent 09120cc commit 7000871
Show file tree
Hide file tree
Showing 2 changed files with 866 additions and 849 deletions.
4 changes: 2 additions & 2 deletions server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Meteor.publish = (name, publishFunction) ->
# iteration) but this is OK because in afterRun of other computations this will be corrected and documents
# with those IDs removed.
for id in _.difference currentlyPublishedDocumentIds, currentComputationAddedDocumentIds, otherComputationsAddedDocumentsIds, otherComputationsPreviouslyAddedDocumentsIds
@removed collectionName, id
@removed collectionName, @_idFilter.idParse id

computation.beforeRun =>
oldDocuments[computation._id] = documents[computation._id] or {}
Expand Down Expand Up @@ -142,7 +142,7 @@ Meteor.publish = (name, publishFunction) ->
# with value set to "undefined". So we look into current session's state and see which fields are currently
# known and create an object of same fields, just all values set to "undefined". We then override some fields
# with new values. Only top-level fields matter.
for field of @_session.getCollectionView(collectionName)?.documents?[id]?.dataByKey or {}
for field of @_session.getCollectionView(collectionName)?.documents?[stringId]?.dataByKey or {}
oldFields[field] = undefined
@changed collectionName, id, _.extend oldFields, fields
else
Expand Down
Loading

0 comments on commit 7000871

Please sign in to comment.