How to retrieve validator for an existing collection?

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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?

            Assignee:
            Unassigned
            Reporter:
            Tomasz Zarna
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: