Class MongoDBQueryEvaluator

java.lang.Object
fr.inria.rules.integraal.storage.external.evaluator.MongoDBQueryEvaluator
All Implemented Interfaces:
NativeQueryEvaluator<String, com.mongodb.client.MongoCursor<org.bson.Document>>

public class MongoDBQueryEvaluator extends Object implements NativeQueryEvaluator<String, com.mongodb.client.MongoCursor<org.bson.Document>>
Sends a MongoDB query This evaluator uses com.mongodb MongoClient to send the query. The result is a MongoCursor
Author:
Florent Tornil
  • Constructor Details

    • MongoDBQueryEvaluator

      public MongoDBQueryEvaluator(String host, String user, String password, String database, String collection)
      Creates a new driver using the given parameters
      Parameters:
      host - the hostname/IP of the database
      user - the username used to connect to the database
      password - the password used to connect to the database
      database - the database name
      collection - the collection name
    • MongoDBQueryEvaluator

      public MongoDBQueryEvaluator(String uri, String database_name, String collection_name)
      Creates a new driver over the given mongodb string
      Parameters:
      uri - mongodb connection uri
      database_name - the database name
      collection_name - the collection name
  • Method Details

    • evaluate

      public Optional<com.mongodb.client.MongoCursor<org.bson.Document>> evaluate(String query)
      Description copied from interface: NativeQueryEvaluator
      Evaluate the given query and returns the result This should not do anymore work
      Specified by:
      evaluate in interface NativeQueryEvaluator<String, com.mongodb.client.MongoCursor<org.bson.Document>>
      Parameters:
      query - to evaluate
      Returns:
      an optional which contains the results of the query if everything went right, an empty optional otherwise