コード例 #1
0
 /**
  * Inserts or updates an object based on its object _id.
  *
  * <p>{@sample.xml ../../../doc/mongo-connector.xml.sample mongo:save-object-from-map}
  *
  * @param collection the collection where to insert the object
  * @param elementAttributes the mandatory object to insert.
  * @param writeConcern the write concern used to persist the object
  */
 @Processor
 public void saveObjectFromMap(
     String collection,
     @Placement(group = "Element Attributes") Map<String, Object> elementAttributes,
     @Optional @Default(WRITE_CONCERN_DEFAULT_VALUE) WriteConcern writeConcern) {
   client.saveObject(collection, (DBObject) adapt(elementAttributes), writeConcern);
 }
コード例 #2
0
 /**
  * Inserts or updates an object based on its object _id.
  *
  * <p>{@sample.xml ../../../doc/mongo-connector.xml.sample mongo:save-object}
  *
  * @param collection the collection where to insert the object
  * @param element the mandatory {@link DBObject} object to insert.
  * @param writeConcern the write concern used to persist the object
  */
 @Processor
 public void saveObject(
     String collection,
     @Optional @Default("#[payload]") DBObject element,
     @Optional @Default(WRITE_CONCERN_DEFAULT_VALUE) WriteConcern writeConcern) {
   client.saveObject(collection, from(element), writeConcern);
 }