diff options
author | Tommaso Tocci <tommaso.tocci@10gen.com> | 2020-01-07 14:52:28 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-07 14:52:28 +0000 |
commit | 47a810f853921657acb78db1110590c0c380091f (patch) | |
tree | 71848edc9aefa4d3c6b74623ebb49068c84b943a /src/mongo | |
parent | d48ce89ee25484c5b59e9d5c14af8c338386b483 (diff) | |
download | mongo-47a810f853921657acb78db1110590c0c380091f.tar.gz |
SERVER-45030 Replace use of $currentDate with $$NOW
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/sessions_collection.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mongo/db/sessions_collection.cpp b/src/mongo/db/sessions_collection.cpp index 98ab79de215..38a843769c6 100644 --- a/src/mongo/db/sessions_collection.cpp +++ b/src/mongo/db/sessions_collection.cpp @@ -71,23 +71,19 @@ BSONObj lsidQuery(const LogicalSessionRecord& record) { return lsidQuery(record.getId()); } -BSONObj updateQuery(const LogicalSessionRecord& record) { - // { $max : { lastUse : <time> }, $setOnInsert : { user : <user> } } +BSONArray updateQuery(const LogicalSessionRecord& record) { + // [ { $set : { lastUse : $$NOW } } , { $set : { user: <user> } } ] // Build our update doc. - BSONObjBuilder updateBuilder; - - { - BSONObjBuilder maxBuilder(updateBuilder.subobjStart("$currentDate")); - maxBuilder.append(LogicalSessionRecord::kLastUseFieldName, true); - } + BSONArrayBuilder updateBuilder; + updateBuilder << BSON("$set" << BSON(LogicalSessionRecord::kLastUseFieldName << "$$NOW")); if (record.getUser()) { - BSONObjBuilder setBuilder(updateBuilder.subobjStart("$setOnInsert")); - setBuilder.append(LogicalSessionRecord::kUserFieldName, BSON("name" << *record.getUser())); + updateBuilder << BSON("$set" << BSON(LogicalSessionRecord::kUserFieldName + << BSON("name" << *record.getUser()))); } - return updateBuilder.obj(); + return updateBuilder.arr(); } template <typename TFactory, typename AddLineFn, typename SendFn, typename Container> |