org.bson.types.MinKey Java Examples
The following examples show how to use
org.bson.types.MinKey.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongodbInputDiscoverFieldsImpl.java From pentaho-mongodb-plugin with Apache License 2.0 | 6 votes |
protected static int mongoToKettleType( Object fieldValue ) { if ( fieldValue == null ) { return ValueMetaInterface.TYPE_STRING; } if ( fieldValue instanceof Symbol || fieldValue instanceof String || fieldValue instanceof Code || fieldValue instanceof ObjectId || fieldValue instanceof MinKey || fieldValue instanceof MaxKey ) { return ValueMetaInterface.TYPE_STRING; } else if ( fieldValue instanceof Date ) { return ValueMetaInterface.TYPE_DATE; } else if ( fieldValue instanceof Number ) { // try to parse as an Integer try { Integer.parseInt( fieldValue.toString() ); return ValueMetaInterface.TYPE_INTEGER; } catch ( NumberFormatException e ) { return ValueMetaInterface.TYPE_NUMBER; } } else if ( fieldValue instanceof Binary ) { return ValueMetaInterface.TYPE_BINARY; } else if ( fieldValue instanceof BSONTimestamp ) { return ValueMetaInterface.TYPE_INTEGER; } return ValueMetaInterface.TYPE_STRING; }
Example #2
Source File: BsonTypeMap.java From morphia with Apache License 2.0 | 6 votes |
/** * Creates the map */ public BsonTypeMap() { map.put(List.class, BsonType.ARRAY); map.put(Binary.class, BsonType.BINARY); map.put(Boolean.class, BsonType.BOOLEAN); map.put(Date.class, BsonType.DATE_TIME); map.put(BsonDbPointer.class, BsonType.DB_POINTER); map.put(Document.class, BsonType.DOCUMENT); map.put(Double.class, BsonType.DOUBLE); map.put(Integer.class, BsonType.INT32); map.put(Long.class, BsonType.INT64); map.put(Decimal128.class, BsonType.DECIMAL128); map.put(MaxKey.class, BsonType.MAX_KEY); map.put(MinKey.class, BsonType.MIN_KEY); map.put(Code.class, BsonType.JAVASCRIPT); map.put(CodeWithScope.class, BsonType.JAVASCRIPT_WITH_SCOPE); map.put(ObjectId.class, BsonType.OBJECT_ID); map.put(BsonRegularExpression.class, BsonType.REGULAR_EXPRESSION); map.put(String.class, BsonType.STRING); map.put(Symbol.class, BsonType.SYMBOL); map.put(BsonTimestamp.class, BsonType.TIMESTAMP); map.put(BsonUndefined.class, BsonType.UNDEFINED); }