Class Updates

java.lang.Object
com.codename1.backend.mongo.Updates

public final class Updates extends Object

Builds update documents; combine(Map...) merges several into one.

Updates.combine(Updates.set("name", "Ada"), Updates.inc("visits", 1))
  • Method Details

    • set

      public static Map set(String field, Object value)
      Sets field to value.
    • unset

      public static Map unset(String field)
      Removes field.
    • inc

      public static Map inc(String field, Number amount)
      Adds amount to field.
    • push

      public static Map push(String field, Object value)
      Appends value to the array in field.
    • addToSet

      public static Map addToSet(String field, Object value)
      Adds value to the array in field unless it is already there.
    • pull

      public static Map pull(String field, Object value)
      Removes every element equal to value from the array in field.
    • combine

      public static Map combine(Map... updates)
      One update with the operators of all of these.