Search in sources :

Example 1 with UnknownIndexType

use of com.torodb.mongodb.commands.pojos.index.type.UnknownIndexType in project torodb by torodb.

the class IndexOptions method unmarshllKeys.

public static List<Key> unmarshllKeys(BsonDocument keyDoc) {
    List<Key> keys = new ArrayList<>(keyDoc.size());
    for (Entry<?> entry : keyDoc) {
        List<String> key = PATH_SPLITER.splitToList(entry.getKey());
        IndexType value = null;
        for (KnownType knownType : KnownType.values()) {
            if (knownType.getIndexType().equalsToBsonValue(entry.getValue())) {
                value = knownType.getIndexType();
                break;
            }
        }
        if (value == null) {
            value = new UnknownIndexType(entry.getValue());
        }
        keys.add(new Key(key, value));
    }
    return keys;
}
Also used : ArrayList(java.util.ArrayList) UnknownIndexType(com.torodb.mongodb.commands.pojos.index.type.UnknownIndexType) HashedIndexType(com.torodb.mongodb.commands.pojos.index.type.HashedIndexType) TextIndexType(com.torodb.mongodb.commands.pojos.index.type.TextIndexType) AscIndexType(com.torodb.mongodb.commands.pojos.index.type.AscIndexType) UnknownIndexType(com.torodb.mongodb.commands.pojos.index.type.UnknownIndexType) DescIndexType(com.torodb.mongodb.commands.pojos.index.type.DescIndexType) IndexType(com.torodb.mongodb.commands.pojos.index.type.IndexType) TwoDIndexType(com.torodb.mongodb.commands.pojos.index.type.TwoDIndexType) GeoHaystackIndexType(com.torodb.mongodb.commands.pojos.index.type.GeoHaystackIndexType)

Aggregations

AscIndexType (com.torodb.mongodb.commands.pojos.index.type.AscIndexType)1 DescIndexType (com.torodb.mongodb.commands.pojos.index.type.DescIndexType)1 GeoHaystackIndexType (com.torodb.mongodb.commands.pojos.index.type.GeoHaystackIndexType)1 HashedIndexType (com.torodb.mongodb.commands.pojos.index.type.HashedIndexType)1 IndexType (com.torodb.mongodb.commands.pojos.index.type.IndexType)1 TextIndexType (com.torodb.mongodb.commands.pojos.index.type.TextIndexType)1 TwoDIndexType (com.torodb.mongodb.commands.pojos.index.type.TwoDIndexType)1 UnknownIndexType (com.torodb.mongodb.commands.pojos.index.type.UnknownIndexType)1 ArrayList (java.util.ArrayList)1