amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.05k stars 1.16k forks source link

RAD pagination #754

Open youssofk opened 5 years ago

youssofk commented 5 years ago

I'm used sea and rad, and I have save all users in one graph node, I'm not getting the right answer when I use '<' to paginate users post. '>' works fine. '>' and '<' also return wrong answer. that is return just logged in user's posts.

The following is a pseudocode

gun.get('users').set(user1)
gun.get('users').set(user2)

user1.get('post').get('2019/06/20:10:10:10.206').put("message-2019/06/20:10:10:12.206")
user1.get('post').get('2019/06/20:10:10:10.207').put("message-2019/06/20:10:10:13.207")
user1.get('post').get('2019/07/20:10:10:10.205').put("message-2019/07/20:10:10:14.205")
user1.get('post').get('2019/07/20:10:10:10.206').put("message-2019/07/20:10:10:15.206")
user1.get('post').get('2019/08/20:10:10:10.205').put("message-2019/08/20:10:10:16.205")
user1.get('post').get('2019/09/20:10:10:10.205').put("message-2019/09/20:10:10:17.205")

user2.get('post').get('2019/06/20:10:10:12.106').put("message-2019/06/20:10:10:12.106")
user2.get('post').get('2019/06/20:10:10:13.107').put("message-2019/06/20:10:10:13.107")
user2.get('post').get('2019/07/20:10:10:14.105').put("message-2019/07/20:10:10:14.105")
user2.get('post').get('2019/07/20:10:10:15.106').put("message-2019/07/20:10:10:15.106")
user2.get('post').get('2019/08/20:10:10:16.105').put("message-2019/08/20:10:10:16.105")
user2.get('post').get('2019/09/20:10:10:17.105').put("message-2019/09/20:10:10:17.105")

gun.get('users').map().get('post').get({'.': {'>': '2019/06/20', '<': '2019/09/20'}, '%': 50000 }).map().once(function(value, id){ 
        console.log(id)
        console.log(value)
 })
youssofk commented 5 years ago

When I add following code just before that, It works correctly.

gun.get('users').map().once(function(user){
        console.log(user)
 })
amark commented 5 years ago

@Youfosk thanks for reporting this, I think @mmalmi experiencing same thing in this https://github.com/amark/gun/pull/760 test.

Also, I'm wondering if RAD lex/pagination broke due to a regression to .once( that happened a few versions back. I fixed this recently in latest. Mind seeing if RAD lex/pagination is working on latest? Just in case, by chance?