Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBreeze sorts by ID #58

Closed
AbdisamadMoh opened this issue Sep 22, 2019 · 4 comments
Closed

DBreeze sorts by ID #58

AbdisamadMoh opened this issue Sep 22, 2019 · 4 comments

Comments

@AbdisamadMoh
Copy link

Hi DBreeze team,
Im very new to dbreeze world and i found it simple, fast and reliable database.
Im trying to store users chats, but the problem im facing is that dbreeze seems to sort them my id(ID i used) which i dnt want.
Here is the code i used to query using LINQPAD

var db = new DBreeze.DBreezeEngine(@"File");
	using(var tr = db.GetTransaction())
	{
	var s = tr.SelectForward<string, DbMJSON<Message>>("ToAli").Select(x=>x.Value.Get).Dump();

	}
	db.Dispose();

image

I dont know if approaching in a wrong way, it is sorting by ID. I want the message to be the way they r inserted without any sorting.

Am i doing in a wrong approach? what to do?

@hhblaze
Copy link
Owner

hhblaze commented Sep 22, 2019

Hi, you should really start from the docu. DBreeze automatically sorts by inserted key, so if you want records to be sorted by insert sequence use as a key growing up integer 1,2,3. In your case you will need probably minimum two indexes, one is to assure the sorting by adding sequence, second to search by MessageID: use object DBreeze for that. Example is here

@hhblaze hhblaze closed this as completed Sep 22, 2019
@AbdisamadMoh
Copy link
Author

Thank you very much.
I have one more issue. Should I comment here or create new issue?

@hhblaze
Copy link
Owner

hhblaze commented Sep 23, 2019

Thank you very much.
I have one more issue. Should I comment here or create new issue?

As you wish

@AbdisamadMoh
Copy link
Author

Thank you. I will create new issue, it may help someone else who have same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants