Examples of MongoDBConnection


Examples of com.ikanow.infinit.e.data_model.store.MongoDbConnection

  // Load document results from the GUI into a (local) mongoDB
 
  public static void loadSampleData(String dataPath, String mongoServer, int mongoPort, boolean resetBeforeLoading) throws MongoException, IOException
  {
    String json = readFile(dataPath);
    MongoDbConnection mongoConnection = new MongoDbConnection(mongoServer, mongoPort);
   
    if (resetBeforeLoading) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").drop();
    }
    QueryResults res = QueryResults.fromApi(json, QueryResults.class);
    List<DocumentPojo> documents = res.documents;
    if (null == documents) {
      documents = res.data; // (maybe it was a direct JSON call not a GUI save file)
    }   
    for (DocumentPojo doc: documents) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").insert(doc.toDb());
    }
   
  }//TESTED
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.MongoDbConnection

  // Load document results from the GUI into a (local) mongoDB
 
  public static void loadSampleData(String dataPath, String mongoServer, int mongoPort, boolean resetBeforeLoading) throws MongoException, IOException
  {
    String json = readFile(dataPath);
    MongoDbConnection mongoConnection = new MongoDbConnection(mongoServer, mongoPort);
   
    if (resetBeforeLoading) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").drop();
    }
    QueryResults res = QueryResults.fromApi(json, QueryResults.class);
    List<DocumentPojo> documents = res.documents;
    if (null == documents) {
      documents = res.data; // (maybe it was a direct JSON call not a GUI save file)
    }   
    for (DocumentPojo doc: documents) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").insert(doc.toDb());
    }
   
  }//TESTED
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.MongoDbConnection

  // Load document results from the GUI into a (local) mongoDB
 
  public static void loadSampleData(String dataPath, String mongoServer, int mongoPort, boolean resetBeforeLoading) throws MongoException, IOException
  {
    String json = readFile(dataPath);
    MongoDbConnection mongoConnection = new MongoDbConnection(mongoServer, mongoPort);
   
    if (resetBeforeLoading) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").drop();
    }
    QueryResults res = QueryResults.fromApi(json, QueryResults.class);
    List<DocumentPojo> documents = res.documents;
    if (null == documents) {
      documents = res.data; // (maybe it was a direct JSON call not a GUI save file)
    }   
    for (DocumentPojo doc: documents) {
      mongoConnection.getMongo().getDB("test").getCollection("docs").insert(doc.toDb());
    }
   
  }//TESTED
View Full Code Here

Examples of fr.eolya.utils.nosql.mongodb.MongoDBConnection

public class DBConnectionFactory {

  public static IDBConnection getDBConnectionInstance(String type, String dbHost, int dbPort, String userName, String userPassword) {
    if ("mongodb".equals(type)) {
      try {
        return  new MongoDBConnection(dbHost, dbPort, userName, userPassword);
      } catch (UnknownHostException e) {
        e.printStackTrace();
        return null;
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.