Package com.mongodb

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


    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

    NativeQueryParser parser = Parboiled.createParser( NativeQueryParser.class );
    ParsingResult<MongoDBQueryDescriptorBuilder> run =  new RecoveringParseRunner<MongoDBQueryDescriptorBuilder>( parser.Query() )
        .run( "db.Order.find({})");

    MongoDBQueryDescriptor queryDescriptor = run.resultValue.build();
    assertThat( queryDescriptor.getCriteria() ).isEqualTo( new BasicDBObject() );
  }
View Full Code Here

    return queue != null && queue.contains( key );
  }

  @Override
  public Tuple createTuple(EntityKeyMetadata entityKeyMetadata, TupleContext tupleContext) {
    return new Tuple( new MongoDBTupleSnapshot( new BasicDBObject(), entityKeyMetadata, SnapshotType.INSERT ) );
  }
View Full Code Here

  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

  /**
   * Returns a projection object for specifying the fields to retrieve during a specific find operation.
   */
  private BasicDBObject getProjection(List<String> fieldNames) {
    BasicDBObject projection = new BasicDBObject( fieldNames.size() );
    for ( String column : fieldNames ) {
      projection.put( column, 1 );
    }

    return projection;
  }
View Full Code Here

  private BasicDBObject prepareIdObject(IdSourceKey key) {
    return this.prepareIdObject( key.getColumnNames(), key.getColumnValues() );
  }

  private BasicDBObject prepareIdObject(String[] columnNames, Object[] columnValues) {
    BasicDBObject object;
    if ( columnNames.length == 1 ) {
      object = new BasicDBObject( ID_FIELDNAME, columnValues[0] );
    }
    else {
      object = new BasicDBObject();
      DBObject idObject = new BasicDBObject();
      for ( int i = 0; i < columnNames.length; i++ ) {
        String columnName = columnNames[i];
        Object columnValue = columnValues[i];

        if ( columnName.contains( PROPERTY_SEPARATOR ) ) {
          int dotIndex = columnName.indexOf( PROPERTY_SEPARATOR );
          String shortColumnName = columnName.substring( dotIndex + 1 );
          idObject.put( shortColumnName, columnValue );
        }
        else {
          idObject.put( columnNames[i], columnValue );
        }

      }
      object.put( ID_FIELDNAME, idObject );
    }
View Full Code Here

      return getCollection( ASSOCIATIONS_COLLECTION_PREFIX + key.getTable() );
    }
  }

  private BasicDBObject getSubQuery(String operator, BasicDBObject query) {
    return query.get( operator ) != null ? (BasicDBObject) query.get( operator ) : new BasicDBObject();
  }
View Full Code Here

  private BasicDBObject getSubQuery(String operator, BasicDBObject query) {
    return query.get( operator ) != null ? (BasicDBObject) query.get( operator ) : new BasicDBObject();
  }

  private void addSubQuery(String operator, BasicDBObject query, String column, Object value) {
    BasicDBObject subQuery = this.getSubQuery( operator, query );
    query.append( operator, subQuery.append( column, value ) );
  }
View Full Code Here

    query.append( operator, subQuery.append( column, value ) );
  }

  @Override
  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    BasicDBObject idObject = this.prepareIdObject( key );

    DBObject updater = objectForUpdate( tuple, idObject );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

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

TOP

Related Classes of com.mongodb.BasicDBObject

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.