Spring Data MongoDB
  1. Spring Data MongoDB
  2. DATAMONGO-174

Add additional constructor to MongoTemplate that take com.mongodb.Mongo, database name, user credentials and MongoConverter.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.0 M3
    • Fix Version/s: None
    • Component/s: Mapping
    • Labels:
      None

      Description

      As a convenience add the constructor

      MongoTemplate(Mongo mongo, String databaseName, org.springframework.data.authentication.UserCredentials userCredentials, MongoConverter mongoConverter)

        Activity

        Hide
        Oliver Gierke added a comment -

        We already have MongoTemplate(MongoDbFactory factory, MongoConverter converter so all it would take right now is the client doing:

        MongoDbFactory factory = new SimpleMongoDbFactory(mongo, databaseName, credentials);
        MongoOperations operations = new MongoTemplate(factory, converter);
        

        So do we really need to add the additional constructor? We already have 5 and right now there's a clean guideline: as soon as you want to configure a MongoConverter or concerns you need to use MongoDbFactory. If we add the constructor proposed we'd almost certainly get request to add one with Mongo, databaseName, credentials, converter, WriteConcern and WriteResultChecking and this feels like constructor creep .

        Show
        Oliver Gierke added a comment - We already have MongoTemplate(MongoDbFactory factory, MongoConverter converter so all it would take right now is the client doing: MongoDbFactory factory = new SimpleMongoDbFactory(mongo, databaseName, credentials); MongoOperations operations = new MongoTemplate(factory, converter); So do we really need to add the additional constructor? We already have 5 and right now there's a clean guideline: as soon as you want to configure a MongoConverter or concerns you need to use MongoDbFactory . If we add the constructor proposed we'd almost certainly get request to add one with Mongo , databaseName, credentials, converter, WriteConcern and WriteResultChecking and this feels like constructor creep .
        Hide
        Oliver Gierke added a comment -

        Closing as won't fix as there's a workaround described in my comment above and we didn't get convinvinc feedback beyond that.

        Show
        Oliver Gierke added a comment - Closing as won't fix as there's a workaround described in my comment above and we didn't get convinvinc feedback beyond that.

          People

          • Assignee:
            Oliver Gierke
            Reporter:
            Mark Pollack
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: