Skip to content

refactor: Upgrade mongodb from 4.10.0 to 5.3.0 #8560

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

Closed
wants to merge 12 commits into from
Closed
96 changes: 51 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lodash": "4.17.21",
"lru-cache": "9.1.1",
"mime": "3.0.0",
"mongodb": "4.10.0",
"mongodb": "5.3.0",
"mustache": "4.2.0",
"parse": "4.1.0",
"path-to-regexp": "6.2.1",
Expand Down
71 changes: 29 additions & 42 deletions spec/AudienceRouter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,54 +317,41 @@ describe('AudiencesRouter', () => {
);
});

it_exclude_dbs(['postgres'])('should support legacy parse.com audience fields', done => {
it_exclude_dbs(['postgres'])('should support legacy parse.com audience fields', async () => {
const database = Config.get(Parse.applicationId).database.adapter.database;
const now = new Date();
Parse._request(
let audience = await Parse._request(
'POST',
'push_audiences',
{ name: 'My Audience', query: JSON.stringify({ deviceType: 'ios' }) },
{ useMasterKey: true }
).then(audience => {
database
.collection('test__Audience')
.updateOne(
{ _id: audience.objectId },
{
$set: {
times_used: 1,
_last_used: now,
},
}
)
.then(result => {
expect(result).toBeTruthy();
database
.collection('test__Audience')
.find({ _id: audience.objectId })
.toArray((error, rows) => {
expect(error).toEqual(undefined);
expect(rows[0]['times_used']).toEqual(1);
expect(rows[0]['_last_used']).toEqual(now);
Parse._request(
'GET',
'push_audiences/' + audience.objectId,
{},
{ useMasterKey: true }
)
.then(audience => {
expect(audience.name).toEqual('My Audience');
expect(audience.query.deviceType).toEqual('ios');
expect(audience.timesUsed).toEqual(1);
expect(audience.lastUsed).toEqual(now.toISOString());
done();
})
.catch(error => {
done.fail(error);
});
});
});
});
);
const result = await database.collection('test__Audience').updateOne(
{ _id: audience.objectId },
{
$set: {
times_used: 1,
_last_used: now,
},
}
);
expect(result).toBeTruthy();
const rows = await database
.collection('test__Audience')
.find({ _id: audience.objectId })
.toArray();
expect(rows[0]['times_used']).toEqual(1);
expect(rows[0]['_last_used']).toEqual(now);
audience = await Parse._request(
'GET',
'push_audiences/' + audience.objectId,
{},
{ useMasterKey: true }
);
expect(audience.name).toEqual('My Audience');
expect(audience.query.deviceType).toEqual('ios');
expect(audience.timesUsed).toEqual(1);
expect(audience.lastUsed).toEqual(now.toISOString());
});

it('should be able to search on audiences', done => {
Expand Down
Loading