Created
June 18, 2015 23:31
-
-
Save jorgegorka/69f26c98fe48494538c2 to your computer and use it in GitHub Desktop.
Messages schema
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
messageSchema = new SimpleSchema | |
userId: | |
type: String | |
label: 'User' | |
index: true | |
optional: true | |
denyUpdate: true | |
description: | |
type: String | |
label: 'Message text' | |
index: true | |
max: 480 | |
denyUpdate: true | |
chatRoom: | |
type: String | |
label: 'Chat Room' | |
index: true | |
autoValue: -> | |
if @isInsert | |
return 'MainChat' | |
else if @isUpsert | |
return $setOnInsert: 'MainChat' | |
else | |
@unset() | |
denyUpdate: true | |
createdAt: | |
type: Date | |
autoValue: -> | |
if @isInsert | |
return new Date | |
else if @isUpsert | |
return $setOnInsert: new Date() | |
else | |
@unset() | |
denyUpdate: true | |
optional: false | |
index: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment