Codota Logo
de.otto.edison.mongo
Code IndexAdd Codota to your IDE (free)

How to use de.otto.edison.mongo

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes the document identified by key.
 *
 * @param key the identifier of the deleted document
 */
public void delete(final K key) {
  delete(key, mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes all documents from this repository.
 */
public void deleteAll() {
  deleteAll(mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/edison-mongo

/**
 * Updates the document if it is already present in the repository.
 *
 * @param value the new value
 * @return true, if the document was updated, false otherwise.
 */
public boolean update(final V value) {
  return update(value, mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/mongo

public void update(final V value) {
  final K key = keyOf(value);
  collection().replaceOne(byId(key), encode(value));
}
origin: de.otto.edison/mongo

public V create(final V value) {
  Document doc = encode(value);
  collection().insertOne(doc);
  return decode(doc);
}
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

/**
 * Deletes the document identified by key.
 *
 * @param key      the identifier of the deleted document
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void delete(final K key, final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteOne(byId(key));
}
origin: otto-de/edison-microservice

/**
 * Deletes all documents from this repository.
 *
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void deleteAll(final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteMany(matchAll());
}
origin: otto-de/edison-microservice

@Test
public void shouldNotUpdateIfEtagNotMatch() {
  // given
  final TestObject testObject = new TestObject("someId", "someValue", "someEtagWhichIsNotInTheDb");
  testee.create(testObject);
  // when
  final UpdateIfMatchResult updated = testee.updateIfMatch(testObject, "someOtherETag");
  // then
  assertThat(updated, is(UpdateIfMatchResult.CONCURRENTLY_MODIFIED));
}
origin: de.otto.edison/edison-mongo

@PostConstruct
public void postConstruct() {
  ensureIndexes();
}
origin: otto-de/edison-microservice

@Test
public void shouldNotUpdateIfEtagNotExists() {
  // given
  final TestObject testObject = new TestObject("someId", "someValue");
  // when
  final UpdateIfMatchResult updated = testee.updateIfMatch(testObject, "someETag");
  // then
  assertThat(updated, is(UpdateIfMatchResult.NOT_FOUND));
}
origin: otto-de/edison-microservice

@Test
public void shouldNotCreateOrUpdateWithMissingId() {
  // given
  final TestObject testObject = new TestObject(null, "someValue");
  // when / then
  assertThrows(NullPointerException.class, () -> {
    final TestObject resultingObject = testee.createOrUpdate(testObject);
  });
}
origin: otto-de/edison-microservice

@Test
public void shouldNotCreateWithMissingId() {
  // given
  final TestObject testObject = new TestObject(null, "someValue");
  // when / then
  assertThrows(NullPointerException.class, () -> {
    testee.create(testObject);
  });
}
origin: otto-de/edison-microservice

  public boolean matches(final Object object) {
    return ((object instanceof TestObject) && ((TestObject) object).equalsWithoutEtag(testObject));
  }
}
origin: otto-de/edison-microservice

/**
 * Deletes the document identified by key.
 *
 * @param key the identifier of the deleted document
 */
public void delete(final K key) {
  delete(key, mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes the document identified by key.
 *
 * @param key      the identifier of the deleted document
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void delete(final K key, final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteOne(byId(key));
}
origin: otto-de/edison-microservice

/**
 * Deletes all documents from this repository.
 */
public void deleteAll() {
  deleteAll(mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: otto-de/edison-microservice

/**
 * Updates the document if it is already present in the repository.
 *
 * @param value the new value
 * @return true, if the document was updated, false otherwise.
 */
public boolean update(final V value) {
  return update(value, mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS);
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes all documents from this repository.
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void deleteAll(final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteMany(matchAll());
}
origin: otto-de/edison-microservice

@PostConstruct
public void postConstruct() {
  ensureIndexes();
}
de.otto.edison.mongo

Most used classes

  • MongoProperties
    Properties used to configure MongoDB clients.
  • AbstractMongoRepository
  • MongoConfiguration
  • MongoProperties$Connectionpool
  • AbstractMongoRepositoryTest$TestObject
  • AbstractMongoRepositoryTest$TestRepository,
  • AbstractMongoRepositoryTest,
  • MongoConfiguration,
  • MongoStatusDetailIndicator,
  • NotFoundException,
  • DateTimeConverters,
  • JobStructure,
  • MongoJobMetaRepository,
  • MongoJobRepository$1,
  • MongoJobRepository$2,
  • MongoJobRepository,
  • MongoTogglzRepository
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now