Skip to content

Commit 928ba12

Browse files
committed
docs: 2.0.3 update: DevAPI classes documentation update
1 parent 437b260 commit 928ba12

File tree

8 files changed

+227
-73
lines changed

8 files changed

+227
-73
lines changed

include/devapi/collection_crud.h

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,13 @@ namespace internal {
466466
return *this;
467467
}
468468

469+
/**
470+
Specify ordering of documents in the operation.
471+
472+
This form accepts a vector, list or other container with strings, each
473+
string defining sorting direction and the value to sort on.
474+
*/
475+
469476
template <typename Ord>
470477
Limit<Res, limit_with_offset>& sort(Ord ord)
471478
{
@@ -476,6 +483,13 @@ namespace internal {
476483
return *this;
477484
}
478485

486+
/**
487+
Specify ordering of documents in the operation.
488+
489+
Arguments are one or more strings, each defining sorting direction and the
490+
value to sort on.
491+
*/
492+
479493
template <typename Ord, typename...Type>
480494
Limit<Res, limit_with_offset>& sort(Ord ord, const Type...rest)
481495
{
@@ -559,7 +573,7 @@ namespace internal {
559573
public:
560574

561575
/**
562-
Remove all documents from the collection.
576+
Return operation which removes all documents from the collection.
563577
*/
564578

565579
virtual CollectionRemove remove()
@@ -568,7 +582,7 @@ namespace internal {
568582
}
569583

570584
/**
571-
Remove documents satisfying given expression.
585+
Return operation which removes documents satisfying given expression.
572586
*/
573587

574588
virtual CollectionRemove remove(const string &cond)
@@ -653,6 +667,13 @@ DIAGNOSTIC_POP
653667

654668
public:
655669

670+
/**
671+
Specify projection for documents found in the collection.
672+
673+
The projection should be an expression given by `expr(<string>)`
674+
which evaluates to a document. Each document found will be transformed by
675+
evaluating the expression an the result will be returned by the operation.
676+
*/
656677

657678
CollectionSort& fields(internal::ExprValue proj)
658679
{
@@ -675,6 +696,18 @@ DIAGNOSTIC_POP
675696
return *this;
676697
}
677698

699+
/**
700+
Specify projection for documents found in the collection.
701+
702+
In this form the projection is given as list of strings of the form
703+
`"<expression> AS <path>"`. Each expression is evaluated and `<path>`
704+
specifies where to put the value of the expression in the resulting
705+
document.
706+
707+
The strings which define the projection are passed as a vector, list
708+
or other container with strings.
709+
*/
710+
678711
template <typename Ord>
679712
CollectionSort& fields(const Ord& ord)
680713
{
@@ -685,6 +718,15 @@ DIAGNOSTIC_POP
685718
return *this;
686719
}
687720

721+
/**
722+
Specify projection for documents found in the collection.
723+
724+
In this form the projection is given as list of strings of the form
725+
`"<expression> AS <path>"`. Each expression is evaluated and `<path>`
726+
specifies where to put the value of the expression in the resulting
727+
document.
728+
*/
729+
688730
/*
689731
Note: If e is an expression (of type ExprValue) then only
690732
.fields(e) is valid - the multi-argument variant .fields(e,...)
@@ -720,7 +762,7 @@ namespace internal {
720762
public:
721763

722764
/**
723-
Return all the documents in the collection.
765+
Return operation which fetches all the documents in the collection.
724766
*/
725767

726768
CollectionFind find()
@@ -729,7 +771,7 @@ namespace internal {
729771
}
730772

731773
/**
732-
Find documents that satisfy given expression.
774+
Return opertion which finds documents that satisfy given expression.
733775
*/
734776

735777
CollectionFind find(const string &cond)
@@ -836,6 +878,13 @@ DIAGNOSTIC_PUSH
836878

837879
DIAGNOSTIC_POP
838880

881+
/**
882+
Set a given field in a docuemnt to the given value.
883+
884+
Field is given by a document path. The value can be either a direct literal
885+
or an expression given by `expr(<string>)`, evaluated in the server.
886+
*/
887+
839888
CollectionModify& set(const Field &field, internal::ExprValue &&val)
840889
{
841890
try {
@@ -845,6 +894,12 @@ DIAGNOSTIC_POP
845894
CATCH_AND_WRAP
846895
}
847896

897+
/**
898+
Unset a given field in a document.
899+
900+
The field is given by a document path.
901+
*/
902+
848903
CollectionModify& unset(const Field &field)
849904
{
850905
try {
@@ -854,6 +909,13 @@ DIAGNOSTIC_POP
854909
CATCH_AND_WRAP
855910
}
856911

912+
/**
913+
Insert value into an array field of a document.
914+
915+
The `field` parameter should be a document path pointing at a location
916+
inside an array field. The given value is inserted at this position.
917+
*/
918+
857919
CollectionModify& arrayInsert(const Field &field, internal::ExprValue &&val)
858920
{
859921
try {
@@ -863,6 +925,14 @@ DIAGNOSTIC_POP
863925
CATCH_AND_WRAP
864926
}
865927

928+
/**
929+
Append value to an array field of a document.
930+
931+
The `field` parameter should be a document path pointing at an array
932+
field inside the document. The given value is appended at the end of the
933+
array.
934+
*/
935+
866936
CollectionModify& arrayAppend(const Field &field, internal::ExprValue &&val)
867937
{
868938
try {
@@ -872,6 +942,14 @@ DIAGNOSTIC_POP
872942
CATCH_AND_WRAP
873943
}
874944

945+
/**
946+
Delete element from an array field of a document.
947+
948+
The `field` parameter should be a document path pointing at a location
949+
inside an array field. The element at indicated location is removed from
950+
the array.
951+
*/
952+
875953
CollectionModify& arrayDelete(const Field &field)
876954
{
877955
try {
@@ -899,7 +977,7 @@ namespace internal {
899977
public:
900978

901979
/**
902-
Modify all documents.
980+
Return operation which modifies all documents in the collection.
903981
*/
904982

905983
CollectionModify modify()
@@ -911,7 +989,7 @@ namespace internal {
911989
}
912990

913991
/**
914-
Modify documents that satisfy given expression.
992+
Return operation which modifies documents that satisfy given expression.
915993
*/
916994

917995
CollectionModify modify(const string &expr)

include/devapi/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace internal {
257257
} // internal
258258

259259

260-
/**
260+
/*
261261
Global unique identifiers for documents.
262262
263263
TODO: Windows GUID type

include/devapi/crud.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ struct Limit_impl : public Statement_impl
127127
};
128128

129129

130-
/// TODO
130+
/**
131+
Base class defining operation's offset() clasue.
132+
*/
131133

132134
template <class Res>
133135
class Offset
@@ -152,6 +154,11 @@ class Offset
152154

153155
public:
154156

157+
/**
158+
Skip the given number of items (rows or documents) before starting
159+
to perform the operation.
160+
*/
161+
155162
Statement<Res>& offset(unsigned rows)
156163
{
157164
get_impl()->set_offset(rows);
@@ -183,7 +190,11 @@ struct LimitRet<Res,false>
183190
};
184191

185192

186-
/// TODO
193+
/**
194+
Base class defining operation's limit() clause.
195+
*/
196+
197+
// TODO: Doxygen does not see the base class
187198

188199
template <class Res, bool with_offset>
189200
class Limit
@@ -206,9 +217,13 @@ class Limit
206217

207218
public:
208219

209-
typename LimitRet<Res, with_offset>::type& limit(unsigned rows)
220+
/**
221+
%Limit the operation to the given number of items (rows or documents).
222+
*/
223+
224+
typename LimitRet<Res, with_offset>::type& limit(unsigned items)
210225
{
211-
get_impl()->set_limit(rows);
226+
get_impl()->set_limit(items);
212227
return *this;
213228
}
214229
};

include/devapi/document.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class DocResult;
5151
// Field class
5252
// ===========
5353

54-
/**
55-
Field object/values represent fields in a document.
54+
/*
55+
%Field object/values represent fields in a document.
5656
5757
TODO: _fld suffix
5858
@@ -225,7 +225,7 @@ class PUBLIC_API DbDoc::Iterator
225225
// ===========
226226

227227
/**
228-
Value object can store value of scalar type, string, array or document.
228+
%Value object can store value of scalar type, string, array or document.
229229
230230
Implicit conversions to and from corresponding C++ types are defined.
231231
If conversion to wrong type is attempted, an error is thrown. If Value

0 commit comments

Comments
 (0)