org.springframework.data.mongodb.core.MongoTemplate.insert()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中org.springframework.data.mongodb.core.MongoTemplate.insert()方法的一些代码示例,展示了MongoTemplate.insert()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoTemplate.insert()方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.MongoTemplate
类名称:MongoTemplate
方法名:insert

MongoTemplate.insert介绍

暂无

代码示例

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void insert(RoncooUser roncooUser) {
  mongoTemplate.insert(roncooUser);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public Collection<T> all(Collection<? extends T> objects) {
  Assert.notNull(objects, "Objects must not be null!");
  return template.insert(objects, getCollectionName());
}

代码示例来源:origin: kaaproject/kaa

@Override
public List<LogEvent> save(List<LogEventDto> logEventDtos, ProfileInfo clientProfile,
              ProfileInfo serverProfile, String collectionName) {
 List<LogEvent> logEvents = new ArrayList<>(logEventDtos.size());
 for (LogEventDto logEventDto : logEventDtos) {
  logEvents.add(new LogEvent(logEventDto, clientProfile, serverProfile));
 }
 LOG.debug("Saving {} log events", logEvents.size());
 mongoTemplate.insert(logEvents, collectionName);
 return logEvents;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public T one(T object) {
  Assert.notNull(object, "Object must not be null!");
  return template.insert(object, getCollectionName());
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public <T> T insert(T objectToSave) {
  Assert.notNull(objectToSave, "ObjectToSave must not be null!");
  ensureNotIterable(objectToSave);
  return insert(objectToSave, operations.determineEntityCollectionName(objectToSave));
}

代码示例来源:origin: lianggzone/springboot-action

public void add(Author author) {
  this.mongoTemplate.insert(author);
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public Collection<T> all(Collection<? extends T> objects) {
  Assert.notNull(objects, "Objects must not be null!");
  return template.insert(objects, getCollectionName());
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public T one(T object) {
  Assert.notNull(object, "Object must not be null!");
  return template.insert(object, getCollectionName());
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public <T> T insert(T objectToSave) {
  Assert.notNull(objectToSave, "ObjectToSave must not be null!");
  ensureNotIterable(objectToSave);
  return insert(objectToSave, operations.determineEntityCollectionName(objectToSave));
}

代码示例来源:origin: spring-projects/spring-integration

protected void addMessageDocument(final MessageDocument document) {
  if (document.getGroupCreatedTime() == 0) {
    document.setGroupCreatedTime(System.currentTimeMillis());
  }
  document.setCreatedTime(System.currentTimeMillis());
  try {
    this.mongoTemplate.insert(document, this.collectionName);
  }
  catch (DuplicateKeyException e) {
    if (this.logger.isDebugEnabled()) {
      this.logger.debug("The Message with id [" + document.getMessageId() + "] already exists.\n" +
          "Ignoring INSERT and SELECT existing...");
    }
  }
}

代码示例来源:origin: spring-projects/spring-integration

private void addMessageDocument(MessageWrapper document) {
  UUID messageId = (UUID) document.headers.get(MessageHeaders.ID);
  Assert.notNull(messageId, "ID header must not be null");
  Query query = whereMessageIdIsAndGroupIdIs(messageId, document.get_GroupId());
  if (!this.template.exists(query, MessageWrapper.class, this.collectionName)) {
    if (document.get_Group_timestamp() == 0) {
      document.set_Group_timestamp(System.currentTimeMillis());
    }
    document.set_message_timestamp(System.currentTimeMillis());
    this.template.insert(document, this.collectionName);
  }
}

代码示例来源:origin: rstyro/Springboot

/**
 * 批量新增
 */
@Override
public void saveBathUser(List<User> users) {
  mongoTemplate.insert(users, User.class);
}

相关文章