Skip to content

DOCSP-41986: multikey indexes #140

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

Merged

Conversation

rustagir
Copy link
Collaborator

@rustagir rustagir commented Sep 12, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-41986
Staging - https://preview-mongodbrustagir.gatsbyjs.io/php-library/DOCSP-41986-multikey-indexes/indexes/multikey-index/

Self-Review Checklist

  • Is this free of any warnings or errors in the RST? Unrelated to PR
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link

netlify bot commented Sep 12, 2024

Deploy Preview for docs-php-library ready!

Name Link
🔨 Latest commit 60f5c9c
🔍 Latest deploy log https://app.netlify.com/sites/docs-php-library/deploys/66e49fb0e4ecda0008ed00d7
😎 Deploy Preview https://deploy-preview-140--docs-php-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@jordan-smith721 jordan-smith721 left a comment

Choose a reason for hiding this comment

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

One non-blocking suggestion but LGTM!

**Multikey indexes** are indexes that improve the performance of queries
on array-valued fields. You can create a multikey index on a collection
by using the ``MongoDB\Collection::createIndex()`` method and the same
syntax that you use to create single field or compound indexes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: Might be helpful to link to the single field and compound index pages as you mention them here

@rustagir rustagir requested review from a team and GromNaN and removed request for a team September 13, 2024 18:54
@GromNaN GromNaN requested review from jmikola and removed request for GromNaN September 13, 2024 18:57
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

LGTM with suggested whitespace change.

If looks like that was also missed in #134 so you can change the other json_encode() line as well for consistency.

$document = $collection->findOne(
['cast' => ['$in' => ['Aamir Khan', 'Kajol']]]
);
echo json_encode($document) , PHP_EOL;
Copy link
Member

Choose a reason for hiding this comment

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

In the index landing PR (#127), I suggested using some driver functions to print the value as extended JSON. It looks like that was missed in a subsequent PR for single field indexes (#134), upon which I expect this was based.

I'll defer to you if it's worth changing. The expected output in the RST doesn't show any special BSON types, so it's probably of little consequence.

Suggested change
echo json_encode($document) , PHP_EOL;
echo json_encode($document), PHP_EOL;

No need for preceding whitespace for a comma. It would be appropriate for a concatenation operator (dot), though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's ok to use the simpler json_encode() method in these contexts. I will change the whitespace though!

@rustagir rustagir merged commit a040fa8 into mongodb:php-standardization Sep 13, 2024
5 of 6 checks passed
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.

3 participants