{"action":"closed","issue":{"url":"https://api.github.com/repos/aldeed/meteor-cfs-autoform/issues/16","labels_url":"https://api.github.com/repos/aldeed/meteor-cfs-autoform/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-cfs-autoform/issues/16/comments","events_url":"https://api.github.com/repos/aldeed/meteor-cfs-autoform/issues/16/events","html_url":"https://github.com/aldeed/meteor-cfs-autoform/issues/16","id":52939074,"number":16,"title":"File schema with an owner","user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-26T21:06:44Z","updated_at":"2015-03-31T15:46:00Z","closed_at":"2015-03-31T15:46:00Z","body":"I want to limit the people who are able to view / download a file based on their ownership of the file. Thus I'm trying to create a schema with an autovalue. Check out the `Receipts` collection below.\r\n\r\n```\r\n@Records = new Mongo.Collection \"records\"\r\n\r\n@Receipts = new FS.Collection \"receipts\", \r\n  stores: [new FS.Store.GridFS(\"receiptStore\")]\r\n\r\n@Receipts.allow\r\n  download: (userId, doc) -> userId is doc.ownerId\r\n  fetch: ['ownerId']\r\n\r\n@Receipts.attachSchema new SimpleSchema\r\n  ownerId:\r\n    type: String,\r\n    label: \"Author\"\r\n    autoValue: -> Meteor.userId()\r\n\r\n@Records.attachSchema new SimpleSchema\r\n  ownerId:\r\n    type: String,\r\n    label: \"Author\"\r\n    autoValue: -> Meteor.userId()\r\n  createdAt:\r\n    type: Date\r\n    autoValue: -> new Date\r\n  amount:\r\n    type: Number\r\n    label: \"Amount\"\r\n    min: 0\r\n  memo:\r\n    type: String\r\n    label: \"Memo\"\r\n    optional: true\r\n  receiptId:\r\n    type: String\r\n    optional: true\r\n    autoform:\r\n      afFieldInput:\r\n        type: \"cfs-file\"\r\n        collection: \"receipts\"\r\n```\r\n\r\nI'm ending up with this error:\r\n\r\n`TypeError: Object #<EventEmitter> has no method 'attachSchema'`\r\n\r\napparently `Receipts` is an EventEmitter. \r\n\r\nAnyways, is there an easy way of implementing this functionality?"}}