How to sort a model

Asked

Viewed 16 times

0

I am having difficulty making an ordering, because I return an object and within that object, I have a list of another object and that list needs to be ordered by a property. The point is, when I give Mongo the ID, he gives me back what I want, fine. Now on that return, there’s this list and I need it to come in order. Like this:

Watchlist I get in the bank(Correct) Within Watchlist I have Notation and Notation has a prowess called Assettype and it should come sorted that property within Watchlist. That didn’t work out:

Watchlist.Notation.OrderBy(x => x.AssetType);

The fishing in Mongo is like this:

var watchlist = WatchlistClient.Find(x => x.id == watchlistId && x.UserId == userId);

It doesn’t work because I actually have Watchlist(1 record only) and the Assettype property is in Notation and not Watchlist, so the ordering would be worth if Assettype belonged to Watchlist.

Does anyone have any idea how I carry a watchlis with the Notation list in ordered by Assettype?

Note: I am in remote environment, I can not copy the models code, by photo would be, but it would be bad. I think the question is clear, if not, please let me know that I improve by posting the photos of the two models.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.