Class Util

java.lang.Object
net.pincette.mongo.Util

public class Util extends Object
Some utilities.
Since:
1.3.2
Author:
Werner Donné
  • Method Details

    • compare

      public static int compare(JsonValue v1, JsonValue v2)
      Compares two values according to the

      BSON comparison order

      Parameters:
      v1 - the first value.
      v2 - the second value.
      Returns:
      Returns a negative value if v1 is smaller than v2, a positive value if v1 is larger than v2 and 0 otherwise.
      Since:
      1.3.2
    • escapeFieldName

      public static String escapeFieldName(String name)
    • fromMongoDB

      public static JsonObject fromMongoDB(JsonObject json)
      Unescapes field names that were escaped for MongoDB.
      Parameters:
      json - the given JSON object.
      Returns:
      The unescaped JSON object.
      Since:
      4.1
      See Also:
    • toMongoDB

      public static JsonObject toMongoDB(JsonObject json)
      Escapes field names that don't work in MongoDB. Dots, dollar signs and slashes are replaced with "_dot_", "_dollar_" and "_slash_" respectively.
      Parameters:
      json - the given JSON object.
      Returns:
      The escaped JSON object.
      Since:
      4.1
    • unescapeFieldName

      public static String unescapeFieldName(String name)