hapipal / confidence

Dynamic, declarative configurations
Other
263 stars 43 forks source link

filter object #66

Closed TangMonk closed 7 years ago

TangMonk commented 7 years ago
let config = { 
   database: {
        development: {
            database: 'create_trip',
            username: 'root',
            password: 'root',
            options: {
                host: 'localhost',
                dialect: 'mysql'    
            }
        },
        '$filter': 'env',
        '$default': 'development'
    }
}
const store = new Confidence.Store(config);

store.get('/database') => 'development'

how can i get entire object instead 'development'

ryanwilliamquinn commented 7 years ago

You need to pass in a criteria object. This should work:

store.get('/database', { env: 'development' })

Currently you are just getting your default value.