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

FEATURE: RxQuery.count() #255

Closed
pubkey opened this issue Aug 22, 2017 · 9 comments
Closed

FEATURE: RxQuery.count() #255

pubkey opened this issue Aug 22, 2017 · 9 comments

Comments

@pubkey
Copy link
Owner

pubkey commented Aug 22, 2017

There is currently no cound-method for queries.

Goal-API:

// single-exec
const amount = await myCollection.count().where('foo').gt(10). /* .. */.exec();
console.log(amount);
// > 5

// subscription
myCollection.count().where('foo').gt(10). /* .. */.$.subscribe(nr => console.log(nr));
// > 5
await myCollection.insert({/* any docData */});
// > 6

There should be an optimisation to determine if the amount is needed once or many times (if we subscribe).
The first case should do a pouch-find-count-query, the second case should use the QueryChangeDetection for better performance.

pubkey added a commit that referenced this issue Aug 25, 2017
@pubkey
Copy link
Owner Author

pubkey commented Aug 25, 2017

I added this feature to the backlog. Maybe this will come in the future.

@pubkey pubkey closed this as completed Aug 25, 2017
@phal0r
Copy link

phal0r commented Mar 10, 2020

@pubkey
Is it still in the Backlog? I am interested in firing count queries against rxdb for one of my current projects.

@pubkey
Copy link
Owner Author

pubkey commented Mar 11, 2020

@phal0r
Copy link

phal0r commented Mar 13, 2020

Ok, thanks. Do you have currently any plans to implement it?

@pubkey
Copy link
Owner Author

pubkey commented Mar 13, 2020

No. But you are also a developer ;)

@phal0r
Copy link

phal0r commented Mar 17, 2020

True. I don't hesitate to contribute to this project. Currently I am working on a project, where I actually use rxdb and I will see, if I can fit it into the project plan, but I can't promise to work on it yet and in general I thought, that you might have some plans, where you want to go with this project. This is why I asked in the first place :)

I will let you know, once there is an opportunity for this feature.

@DouglasCalora
Copy link
Contributor

DouglasCalora commented Feb 22, 2021

@phal0r how do you resolve this? I'm new at rxdb.

@phal0r
Copy link

phal0r commented Feb 23, 2021

@DouglasCalora
Currently I solve it by selecting all records from the collection and checking the length of the array. It is clear, that this is the worst approach to solve this, but I had no clue how RxDB worked back when I wrote this message.

Now I think I would be able to implement this with reasonable amount of time, but no plans to do this within the next weeks.

@pubkey
Copy link
Owner Author

pubkey commented Oct 31, 2022

Related: #4096

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

No branches or pull requests

3 participants