Example usage for org.springframework.data.mongodb.core.convert DefaultMongoTypeMapper DefaultMongoTypeMapper

List of usage examples for org.springframework.data.mongodb.core.convert DefaultMongoTypeMapper DefaultMongoTypeMapper

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.convert DefaultMongoTypeMapper DefaultMongoTypeMapper.

Prototype

public DefaultMongoTypeMapper(@Nullable String typeKey) 

Source Link

Document

Create a new MongoTypeMapper with fully-qualified type hints using typeKey .

Usage

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.config.mongo.MongoConfiguration.java

public @Bean MongoTemplate mongoTemplate() throws Exception {
    MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory()),
            new MongoMappingContext());
    // remove _class
    converter.setTypeMapper(new DefaultMongoTypeMapper(null));

    return new MongoTemplate(mongoDbFactory(), converter);
}

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.config.mongo.MongoConfiguration.java

public

@Bean MongoTemplate categoriesMongoTemplate() throws Exception {
    MongoClient client;//w w  w  .j  a  v  a  2 s . c  om
    client = getMongoClientForCategoriesDatabase();

    MongoDbFactory categoriesMongoDbFactory = new SimpleMongoDbFactory(client, database);
    MappingMongoConverter converter = new MappingMongoConverter(
            new DefaultDbRefResolver(categoriesMongoDbFactory), new MongoMappingContext());
    // remove _class
    converter.setTypeMapper(new DefaultMongoTypeMapper(null));

    return new MongoTemplate(categoriesMongoDbFactory, converter);
}