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

Use mongo driver 4 rc #17

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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-vc-delivery ChangeLog

## 2.0.0 -

### Changed
- **BREAKING**: Upgraded to next release of `@bedrock/mongodb` with support for Node Mongo Driver ^4.
- **BREAKING**: Changed various database results to use updated Mongo Driver 4 API.

## 1.0.0 - 2022-11-03

- See git history for changes.
11 changes: 5 additions & 6 deletions lib/exchanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
// cover exchange queries by exchanger ID + exchange ID
collection: COLLECTION_NAME,
fields: {localExchangerId: 1, 'exchange.id': 1},
options: {unique: true, background: false}
options: {unique: true}
}, {
// expire exchanges based on `expires` field
collection: COLLECTION_NAME,
Expand All @@ -45,7 +45,6 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
'meta.expires': {$exists: true}
},
unique: false,
background: false,
expireAfterSeconds: 0
}
}]);
Expand Down Expand Up @@ -90,8 +89,8 @@ export async function insert({exchangerId, exchange}) {
// insert the exchange and get the updated record
try {
const collection = database.collections[COLLECTION_NAME];
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 Expand Up @@ -200,7 +199,7 @@ export async function complete({exchangerId, id, explain = false} = {}) {

try {
const result = await collection.updateOne(query, update);
if(result.result.n > 0) {
if(result.modifiedCount > 0) {
// document modified: success
return true;
}
Expand Down Expand Up @@ -272,7 +271,7 @@ async function _markExchangeInvalid({record}) {
};
const collection = database.collections[COLLECTION_NAME];
const result = await collection.updateOne(query, update);
if(result.result.n > 0) {
if(result.modifiedCount > 0) {
// document modified: success
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@bedrock/did-io": "^9.0.1",
"@bedrock/express": "^8.0.0",
"@bedrock/https-agent": "^4.0.0",
"@bedrock/mongodb": "^10.0.0",
"@bedrock/mongodb": "^11.0.0",
"@bedrock/oauth2-verifier": "^1.0.0",
"@bedrock/service-agent": "^6.0.0",
"@bedrock/service-core": "^7.0.1",
"@bedrock/service-agent": "^7.0.0",
"@bedrock/service-core": "^8.0.1",
"@bedrock/validation": "^7.1.0"
},
"directories": {
Expand Down
24 changes: 12 additions & 12 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@
"@bedrock/data-integrity-context": "^1.0.0",
"@bedrock/did-context": "^4.0.0",
"@bedrock/did-io": "^9.0.1",
"@bedrock/edv-storage": "^16.0.0",
"@bedrock/edv-storage": "github:digitalbazaar/bedrock-edv-storage#use-mongo-driver-4-rc",
"@bedrock/express": "^8.0.0",
"@bedrock/https-agent": "^4.0.0",
"@bedrock/jsonld-document-loader": "^3.0.0",
"@bedrock/kms": "^11.0.0",
"@bedrock/kms-http": "^15.0.0",
"@bedrock/kms": "github:digitalbazaar/bedrock-kms#use-mongo-driver-4-rc",
"@bedrock/kms-http": "github:digitalbazaar/bedrock-kms-http#use-mongo-driver-4-rc",
"@bedrock/ledger-context": "^23.0.0",
"@bedrock/meter": "^5.0.0",
"@bedrock/meter-http": "^10.0.0",
"@bedrock/meter": "github:digitalbazaar/bedrock-meter#use-mongo-driver-4-rc",
"@bedrock/meter-http": "github:digitalbazaar/bedrock-meter-http#use-mongo-driver-4-rc",
"@bedrock/meter-usage-reporter": "^8.0.0",
"@bedrock/mongodb": "^10.0.0",
"@bedrock/mongodb": "github:digitalbazaar/bedrock-mongodb#mongo-driver-4-rc-fix-duplicate-error",
"@bedrock/multikey-context": "^1.0.0",
"@bedrock/oauth2-verifier": "^1.0.0",
"@bedrock/package-manager": "^3.0.0",
"@bedrock/security-context": "^7.0.0",
"@bedrock/server": "^5.0.0",
"@bedrock/service-agent": "^6.2.0",
"@bedrock/service-agent": "github:digitalbazaar/bedrock-service-agent#use-mongo-driver-4-rc",
"@bedrock/service-context-store": "^9.0.0",
"@bedrock/service-core": "^7.0.1",
"@bedrock/ssm-mongodb": "^10.0.0",
"@bedrock/service-core": "github:digitalbazaar/bedrock-service-core#use-mongo-driver-4-rc",
"@bedrock/ssm-mongodb": "github:digitalbazaar/bedrock-ssm-mongodb#use-mongo-driver-4-rc",
"@bedrock/test": "^8.0.5",
"@bedrock/validation": "^7.1.0",
"@bedrock/vc-delivery": "file:..",
"@bedrock/vc-issuer": "^20.0.0",
"@bedrock/vc-issuer": "github:digitalbazaar/bedrock-vc-issuer#use-mongo-driver-4-rc",
"@bedrock/vc-revocation-list-context": "^3.1.0",
"@bedrock/vc-status-list-context": "^4.1.0",
"@bedrock/vc-verifier": "^14.0.0",
"@bedrock/vc-verifier": "github:digitalbazaar/bedrock-vc-verifier#use-mongo-driver-4-rc",
"@bedrock/veres-one-context": "^14.0.1",
"@bedrock/zcap-storage": "^8.0.0",
"@bedrock/zcap-storage": "github:digitalbazaar/bedrock-zcap-storage#use-mongo-driver-4-rc",
"@digitalbazaar/did-method-key": "^3.0.0",
"@digitalbazaar/ed25519-multikey": "^1.0.0",
"@digitalbazaar/ed25519-signature-2020": "^4.0.1",
Expand Down