Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
migration with temporary simple schema
version : 26,
name : 'Remove from users',
up : function(){
// add optional so we can remove it
var profile = _.extend({
email : {
type : String,
optional: true
}, Schemas.UserProfile._schema);
var user = Schemas.User._schema;
var profileSchema = new SimpleSchema(profile);
user.profile = {type: profileSchema, optional: true};
var userSchema = new SimpleSchema(user);
Meteor.users.attachSchema(userSchema, {replace: true});
Meteor.users.find({"": {$exists: true}}).forEach(function(u){
Meteor.users.update({_id: u._id}, {$unset: {"": ""}});
// reset the schema back to the original
Meteor.users.attachSchema(Schemas.User, {replace: true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.