Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return record instead of using mongodb return value. #31

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# bedrock-service-core ChangeLog

## 10.1.1 - 2025-mm-dd

### Fixed
- Return passed `record` instead of resulting record from mongodb calls to
enable using newer mongodb driver.

## 10.1.0 - 2025-01-23

### Changed
Expand Down
8 changes: 4 additions & 4 deletions lib/storage/ConfigStorage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2021-2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2021-2025 Digital Bazaar, Inc. All rights reserved.
*/
import * as bedrock from '@bedrock/core';
import * as brZCapStorage from '@bedrock/zcap-storage';
Expand Down Expand Up @@ -64,14 +64,14 @@ export class ConfigStorage {
});
}

// insert the configuration and get the updated record
// insert the configuration and return the updated record
const now = Date.now();
const meta = {created: now, updated: now};
const record = {meta, config};
try {
const collection = this._getCollection();
const result = await collection.insertOne(record);
return result.ops[0];
await collection.insertOne(record);
return record;
} catch(e) {
if(!database.isDuplicateError(e)) {
throw e;
Expand Down