Skip to content

Latest commit

 

History

History
61 lines (51 loc) · 2 KB

README.md

File metadata and controls

61 lines (51 loc) · 2 KB

#autoform-relations#

###Description### Adds a custom input type called "relation" to the Aldeed's meteor-autoform package for when we need to add a reference to a document (or documents) in another collection. Includes an integration with meteorhacks:searchsource to provide full text search capabilities.

###Usage###

meteor add skehoe1989:autoform-relations

Add the 'relation' input type to the autoform property in your collection's SimpleSchema:

autoform-relations

CoursesSchema = new SimpleSchema({
    'title': {
        type: String
    },
    'category' : {
      type: String
    },
    'classes' : {
      type: [String],
        autoform: {
            type: 'relation',
            settings: {
                collection: 'Classes',
                fields: ['title', 'description'],
                options: {
                    keepHistory: 1000 * 60 * 5,
                    localSearch: true
                }
            }
        }
    },
    'instructor': {
        type: String,
        optional: true
    },
    'description': {
        type: String,
        optional:true,
        autoform: {
            rows: 20,
            type: 'markdown'
        }
    }

});

Settings Explained

  • collection - The name of the collection you want to search/add document references from.
  • fields - An array of field names from the collection specified that you want to search over. Passes through to meteorhacks:searchsource
  • options - Options to be passed to meteorhacks:searchsource that can enable search caching, local search, and paged results.

Maintained by BitTiger

BitTiger Logo