I have a xamarin.droid app that allows users to type in a message and that message is then displayed in a recyclerview. im now trying to get the messages to show in descending order by setting the query descending property to true but the rows in the recyclerview still return the messages in ascending format. can anyone pick up on what i have done wrong?
save message method:
public void SaveChatMessage(string msg,string user)
{
var document = cbDB.CreateDocument();
var properties = new Dictionary<string, object>{
{"type","message"},
{"message",msg},
{"user",user},
{"created",DateTime.Now.ToString()},
};
document.PutProperties(properties);
var retrieveDocument = cbDB.GetDocument(document.Id);
foreach(var props in retrieveDocument.Properties)
{
Log.Info("--DOCUMENT EVENT--","Document Properties: " + props.Key + " " + props.Value);
}
}
get chats:
public Query GetChats()
{
var view = cbDB.GetView(dbView);
if (view.Map == null)
{
view.SetMap((document, emitter) =>
{
object type;
document.TryGetValue("type", out type);
if (docType.Equals((string)type))
{
emitter(document["created"], document);
}
}, "1");
}
var query = view.CreateQuery();
query.Descending = true;
return query;
}