org.springframework.data.mongodb.repository

Interface MongoRepository<T,ID>

    • Method Detail

      • insert

        <S extends T> S insert(S entity)
        Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the returned instance for further operations as the save operation might have changed the entity instance completely. Prefer using CrudRepository.save(Object) instead to avoid the usage of store-specific API.
        Parameters:
        entity - must not be null.
        Returns:
        the saved entity
        Since:
        1.7
      • insert

        <S extends TList<S> insert(Iterable<S> entities)
        Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the insert over a call to #save(Iterable). Prefer using #save(Iterable) to avoid the usage of store specific API.
        Parameters:
        entities - must not be null.
        Returns:
        the saved entities
        Since:
        1.7