Question regarding Schemas

Hi guys. Im trying to get up and running with the cosio55:autoform-cloudinary package.

According to the docs I need to :

Images = new Mongo.Collection('images');

Images.attachSchema(new SimpleSchema({
  image: {
type: String,
autoform: {
  afFieldInput: {
type: 'cloudinary'
   }
 }
}
}));

This is confusing because it seems like the Schema is being attached before its created. Meteor doesnt seem to like it one bit either. The error I’m getting is:
TypeError: Object [object Object] has no method ‘attachSchema’

Isnt the usual syntax for a Schema something like this?

PostSchema = new SimpleSchema({
name: {
type: String,
label: "Name"
}
});

Posts.attachSchema( PostSchema );

Thanks in advance :smile:

Have you installed aldeed:collection2 ?

Actually, The simple schema is created first, then attached. Your error is complaining that your collection doesn’t have the attachSchema method, which would be the case if you didn’t have the collection2 package installed.

1 Like

Ya. I realized it was because of my folder structure haha. LOTS to learn still. Still not working though, getting “ReferenceError match not defined”.

BTW, how do you handle image uploads in Meteor? Ive been struggling with this for days.