{"action":"opened","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1411","repository_url":"https://api.github.com/repos/aldeed/meteor-autoform","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1411/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1411/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/1411/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/1411","id":138971926,"number":1411,"title":"problem with autoValue","user":{"login":"rslp2","id":17356597,"avatar_url":"https://avatars.githubusercontent.com/u/17356597?v=3","gravatar_id":"","url":"https://api.github.com/users/rslp2","html_url":"https://github.com/rslp2","followers_url":"https://api.github.com/users/rslp2/followers","following_url":"https://api.github.com/users/rslp2/following{/other_user}","gists_url":"https://api.github.com/users/rslp2/gists{/gist_id}","starred_url":"https://api.github.com/users/rslp2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rslp2/subscriptions","organizations_url":"https://api.github.com/users/rslp2/orgs","repos_url":"https://api.github.com/users/rslp2/repos","events_url":"https://api.github.com/users/rslp2/events{/privacy}","received_events_url":"https://api.github.com/users/rslp2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-07T12:54:57Z","updated_at":"2016-03-07T12:54:57Z","closed_at":null,"body":"I'm trying to set **Meteor.userId()** as default value for a field in my simpleSchema.\r\n\r\nhere is the schema:\r\n\r\n    AdsSchema = new SimpleSchema({\r\n      title: {\r\n        type: String,\r\n        label: \"Title\"\r\n      },\r\n      insertedBy: {\r\n        type: String,\r\n        label: \"Inserted By\",\r\n        autoform:{\r\n          type:\"hidden\"\r\n        },\r\n        autoValue: function() {\r\n          if (Meteor.userId()) {\r\n            return Meteor.userId();\r\n          }\r\n        }\r\n      }\r\n    })\r\n\r\nautoForm:\r\n\r\n`{{> quickForm schema= \"AdsSchema\" collection=\"Ads\" id=\"insBaseAds\" type=\"insert\"}}`\r\n\r\nbut after inserting by above autoform, the inserted document on MongoDB is:\r\n\r\n    {\r\n        \"_id\" : \"Zm5TML5bwJhyN8B9F\",\r\n        \"title\" : \"test\"\r\n    }\r\n\r\nit means \"insertedBy\" field has never filled!\r\n\r\nI even try this code:\r\n\r\n    AdsSchema = new SimpleSchema({\r\n      title: {\r\n        type: String,\r\n        label: \"Title\"\r\n      },\r\n      insertedBy: {\r\n        type: String,\r\n        label: \"Inserted By\",\r\n        autoform:{\r\n          type:\"hidden\"\r\n        },\r\n        defalutValue: Meteor.userId();\r\n      }\r\n    })\r\n\r\nbut it insert the same document too!\r\n\r\nhow can I fix this?\r\n\r\n"}}