Skip to content

Conversation

@TylerBrock
Copy link
Contributor

@acmorrow, it seems we can take advantage of the fact that Query::hint() had a useless overload that took a string. What I did was repurpose that method to take an index name as opposed to a json string representation of the index spec. This way we can use Query to hold a hint that can either be either an index spec (BSONObj) or index name (std::string).

This is good because:

  • When the query gets unpacked in the _countCmd method we can use either to support current and future server versions.
  • The api isn't terrible because we avoid adding another parameter to the count method.
  • It fits well with our current design.

@TylerBrock TylerBrock force-pushed the count-hint branch 2 times, most recently from d4f42e1 to 201726b Compare September 11, 2014 22:05
@acmorrow
Copy link
Contributor

LGTM, nice to see we didn't need to rip apart Query. Seems like there is some very slight risk for older users of the API you repurposed, but seems pretty unlikely.

@TylerBrock TylerBrock merged commit 921a4c6 into mongodb:legacy Sep 12, 2014
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