Examples of DBCollection


Examples of com.mongodb.DBCollection

    return insertsForCollection;
  }

  private void flushInserts(Map<DBCollection, BatchInsertionTask> inserts) {
    for ( Map.Entry<DBCollection, BatchInsertionTask> entry : inserts.entrySet() ) {
      DBCollection collection = entry.getKey();
      collection.insert( entry.getValue().getAll(), entry.getValue().getWriteConcern() );
    }
    inserts.clear();
  }
View Full Code Here

Examples of com.mongodb.DBCollection

  @Override
  protected void addExtraColumn() {
    MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) super.getService( DatastoreProvider.class );
    DB database = provider.getDatabase();
    DBCollection collection = database.getCollection( "Project" );

    BasicDBObject query = new BasicDBObject( 1 );
    query.put( "_id", "projectID" );

    BasicDBObject updater = new BasicDBObject( 1 );
    updater.put( "$push", new BasicDBObject( "extraColumn", 1 ) );
    collection.update( query, updater );
  }
View Full Code Here

Examples of com.mongodb.DBCollection

   */
  @Override
  protected void addExtraColumn() {
    MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) super.getService( DatastoreProvider.class );
    DB database = provider.getDatabase();
    DBCollection collection = database.getCollection( "Associations" );

    final BasicDBObject idObject = new BasicDBObject( 2 );
    idObject.append( "Project_id", "projectID" );
    idObject.append( "table", "Project_Module" );

    BasicDBObject query = new BasicDBObject( 1 );
    query.put( "_id", idObject );

    BasicDBObject updater = new BasicDBObject( 1 );
    updater.put( "$push", new BasicDBObject( "extraColumn", 1 ) );
    collection.update( query, updater );
  }
View Full Code Here

Examples of com.mongodb.DBCollection

      return embeddingEntityDocument;
    }
    else {
      ReadPreference readPreference = getReadPreference( associationContext );

      DBCollection collection = getCollection( key.getEntityKey() );
      DBObject searchObject = prepareIdObject( key.getEntityKey() );
      DBObject projection = getProjection( key, true );

      return collection.findOne( searchObject, projection, readPreference );
    }
  }
View Full Code Here

Examples of com.mongodb.DBCollection

  }

  private DBObject getObject(EntityKey key, TupleContext tupleContext) {
    ReadPreference readPreference = getReadPreference( tupleContext );

    DBCollection collection = getCollection( key );
    DBObject searchObject = prepareIdObject( key );
    BasicDBObject projection = getProjection( tupleContext );

    return collection.findOne( searchObject, projection, readPreference );
  }
View Full Code Here

Examples of com.mongodb.DBCollection

    return !column.equals( ID_FIELDNAME ) && !column.endsWith( PROPERTY_SEPARATOR + ID_FIELDNAME ) && !snapshot.isKeyColumn( column );
  }

  @Override
  public void removeTuple(EntityKey key, TupleContext tupleContext) {
    DBCollection collection = getCollection( key );
    DBObject toDelete = prepareIdObject( key );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    collection.remove( toDelete, writeConcern );
  }
View Full Code Here

Examples of com.mongodb.DBCollection

    for ( String versionColumn : oldLockState.getColumnNames() ) {
      toDelete.put( versionColumn, oldLockState.get( versionColumn ) );
    }

    DBCollection collection = getCollection( entityKey );
    DBObject deleted = collection.findAndRemove( toDelete );

    return deleted != null;
  }
View Full Code Here

Examples of com.mongodb.DBCollection

    try {

      // force connection to be established
      mongoClient.getDatabaseNames();

      DBCollection ME = db.getCollection(Entities);

      BasicDBObject created = new BasicDBObject("name", comp.getName())
          .append("time", System.currentTimeMillis()).append("op",
              "created");

      for (Map.Entry<String, Object> e : comp.getAllProperties()
          .entrySet()) {
        created.append(e.getKey().replace('.', '_'), e.getValue()
            .toString());
      }

      ME.insert(created);

    } catch (MongoException e) {

      stop();
    }
View Full Code Here

Examples of com.mongodb.DBCollection

    try {

      // force connection to be established
      mongoClient.getDatabaseNames();

      DBCollection ChangedLink = db.getCollection(Links);

      BasicDBObject newLink = new BasicDBObject("name", wire.getSource()
          .getName()).append("time", System.currentTimeMillis())
          .append("linkType", "Wire")
          .append("linkId", wire.getName())
          .append("added", wire.getDestination().getName());

      ChangedLink.insert(newLink);
    } catch (MongoException e) {

      stop();
    }
View Full Code Here

Examples of com.mongodb.DBCollection

    try {

      // force connection to be established
      mongoClient.getDatabaseNames();

      DBCollection ChangedAttr = db.getCollection(ChangedAttributes);

      BasicDBObject newVal = new BasicDBObject("name", comp.getName())
          .append("time", System.currentTimeMillis())
          .append("op", "added").append("attribute", attr)
          .append("value", newValue);
      for (Map.Entry<String, Object> e : comp.getAllProperties()
          .entrySet()) {
        newVal.append(e.getKey(), e.getValue().toString());
      }
      ChangedAttr.insert(newVal);
    } catch (MongoException e) {
      stop();
    }
  }
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.