Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3086

How to retrieve validator for an existing collection?

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • API
    • None

    Description

      Document validation can be specified when creating a new collection, see JAVA-2008, but is there a way to retrieve it after the collection has been created?

       In mongo Shell this can be easily achieved by running db.getCollectionInfos({name: "MyTestCollection"})[0].options.validator;

      What I miss is a similar method on the MongoDatabase class or a Database Command I can run with the MongoDatabase.runCommand(...) method.

      If there's currently no way to retrieve that information, would it be possible to turn this question into a feature request?

      Attachments

        Activity

          People

            Unassigned Unassigned
            zaza Tomasz Zarna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: