Skip to content

Instantly share code, notes, and snippets.

@ryanswrt
Created April 22, 2015 14:57
Show Gist options
  • Save ryanswrt/b7fdd171d7dd564e5fb9 to your computer and use it in GitHub Desktop.
Save ryanswrt/b7fdd171d7dd564e5fb9 to your computer and use it in GitHub Desktop.
Schemas.Link = (collection) ->new SimpleSchema
url:
type: String
regEx: SimpleSchema.RegEx.Url
meta:
type: Object
optional:true
autoValue: ->
if this.isInsert
doc_id = this.field('_id')
Meteor.call 'simplecrawler_findMetadata', (e,r)->
if r
r.image = r.images[0]
collection.update(doc_id,{$set:{meta:r}})
'meta.description':
type: String
optional: true
'meta.image_url':
type: String
regEx: SimpleSchema.RegEx.Url
optional: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment