Examples of BasicDBObject


Examples of com.mongodb.BasicDBObject

    bepplePeach.put( "name", "Bepple Peach" );
    return bepplePeach;
  }

  private BasicDBObject getPlayer() {
    BasicDBObject golfPlayer = new BasicDBObject();
    golfPlayer.put( "_id", 1L );
    golfPlayer.put( "name", "Ben" );
    golfPlayer.put( "handicap", 0.1 );
    return golfPlayer;
  }
View Full Code Here

Examples of com.mongodb.BasicDBObject

    golfPlayer.put( "handicap", 0.1 );
    return golfPlayer;
  }

  private BasicDBList getPlayedCoursesAssociationEmbedded() {
    BasicDBObject bepplePeachRef = new BasicDBObject();
    bepplePeachRef.put( "playedCourses_id", 1L );

    BasicDBList playedCourses = new BasicDBList();
    playedCourses.add( bepplePeachRef );

    return playedCourses;
View Full Code Here

Examples of com.mongodb.BasicDBObject

    return playedCourses;
  }

  private BasicDBObject getPlayedCoursesAssociationAsDocument() {
    BasicDBObject id = new BasicDBObject();
    id.put( "golfPlayer_id", 1L );
    id.put( "table", "GolfPlayer_GolfCourse" );

    BasicDBObject row = new BasicDBObject();
    row.put( "playedCourses_id", 1L );

    BasicDBList rows = new BasicDBList();
    rows.add( row );

    BasicDBObject association = new BasicDBObject();
    association.put( "_id", id );
    association.put( "rows", rows );
    return association;
  }
View Full Code Here

Examples of com.mongodb.BasicDBObject

        if ( field == null ) {
          if ( index == size - 1 ) {
            field = value;
          }
          else {
            field = new BasicDBObject();
          }
          parent.put( node, field );
        }
      }
    }
View Full Code Here

Examples of com.mongodb.BasicDBObject

    this.dbObject = document;
  }

  //not for embedded
  public DBObject getQueryObject() {
    DBObject query = new BasicDBObject();
    query.put( MongoDBDialect.ID_FIELDNAME, dbObject.get( MongoDBDialect.ID_FIELDNAME ) );
    return query;
  }
View Full Code Here

Examples of com.mongodb.BasicDBObject

  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.BasicDBObject

  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.BasicDBObject

  }

  @Test
  public void shouldApplyConfiguredWriteConcernForUpdateOfEmbeddedAssociation() {
    // given a persisted player with one associated golf course
    BasicDBObject player = getPlayer();
    player.put( "playedCourses", getPlayedCoursesAssociationEmbedded() );

    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", player )
        .insert( "GolfCourse", getGolfCourse() )
        .build();
View Full Code Here

Examples of com.mongodb.BasicDBObject

  }

  @Test
  public void shouldApplyConfiguredWriteConcernForRemovalOfEmbeddedAssociation() {
    // given a persisted player with one associated golf course
    BasicDBObject player = getPlayer();
    player.put( "playedCourses", getPlayedCoursesAssociationEmbedded() );

    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", player )
        .insert( "GolfCourse", getGolfCourse() )
        .build();
View Full Code Here

Examples of com.mongodb.BasicDBObject

    sessions = configuration.buildSessionFactory();
  }

  private BasicDBObject getGolfCourse() {
    BasicDBObject bepplePeach = new BasicDBObject();
    bepplePeach.put( "_id", 1L );
    bepplePeach.put( "name", "Bepple Peach" );
    return bepplePeach;
  }
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.