samedi 7 février 2015

Transforming on excluded field in meteor Mongo Collection


Vote count:

0





Meteor.publish("thing", function(options) {

return Collection.find({}, {fields: {anArray: 0}})
})


I exclude "anArray" because it contains userids not meant to be seen by each user. However it could contain the logged in user itself, in which case the user needs to know it.



Collection = new Mongo.Collection("thing", {
transform: function(document) {

_.each(document.anArray, function(item) {

item = true
})

return document
}
})


Above I try to transform the collection(simplified) but because the "anArray" is excluded, "anArray" is simply not defined.


How can I let the user know he is in "anArray" without compromising all other users in "anArray"?



asked 41 secs ago

Hans

1,543






Transforming on excluded field in meteor Mongo Collection

Aucun commentaire:

Enregistrer un commentaire