examples/mongocxx/mongodb.com/index_examples.cpp
// NOTE: Any time this file is modified, a DOCS ticket should be opened to sync the changes with the
// corresponding page on docs.mongodb.com. See CXX-1514, CXX-1249, and DRIVERS-356 for more info.
Any time this file is modified, a DOCS ticket should be opened to sync the changes with the
corresponding page on docs.mongodb.com.
Any time this file is modified a DOCS ticket should be opened to sync the changes with the corresponding page on docs . mongodb . com .
void index_examples(const mongocxx::database& db) {
    {
        using namespace bsoncxx::builder::basic;
        auto result = db["records"].create_index(make_document(kvp("score", 1)));
    }
    {
        using namespace bsoncxx::builder::basic;
        auto result = db["restaurants"].create_index(
            make_document(kvp("cuisine", 1), kvp("name", 1)),
            make_document(kvp("partialFilterExpression",
                              make_document(kvp("rating", make_document(kvp("$gt", 5)))))));
    }
}
void index_examples ( const mongocxx :: database & db ) { { using namespace bsoncxx :: builder :: basic ; auto result = db [ " " ] . create_index ( make_document ( kvp ( " " , 1 ) ) ) ; } { using namespace bsoncxx :: builder :: basic ; auto result = db [ " " ] . create_index ( make_document ( kvp ( " " , 1 ) , kvp ( " " , 1 ) ) , make_document ( kvp ( " " , make_document ( kvp ( " " , make_document ( kvp ( " " , 5 ) ) ) ) ) ) ) ; } }
NOTE: Any time this file is modified, a DOCS ticket should be opened to sync the changes with the
corresponding page on docs.mongodb.com.
NOTE : Any time this file is modified a DOCS ticket should be opened to sync the changes with the corresponding page on docs . mongodb . com .
// Start Index Example 1 // End Index Example 1 // Start Index Example 2 // End Index Example 2