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

DOCSP-28393 C# new atlas search examples #521

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shuangela
Copy link
Collaborator

@shuangela shuangela commented Mar 12, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-28393

Staging Links

  • fundamentals/atlas-search
  • Self-Review Checklist

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

    @shuangela shuangela changed the title new atlas search examples DOCSP-28393 C# new atlas search examples Mar 12, 2025
    Copy link

    netlify bot commented Mar 12, 2025

    Deploy Preview for docs-csharp ready!

    Name Link
    🔨 Latest commit 7ee831f
    🔍 Latest deploy log https://app.netlify.com/sites/docs-csharp/deploys/67d312b89b3f3e00086c0219
    😎 Deploy Preview https://deploy-preview-521--docs-csharp.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

    @stephmarie17 stephmarie17 left a comment

    Choose a reason for hiding this comment

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

    Nice work 🎉 A few comments with some suggestions.

    Use the ``Facet()`` method to group results by values or ranges in the specified faceted fields
    and return the count for each of those groups.

    You can use ``Facet()`` with both the ``$search`` and ``$searchMeta`` stages. MongoDB recommends using
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [s] Suggestion to include the term method here for consistency with the other sections, and also to differentiate from the other mentions of "using facet" when generally referring to the collector:

    Suggested change
    You can use ``Facet()`` with both the ``$search`` and ``$searchMeta`` stages. MongoDB recommends using
    You can use the ``Facet()`` method with both the ``$search`` and ``$searchMeta`` stages. MongoDB recommends using

    The following example searches searches the ``guitars`` collection for any documents in
    which the value of the ``in_stock`` field is ``true``. The query uses the ``Facet()`` method to process the input documents, with a maximum number of ``100`` facet categories to return in the results. The query returns the total count of documents in which the value of ``in_stock`` is ``true``.

    .. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [q] Curious why the examples throughout this doc (not just in the diff) don't just use the io codeblock which is a bit cleaner? Or at least set copyable to false for the output maybe?

    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 am also not sure because this is my first c# pr! I just followed the standard convention/what the rest of the examples had.

    You can use ``Facet()`` with both the ``$search`` and ``$searchMeta`` stages. MongoDB recommends using
    facet with the ``$searchMeta`` stage to retrieve metadata results only for the query.
    To retrieve metadata results and query results using the ``$search`` stage, you must use the
    ``$$SEARCH_META`` aggregation variable. See :atlas:`SEARCH_META Aggregation Variable </atlas-search/facet/#std-label-fts-facet-aggregation-variable>` to learn more.
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [s] Suggestion to revise (or something similar) based on the style guide:

    Suggested change
    ``$$SEARCH_META`` aggregation variable. See :atlas:`SEARCH_META Aggregation Variable </atlas-search/facet/#std-label-fts-facet-aggregation-variable>` to learn more.
    ``$$SEARCH_META`` aggregation variable. To learn more about this variable, see the :atlas:`SEARCH_META Aggregation Variable </atlas-search/facet/#std-label-fts-facet-aggregation-variable>` section.

    - You can run facet queries on a single field only. You can't run facet queries on groups of fields.
    - You can run facet queries over sharded collections on clusters running MongoDB v6.0 only.

    The following example searches searches the ``guitars`` collection for any documents in
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    Suggested change
    The following example searches searches the ``guitars`` collection for any documents in
    The following example searches the ``guitars`` collection for any documents in

    documentation for each individual operator for details on what types
    of path it supports.

    To search multiple indexed fields, use the ``Multi()`` method and pass in your fields. Documents which match on any of the specified fields are included in the result set. The following example searches the description and type fields.
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [q] Are these references something different than make and description described in the next paragraph? Or are they the same and should they be monospace and should type be make?

    Suggested change
    To search multiple indexed fields, use the ``Multi()`` method and pass in your fields. Documents which match on any of the specified fields are included in the result set. The following example searches the description and type fields.
    To search multiple indexed fields, use the ``Multi()`` method and pass in your fields. Documents which match on any of the specified fields are included in the result set. The following example searches the ``description`` and ``make`` fields.

    Copy link
    Collaborator Author

    Choose a reason for hiding this comment

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

    good catch! it is the same. i will delete that sentence because it seems redundant with the following one

    Comment on lines 725 to 738
    :atlas:`operators </atlas-search/query-syntax>` to specify the field or fields
    to be searched. It may contain:

    - A string
    - An array of strings
    - A :atlas:`multi analyzer </atlas-search/analyzers/multi>` specification
    - An array containing a combination of strings and multi analyzer
    specifications

    .. note::

    Not all operators can use all the different types of paths. See the
    documentation for each individual operator for details on what types
    of path it supports.
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [s] Up to you but since this repeats most of the info from the guide, maybe can edit a bit and link to the guide for more information.

    @shuangela shuangela requested a review from stephmarie17 March 13, 2025 14:22
    Copy link
    Collaborator

    @stephmarie17 stephmarie17 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 a small suggestion 🚢

    - A :atlas:`multi analyzer </atlas-search/analyzers/multi>` specification
    - An array containing a combination of strings and multi analyzer
    specifications
    to be searched. To learn more about what the ``path`` parameter may contain, see :atlas:`Construct a Query Path </atlas-search/path-construction>` in the Atlas guide.
    Copy link
    Collaborator

    Choose a reason for hiding this comment

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

    [s] Can potentially shorten to:

    Suggested change
    to be searched. To learn more about what the ``path`` parameter may contain, see :atlas:`Construct a Query Path </atlas-search/path-construction>` in the Atlas guide.
    to be searched. To learn more about what the ``path`` parameter may contain, see the :atlas:`Construct a Query Path </atlas-search/path-construction>` guide.

    @shuangela shuangela requested review from a team and rstam and removed request for a team March 13, 2025 18:07
    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