meteor-collection-timestampable icon indicating copy to clipboard operation
meteor-collection-timestampable copied to clipboard

Problem global config with "imports" structure

Open thearabbit opened this issue 7 years ago • 4 comments

I use imports structure like this

/ client
/ common
     behaviors.js
/ imorts
     api/
           collection.js
/ server

Behaviors Config

// Collection Behaviours config
CollectionBehaviours.configure({
    timestampable: {
        createdAt: 'createdAt',
        createdBy: 'createdBy',
        updatedAt: 'updatedAt',
        updatedBy: 'updatedBy',
        systemId: '0'
    },
    softRemovable: {
        removed: 'removed',
        removedAt: 'removedAt',
        removedBy: 'removedBy',
        restoredAt: 'restoredAt',
        restoredBy: 'restoredAt',
        systemId: '0'
    }
});

But don't work, Please help me

thearabbit avatar Jan 21 '18 03:01 thearabbit

You need to make sure that the configure code is imported and run before any calls to attach are made.

zimme avatar Jan 21 '18 09:01 zimme

Follow my structure, the common/behaviors .js is run first because it is out of imports folder. Could more detail?

thearabbit avatar Jan 23 '18 00:01 thearabbit

Or it mean that I must import config file on all collection file.

import '../../common/behaviors.js'

export const MyCollection = new Mongo.Collection('myCollection');

thearabbit avatar Jan 23 '18 00:01 thearabbit

Still don't work

thearabbit avatar Jan 25 '18 11:01 thearabbit