Class MongoTable

    • Field Detail

      • collectionName

        private final java.lang.String collectionName
    • Constructor Detail

      • MongoTable

        MongoTable​(java.lang.String collectionName)
        Creates a MongoTable.
    • Method Detail

      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • getRowType

        public RelDataType getRowType​(RelDataTypeFactory typeFactory)
        Description copied from interface: Table
        Returns this table's row type.

        This is a struct type whose fields describe the names and types of the columns in this table.

        The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.

        Specified by:
        getRowType in interface Table
        typeFactory - Type factory with which to create the type
        Row type
      • find

        private Enumerable<java.lang.Object> find​(com.mongodb.client.MongoDatabase mongoDb,
                                                  java.lang.String filterJson,
                                                  java.lang.String projectJson,
                                                  java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Class>> fields)
        Executes a "find" operation on the underlying collection.

        For example, zipsTable.find("{state: 'OR'}", "{city: 1, zipcode: 1}")

        mongoDb - MongoDB connection
        filterJson - Filter JSON string, or null
        projectJson - Project JSON string, or null
        fields - List of fields to project; or null to return map
        Enumerator of results
      • aggregate

        private Enumerable<java.lang.Object> aggregate​(com.mongodb.client.MongoDatabase mongoDb,
                                                       java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Class>> fields,
                                                       java.util.List<java.lang.String> operations)
        Executes an "aggregate" operation on the underlying collection.

        For example: zipsTable.aggregate( "{$filter: {state: 'OR'}", "{$group: {_id: '$city', c: {$sum: 1}, p: {$sum: '$pop'}}}")

        mongoDb - MongoDB connection
        fields - List of fields to project; or null to return map
        operations - One or more JSON strings
        Enumerator of results
      • parseIntString

        private static java.lang.Integer parseIntString​(java.lang.String valueString)
        Helper method to strip non-numerics from a string.

        Currently used to determine mongod versioning numbers from buildInfo.versionArray for use in aggregate method logic.