amark on master
ok ack + webrtc Merge branch 'master' of http:/… bump (ok ack + webrtc) @Draeder… (compare)
amark on master
websocket ../index to ./index (… (compare)
amark on master
PANIC tests + AXE get dedup + f… Merge branch 'master' of http:/… (compare)
amark on master
lib/ison: Use setTimeout instea… (compare)
2019/06/22:10:10:10.33
I don't how lex sorting on multiple : : : would work, that's not a date format imo
{
"2019/05/25:10:10:10.30": {
"#": "chat/2019/05/25:10:10:10.30"
},
"2019/05/21:10:10:10.30": {
"#": "chat/2019/05/21:10:10:10.30"
},
"2019/05/22:10:10:10.30": {
"#": "chat/2019/05/22:10:10:10.30"
},
"2019/05/23:10:10:10.30": {
"#": "chat/2019/05/23:10:10:10.30"
},
"2019/06/23:10:10:10.30": {
"#": "chat/2019/06/23:10:10:10.30"
},
"2019/06/21:10:10:10.30": {
"#": "chat/2019/06/21:10:10:10.30"
},
"2019/06/22:10:10:10.30": {
"#": "chat/2019/06/22:10:10:10.30"
},
"2019/06/24:10:10:10.30": {
"#": "chat/2019/06/24:10:10:10.30"
},
"2019/06/25:10:10:10.30": {
"#": "chat/2019/06/25:10:10:10.30"
},
"2019/06/20:10:10:10.30": {
"#": "chat/2019/06/20:10:10:10.30"
},
"2019/05": {
"#": "chat/2019/05"
}
}
gunHeroku.get('chat').get({'.': {'*': '2019/05'}, "%" : 5000}).map().once(s=>{
console.log (s); //This only fired once
})
is this an expected result ?
I note you have
2019/06/22:10:10:10.33
I don't how lex sorting on multiple : : : would work, that's not a date format imo
I copied it from the docs.
Hi guys, I've been playing around with Gun it the past few days. It's great :)
I have a few basic/conceptual questions I wasn't able to get with the docs though. I didn't want to bother you here so I opened it on StackOverflow if you want to have a look: stackOverflow link Hopefully I'm not the only one with such questions
@amark , the docs really need some big overhaul.
console.log("testing get {'.':{'>':'2021/06'} expecting 6 output")
var i = 1;
var raddy = gun.get(key).get({'.':{'>':'2021/06'},'%':50000}).map(data=>{
i++;
console.log("getter found data",data);
if(i==2) t.equal(data.stuff, "22", "expected result to be `22` correct")
if(i==3) t.equal(data.stuff, "23", "expected result to be `23` correct")
if(i==4) t.equal(data.stuff, "24", "expected result to be `24` correct")
if(i==5) t.equal(data.stuff, "25", "expected result to be `25` correct")
if(i==6) t.equal(data.stuff, "31 1.00", "expected result to be `31 1.00` correct")
if(i==7) t.equal(data.stuff, "31 1.30", "expected result to be `31 1.30` correct")
}).once();
t.end();
_: {
'#': 'chat',
'>': {
'2021/05/31': 1632566761209,
'2021/06/22 01:00:00': 1632566761312,
'2021/06/23 01:30:00': 1632566761313.002,
'2021/06/24 01:00:00': 1632566761314.001,
'2021/06/25 01:30:00': 1632566761315,
'2021/06/31 01:00:00': 1632566761315.004,
'2021/06/31 01:30:00': 1632566761315.008
}
},
'2021/05/31': { '#': 'chat.102jvom' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
}
testing get {'.':{'*':'2021/06'} expecting 6 output
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
_: { '#': 'chat.-ipfkim', '>': { stuff: 1632566761312 } },
stuff: '22'
}
ok 1 expected result to be `22` correct
getter found data {
_: { '#': 'chat.-oi86lk', '>': { stuff: 1632566761313.002 } },
stuff: '23'
}
ok 2 expected result to be `23` correct
getter found data {
_: { '#': 'chat.-ug9s0o', '>': { stuff: 1632566761314.001 } },
stuff: '24'
}
ok 3 expected result to be `24` correct
getter found data {
_: { '#': 'chat.-1492e3m', '>': { stuff: 1632566761315 } },
stuff: '25'
}
ok 4 expected result to be `25` correct
getter found data {
_: { '#': 'chat.1tg6rqc', '>': { stuff: 1632566761315.004 } },
stuff: '31 1.00'
}
ok 5 expected result to be `31 1.00` correct
getter found data {
_: { '#': 'chat.1tirdef', '>': { stuff: 1632566761315.008 } },
stuff: '31 1.30'
}
ok 6 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 7 forcing test to end with process.exit
1..7
# tests 7
# pass 7
# ok
var raddy = gun.get(key).get({'.':{'*':'2021/06'},'%':50000}).map(data=>{
i++;
console.log("getter found data",data);
if(i==2) { t.equal(data.stuff, "22", "expected result to be `22` correct")
} else if(i==3) { t.equal(data.stuff, "23", "expected result to be `23` correct")
} else if(i==4) { t.equal(data.stuff, "24", "expected result to be `24` correct")
} else if(i==5) { t.equal(data.stuff, "25", "expected result to be `25` correct")
} else if(i==6) { t.equal(data.stuff, "31 1.00", "expected result to be `31 1.00` correct")
} else if(i==7) { t.equal(data.stuff, "31 1.30", "expected result to be `31 1.30` correct")
} else { t.equal(data.stuff, "we shouldn't be here"); }
}).once();
here is my complete data
{ "2019/05/25:10:10:10.30": { "#": "chat/2019/05/25:10:10:10.30" }, "2019/05/21:10:10:10.30": { "#": "chat/2019/05/21:10:10:10.30" }, "2019/05/22:10:10:10.30": { "#": "chat/2019/05/22:10:10:10.30" }, "2019/05/23:10:10:10.30": { "#": "chat/2019/05/23:10:10:10.30" }, "2019/06/23:10:10:10.30": { "#": "chat/2019/06/23:10:10:10.30" }, "2019/06/21:10:10:10.30": { "#": "chat/2019/06/21:10:10:10.30" }, "2019/06/22:10:10:10.30": { "#": "chat/2019/06/22:10:10:10.30" }, "2019/06/24:10:10:10.30": { "#": "chat/2019/06/24:10:10:10.30" }, "2019/06/25:10:10:10.30": { "#": "chat/2019/06/25:10:10:10.30" }, "2019/06/20:10:10:10.30": { "#": "chat/2019/06/20:10:10:10.30" }, "2019/05": { "#": "chat/2019/05" } }
like this
'2021/05/31': { '#': 'chat.102jvom' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
* : 2021/06
testing get {'.':{'>':'2021/06'} expecting 7 outputs
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
_: { '#': 'chat.-1b4get8', '>': { stuff: 1632567525735 } },
stuff: '2021/06'
}
ok 1 expected result to be `2021/06` correct
getter found data {
_: { '#': 'chat.-ipfkim', '>': { stuff: 1632567525904 } },
stuff: '22'
}
ok 2 expected result to be `22` correct
getter found data {
_: { '#': 'chat.-oi86lk', '>': { stuff: 1632567525905.003 } },
stuff: '23'
}
ok 3 expected result to be `23` correct
getter found data {
_: { '#': 'chat.-ug9s0o', '>': { stuff: 1632567525906.002 } },
stuff: '24'
}
ok 4 expected result to be `24` correct
getter found data {
_: { '#': 'chat.-1492e3m', '>': { stuff: 1632567525907.002 } },
stuff: '25'
}
ok 5 expected result to be `25` correct
getter found data {
_: { '#': 'chat.1tg6rqc', '>': { stuff: 1632567525907.006 } },
stuff: '31 1.00'
}
ok 6 expected result to be `31 1.00` correct
getter found data {
_: { '#': 'chat.1tirdef', '>': { stuff: 1632567525908 } },
stuff: '31 1.30'
}
ok 7 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 8 forcing test to end with process.exit
1..8
# tests 8
# pass 8
# ok
testing get {'.':{'*':'2021/06'} expecting 7 outputs
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
_: { '#': 'chat.-1b4get8', '>': { stuff: 1632567559855 } },
stuff: '2021/06'
}
ok 1 expected result to be `2021/06` correct
getter found data {
_: { '#': 'chat.-ipfkim', '>': { stuff: 1632567559960 } },
stuff: '22'
}
ok 2 expected result to be `22` correct
getter found data {
_: { '#': 'chat.-oi86lk', '>': { stuff: 1632567559960.004 } },
stuff: '23'
}
ok 3 expected result to be `23` correct
getter found data {
_: { '#': 'chat.-ug9s0o', '>': { stuff: 1632567559961.003 } },
stuff: '24'
}
ok 4 expected result to be `24` correct
getter found data {
_: { '#': 'chat.-1492e3m', '>': { stuff: 1632567559962.002 } },
stuff: '25'
}
ok 5 expected result to be `25` correct
getter found data {
_: { '#': 'chat.1tg6rqc', '>': { stuff: 1632567559962.006 } },
stuff: '31 1.00'
}
ok 6 expected result to be `31 1.00` correct
getter found data {
_: { '#': 'chat.1tirdef', '>': { stuff: 1632567559963.002 } },
stuff: '31 1.30'
}
ok 7 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 8 forcing test to end with process.exit
1..8
# tests 8
# pass 8
# ok
_: {
'#': 'chat',
'>': {
'2021/06': 1632567559855,
'2021/06/22 01:00:00': 1632567559960,
'2021/06/23 01:30:00': 1632567559960.004,
'2021/06/24 01:00:00': 1632567559961.003,
'2021/06/25 01:30:00': 1632567559962.002,
'2021/06/31 01:00:00': 1632567559962.006,
'2021/06/31 01:30:00': 1632567559963.002
}
},
'2021/06': { '#': 'chat.-1b4get8' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
}
let me rephrase my quesiton :
imagine this is the data
'2021/05/31': { '#': 'chat.102jvom' },
'2021/05/30 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05/29 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05/28 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05': { '#': 'chat.-ipfkim' },
'2021/06': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
What's the query to get
'2021/06': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }