bwgjoseph / mongoose-vs-ottoman

feature comparison between mongoose and ottoman
0 stars 1 forks source link

count usage #79

Closed bwgjoseph closed 3 years ago

bwgjoseph commented 3 years ago

Hi,

How are the count options used? Is there any sample I can look at? I don't find the usage of count in the documentation as well

The count API is declared as such

export declare type CountOptions = {
    sort?: Record<string, SortType>;
    limit?: number;
    skip?: number;
};

count(filter?: LogicalWhereExpr<T>, options?: CountOptions): Promise<any>;

But I'm not sure when would the options be used, and in what scenario would it be useful?

Thanks

AV25242 commented 3 years ago

hello @bwgjoseph tests are the best place to look. https://github.com/couchbaselabs/node-ottoman/blob/master/__test__/model-crud.spec.ts has quite a few examples

bwgjoseph commented 3 years ago

There's actually only one example, and it doesn't really show too much

https://github.com/couchbaselabs/node-ottoman/blob/b21c165338bd63082ba5438725fbeb330c94aa41/__test__/model-crud.spec.ts#L232-L242

I'm still trying to think of a scenario where I need a count, but still, pass in a limit option

AV25242 commented 3 years ago

This was an oversight, countoptions will be removed in the next release.