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

Filter documents using Go code #370

Merged
merged 21 commits into from
Mar 21, 2022
Merged

Filter documents using Go code #370

merged 21 commits into from
Mar 21, 2022

Conversation

AlekSi
Copy link
Member

@AlekSi AlekSi commented Mar 20, 2022

No description provided.

@AlekSi AlekSi added this to the v0.0.7 milestone Mar 20, 2022
@AlekSi AlekSi added code/chore Code maintenance improvements trust PRs that can access Actions secrets labels Mar 20, 2022

// ProjectDocuments modifies given documents in places according to the given projection.
func ProjectDocuments(docs []*types.Document, projection *types.Document) error {
// TODO
Copy link
Member Author

Choose a reason for hiding this comment

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

Missing

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

👌


// SortDocuments sorts given documents in place according to the given sorting conditions.
func SortDocuments(docs []*types.Document, sort *types.Document) error {
// TODO
Copy link
Member Author

Choose a reason for hiding this comment

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

Missing

Copy link
Member Author

Choose a reason for hiding this comment

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

}

return &reply, nil
return nil, fmt.Errorf("TODO")
Copy link
Member Author

Choose a reason for hiding this comment

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

Missing

@AlekSi AlekSi marked this pull request as ready for review March 21, 2022 06:06
internal/handlers/common/compare.go Show resolved Hide resolved
internal/handlers/common/compare.go Show resolved Hide resolved

// ProjectDocuments modifies given documents in places according to the given projection.
func ProjectDocuments(docs []*types.Document, projection *types.Document) error {
// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

MsgCreateIndexes(context.Context, *wire.OpMsg) (*wire.OpMsg, error)
MsgDelete(context.Context, *wire.OpMsg) (*wire.OpMsg, error)
MsgFindOrCount(context.Context, *wire.OpMsg) (*wire.OpMsg, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

"github.com/FerretDB/FerretDB/internal/wire"
)

// MsgFindOrCount finds documents in a collection or view and returns a cursor to the selected documents
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// MsgFindOrCount finds documents in a collection or view and returns a cursor to the selected documents
// MsgFind finds documents in a collection or view and returns a cursor to the selected documents

internal/handlers/jsonb1/msg_count.go Show resolved Hide resolved
resDocs = append(resDocs, doc)
}

if err = common.SortDocuments(resDocs, sort); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to sort documents on count query?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. Nice catch!

Documents: []*types.Document{types.MustNewDocument(
"cursor", types.MustNewDocument(
"firstBatch", firstBatch,
"id", int64(0), // TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

what TODO is meant?

Copy link
Member Author

Choose a reason for hiding this comment

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

Cursor support. Not for this PR

@AlekSi AlekSi merged commit 7ee90af into FerretDB:main Mar 21, 2022
@AlekSi AlekSi deleted the go-filters branch March 21, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements trust PRs that can access Actions secrets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants