Package com.ikanow.infinit.e.data_model.store

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


  // 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

  // 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

TOP

Related Classes of com.ikanow.infinit.e.data_model.store.MongoDbConnection

Copyright © 2018 www.massapicom. 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.