[CXX-2046] Implement operator[] for bsoncxx::document::value Created: 10/Jun/20  Updated: 22/Sep/20  Resolved: 22/Sep/20

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Raymund Rodriguez
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CXX-2082

 Description   

All of the usability methods for document reading are on the document::view class.  However, as a usability improvement, it would be nice to provide operator[] on the document::value class, which would delegate the real work to document::view under the hood:

auto doc = make_document(kvp("a", 1));
 
// currently
auto a = doc.view()["a"].get_value(); 
 
// also currently
auto doc_view = doc.view();
auto a = doc_view["a"].get_value();
 
// proposed
auto a = doc["a"].get_value();



 Comments   
Comment by Githook User [ 22/Sep/20 ]

Author:

{'name': 'rayangler', 'email': 'rayangler@users.noreply.github.com', 'username': 'rayangler'}

Message: CXX-2046 Implement operator[] for bsoncxx::document::value (#723)
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/2f346b8cded213c08e08fa8f31a1fbe20a5cad56

Generated at Wed Feb 07 22:04:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.