Hello all PHP coders I have a little problem that I have problem to figure out, I have alot of Mongo documents in my database for every hand played on our poker servers
here is an example:
{
"_id" : "a6136d1a-d676-4352-8d54-d51645edfe84",
"className" : "com.cubeia.poker.handhistory.api.HistoricHand",
"table" : {
"tableId" : 5,
"tableIntegrationId" : "TABLE::eb54b0e9-693c-4f4b-8d3a-a62edfc9e9ac",
"tableName" : "Orem",
"seats" : 0
},
"startTime" : NumberLong(1447486395510),
"endTime" : NumberLong(1447486423769),
"deckInfo" : {
"size" : 52,
"lowRank" : "TWO"
},
"results" : {
"totalRake" : "2.80",
"results" : {
"85" : {
"playerId" : 85,
"netWin" : "217.20",
"totalWin" : "277.20",
"rake" : "0.60",
"totalBet" : "60.00",
"transactionId" : "275"
},
"19" : {
"playerId" : 19,
"netWin" : "-20.00",
"totalWin" : "0.00",
"rake" : "0.20",
"totalBet" : "20.00",
"transactionId" : "275"
},
"71" : {
"playerId" : 71,
"netWin" : "-60.00",
"totalWin" : "0.00",
"rake" : "0.60",
"totalBet" : "60.00",
"transactionId" : "275"
},
"82" : {
"playerId" : 82,
"netWin" : "-20.00",
"totalWin" : "0.00",
"rake" : "0.20",
"totalBet" : "20.00",
"transactionId" : "275"
},
"8" : {
"playerId" : 8,
"netWin" : "-20.00",
"totalWin" : "0.00",
"rake" : "0.20",
"totalBet" : "20.00",
"transactionId" : "275"
},
"92" : {
"playerId" : 92,
"netWin" : "-20.00",
"totalWin" : "0.00",
"rake" : "0.20",
"totalBet" : "20.00",
"transactionId" : "275"
},
"26" : {
"playerId" : 26,
"netWin" : "-20.00",
"totalWin" : "0.00",
"rake" : "0.20",
"totalBet" : "20.00",
"transactionId" : "275"
},
"62" : {
"playerId" : 62,
"netWin" : "-60.00",
"totalWin" : "0.00",
"rake" : "0.60",
"totalBet" : "60.00",
"transactionId" : "275"
}
}
},
"events" : [
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 19,
"type" : "PlayerAction",
"time" : NumberLong(1447486396526)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 92,
"type" : "PlayerAction",
"time" : NumberLong(1447486396528)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 8,
"type" : "PlayerAction",
"time" : NumberLong(1447486396530)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 62,
"type" : "PlayerAction",
"time" : NumberLong(1447486396532)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 85,
"type" : "PlayerAction",
"time" : NumberLong(1447486396534)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 26,
"type" : "PlayerAction",
"time" : NumberLong(1447486396536)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 71,
"type" : "PlayerAction",
"time" : NumberLong(1447486396538)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "ANTE",
"amount" : {
"type" : "BET",
"amount" : "20.00"
},
"timeout" : false,
"playerId" : 82,
"type" : "PlayerAction",
"time" : NumberLong(1447486396540)
},
{
"className" : "com.cubeia.poker.handhistory.api.PotUpdate",
"pots" : [
{
"potId" : 0,
"players" : [
85,
19,
71,
82,
8,
92,
26,
62
],
"potSize" : "160.00"
}
],
"type" : "PotUpdate",
"time" : NumberLong(1447486396541)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 19,
"cards" : [
{
"suit" : "DIAMONDS",
"rank" : "FIVE"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 62,
"cards" : [
{
"suit" : "CLUBS",
"rank" : "KING"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 92,
"cards" : [
{
"suit" : "SPADES",
"rank" : "TWO"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 8,
"cards" : [
{
"suit" : "SPADES",
"rank" : "QUEEN"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 85,
"cards" : [
{
"suit" : "CLUBS",
"rank" : "FIVE"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 26,
"cards" : [
{
"suit" : "SPADES",
"rank" : "THREE"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 71,
"cards" : [
{
"suit" : "DIAMONDS",
"rank" : "NINE"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 82,
"cards" : [
{
"suit" : "CLUBS",
"rank" : "SIX"
}
],
"isExposed" : false,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396542)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 19,
"cards" : [
{
"suit" : "SPADES",
"rank" : "NINE"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 62,
"cards" : [
{
"suit" : "HEARTS",
"rank" : "QUEEN"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 92,
"cards" : [
{
"suit" : "HEARTS",
"rank" : "SIX"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 8,
"cards" : [
{
"suit" : "SPADES",
"rank" : "SEVEN"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 85,
"cards" : [
{
"suit" : "HEARTS",
"rank" : "FIVE"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 26,
"cards" : [
{
"suit" : "CLUBS",
"rank" : "TEN"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 71,
"cards" : [
{
"suit" : "DIAMONDS",
"rank" : "KING"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerCardsDealt",
"playerId" : 82,
"cards" : [
{
"suit" : "HEARTS",
"rank" : "SEVEN"
}
],
"isExposed" : true,
"type" : "PlayerCardsDealt",
"time" : NumberLong(1447486396543)
},
{
"className" : "com.cubeia.poker.handhistory.api.RoundStarted",
"type" : "RoundStarted",
"time" : NumberLong(1447486397546)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "BET",
"amount" : {
"type" : "BET",
"amount" : "40.00"
},
"timeout" : false,
"playerId" : 71,
"type" : "PlayerAction",
"time" : NumberLong(1447486398549)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 82,
"type" : "PlayerAction",
"time" : NumberLong(1447486399554)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 19,
"type" : "PlayerAction",
"time" : NumberLong(1447486401734)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "CALL",
"amount" : {
"type" : "BET",
"amount" : "40.00"
},
"timeout" : false,
"playerId" : 62,
"type" : "PlayerAction",
"time" : NumberLong(1447486404775)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 92,
"type" : "PlayerAction",
"time" : NumberLong(1447486409799)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 8,
"type" : "PlayerAction",
"time" : NumberLong(1447486412019)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "RAISE",
"amount" : {
"type" : "BET",
"amount" : "80.00"
},
"timeout" : false,
"playerId" : 85,
"type" : "PlayerAction",
"time" : NumberLong(1447486416126)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 26,
"type" : "PlayerAction",
"time" : NumberLong(1447486419487)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 71,
"type" : "PlayerAction",
"time" : NumberLong(1447486421934)
},
{
"className" : "com.cubeia.poker.handhistory.api.PlayerAction",
"action" : "FOLD",
"amount" : {
"type" : "BET",
"amount" : "0.00"
},
"timeout" : false,
"playerId" : 62,
"type" : "PlayerAction",
"time" : NumberLong(1447486423531)
},
{
"className" : "com.cubeia.poker.handhistory.api.PotUpdate",
"pots" : [
{
"potId" : 0,
"players" : [
85,
19,
71,
82,
8,
92,
26,
62
],
"potSize" : "280.00"
}
],
"type" : "PotUpdate",
"time" : NumberLong(1447486423532)
},
{
"className" : "com.cubeia.poker.handhistory.api.ShowDownSummary",
"type" : "ShowDownSummary",
"time" : NumberLong(1447486423769)
}
],
"seats" : [
{
"playerId" : 19,
"initialBalance" : "2000.00",
"seatId" : 0,
"name" : "Bot_18"
},
{
"playerId" : 62,
"initialBalance" : "2000.00",
"seatId" : 1,
"name" : "Bot_61"
},
{
"playerId" : 92,
"initialBalance" : "2000.00",
"seatId" : 2,
"name" : "Bot_91"
},
{
"playerId" : 8,
"initialBalance" : "2000.00",
"seatId" : 3,
"name" : "Bot_7"
},
{
"playerId" : 85,
"initialBalance" : "2000.00",
"seatId" : 4,
"name" : "Bot_84"
},
{
"playerId" : 26,
"initialBalance" : "2000.00",
"seatId" : 5,
"name" : "Bot_25"
},
{
"playerId" : 71,
"initialBalance" : "2000.00",
"seatId" : 6,
"name" : "Bot_70"
},
{
"playerId" : 82,
"initialBalance" : "2000.00",
"seatId" : 7,
"name" : "Bot_81"
}
],
"settings" : {
"variant" : "TELESINA",
"currencyCode" : "EUR",
"betStrategyType" : "NO_LIMIT"
}
}
I need to could be able to check playerid of a choosen player for making a bonus system that can count how many hands that is played by players on our servers.
I have got so far that I need something simular to this:
<?php
$connection = new MongoClient("mongodb://ip");
echo "connected<br>";
$collection = $connection->poker->HistoricHand;
echo "colection selected<br>";
$cursor = $collection->find(array("playerId"=>"85"));
$result=var_dump($cursor->count());
But I cant find a reasonable way down though the arrays.
the specific part I need is this :
"results" : {
"85" : {
"playerId" : 85,
I hope there is someone who can help me out
Thanks with regards of a happy new year
Brian Olsen