Package com.mongodb

Examples of com.mongodb.WriteConcern$Majority


    //  execution(WriteResult DBCollection.save(DBObject, WriteConcern));
    @Test
    @Ignore("This particular method is very difficult to test due to final and various other interactions in the DBCollection class")
    public void testSave() {
        ((DBCollectionDummy) getMeACollection()).save(new BasicDBObject("whoa", "there"), new WriteConcern(), "blah");
        Operation op = getLastEntered();
        standardAsserts(op);
    }
View Full Code Here


  @Override
  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    BasicDBObject idObject = this.prepareIdObject( key );
    DBObject updater = objectForUpdate( tuple, key, idObject );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    getCollection( key ).update( idObject, updater, true, false, writeConcern );
  }
View Full Code Here

  }

  @Override
  public void insertTuple(EntityKeyMetadata entityKeyMetadata, Tuple tuple, TupleContext tupleContext) {
    DBObject dbObject = objectForInsert( tuple, new BasicDBObject( tuple.getColumnNames().size() ) );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    getCollection( entityKeyMetadata ).insert( dbObject, writeConcern );

    tuple.put( entityKeyMetadata.getColumnNames()[0], dbObject.get( ID_FIELDNAME ) );
  }
View Full Code Here

  @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

  }

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
    WriteConcern writeConcern = getWriteConcern( associationContext );

    if ( storageStrategy == AssociationStorageStrategy.IN_ENTITY ) {
      DBObject entity = getEmbeddingEntity( key, associationContext );
      DBObject entityId = prepareIdObject( key.getEntityKey() );
View Full Code Here

    DBObject query;
    MongoDBAssociationSnapshot assocSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
    String associationField;

    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
    WriteConcern writeConcern = getWriteConcern( associationContext );

    // We need to execute the previous operations first or it won't be able to find the key that should have
    // been created
    executeBatch( associationContext.getOperationsQueue() );
    if ( storageStrategy == AssociationStorageStrategy.IN_ENTITY ) {
View Full Code Here

  }

  @Override
  public void removeAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
    WriteConcern writeConcern = getWriteConcern( associationContext );

    if ( storageStrategy == AssociationStorageStrategy.IN_ENTITY ) {
      DBObject entity = this.prepareIdObject( key.getEntityKey() );
      if ( entity != null ) {
        BasicDBObject updater = new BasicDBObject();
View Full Code Here

  private void executeBatchUpdate(Map<DBCollection, BatchInsertionTask> inserts, UpdateTupleOperation tupleOperation) {
    EntityKey entityKey = tupleOperation.getEntityKey();
    Tuple tuple = tupleOperation.getTuple();
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tupleOperation.getTuple().getSnapshot();
    WriteConcern writeConcern = getWriteConcern( tupleOperation.getTupleContext() );

    if ( INSERT == snapshot.getOperationType() && columnNamesAllowBatchInsert( tupleOperation ) ) {
      prepareForInsert( inserts, snapshot, entityKey, tuple, writeConcern );
    }
    else {
View Full Code Here

  @Override
  public void updateTuple(Tuple tuple, EntityKey key, TupleContext tupleContext) {
    BasicDBObject idObject = this.prepareIdObject( key );
    DBObject updater = objectForUpdate( tuple, key, idObject );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    getCollection( key ).update( idObject, updater, true, false, writeConcern );
  }
View Full Code Here

  @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

TOP

Related Classes of com.mongodb.WriteConcern$Majority

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.