Skip to content

Commit 3a14bef

Browse files
Merge branch 'master' into addTypesModelRemove
2 parents 14eb1c6 + 1284e68 commit 3a14bef

38 files changed

+276
-176
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,20 @@ jobs:
4141
matrix:
4242
node: [12, 14, 16, 18]
4343
os: [ubuntu-18.04, ubuntu-20.04]
44+
mongodb: [4.0.2, 5.0.2, 6.0.0]
4445
include:
4546
- os: ubuntu-18.04
46-
mongo-os: ubuntu1804
47-
mongo: 4.0.2
47+
mongodb-os: ubuntu1804
4848
- os: ubuntu-20.04
49-
mongo-os: ubuntu2004
50-
mongo: 5.0.2
49+
mongodb-os: ubuntu2004
5150
exclude:
52-
- os: ubuntu-18.04
51+
- os: ubuntu-18.04 # exclude because nodejs 18 requires higher GLIBC
5352
node: 18
54-
name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongo }}
53+
- os: ubuntu-18.04 # exclude because there are no builds for this ubuntu-mongodb version combination
54+
mongodb: 6.0.0
55+
- os: ubuntu-20.04 # exclude because there are no <4.4 mongodb builds for 2004
56+
mongodb: 4.0.2
57+
name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongodb }} OS ${{ matrix.os }}
5558
steps:
5659
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
5760

@@ -64,14 +67,14 @@ jobs:
6467

6568
- name: Setup
6669
run: |
67-
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}.tgz
68-
tar xf mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}.tgz
70+
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}.tgz
71+
tar xf mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}.tgz
6972
mkdir -p ./data/db/27017 ./data/db/27000
7073
printf "\n--timeout 8000" >> ./test/mocha.opts
71-
./mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
74+
./mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
7275
sleep 2
7376
mongod --version
74-
echo `pwd`/mongodb-linux-x86_64-${{ matrix.mongo-os }}-${{ matrix.mongo }}/bin >> $GITHUB_PATH
77+
echo `pwd`/mongodb-linux-x86_64-${{ matrix.mongodb-os }}-${{ matrix.mongodb }}/bin >> $GITHUB_PATH
7578
- run: npm test
7679

7780
test-replica-sets:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
5.13.15 / 2022-08-22
2+
====================
3+
* fix: backport fix for CVE-2022-2564 #12281 [shubanker](https://github.com/shubanker)
4+
* docs: fix broken link from findandmodify method deprecation #11366 [laissonsilveira](https://github.com/laissonsilveira)
5+
16
6.5.2 / 2022-08-09
27
==================
38
* fix(aggregate): avoid throwing error when disconnecting with change stream open #12201 [ramos-ph](https://github.com/ramos-ph)

docs/documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ to documents as stored in MongoDB. Each document is an instance of its
77
<ul class="toc">
88
<li><a href="#documents-vs-models">Documents vs Models</a></li>
99
<li><a href="#retrieving">Retrieving</a></li>
10-
<li><a href="#updating-using-save">Updating Using <code>save()<code></a></li>
10+
<li><a href="#updating-using-save">Updating Using <code>save()</code></a></li>
1111
<li><a href="#updating-using-queries">Updating Using Queries</a></li>
1212
<li><a href="#validating">Validating</a></li>
1313
<li><a href="#overwriting">Overwriting</a></li>

docs/geojson.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
});
77
</script>
88

9-
<div class="native-inline">
10-
<a href="#native_link#"><span class="sponsor">Sponsor</span> #native_company# — #native_desc#</a>
11-
</div>
12-
139
[GeoJSON](http://geojson.org/) is a format for storing geographic points and
1410
polygons. [MongoDB has excellent support for geospatial queries](http://thecodebarbarian.com/80-20-guide-to-mongodb-geospatial-queries)
1511
on GeoJSON objects. Let's take a look at how you can use Mongoose to store
@@ -157,4 +153,4 @@ citySchema.index({ location: '2dsphere' });
157153

158154
MongoDB's [`$near` query operator](https://docs.mongodb.com/v4.0/reference/operator/query/near/#op._S_near)
159155
and [`$geoNear` aggregation stage](https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear)
160-
_require_ a 2dsphere index.
156+
_require_ a 2dsphere index.

docs/guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ const animalSchema = new Schema({ name: String, type: String },
147147
{
148148
// Assign a function to the "methods" object of our animalSchema through schema options.
149149
// By following this approach, there is no need to create a separate TS type to define the type of the instance functions.
150-
methods:{
151-
findSimilarTypes(cb){
150+
methods: {
151+
findSimilarTypes(cb) {
152152
return mongoose.model('Animal').find({ type: this.type }, cb);
153153
}
154154
}
@@ -192,8 +192,8 @@ const animalSchema = new Schema({ name: String, type: String },
192192
{
193193
// Assign a function to the "statics" object of our animalSchema through schema options.
194194
// By following this approach, there is no need to create a separate TS type to define the type of the statics functions.
195-
statics:{
196-
findByName(name){
195+
statics: {
196+
findByName(name) {
197197
return this.find({ name: new RegExp(name, 'i') });
198198
}
199199
}
@@ -347,9 +347,9 @@ const personSchema = new Schema({
347347
first: String,
348348
last: String
349349
}
350-
},{
351-
virtuals:{
352-
fullName:{
350+
}, {
351+
virtuals: {
352+
fullName: {
353353
get() {
354354
return this.name.first + ' ' + this.name.last;
355355
}
@@ -386,9 +386,9 @@ const personSchema = new Schema({
386386
first: String,
387387
last: String
388388
}
389-
},{
390-
virtuals:{
391-
fullName:{
389+
}, {
390+
virtuals: {
391+
fullName: {
392392
get() {
393393
return this.name.first + ' ' + this.name.last;
394394
}
@@ -404,7 +404,7 @@ const personSchema = new Schema({
404404
personSchema.virtual('fullName').
405405
get(function() {
406406
return this.name.first + ' ' + this.name.last;
407-
}).
407+
}).
408408
set(function(v) {
409409
this.name.first = v.substr(0, v.indexOf(' '));
410410
this.name.last = v.substr(v.indexOf(' ') + 1);

docs/js/mobile-navbar-toggle.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// this js is for mobile, to toggle the navbar
2+
3+
(function (window, document) {
4+
const layout = document.getElementById('layout'),
5+
menu = document.getElementById('menu'),
6+
menuLink = document.getElementById('menuLink'),
7+
content = document.getElementById('content');
8+
9+
function toggleClass(element, className) {
10+
const classes = element.className.split(/\s+/),
11+
length = classes.length;
12+
13+
for(let i = 0; i < length; i++) {
14+
if (classes[i] === className) {
15+
classes.splice(i, 1);
16+
break;
17+
}
18+
}
19+
// The className is not found
20+
if (length === classes.length) {
21+
classes.push(className);
22+
}
23+
24+
element.className = classes.join(' ');
25+
}
26+
27+
function toggleAll(e) {
28+
let active = 'active';
29+
30+
e.preventDefault();
31+
toggleClass(layout, active);
32+
toggleClass(menu, active);
33+
toggleClass(menuLink, active);
34+
}
35+
36+
menuLink.onclick = function (e) {
37+
toggleAll(e);
38+
};
39+
40+
content.onclick = function(e) {
41+
if (menu.className.indexOf('active') !== -1) {
42+
toggleAll(e);
43+
}
44+
};
45+
46+
}(this, this.document));

docs/js/navbar-search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
document.getElementById('search-button-nav').onclick = function() {
22
var q = document.getElementById('search-input-nav').value;
3-
window.location.href = 'search.html?q=' + encodeURIComponent(q);
3+
window.location.href = '/docs/search.html?q=' + encodeURIComponent(q);
44
};
55

66
var q = document.getElementById('search-input-nav').onkeyup = function(ev) {
77
if (ev.keyCode === 13) {
88
var q = document.getElementById('search-input-nav').value;
99
window.location.href = '/docs/search.html?q=' + encodeURIComponent(q);
1010
}
11-
};
11+
};

docs/layout.pug

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -171,49 +171,4 @@ html(lang='en')
171171

172172

173173
script(type="text/javascript" src="/docs/js/navbar-search.js")
174-
script(type="text/javascript").
175-
(function (window, document) {
176-
var layout = document.getElementById('layout'),
177-
menu = document.getElementById('menu'),
178-
menuLink = document.getElementById('menuLink'),
179-
content = document.getElementById('content');
180-
181-
function toggleClass(element, className) {
182-
var classes = element.className.split(/\s+/),
183-
length = classes.length,
184-
i = 0;
185-
186-
for(; i < length; i++) {
187-
if (classes[i] === className) {
188-
classes.splice(i, 1);
189-
break;
190-
}
191-
}
192-
// The className is not found
193-
if (length === classes.length) {
194-
classes.push(className);
195-
}
196-
197-
element.className = classes.join(' ');
198-
}
199-
200-
function toggleAll(e) {
201-
var active = 'active';
202-
203-
e.preventDefault();
204-
toggleClass(layout, active);
205-
toggleClass(menu, active);
206-
toggleClass(menuLink, active);
207-
}
208-
209-
menuLink.onclick = function (e) {
210-
toggleAll(e);
211-
};
212-
213-
content.onclick = function(e) {
214-
if (menu.className.indexOf('active') !== -1) {
215-
toggleAll(e);
216-
}
217-
};
218-
219-
}(this, this.document));
174+
script(type="text/javascript" src="/docs/js/mobile-navbar-toggle.js")

docs/source/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ exports['docs/change-streams.md'] = { title: 'MongoDB Change Streams in NodeJS w
6565

6666
for (const props of Object.values(exports)) {
6767
props.jobs = jobs;
68-
}
68+
}

lib/browserDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const isObject = require('./helpers/isObject');
2020
* @param {Object} schema
2121
* @param {Object} [fields] optional object containing the fields which were selected in the query returning this document and any populated paths data
2222
* @param {Boolean} [skipId] bool, should we auto create an ObjectId _id
23-
* @inherits NodeJS EventEmitter https://nodejs.org/api/events.html#events_class_events_eventemitter
23+
* @inherits NodeJS EventEmitter https://nodejs.org/api/events.html#class-eventemitter
2424
* @event `init`: Emitted on a document after it has was retrieved from the db and fully hydrated by Mongoose.
2525
* @event `save`: Emitted when the document is successfully saved
2626
* @api private

0 commit comments

Comments
 (0)