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

Find command implementation #37

Merged
merged 11 commits into from
Jan 20, 2023
Merged

Find command implementation #37

merged 11 commits into from
Jan 20, 2023

Conversation

maheshrajamani
Copy link
Contributor

No description provided.

@tatu-at-datastax tatu-at-datastax merged commit 0220ad8 into main Jan 20, 2023
@tatu-at-datastax tatu-at-datastax deleted the find-command branch January 20, 2023 16:48
@tatu-at-datastax
Copy link
Contributor

tatu-at-datastax commented Jan 20, 2023

Oh shoot. Did not mean to merge yet... sorry. WIll complete review in the meantime should be fine.

type = SchemaType.STRING,
implementation = String.class)
String pagingState,
@Valid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is defaulting handled here, given it's int and not Integer? (compared to limit for example)
Should this actually be Integer?

Copy link
Contributor Author

@maheshrajamani maheshrajamani Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value will be 0. This is handled in FindCommandResolver. Instead of removing Optional its better to pass as Integer. Will make this change

boolean readDocument,
ObjectMapper objectMapper) {
return queryExecutor
.executeRead(query, Optional.ofNullable(pagingState), Optional.empty())
.executeRead(query, Optional.ofNullable(pagingState), Optional.of(pageSize))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's passed as int, it isn't really optional ever, it can never be absent?

Copy link
Contributor Author

@maheshrajamani maheshrajamani Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change int to Integer so can handle for null

int limit =
command.options() != null && command.options().limit() != 0
? command.options().limit()
: documentConfig.maxLimit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not have something like "default limit"? Max limit would imply upper bound for explicit limit, not default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the maximum documents we will return for a query. Default and maximum are same here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I think I get it: if user does not specify limit, we'll indicate "as many as you can get", which is max.
Makes sense.

@tatu-at-datastax
Copy link
Contributor

Ok, makes sense: I have some questions on defaulting/max limits, but otherwise looks good as initial merge.

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

Successfully merging this pull request may close these issues.

2 participants