Package com.mongodb

Examples of com.mongodb.DBCollection.update()


                if ( col != null ) {
                    final String[] info = new String[] {changed.getCollection(),
                            changed.getProperties().get(getPROP_PATH()).toString()};
                    // create or update?
                    if ( changed.getProperties().get(PROP_ID) != null ) {
                        col.update(QueryBuilder.start(getPROP_PATH()).is(changed.getProperties().get(getPROP_PATH())).get(),
                                changed.getProperties());
                        this.context.notifyUpdated(info);
                    } else {
                        // create
                        col.save(changed.getProperties());
View Full Code Here


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

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

  protected void checkLoading(DBObject associationObject) {
    /*
     * The only column (except _id) that needs to be retrieved is "rows"
View Full Code Here

      associationField = ROWS_FIELDNAME;
    }

    DBObject update = new BasicDBObject( "$set", new BasicDBObject( associationField, toStore ) );

    collection.update( query, update, true, false, writeConcern );
  }

  @Override
  public void removeAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
View Full Code Here

    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 );
  }

  @Override
  protected void checkLoading(DBObject associationObject) {
    /*
 
View Full Code Here

    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

                DBCollection coll = getCollection();

                DBObject query = getTemplateObject(changedRole);
                DBObject update = m_helper.serializeUpdate(changedRole);

                WriteResult result = coll.update(query, update, false /* upsert */, false /* multi */);

                if (result.getLastError() != null) {
                    result.getLastError().throwOnError();
                }
            }
View Full Code Here

        // full-signature method update(DBObject, DBObject, boolean, boolean). However, the default behaviour may change in the future,
        // so it's safer to be explicit at this level for full determinism
        if (multi == null && upsert == null) {
            // for update with no multi nor upsert but with specific WriteConcern there is no update signature without multi and upsert args,
            // so assume defaults
            result = wc == null ? dbCol.update(updateCriteria, objNew) : dbCol.update(updateCriteria, objNew, false, false, wc);
        } else {
            // we calculate the final boolean values so that if any of these
            // parameters is null, it is resolved to false
            result = wc == null ? dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi)) : dbCol
                .update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi), wc);
View Full Code Here

        // full-signature method update(DBObject, DBObject, boolean, boolean). However, the default behaviour may change in the future,
        // so it's safer to be explicit at this level for full determinism
        if (multi == null && upsert == null) {
            // for update with no multi nor upsert but with specific WriteConcern there is no update signature without multi and upsert args,
            // so assume defaults
            result = wc == null ? dbCol.update(updateCriteria, objNew) : dbCol.update(updateCriteria, objNew, false, false, wc);
        } else {
            // we calculate the final boolean values so that if any of these
            // parameters is null, it is resolved to false
            result = wc == null ? dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi)) : dbCol
                .update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi), wc);
View Full Code Here

            // so assume defaults
            result = wc == null ? dbCol.update(updateCriteria, objNew) : dbCol.update(updateCriteria, objNew, false, false, wc);
        } else {
            // we calculate the final boolean values so that if any of these
            // parameters is null, it is resolved to false
            result = wc == null ? dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi)) : dbCol
                .update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi), wc);
        }

        Message resultMessage = prepareResponseMessage(exchange, MongoDbOperation.update);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
View Full Code Here

            // so assume defaults
            result = wc == null ? dbCol.update(updateCriteria, objNew) : dbCol.update(updateCriteria, objNew, false, false, wc);
        } else {
            // we calculate the final boolean values so that if any of these
            // parameters is null, it is resolved to false
            result = wc == null ? dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi)) : dbCol
                .update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi), wc);
        }

        Message resultMessage = prepareResponseMessage(exchange, MongoDbOperation.update);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
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.