Class MongoUtils

java.lang.Object
org.eclipse.jetty.nosql.mongodb.MongoUtils

public class MongoUtils extends Object
MongoUtils Some utility methods for manipulating mongo data. This class facilitates testing.
  • Constructor Details

    • MongoUtils

      public MongoUtils()
  • Method Details

    • decodeValue

      public static Object decodeValue(Object valueToDecode) throws IOException, ClassNotFoundException
      Returns:
      the decoded object value from MongoDB binary data
      Throws:
      IOException
      ClassNotFoundException
    • decodeName

      public static String decodeName(String name)
      Returns:
      the decoded name with special characters unescaped
    • encodeName

      public static String encodeName(String name)
      Returns:
      the encoded name with special characters escaped for MongoDB
    • encodeName

      public static Object encodeName(Object value) throws IOException
      Returns:
      the encoded object value suitable for MongoDB storage
      Throws:
      IOException
    • getNestedValue

      public static Object getNestedValue(org.bson.Document sessionDocument, String nestedKey)
      Dig through a given dbObject for the nested value
      Parameters:
      sessionDocument - the mongo document to search
      nestedKey - the field key to find
      Returns:
      the value of the field key