Skip to content

Commit

Permalink
SERVER-24703 Improve usage comment for BSONField
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassi committed Jun 27, 2016
1 parent cd9cef1 commit 130a4ae
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/mongo/bson/bson_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ namespace mongo {
* BSONField<bool> MyCollFields::draining("draining");
* BSONField<int> MyCollFields::count("count");
*
* In an insert:
* conn->insert(myColl,
* BSON(MyCollFields::name("id_for_this_doc") <<
* MyCollFields::draining(true) <<
* MyCollFields::count(0)));
* // Use BSONField::operator()(const T&) to instantiate a typed element for the field:
* BSONObj obj = BSON(MyCollFields::name("id_for_this_doc") <<
* MyCollFields::draining(true) <<
* MyCollFields::count(0));
*
* In a query:
* conn->findOne(myColl, BSON(MyCollFields::count.gt(10))) ;
* // Use BSONField::gt() and friends to construct a basic query predicate over the field:
* BSONObj obj = BSON(MyCollFields::count.gt(10));
*
* // Use BSONField::operator()() to retrieve the name of the field:
* BSONObj obj = BSON(MyCollFields::draining() << 1);
*/

template <typename T>
Expand Down

0 comments on commit 130a4ae

Please sign in to comment.