Example #1
0
// ** Films::votesForFilm
NumericFeatures Films::votesForFilm( int filmId ) const
{
    NumericFeatures result;

    CollectionPtr votes  = m_source->collection( "votes" );
    CursorPtr     cursor = votes->find( QUERY( "itemId" << filmId ) );
    DocumentPtr   document;

    while( (document = cursor->next()) ) {
        printf( "get\n" );
        result.set( document->integer( "userId" ), document->number( "rating" ) );
        printf( "v %d\n", result.size() );
    //    sleep(1);
        printf( "next\n" );
    }

    printf( "done! %d\n", result.size() );

    return result;
}