Skip to content

Conversation

mcmorisi
Copy link
Collaborator

@mcmorisi mcmorisi commented Jun 4, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - DOCSP-32634
Staging - https://preview-mongodbmcmorisi.gatsbyjs.io/csharp/DOCSP-32634-indexes/fundamentals/indexes/

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?

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.

Nice work! A few suggestions and link fixes

@mcmorisi mcmorisi requested a review from jordan-smith721 June 5, 2024 13:31
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.

LGTM!

Copy link
Collaborator

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

Overall looking great. Biggest recommendation is to use the strongly-typed Builders<T>.IndexKeys builder rather than specifying indexes as BsonDocument or JSON strings.

@mcmorisi mcmorisi requested a review from JamesKovacs June 12, 2024 14:11
Console.WriteLine("wildcard index");

// begin-wildcard-index
collection.Indexes.CreateOne(Builders<Theater>.IndexKeys.Ascending("location.$**"));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JamesKovacs Wanted to specifically draw your attention here – is this the preferred way to implement an ascending wildcard index using the Builders model?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a Wildcard method on IndexKeys.

coll.Indexes.CreateOne(
    new CreateIndexModel<Theater>(Builders<Review>.IndexKeys.Wildcard(x => x.Location))
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case, would the x.Location wildcard be defined in the Theater Poco as something like this?

        [BsonElement("location.$**")]
        public string LocationGeo { get; set; }

Copy link
Collaborator

Choose a reason for hiding this comment

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

[BsonElement] specifies the field name in the database and is unrelated to wildcard indexes. You would still specify this field as location.geo.

Copy link
Collaborator

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

A few more changes...

Console.WriteLine("wildcard index");

// begin-wildcard-index
collection.Indexes.CreateOne(Builders<Theater>.IndexKeys.Ascending("location.$**"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a Wildcard method on IndexKeys.

coll.Indexes.CreateOne(
    new CreateIndexModel<Theater>(Builders<Review>.IndexKeys.Wildcard(x => x.Location))
);

@mcmorisi mcmorisi requested a review from JamesKovacs June 12, 2024 19:06
Copy link
Collaborator

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

LGTM

@mcmorisi mcmorisi merged commit d150844 into mongodb:master Jun 17, 2024
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mcmorisi added a commit that referenced this pull request Jun 17, 2024
(cherry picked from commit d150844)
mongoKart pushed a commit to mongoKart/docs-csharp that referenced this pull request May 16, 2025
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