我有按月收集的用户游戏日志记录。 对于每月存储在mongo db中game_(year + month)集合中的用户玩的游戏。现在,我想获取用户最近2-4-5-6个月玩过的游戏的数据。集合结构是:
game_201801 :[
{name : 'Dhoni', gameId : 123, uid : 7, gameLog : {userTurn: 'Fold'} },
{name : 'Dhoni', gameId : 125, uid : 7, gameLog : {userTurn: 'Raise'} },
{name : 'Dhoni', gameId : 126, uid : 7, gameLog : {userTurn: 'Bet'} },
{name : 'Dhoni', gameId : 127, uid : 7, gameLog : {userTurn: 'Fold'} },
{name : 'Dhoni', gameId : 128, uid : 7, gameLog : {userTurn: 'Raise'} },
{name : 'Kohli', gameId : 129, uid : 18, gameLog : {userTurn: 'Fold'}},
{name : 'Bhuvi', gameId : 130, uid : 15, gameLog : {userTurn: 'Fold'}}
];
game_201802 : [
{name : 'Dhawan', gameId : 131, uid : 25 , gameLog : {userTurn: 'Fold'} },
{name : 'Rohit', gameId : 132, uid : 45, gameLog : {userTurn: 'Fold'}},
{name : 'Ashwin',gameId : 133, uid : 99, gameLog : {userTurn: 'Fold'}},
{name : 'Raina', gameId : 134, uid : 48, gameLog : {userTurn: 'Fold'}},
{name : 'Dhoni', gameId : 135, uid : 7, gameLog : {userTurn: 'Raise'} ,
{name : 'Dhoni', gameId : 136, uid : 7, gameLog : {userTurn: 'Raise'} ,
{name : 'Dhoni', gameId : 137, uid : 7, gameLog : {userTurn: 'Raise'} ];
我想在一个mongo查询中从两个集合(game_201801和game_201802)中获取ID:7的Dhoni的游戏日志数据。