Created
April 21, 2015 04:31
-
-
Save ryanswrt/f084790bc1ced219fadf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ParentSchemaCol = new Meteor.Collection('parentcol') | |
@SubSchemaCol = new Meteor.Collection('subcol') | |
subSchema = new SimpleSchema { | |
autovalue: { | |
type: Date | |
autoValue: -> | |
new Date() | |
} | |
value:{ | |
type: String | |
autoValue: -> | |
value = this.siblingField('autovalue') | |
console.log(value) | |
value?.toUTCString?() ? 'no value' | |
} | |
} | |
parentSchema = new SimpleSchema { | |
sub: { | |
type: subSchema | |
autoValue: -> | |
{autovalue: new Date()} | |
} | |
value:{ | |
type: String | |
} | |
} | |
ParentSchemaCol.attachSchema parentSchema | |
SubSchemaCol.attachSchema subSchema | |
parent_id = ParentSchemaCol.insert({value:'Test'}) // Works | |
ParentSchemaCol.update(parent_id,{$set:{value:'Breaks'}) // Breaks, autoValue in subschema doesn't set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment