-
-
Notifications
You must be signed in to change notification settings - Fork 169
Schema
dr.dimitru edited this page May 18, 2016
·
10 revisions
Below is default Files collection schema. Please keep default schema structure when extending it!. To pass your own schema use schema
property when passing config to FilesCollection
constructor.
For more info see Collection2 and simple-schema packages.
var defaultSchema = {
size: {
type: Number
},
name: {
type: String
},
type: {
type: String
},
path: {
type: String
},
isVideo: {
type: Boolean
},
isAudio: {
type: Boolean
},
isImage: {
type: Boolean
},
isText: {
type: Boolean
},
isJSON: {
type: Boolean
},
_prefix: {
type: String
},
extension: {
type: String,
optional: true
},
_storagePath: {
type: String
},
_downloadRoute: {
type: String
},
_collectionName: {
type: String
},
public: {
type: Boolean,
optional: true
},
meta: {
type: Object,
blackbox: true,
optional: true
},
userId: {
type: String,
optional: true
},
updatedAt: {
type: Date,
autoValue: function() {
return new Date();
}
},
versions: {
type: Object,
blackbox: true
}
};
Although this package comes with schema it isn't enabled (attached) by default (since v1.5.0), you're free to use it or not. To attach schema you need to install Collection2 and simple-schema packages separately.
this.Images = new FilesCollection({ collectionName: 'Images'});
Images.collection.attachSchema(new SimpleSchema(Images.schema));
var mySchema = _.extend(defaultSchema, {
myProp: {
type: String
}
});
this.Images = new FilesCollection({
collectionName: 'Images',
schema: new SimpleSchema(mySchema)
});
var mySchema = { /* Your schema here */ };
this.Images = new FilesCollection({
collectionName: 'Images',
schema: new SimpleSchema(mySchema)
});
Meteor-Files | Support | Try ostr.io |
---|---|---|
If you found this package useful, — star it at GitHub and support our open source contributions with a monthly pledge, or submit a one-time donation via PayPal | Monitoring, Analytics, WebSec, Web-CRON and Pre-rendering for a website |