Tabnine Logo
AbstractMongoRepository.findOne
Code IndexAdd Tabnine to your IDE (free)

How to use
findOne
method
in
de.otto.edison.mongo.AbstractMongoRepository

Best Java code snippets using de.otto.edison.mongo.AbstractMongoRepository.findOne (Showing top 3 results out of 315)

origin: de.otto.edison/edison-mongo

/**
 * Find a single value with the specified key, if existing.
 *
 * @param key the key to search for
 * @return an Optional containing the requested value, or {@code Optional.empty()} if no value with this key exists
 */
public Optional<V> findOne(final K key) {
  return findOne(key, mongoProperties.getDefaultReadTimeout(), TimeUnit.MILLISECONDS);
}
origin: otto-de/edison-microservice

/**
 * Find a single value with the specified key, if existing.
 *
 * @param key the key to search for
 * @return an Optional containing the requested value, or {@code Optional.empty()} if no value with this key exists
 */
public Optional<V> findOne(final K key) {
  return findOne(key, mongoProperties.getDefaultReadTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/mongo

public void updateIfMatch(final V value, final String eTag) {
  Bson query = and(eq(AbstractMongoRepository.ID, keyOf(value)), eq(ETAG, eTag));
  Document updatedETaggable = collection().findOneAndReplace(query, encode(value), new FindOneAndReplaceOptions().returnDocument(AFTER));
  if (isNull(updatedETaggable)) {
    Optional<V> findById = findOne(keyOf(value));
    if (findById.isPresent()) {
      throw new ConcurrentModificationException("Entity concurrently modified: " + keyOf(value));
    }
    throw new NotFoundException("Entity does not exist: " + keyOf(value));
  }
}
de.otto.edison.mongoAbstractMongoRepositoryfindOne

Javadoc

Find a single value with the specified key, if existing.

Popular methods of AbstractMongoRepository

  • byId
    Returns a query that is selecting documents by ID.
  • collection
  • decode
    Decode a MongoDB Document into a value.
  • encode
    Encode a value into a MongoDB Document.
  • keyOf
    Returns the key / identifier from the given value. The key of a document must never be null.
  • matchAll
    Returns a query that is selecting all documents.
  • collectionWithWriteTimeout
  • create
  • createOrUpdate
  • createOrUpdateBulk
  • delete
    Deletes the document identified by key.
  • deleteAll
    Deletes all documents from this repository.
  • delete,
  • deleteAll,
  • ensureIndexes,
  • findAll,
  • findAllAsStream,
  • getFindIterable,
  • size,
  • toStream,
  • update

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • setContentView (Activity)
  • setScale (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now