0
votes

I created a project following the steps of the sample project at https://github.com/teiid/teiid-spring-boot/tree/master/samples/mongodb and added org.teiid:spring-odata dependency for OData exposure.

I find out that it exposed all collections in the MongoDB database as OData entities by default. Would it possible to configure it to expose specific collections only?

1

1 Answers

0
votes

Updated:

You can add following to application.properties,

spring.teiid.data.mongodb.accounts.remoteServerList=localhost:27017
spring.teiid.data.mongodb.accounts.database=sampledb
spring.teiid.data.mongodb.accounts.user=admin
spring.teiid.data.mongodb.accounts.password=admin
spring.teiid.data.mongodb.accounts.authDatabase=admin

spring.teiid.data.mongodb.accounts.importer.excludeTables=.*

where "accounts" is the bean name. See "importer properties" http://teiid.github.io/teiid-documents/master/content/reference/MongoDB_Translator.html

Then to configure the data source

@Configuration
public class DataSources {
    @Bean
    public MongoDBConnectionFactory accounts(@Qualifier("config") @Autowired MongoDBConfiguration config) {
        return new MongoDBConnectionFactory(new MongoDBTemplate(config));
    }

    @ConfigurationProperties("spring.teiid.data.mongodb.accounts")
    @Bean("config")
    public MongoDBConfiguration mongoConfig() {
        return new MongoDBConfiguration();
    }
}

The above is when strictly talking about exposing MongoDB alone without any other changes.