{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/comments/42252864","id":42252864,"diff_hunk":"@@ -0,0 +1,419 @@\n+// Copyright 2015 MongoDB Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#pragma once\n+\n+#include <mongocxx/config/prelude.hpp>\n+\n+#include <bsoncxx/document/view.hpp>\n+#include <bsoncxx/stdx/optional.hpp>\n+#include <mongocxx/stdx.hpp>\n+\n+namespace mongocxx {\n+MONGOCXX_INLINE_NAMESPACE_BEGIN\n+\n+class collection;\n+\n+namespace options {\n+\n+///\n+/// Class representing the optional arguments to a MongoDB create index operation\n+///\n+class MONGOCXX_API index {\n+   public:\n+    ///\n+    /// Base class representing the optional storage engine options for indexes.\n+    ///\n+    class base_storage_options {\n+       private:\n+        friend collection;\n+        virtual const int type() const = 0;\n+    };\n+\n+    ///\n+    /// Class representing the optional WiredTiger storage engine options for indexes.\n+    ///\n+    class wiredtiger_storage_options : public base_storage_options {\n+       public:\n+        ///\n+        /// Set the WiredTiger configuration string.\n+        ///\n+        /// @param config_str\n+        ///   The WiredTiger configuration string.\n+        ///\n+        /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+        ///\n+        void config_str(std::string config_str);\n+\n+        ///\n+        /// The current config_str setting.\n+        ///\n+        /// @return The current config_str.\n+        ///\n+        /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+        ///\n+        const stdx::optional<std::string>& config_str() const;\n+\n+       private:\n+        friend collection;\n+        const int type() const override;\n+        stdx::optional<std::string> _config_str;\n+    };\n+\n+    index();\n+\n+    ///\n+    /// Whether or not to build the index in the background so that building\n+    /// the index does not block other database activities.\n+    ///\n+    /// @param background\n+    ///   Whether or not to build the index in the background.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    void background(bool background);\n+\n+    ///\n+    /// The current background setting.\n+    ///\n+    /// @return The current background.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    const stdx::optional<bool>& background() const;\n+\n+    ///\n+    /// Whether or not to create a unique index so that the collection will not\n+    /// accept insertion of documents where the index key or keys match an\n+    /// existing value in the index.\n+    ///\n+    /// @param unique\n+    ///   Whether or not to create a unique index.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    void unique(bool unique);\n+\n+    ///\n+    /// The current unique setting.\n+    ///\n+    /// @return The current unique.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    const stdx::optional<bool>& unique() const;\n+\n+    ///\n+    /// The name of the index.\n+    ///\n+    /// @param name\n+    ///   The name of the index.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    void name(std::string name);\n+\n+    ///\n+    /// The current name setting.\n+    ///\n+    /// @return The current name.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    const stdx::optional<std::string>& name() const;\n+\n+    ///\n+    /// Whether or not to create a sparse index. Sparse indexes only reference\n+    /// documents with the indexed fields.\n+    ///\n+    /// @param sparse\n+    ///   Whether or not to create a sparse index.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    void sparse(bool sparse);\n+\n+    ///\n+    /// The current sparse setting.\n+    ///\n+    /// @return The current sparse.\n+    ///\n+    /// @see http://docs.mongodb.org/manual/reference/method/db.collection.createIndex/#options\n+    ///\n+    const stdx::optional<bool>& sparse() const;\n+\n+    ///\n+    /// Optionally used only in MongoDB 3.0.0 and higher. Specifies the storage\n+    /// engine options for the index\n+    ///\n+    /// @param storage_options\n+    ///   The storage engine options for the index in.","path":"src/mongocxx/options/index.hpp","position":161,"original_position":161,"commit_id":"ff039728b955b876e1f1204410aa0070259bdf5b","original_commit_id":"ff039728b955b876e1f1204410aa0070259bdf5b","user":{"login":"amidvidy","id":363757,"avatar_url":"https://avatars.githubusercontent.com/u/363757?v=3","gravatar_id":"","url":"https://api.github.com/users/amidvidy","html_url":"https://github.com/amidvidy","followers_url":"https://api.github.com/users/amidvidy/followers","following_url":"https://api.github.com/users/amidvidy/following{/other_user}","gists_url":"https://api.github.com/users/amidvidy/gists{/gist_id}","starred_url":"https://api.github.com/users/amidvidy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amidvidy/subscriptions","organizations_url":"https://api.github.com/users/amidvidy/orgs","repos_url":"https://api.github.com/users/amidvidy/repos","events_url":"https://api.github.com/users/amidvidy/events{/privacy}","received_events_url":"https://api.github.com/users/amidvidy/received_events","type":"User","site_admin":false},"body":"Can you add a section to the comment explaining that the base_storage_options* instance must stay in scope until after the call to create_index?\r\n\r\n@acmorrow curious to hear your thoughts on this interface - I suggested it due to how the C driver implements WT-specific options internally","created_at":"2015-10-16T15:06:35Z","updated_at":"2015-10-16T15:06:35Z","html_url":"https://github.com/mongodb/mongo-cxx-driver/pull/325#discussion_r42252864","pull_request_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/comments/42252864"},"html":{"href":"https://github.com/mongodb/mongo-cxx-driver/pull/325#discussion_r42252864"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325","id":47700904,"html_url":"https://github.com/mongodb/mongo-cxx-driver/pull/325","diff_url":"https://github.com/mongodb/mongo-cxx-driver/pull/325.diff","patch_url":"https://github.com/mongodb/mongo-cxx-driver/pull/325.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/325","number":325,"state":"open","locked":false,"title":"CXX-687: add option class for index creation","user":{"login":"Machyne","id":2737181,"avatar_url":"https://avatars.githubusercontent.com/u/2737181?v=3","gravatar_id":"","url":"https://api.github.com/users/Machyne","html_url":"https://github.com/Machyne","followers_url":"https://api.github.com/users/Machyne/followers","following_url":"https://api.github.com/users/Machyne/following{/other_user}","gists_url":"https://api.github.com/users/Machyne/gists{/gist_id}","starred_url":"https://api.github.com/users/Machyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machyne/subscriptions","organizations_url":"https://api.github.com/users/Machyne/orgs","repos_url":"https://api.github.com/users/Machyne/repos","events_url":"https://api.github.com/users/Machyne/events{/privacy}","received_events_url":"https://api.github.com/users/Machyne/received_events","type":"User","site_admin":false},"body":"Create a new options class to be used on index creation.\r\nThis class supports the partial filter expression, so this also fixes CXX-686.","created_at":"2015-10-14T19:04:02Z","updated_at":"2015-10-16T15:06:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01c0e15046d4c21e642ee0427e92867da3584851","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/325/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/statuses/ff039728b955b876e1f1204410aa0070259bdf5b","head":{"label":"Machyne:master","ref":"master","sha":"ff039728b955b876e1f1204410aa0070259bdf5b","user":{"login":"Machyne","id":2737181,"avatar_url":"https://avatars.githubusercontent.com/u/2737181?v=3","gravatar_id":"","url":"https://api.github.com/users/Machyne","html_url":"https://github.com/Machyne","followers_url":"https://api.github.com/users/Machyne/followers","following_url":"https://api.github.com/users/Machyne/following{/other_user}","gists_url":"https://api.github.com/users/Machyne/gists{/gist_id}","starred_url":"https://api.github.com/users/Machyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machyne/subscriptions","organizations_url":"https://api.github.com/users/Machyne/orgs","repos_url":"https://api.github.com/users/Machyne/repos","events_url":"https://api.github.com/users/Machyne/events{/privacy}","received_events_url":"https://api.github.com/users/Machyne/received_events","type":"User","site_admin":false},"repo":{"id":44116438,"name":"mongo-cxx-driver","full_name":"Machyne/mongo-cxx-driver","owner":{"login":"Machyne","id":2737181,"avatar_url":"https://avatars.githubusercontent.com/u/2737181?v=3","gravatar_id":"","url":"https://api.github.com/users/Machyne","html_url":"https://github.com/Machyne","followers_url":"https://api.github.com/users/Machyne/followers","following_url":"https://api.github.com/users/Machyne/following{/other_user}","gists_url":"https://api.github.com/users/Machyne/gists{/gist_id}","starred_url":"https://api.github.com/users/Machyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machyne/subscriptions","organizations_url":"https://api.github.com/users/Machyne/orgs","repos_url":"https://api.github.com/users/Machyne/repos","events_url":"https://api.github.com/users/Machyne/events{/privacy}","received_events_url":"https://api.github.com/users/Machyne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Machyne/mongo-cxx-driver","description":"C++ Driver for MongoDB","fork":true,"url":"https://api.github.com/repos/Machyne/mongo-cxx-driver","forks_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/forks","keys_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/teams","hooks_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/hooks","issue_events_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/issues/events{/number}","events_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/events","assignees_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/assignees{/user}","branches_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/branches{/branch}","tags_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/tags","blobs_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/languages","stargazers_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/stargazers","contributors_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/contributors","subscribers_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/subscribers","subscription_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/subscription","commits_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/contents/{+path}","compare_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/merges","archive_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/downloads","issues_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/issues{/number}","pulls_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/labels{/name}","releases_url":"https://api.github.com/repos/Machyne/mongo-cxx-driver/releases{/id}","created_at":"2015-10-12T15:29:36Z","updated_at":"2015-10-12T15:29:38Z","pushed_at":"2015-10-16T14:58:26Z","git_url":"git://github.com/Machyne/mongo-cxx-driver.git","ssh_url":"git@github.com:Machyne/mongo-cxx-driver.git","clone_url":"https://github.com/Machyne/mongo-cxx-driver.git","svn_url":"https://github.com/Machyne/mongo-cxx-driver","homepage":null,"size":5433,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"legacy"}},"base":{"label":"mongodb:master","ref":"master","sha":"718fcb4190894a45b8b9124e54c762ba3d3b9be3","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":15881868,"name":"mongo-cxx-driver","full_name":"mongodb/mongo-cxx-driver","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-cxx-driver","description":"C++ Driver for MongoDB","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-cxx-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-cxx-driver/releases{/id}","created_at":"2014-01-13T21:08:36Z","updated_at":"2015-10-10T00:25:46Z","pushed_at":"2015-10-16T14:58:26Z","git_url":"git://github.com/mongodb/mongo-cxx-driver.git","ssh_url":"git@github.com:mongodb/mongo-cxx-driver.git","clone_url":"https://github.com/mongodb/mongo-cxx-driver.git","svn_url":"https://github.com/mongodb/mongo-cxx-driver","homepage":null,"size":11014,"stargazers_count":194,"watchers_count":194,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":175,"mirror_url":null,"open_issues_count":9,"forks":175,"open_issues":9,"watchers":194,"default_branch":"legacy"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325"},"html":{"href":"https://github.com/mongodb/mongo-cxx-driver/pull/325"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/325"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/issues/325/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/pulls/325/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-driver/statuses/ff039728b955b876e1f1204410aa0070259bdf5b"}}}}