mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 23:19:39 -05:00
26 lines
513 B
Plaintext
26 lines
513 B
Plaintext
-- Add size of the array to MongoDB collection --
|
|
|
|
addFlex: async () => {
|
|
await Player.aggregate( [
|
|
{
|
|
$addFields: {
|
|
weaponsCount: { $size: "$weapons" } ,
|
|
},
|
|
},
|
|
{
|
|
$out: "players"
|
|
}
|
|
] )
|
|
|
|
return "ok"
|
|
|
|
-- React timer --
|
|
|
|
useEffect(() => {
|
|
const timeout = setTimeout(() => {
|
|
setCurrentTime(new Date(Math.floor(Date.now() / 1000)))
|
|
}, 1000)
|
|
return () => {
|
|
clearTimeout(timeout)
|
|
}
|
|
}, [currentTime]) |