Skip to content

Commit 26060c7

Browse files
committed
📔 Documentation update
1 parent 3ebfa9f commit 26060c7

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

‎README.md‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[![support](https://img.shields.io/badge/support-GitHub-white)](https://github.com/sponsors/dr-dimitru)
22
[![support](https://img.shields.io/badge/support-PayPal-white)](https://paypal.me/veliovgroup)
33
[![Mentioned in Awesome ostrio:files](https://awesome.re/mentioned-badge.svg)](https://project-awesome.org/Urigo/awesome-meteor#files)
4-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/veliovgroup/Meteor-Files)
54
[![GitHub stars](https://img.shields.io/github/stars/veliovgroup/Meteor-Files.svg)](https://github.com/veliovgroup/Meteor-Files/stargazers)
65
<a href="https://ostr.io/info/built-by-developers-for-developers">
76
<img src="https://ostr.io/apple-touch-icon-60x60.png" height="20">
@@ -44,8 +43,8 @@ SimpleSchema.setDefaultMessages({
4443
import { Meteor } from 'meteor/meteor';
4544
import { FilesCollection } from 'meteor/ostrio:files';
4645

47-
const Images = new FilesCollection({
48-
collectionName: 'Images',
46+
const imagesCollection = new FilesCollection({
47+
collectionName: 'images',
4948
allowClientCode: true, // Required to let you remove uploaded file
5049
onBeforeUpload(file) {
5150
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
@@ -62,12 +61,12 @@ if (Meteor.isClient) {
6261

6362
if (Meteor.isServer) {
6463
Meteor.publish('files.images.all', () => {
65-
return Images.collection.find({});
64+
return imagesCollection.collection.find({});
6665
});
6766
}
6867
```
6968

70-
__Note:__ If you don't use Mongo Collection instances (`dburles:mongo-collection-instances`), then the `Images` variable must be attached to *Global* scope. And has same name (*case-sensitive*) as `collectionName` option passed into `FilesCollection#insert({collectionName: 'Images'})` method, `Images` in our case.
69+
__Note:__ If you don't use Mongo Collection instances (`dburles:mongo-collection-instances`), then the `imagesCollection` variable must be attached to *Global* scope. And has same name (*case-sensitive*) as `collectionName` option passed into `FilesCollection#insert({collectionName: 'images'})` method, `images` in our case.
7170

7271
To start using `dburles:mongo-collection-instances` simply install it:
7372

@@ -79,7 +78,7 @@ meteor add dburles:mongo-collection-instances
7978

8079
```js
8180
Schemas = {};
82-
Posts = new Meteor.Collection('posts');
81+
Posts = new Meteor.Collection('posts');
8382
Schemas.Posts = new SimpleSchema({
8483
title: {
8584
type: String,
@@ -90,7 +89,7 @@ Schemas.Posts = new SimpleSchema({
9089
autoform: {
9190
afFieldInput: {
9291
type: 'fileUpload',
93-
collection: 'Images',
92+
collection: 'images',
9493
uploadTemplate: 'uploadField', // <- Optional
9594
previewTemplate: 'uploadPreview', // <- Optional
9695
insertConfig: { // <- Optional, .insert() method options, see: https://github.com/veliovgroup/Meteor-Files/blob/master/docs/insert.md
@@ -108,7 +107,7 @@ Schemas.Posts = new SimpleSchema({
108107
Posts.attachSchema(Schemas.Posts);
109108
```
110109

111-
The `collection` property must be the same as name of your *FilesCollection* (*case-sensitive*), `Images` in our case.
110+
The `collection` property must be the same as name of your *FilesCollection* (*case-sensitive*), `images` in our case.
112111

113112
Generate the form with `{{> quickform}}` or `{{#autoform}}` e.g.:
114113

@@ -167,7 +166,7 @@ Schemas.Posts = new SimpleSchema({
167166
autoform: {
168167
afFieldInput: {
169168
type: 'fileUpload',
170-
collection: 'Images',
169+
collection: 'images',
171170
accept: 'image/*' // or use explicit ext names like .png,.jpg
172171
}
173172
}
@@ -200,7 +199,7 @@ Schemas.Posts = new SimpleSchema({
200199
autoform: {
201200
afFieldInput: {
202201
type: 'fileUpload',
203-
collection: 'Images'
202+
collection: 'images'
204203
}
205204
}
206205
}
@@ -220,7 +219,7 @@ Your custom file preview template data context will be:
220219
autoform: {
221220
afFieldInput: {
222221
type: 'fileUpload',
223-
collection: 'Images',
222+
collection: 'images',
224223
previewTemplate: 'myFilePreview'
225224
}
226225
}
@@ -251,7 +250,7 @@ Your custom file upload template data context will be:
251250
autoform: {
252251
afFieldInput: {
253252
type: 'fileUpload',
254-
collection: 'Images',
253+
collection: 'images',
255254
uploadTemplate: 'myFileUpload'
256255
}
257256
}

0 commit comments

Comments
 (0)