Examples of collectionExists()


Examples of com.mongodb.DB.collectionExists()

    public final List<DBObject> getDBUsers(final String dbname, final String authusername,
            final String authpassword) throws StandardCodedException {
        try {
            final DB db = this.getDB(dbname, authusername, authpassword);
            if (null != db) {
                if (db.collectionExists(COLL_SYSTEMUSERS)) {
                    final DBCollection coll = db.getCollection(COLL_SYSTEMUSERS);
                    return coll.find().toArray();
                }
            }
        } catch (Throwable t) {
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

                AbstractClassMetaData cmd = getMetaDataManager().getMetaDataForClass(className, clr);
                if (cmd != null)
                {
                    // Validate the schema for the class
                    String tableName = MongoDBUtils.getCollectionName(cmd);
                    if (!db.collectionExists(tableName))
                    {
                        success = false;
                        String msg = "Table doesn't exist for " + cmd.getFullClassName() +
                            " - should have name="+ tableName;
                        System.out.println(msg);
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

  private static final String OPLOG_DB_NAME = "local";

  public Oplog(final MongoClient mongo) {
    DB local = mongo.getDB(OPLOG_DB_NAME);

    boolean oplogExists = local.collectionExists(OPLOG_COLLECTIONNAME);
    if (!oplogExists) {
      throw new NotAReplicaSetNode("node is not a part of ReplicaSet");
    }
    oplog = local.getCollection(OPLOG_COLLECTIONNAME);
  }
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

 
  private void initialize(Mongo mongo, Database database) throws T2DBException {
    DB db = mongo.getDB(configuration.getParameter(MONGODB_DB, true));
    db.setWriteConcern(getWriteConcernFromKeyword(
        configuration.getParameter(MONGODB_WRITE_CONCERN, false)));
    if (!db.collectionExists(MongoDatabase.COLL_VT)) {
      valueTypes = createCollection(db, MongoDatabase.COLL_VT, MongoDatabase.FLD_VT_NAME);
      properties = createCollection(db, MongoDatabase.COLL_PROP, MongoDatabase.FLD_PROP_NAME);
      schemas = createCollection(db, MongoDatabase.COLL_SCHEMA, MongoDatabase.FLD_SCHEMA_NAME);
      chronicles = createCollection(db, MongoDatabase.COLL_CHRON,
          MongoDatabase.FLD_CHRON_PARENT, MongoDatabase.FLD_CHRON_NAME);
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

    {
        for (TableInfo tableInfo : tableInfos)
        {
            DBObject options = setCollectionProperties(tableInfo);
            DB db = mongo.getDB(databaseName);
            if (db.collectionExists(tableInfo.getTableName()))
            {
                db.getCollection(tableInfo.getTableName()).drop();

                KunderaCoreUtils.printQuery("Drop existing collection:" + tableInfo.getTableName(), showQuery);
            }
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

        for (TableInfo tableInfo : tableInfos)
        {
            DBObject options = setCollectionProperties(tableInfo);
            DB db = mongo.getDB(databaseName);
            DBCollection collection = null;
            if (!db.collectionExists(tableInfo.getTableName()))
            {
                collection = db.createCollection(tableInfo.getTableName(), options);
                KunderaCoreUtils.printQuery("Create collection:" + tableInfo.getTableName(), showQuery);
            }
            collection = collection != null ? collection : db.getCollection(tableInfo.getTableName());
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

                if (!db.isAccessible())
                {
                    db.setAccessible(true);
                }
                DB mongoDB = (DB) db.get(client);
                if (mongoDB.collectionExists(colFamilies[0]))
                {
                    mongoDB.getCollection(colFamilies[0]).drop();
                }
                if (mongoDB.collectionExists(colFamilies[1]))
                {
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

                DB mongoDB = (DB) db.get(client);
                if (mongoDB.collectionExists(colFamilies[0]))
                {
                    mongoDB.getCollection(colFamilies[0]).drop();
                }
                if (mongoDB.collectionExists(colFamilies[1]))
                {
                    mongoDB.getCollection(colFamilies[1]).drop();
                }
                if (colFamilies.length == 3 && mongoDB.collectionExists(colFamilies[2]))
                {
View Full Code Here

Examples of com.mongodb.DB.collectionExists()

                }
                if (mongoDB.collectionExists(colFamilies[1]))
                {
                    mongoDB.getCollection(colFamilies[1]).drop();
                }
                if (colFamilies.length == 3 && mongoDB.collectionExists(colFamilies[2]))
                {
                    mongoDB.getCollection(colFamilies[2]).drop();
                }
            }
            catch (SecurityException e)
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.