类com.mongodb.Bytes源码实例Demo

下面列出了怎么用com.mongodb.Bytes的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: zerowing   文件: Tailer.java
private DBCursor createCursor() {
  DBCollection oplog = _mongo.getDB("local").getCollection("oplog.rs");
  BSONTimestamp startingTimestamp = getStartingTimestamp();

  DBCursor cursor;
  if (startingTimestamp == null) {
    log.info("Tailing the oplog from the beginning...");
    cursor = oplog.find();
  } else {
    log.info("Tailing the oplog from " + startingTimestamp);
    BasicDBObject query = new BasicDBObject("ts", new BasicDBObject("$gt", startingTimestamp));
    cursor = oplog.find(query);
    cursor.addOption(Bytes.QUERYOPTION_OPLOGREPLAY);
  }

  cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
  cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
  cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);

  return cursor;
}
 
源代码2 项目: bluima   文件: MongoCollectionReader.java
protected void initQuery(MongoConnection conn) throws IOException {
    if (query != null)
        cur = conn.coll.find((DBObject) JSON.parse(query));
    else
        cur = conn.coll.find();
    cur.addOption(Bytes.QUERYOPTION_NOTIMEOUT).batchSize(1000);
}
 
源代码3 项目: birt   文件: MDbMetaData.java
private void addDataType( Object fieldValue )
     {
         // add the data type of given fieldValue to existing set, if exists;
         // the same named field set in a different doc may have a different data type 
         byte nativeBSonDataTypeCode = Bytes.getType( fieldValue );
         if( m_nativeDataTypes == null )
             m_nativeDataTypes = new HashSet<Integer>(2);
if ( nativeBSonDataTypeCode == -1 )
{
	if ( fieldValue instanceof Document )
	{
		nativeBSonDataTypeCode = Bytes.OBJECT;
	}
}
         m_nativeDataTypes.add( Integer.valueOf( nativeBSonDataTypeCode ) );

         // check if field value contains a document,
         // iteratively get field document's nested metadata
         if( nativeBSonDataTypeCode == BSON.ARRAY )
         {
             if( fieldValue instanceof java.util.List )
             {
                 java.util.List<?> listOfObjects = (java.util.List<?>)fieldValue;
                 if( listOfObjects.size() > 0 )
                 {
                     // use first element in array to determine metadata
                     addDataType( listOfObjects.get(0) );    // handles nested arrays
                     return;
                 }
             }
         }

         Object fieldObjValue = 
                 ResultDataHandler.fetchFieldDocument( fieldValue, nativeBSonDataTypeCode );
         
         if( fieldObjValue != null ) // contains nested document
         {
             if( m_childDocMetaData == null )
                 m_childDocMetaData = sm_factory.new DocumentsMetaData();
             m_childDocMetaData.addDocumentMetaData( fieldObjValue, this );
         }
     }
 
 类所在包
 同包方法