{"action":"created","issue":{"url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/6","labels_url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/6/comments","events_url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/6/events","html_url":"https://github.com/kongo2002/ejabberd-mod-mam/issues/6","id":54785987,"number":6,"title":"<before> tag works incorrect?","user":{"login":"DarkSideF","id":5888422,"avatar_url":"https://avatars.githubusercontent.com/u/5888422?v=3","gravatar_id":"","url":"https://api.github.com/users/DarkSideF","html_url":"https://github.com/DarkSideF","followers_url":"https://api.github.com/users/DarkSideF/followers","following_url":"https://api.github.com/users/DarkSideF/following{/other_user}","gists_url":"https://api.github.com/users/DarkSideF/gists{/gist_id}","starred_url":"https://api.github.com/users/DarkSideF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarkSideF/subscriptions","organizations_url":"https://api.github.com/users/DarkSideF/orgs","repos_url":"https://api.github.com/users/DarkSideF/repos","events_url":"https://api.github.com/users/DarkSideF/events{/privacy}","received_events_url":"https://api.github.com/users/DarkSideF/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-01-19T16:43:45Z","updated_at":"2015-10-18T19:23:41Z","closed_at":"2015-10-18T19:23:41Z","body":"Hi,\r\nBlank <before/> tag in your module works perfect, but with specified ID is return result from wrong order (not as  described in http://xmpp.org/extensions/xep-0059.html#backwards)\r\n\r\nexample: \r\n``` xml \r\n<iq xmlns=\"jabber:client\" type=\"get\" id=\"la\"><query xmlns=\"urn:xmpp:mam:tmp\"><with>user-6@ch</with><set xmlns=\"http://jabber.org/protocol/rsm\"><max>2</max><before/></set></query></iq></body>\r\n```\r\ni receive some messages and <set>  tag like this:\r\n``` xml \r\n<set xmlns='http://jabber.org/protocol/rsm'><first>54BD089D1E374104EF000026</first><last>54BD08A81E374104EF000028</last><count>2</count></set>\r\n```\r\nin server logs we may see order is right:\r\n``` \r\n...\r\n>@mod_mam:find:741 Query: {'$query',{'j.u',<<\"user-6\">>,'j.s',<<\"ch\">>,u,<<\"user-1\">>},'$orderby',{'_id',-1}}\r\n\r\n``` \r\n\r\nand if i trying to get previous\r\n``` xml\r\n<iq xmlns=\"jabber:client\" type=\"get\" id=\"la2\"><query xmlns=\"urn:xmpp:mam:tmp\"><with>user-6@ch</with><set xmlns=\"http://jabber.org/protocol/rsm\"><max>1</max><before>54BD089D1E374104EF000026</before></set></query></iq\r\n```\r\n\r\nits return to me first messages of all history\r\n\r\nin server logs i may see order is wrong:\r\n``` \r\n...\r\n@mod_mam:find:745 Query: {'$query',{'j.u',<<\"user-6\">>,'j.s',<<\"ch\">>,u,<<\"user-1\">>},'$orderby',{'_id',1}}\r\n``` "},"comment":{"url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/comments/149040398","html_url":"https://github.com/kongo2002/ejabberd-mod-mam/issues/6#issuecomment-149040398","issue_url":"https://api.github.com/repos/kongo2002/ejabberd-mod-mam/issues/6","id":149040398,"user":{"login":"kongo2002","id":69115,"avatar_url":"https://avatars.githubusercontent.com/u/69115?v=3","gravatar_id":"","url":"https://api.github.com/users/kongo2002","html_url":"https://github.com/kongo2002","followers_url":"https://api.github.com/users/kongo2002/followers","following_url":"https://api.github.com/users/kongo2002/following{/other_user}","gists_url":"https://api.github.com/users/kongo2002/gists{/gist_id}","starred_url":"https://api.github.com/users/kongo2002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kongo2002/subscriptions","organizations_url":"https://api.github.com/users/kongo2002/orgs","repos_url":"https://api.github.com/users/kongo2002/repos","events_url":"https://api.github.com/users/kongo2002/events{/privacy}","received_events_url":"https://api.github.com/users/kongo2002/received_events","type":"User","site_admin":false},"created_at":"2015-10-18T19:23:41Z","updated_at":"2015-10-18T19:23:41Z","body":"In case the wrong *RSM* behavior persists please reopen the issue."}}