 RoomSchema.plugin(findOrCreate)
 RoomSchema.plugin(taggable)
 RoomSchema.plugin(uniqueValidator)
+RoomSchema.path('jid').set (jid) ->
+	@_id ?= jid
+	return jid
 
 RoomSchema.path('name').set (name) ->
 	@jid ?= "#{name}@#{sails.config.xmpp.muc}"

module.exports = 
	models:
		user: 		User
		Room: 		Room
		Bookmark:	Bookmark
		Msg:		Msg
		roster:		Roster
	name:			{ type: String, required: true }
	autoJoin:		{ type: Boolean, default: true }
	createdBy:		{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }
	createdAt:		{ type: Date, default: Date.now }
	
BookmarkSchema.statics =
	search_fields: ->
