Search code examples
springmongodbherokumongohq

connect mongohq or mongolab using spring framework


i try to connect to mongohq using spring. i got some information from heroku but while connecting with that code MongoURI class are deprecated . I used spring-data-mongodb version 1.2.0.RELEASE. and mongo-java-driver - 2.11.0

can any one tell how to connect to mongohq or mongolab using spring


Solution

  • As you can read in the MongoURI documentation

    public class MongoURI extends Object

    Represents a URI which can be used to create a Mongo instance. The URI describes the hosts to be used and options.

    This class has been superseded by MongoClientURI, and may be deprecated in a future release.

    So MongoClientURI is your answer