diff options
author | Eliot Horowitz <eliot@10gen.com> | 2013-05-08 11:56:39 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2013-05-09 10:16:55 -0400 |
commit | 5638031288f5dc8069dee5bebb02a7698d39ee75 (patch) | |
tree | f7f219e8a27fc4c1edcb5309e38145a1d7622a26 /src/mongo/db/field_ref.cpp | |
parent | b326df258988f9f7d91dcbe77440ab3c365bc3da (diff) | |
download | mongo-5638031288f5dc8069dee5bebb02a7698d39ee75.tar.gz |
SERVER-6400: FieldRef support for sub dottedField
Diffstat (limited to 'src/mongo/db/field_ref.cpp')
-rw-r--r-- | src/mongo/db/field_ref.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/field_ref.cpp b/src/mongo/db/field_ref.cpp index 68ab798b320..bc59e6583f6 100644 --- a/src/mongo/db/field_ref.cpp +++ b/src/mongo/db/field_ref.cpp @@ -101,15 +101,16 @@ namespace mongo { _replacements.clear(); } - std::string FieldRef::dottedField() const { + std::string FieldRef::dottedField( size_t offset ) const { std::string res; - if (_size == 0) { + + if (_size == 0 || offset >= numParts() ) { return res; } - res.append(_fixed[0].rawData(), _fixed[0].size()); - for (size_t i=1; i<_size; i++) { - res.append(1, '.'); + for (size_t i=offset; i<_size; i++) { + if ( i > offset ) + res.append(1, '.'); StringData part = getPart(i); res.append(part.rawData(), part.size()); } |