mongoose 4.13.7 → 4.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +26 -0
- package/README.md +10 -2
- package/d1c5478c698dcae9731751e285eef3c431a8f213.patch +56 -0
- package/docs.html +413 -0
- package/lib/aggregate.js +5 -3
- package/lib/document.js +3 -1
- package/lib/model.js +114 -94
- package/lib/query.js +5 -2
- package/lib/queryhelpers.js +11 -5
- package/lib/schema/array.js +9 -2
- package/lib/schema/buffer.js +1 -1
- package/lib/schema/documentarray.js +11 -2
- package/lib/schema/embedded.js +5 -1
- package/lib/schema.js +13 -17
- package/lib/services/model/discriminator.js +3 -0
- package/lib/services/populate/getSchemaTypes.js +115 -0
- package/mongoose5_transparent.png +0 -0
- package/package.json +5 -3
- package/release-items.md +9 -9
- package/test.js +1 -0
- package/.npmignore +0 -19
package/History.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
4.13.11 / 2018-02-07
|
|
2
|
+
====================
|
|
3
|
+
* docs: fix links in 4.x docs #6081
|
|
4
|
+
* chore: add release script that uses --tag for npm publish for 4.x releases #6063
|
|
5
|
+
|
|
6
|
+
4.13.10 / 2018-01-28
|
|
7
|
+
====================
|
|
8
|
+
* docs(model+query): add lean() option to Model helpers #5996 [aguyinmontreal](https://github.com/aguyinmontreal)
|
|
9
|
+
* fix: use lazy loading so we can build mongoose with webpack #5993 #5842
|
|
10
|
+
* docs(connections): clarify multi-mongos with useMongoClient for 4.x docs #5984
|
|
11
|
+
* fix(populate): handle populating embedded discriminator paths #5970
|
|
12
|
+
* docs(query+aggregate): add more detail re: maxTimeMS #4066
|
|
13
|
+
|
|
14
|
+
4.13.9 / 2018-01-07
|
|
15
|
+
===================
|
|
16
|
+
* chore: update marked (dev dependency) re: security vulnerability #5951 [ChristianMurphy](https://github.com/ChristianMurphy)
|
|
17
|
+
* fix: upgrade mongodb -> 2.2.34 for ipv6 and autoReconnect fixes #5794 #5760
|
|
18
|
+
* docs: use useMongooseAggCursor for aggregate docs #2955
|
|
19
|
+
|
|
20
|
+
4.13.8 / 2017-12-27
|
|
21
|
+
===================
|
|
22
|
+
* docs(guide): use more up-to-date syntax for autoIndex example #5933
|
|
23
|
+
* docs: fix grammar #5927 [abagh0703](https://github.com/abagh0703)
|
|
24
|
+
* fix: propagate lean options to child schemas #5914
|
|
25
|
+
* fix(populate): use correct model with discriminators + nested populate #5858
|
|
26
|
+
|
|
1
27
|
4.13.7 / 2017-12-11
|
|
2
28
|
===================
|
|
3
29
|
* docs(schematypes): fix typo #5889 [gokaygurcan](https://github.com/gokaygurcan)
|
package/README.md
CHANGED
|
@@ -5,8 +5,6 @@ Mongoose is a [MongoDB](https://www.mongodb.org/) object modeling tool designed
|
|
|
5
5
|
[](http://slack.mongoosejs.io)
|
|
6
6
|
[](https://travis-ci.org/Automattic/mongoose)
|
|
7
7
|
[](http://badge.fury.io/js/mongoose)
|
|
8
|
-
[](https://gemnasium.com/Automattic/mongoose)
|
|
9
|
-
[](https://www.codementor.io/vkarpov?utm_source=github&utm_medium=button&utm_term=vkarpov&utm_campaign=github)
|
|
10
8
|
|
|
11
9
|
## Documentation
|
|
12
10
|
|
|
@@ -20,6 +18,16 @@ Mongoose is a [MongoDB](https://www.mongodb.org/) object modeling tool designed
|
|
|
20
18
|
- [Help Forum](http://groups.google.com/group/mongoose-orm)
|
|
21
19
|
- [MongoDB Support](https://docs.mongodb.org/manual/support/)
|
|
22
20
|
|
|
21
|
+
## Importing
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// Using Node.js `require()`
|
|
25
|
+
const mongoose = require('mongoose');
|
|
26
|
+
|
|
27
|
+
// Using ES6 imports
|
|
28
|
+
import mongoose from 'mongoose';
|
|
29
|
+
```
|
|
30
|
+
|
|
23
31
|
## Plugins
|
|
24
32
|
|
|
25
33
|
Check out the [plugins search site](http://plugins.mongoosejs.io/) to see hundreds of related modules from the community. Next, learn how to write your own plugin from the [docs](http://mongoosejs.com/docs/plugins.html) or [this blog post](http://thecodebarbarian.com/2015/03/06/guide-to-mongoose-plugins).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
From d1c5478c698dcae9731751e285eef3c431a8f213 Mon Sep 17 00:00:00 2001
|
|
2
|
+
From: Jess <jessachandler@gmail.com>
|
|
3
|
+
Date: Fri, 26 Jan 2018 10:06:01 +0900
|
|
4
|
+
Subject: [PATCH] Updated CONTRIBUTING.md (optional)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++++++++++
|
|
8
|
+
1 file changed, 38 insertions(+)
|
|
9
|
+
|
|
10
|
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
|
|
11
|
+
index 477f83a8a..a82f1ed20 100644
|
|
12
|
+
--- a/CONTRIBUTING.md
|
|
13
|
+
+++ b/CONTRIBUTING.md
|
|
14
|
+
@@ -60,3 +60,41 @@ Visit `http://localhost:8088` and you should see the docs with your local change
|
|
15
|
+
### Plugins website
|
|
16
|
+
|
|
17
|
+
The [plugins](http://plugins.mongoosejs.io/) site is also an [open source project](https://github.com/vkarpov15/mongooseplugins) that you can get involved with. Feel free to fork and improve it as well!
|
|
18
|
+
+
|
|
19
|
+
+
|
|
20
|
+
+## Financial contributions
|
|
21
|
+
+
|
|
22
|
+
+We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/mongoose).
|
|
23
|
+
+Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
|
24
|
+
+
|
|
25
|
+
+
|
|
26
|
+
+## Credits
|
|
27
|
+
+
|
|
28
|
+
+
|
|
29
|
+
+### Contributors
|
|
30
|
+
+
|
|
31
|
+
+Thank you to all the people who have already contributed to mongoose!
|
|
32
|
+
+<a href="graphs/contributors"><img src="https://opencollective.com/mongoose/contributors.svg?width=890" /></a>
|
|
33
|
+
+
|
|
34
|
+
+
|
|
35
|
+
+### Backers
|
|
36
|
+
+
|
|
37
|
+
+Thank you to all our backers! [[Become a backer](https://opencollective.com/mongoose#backer)]
|
|
38
|
+
+
|
|
39
|
+
+<a href="https://opencollective.com/mongoose#backers" target="_blank"><img src="https://opencollective.com/mongoose/backers.svg?width=890"></a>
|
|
40
|
+
+
|
|
41
|
+
+
|
|
42
|
+
+### Sponsors
|
|
43
|
+
+
|
|
44
|
+
+Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/mongoose#sponsor))
|
|
45
|
+
+
|
|
46
|
+
+<a href="https://opencollective.com/mongoose/sponsor/0/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/0/avatar.svg"></a>
|
|
47
|
+
+<a href="https://opencollective.com/mongoose/sponsor/1/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/1/avatar.svg"></a>
|
|
48
|
+
+<a href="https://opencollective.com/mongoose/sponsor/2/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/2/avatar.svg"></a>
|
|
49
|
+
+<a href="https://opencollective.com/mongoose/sponsor/3/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/3/avatar.svg"></a>
|
|
50
|
+
+<a href="https://opencollective.com/mongoose/sponsor/4/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/4/avatar.svg"></a>
|
|
51
|
+
+<a href="https://opencollective.com/mongoose/sponsor/5/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/5/avatar.svg"></a>
|
|
52
|
+
+<a href="https://opencollective.com/mongoose/sponsor/6/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/6/avatar.svg"></a>
|
|
53
|
+
+<a href="https://opencollective.com/mongoose/sponsor/7/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/7/avatar.svg"></a>
|
|
54
|
+
+<a href="https://opencollective.com/mongoose/sponsor/8/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/8/avatar.svg"></a>
|
|
55
|
+
+<a href="https://opencollective.com/mongoose/sponsor/9/website" target="_blank"><img src="https://opencollective.com/mongoose/sponsor/9/avatar.svg"></a>
|
|
56
|
+
|
package/docs.html
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<link
|
|
4
|
+
rel="stylesheet"
|
|
5
|
+
href="https://unpkg.com/purecss@1.0.0/build/pure-min.css"
|
|
6
|
+
integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w"
|
|
7
|
+
crossorigin="anonymous">
|
|
8
|
+
|
|
9
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans">
|
|
10
|
+
<link rel="stylesheet" href="http://thecodebarbarian.com/style/github.css">
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
html {
|
|
14
|
+
font-family: 'Open Sans';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
a {
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#logo {
|
|
26
|
+
width: 62px;
|
|
27
|
+
height: 30px;
|
|
28
|
+
position: relative;
|
|
29
|
+
top: 5px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.logo-text {
|
|
33
|
+
color: #800;
|
|
34
|
+
font-size: 20pt;
|
|
35
|
+
position: relative;
|
|
36
|
+
top: 0px;
|
|
37
|
+
left: 10px;
|
|
38
|
+
text-transform: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.pure-menu-item {
|
|
42
|
+
height: 30px;
|
|
43
|
+
font-size: 13pt;
|
|
44
|
+
padding-top: 0px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.pure-menu-link {
|
|
48
|
+
padding-top: 2px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
li.sub-item {
|
|
52
|
+
height: 25px;
|
|
53
|
+
font-size: 11pt;
|
|
54
|
+
margin-left: 20px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#logo-container {
|
|
58
|
+
position: relative;
|
|
59
|
+
top: -4px;
|
|
60
|
+
padding-bottom: 6px;
|
|
61
|
+
border-bottom: 1px solid #ddd;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#menu {
|
|
65
|
+
z-index: 1;
|
|
66
|
+
position: fixed;
|
|
67
|
+
top: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
height: 100%;
|
|
70
|
+
background-color: #eee;
|
|
71
|
+
width: 250px;
|
|
72
|
+
border-right: 1px solid #ddd;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.container {
|
|
76
|
+
position: relative;
|
|
77
|
+
left: 250px;
|
|
78
|
+
padding-left: 50px;
|
|
79
|
+
width: 850px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
pre {
|
|
83
|
+
display: block;
|
|
84
|
+
padding: 9.5px;
|
|
85
|
+
margin: 10px 0 10px;
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
line-height: 1.42857143;
|
|
88
|
+
color: #333;
|
|
89
|
+
word-break: break-all;
|
|
90
|
+
word-wrap: break-word;
|
|
91
|
+
background-color: #f5f5f5;
|
|
92
|
+
border: 1px solid #ccc;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#mobile-menu {
|
|
98
|
+
display: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (max-width: 1160px) {
|
|
102
|
+
.container {
|
|
103
|
+
width: 100%;
|
|
104
|
+
padding: 0px;
|
|
105
|
+
left: 0px;
|
|
106
|
+
margin: auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
#content {
|
|
110
|
+
margin: 10px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#menu {
|
|
114
|
+
display: none;
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 45px;
|
|
117
|
+
border-top: 1px solid #ddd;
|
|
118
|
+
border-right: 1px solid #ddd;
|
|
119
|
+
border-bottom: 1px solid #ddd;
|
|
120
|
+
left: 0px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
pre {
|
|
124
|
+
margin: 0px;
|
|
125
|
+
margin-top: 10px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#mobile-menu {
|
|
129
|
+
display: block;
|
|
130
|
+
height: 45px;
|
|
131
|
+
background-color: #eee;
|
|
132
|
+
border-bottom: 1px solid #ddd;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#logo {
|
|
136
|
+
border: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#mobile-logo-container {
|
|
140
|
+
padding: 0;
|
|
141
|
+
border: 0px;
|
|
142
|
+
padding-top: 3px;
|
|
143
|
+
padding-bottom: 3px;
|
|
144
|
+
width: 215px;
|
|
145
|
+
margin-left: auto;
|
|
146
|
+
margin-right: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
#logo-container {
|
|
150
|
+
display: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.menu-link {
|
|
154
|
+
position: absolute;
|
|
155
|
+
display: block;
|
|
156
|
+
top: 0px;
|
|
157
|
+
left: 0;
|
|
158
|
+
background-color: #eee;
|
|
159
|
+
font-size: 10px; /* change this value to increase/decrease button size */
|
|
160
|
+
z-index: 10;
|
|
161
|
+
width: 2em;
|
|
162
|
+
height: 3px;
|
|
163
|
+
padding: 2.1em 1.6em;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.menu-link:hover,
|
|
167
|
+
.menu-link:focus {
|
|
168
|
+
background: #ddd;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.menu-link span {
|
|
172
|
+
position: relative;
|
|
173
|
+
display: block;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.menu-link span,
|
|
177
|
+
.menu-link span:before,
|
|
178
|
+
.menu-link span:after {
|
|
179
|
+
background-color: #333;
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 0.2em;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.menu-link span:before,
|
|
185
|
+
.menu-link span:after {
|
|
186
|
+
position: absolute;
|
|
187
|
+
margin-top: -0.6em;
|
|
188
|
+
content: " ";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.menu-link span:after {
|
|
192
|
+
margin-top: 0.6em;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.active {
|
|
196
|
+
display: block !important;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
200
|
+
</head>
|
|
201
|
+
|
|
202
|
+
<body>
|
|
203
|
+
<div id="layout">
|
|
204
|
+
<div id="mobile-menu">
|
|
205
|
+
<a href="#menu" class="menu-link" id="menuLink">
|
|
206
|
+
<span></span>
|
|
207
|
+
</a>
|
|
208
|
+
<div id="mobile-logo-container">
|
|
209
|
+
<a href="#">
|
|
210
|
+
<img id="logo" src="./mongoose5_transparent.png">
|
|
211
|
+
<span class="logo-text">mongoose</span>
|
|
212
|
+
</a>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div id="menu">
|
|
217
|
+
<div class="pure-menu">
|
|
218
|
+
<div id="logo-container" class="pure-menu-heading">
|
|
219
|
+
<a href="#">
|
|
220
|
+
<img id="logo" src="./mongoose5_transparent.png">
|
|
221
|
+
<span class="logo-text">mongoose</span>
|
|
222
|
+
</a>
|
|
223
|
+
</div>
|
|
224
|
+
<ul class="pure-menu-list">
|
|
225
|
+
<li class="pure-menu-item">
|
|
226
|
+
<a class="pure-menu-link">Quick Start</a>
|
|
227
|
+
</li>
|
|
228
|
+
<li class="pure-menu-item">
|
|
229
|
+
<a class="pure-menu-link">Guide</a>
|
|
230
|
+
</li>
|
|
231
|
+
<li class="pure-menu-item sub-item">
|
|
232
|
+
<a class="pure-menu-link">Schemas</a>
|
|
233
|
+
</li>
|
|
234
|
+
<li class="pure-menu-item sub-item">
|
|
235
|
+
<a href="#" class="pure-menu-link">Connections</a>
|
|
236
|
+
</li>
|
|
237
|
+
<li class="pure-menu-item sub-item">
|
|
238
|
+
<a href="#" class="pure-menu-link">Models</a>
|
|
239
|
+
</li>
|
|
240
|
+
<li class="pure-menu-item sub-item">
|
|
241
|
+
<a href="#" class="pure-menu-link">Documents</a>
|
|
242
|
+
</li>
|
|
243
|
+
<li class="pure-menu-item sub-item">
|
|
244
|
+
<a href="#" class="pure-menu-link">Queries</a>
|
|
245
|
+
</li>
|
|
246
|
+
<li class="pure-menu-item sub-item">
|
|
247
|
+
<a href="#" class="pure-menu-link">Validation</a>
|
|
248
|
+
</li>
|
|
249
|
+
<li class="pure-menu-item sub-item">
|
|
250
|
+
<a href="#" class="pure-menu-link">Middleware</a>
|
|
251
|
+
</li>
|
|
252
|
+
<li class="pure-menu-item sub-item">
|
|
253
|
+
<a href="#" class="pure-menu-link">Population</a>
|
|
254
|
+
</li>
|
|
255
|
+
<li class="pure-menu-item sub-item">
|
|
256
|
+
<a href="#" class="pure-menu-link">Discriminators</a>
|
|
257
|
+
</li>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<li class="pure-menu-item">
|
|
261
|
+
<a class="pure-menu-link">API</a>
|
|
262
|
+
</li>
|
|
263
|
+
<li class="pure-menu-item sub-item">
|
|
264
|
+
<a class="pure-menu-link">Schema</a>
|
|
265
|
+
</li>
|
|
266
|
+
<li class="pure-menu-item sub-item">
|
|
267
|
+
<a href="#" class="pure-menu-link">Document</a>
|
|
268
|
+
</li>
|
|
269
|
+
<li class="pure-menu-item sub-item">
|
|
270
|
+
<a href="#" class="pure-menu-link">Model</a>
|
|
271
|
+
</li>
|
|
272
|
+
<li class="pure-menu-item sub-item">
|
|
273
|
+
<a href="#" class="pure-menu-link">Query</a>
|
|
274
|
+
</li>
|
|
275
|
+
<li class="pure-menu-item sub-item">
|
|
276
|
+
<a href="#" class="pure-menu-link">Aggregate</a>
|
|
277
|
+
</li>
|
|
278
|
+
<li class="pure-menu-item sub-item">
|
|
279
|
+
<a href="#" class="pure-menu-link">SchemaType</a>
|
|
280
|
+
</li>
|
|
281
|
+
<li class="pure-menu-item sub-item">
|
|
282
|
+
<a href="#" class="pure-menu-link">VirtualType</a>
|
|
283
|
+
</li>
|
|
284
|
+
<li class="pure-menu-item sub-item">
|
|
285
|
+
<a href="#" class="pure-menu-link">Error</a>
|
|
286
|
+
</li>
|
|
287
|
+
|
|
288
|
+
<li class="pure-menu-item">
|
|
289
|
+
<a class="pure-menu-link">Version Compatibility</a>
|
|
290
|
+
</li>
|
|
291
|
+
<li class="pure-menu-item">
|
|
292
|
+
<a class="pure-menu-link">FAQ</a>
|
|
293
|
+
</li>
|
|
294
|
+
</ul>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class="container">
|
|
299
|
+
<div id="content">
|
|
300
|
+
<h1>Header</h1>
|
|
301
|
+
<p>
|
|
302
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque faucibus lobortis enim, eu sodales risus bibendum vitae. Phasellus aliquam ultrices sem non posuere. Aenean finibus a massa nec euismod. Donec ullamcorper, sapien rhoncus tempor rhoncus, purus arcu eleifend mauris, ullamcorper maximus magna arcu vel purus. Sed consequat nibh ipsum, vitae commodo risus rhoncus in. Morbi et dolor ultrices, finibus urna at, hendrerit ex. Morbi suscipit eget leo quis vehicula. Curabitur eu lacinia turpis. Sed ut bibendum nisl.
|
|
303
|
+
</p>
|
|
304
|
+
|
|
305
|
+
<p>
|
|
306
|
+
Integer id turpis magna. Nunc lectus lectus, pellentesque vel vulputate ac, pharetra eu tortor. Phasellus arcu erat, pellentesque et nibh non, dignissim scelerisque lacus. Pellentesque mattis ipsum a tincidunt porttitor. Suspendisse ut congue magna. Donec aliquam lectus libero, in feugiat dolor ornare sit amet. Nulla et molestie libero. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
307
|
+
</p>
|
|
308
|
+
|
|
309
|
+
<p>
|
|
310
|
+
Donec aliquet ac turpis vitae elementum. Nullam volutpat mattis leo, id facilisis orci porta nec. Nulla vel faucibus ex, et gravida felis. Nulla facilisi. Donec ut felis ut ante fringilla dapibus id sed mi. Donec a blandit velit, id ultricies risus. Vivamus bibendum odio sit amet vehicula tincidunt. Phasellus blandit dui urna, blandit venenatis erat tincidunt eget. Nunc pretium sodales ligula, ut faucibus orci elementum sit amet. Curabitur luctus, est in rutrum congue, est lorem luctus dui, vitae auctor libero lacus ut enim. Nullam neque est, pellentesque ac viverra pretium, varius ut risus.
|
|
311
|
+
</p>
|
|
312
|
+
|
|
313
|
+
<p>
|
|
314
|
+
Pellentesque blandit quam turpis, sit amet ullamcorper dui malesuada tincidunt. Donec ac mattis urna, nec posuere nunc. Aenean non urna ultrices, convallis mauris non, efficitur lacus. Duis eget metus sed magna convallis lobortis ac et est. Suspendisse tincidunt ligula arcu. Aenean at euismod elit, a suscipit ante. Nulla porttitor sit amet justo et vestibulum. Cras sodales leo a velit tempor, sit amet commodo odio tincidunt. In nec tempus dolor. In bibendum sodales enim nec rhoncus.
|
|
315
|
+
</p>
|
|
316
|
+
|
|
317
|
+
<p>
|
|
318
|
+
Duis convallis a ante vel imperdiet. Vivamus nec arcu mollis, malesuada felis sit amet, aliquet elit. Aliquam erat volutpat. Morbi consequat orci sit amet tellus convallis laoreet. Nunc sed suscipit neque. Fusce convallis nisi ligula, et maximus lorem tincidunt eu. Morbi nec venenatis justo. Morbi laoreet lectus at vestibulum placerat. Pellentesque bibendum magna velit, convallis euismod leo fringilla vel. Duis maximus elementum enim, dignissim accumsan ex finibus ac. Aliquam erat volutpat. Etiam sit amet commodo enim. Pellentesque ac est eget ipsum fermentum facilisis sit amet sed nisl.
|
|
319
|
+
</p>
|
|
320
|
+
|
|
321
|
+
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> mongoose = <span class="hljs-built_in">require</span>(<span class="hljs-string">'mongoose'</span>);
|
|
322
|
+
|
|
323
|
+
mongoose.connect(<span class="hljs-string">'mongodb://localhost:27017/test'</span>);
|
|
324
|
+
mongoose.set(<span class="hljs-string">'debug'</span>, <span class="hljs-literal">true</span>);
|
|
325
|
+
|
|
326
|
+
<span class="hljs-keyword">const</span> vehicleSchema = <span class="hljs-keyword">new</span> mongoose.Schema({
|
|
327
|
+
make: <span class="hljs-built_in">String</span>,
|
|
328
|
+
model: <span class="hljs-built_in">String</span>,
|
|
329
|
+
year: <span class="hljs-built_in">Number</span>,
|
|
330
|
+
customerId: mongoose.Schema.Types.ObjectId
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
<span class="hljs-keyword">const</span> customerSchema = <span class="hljs-keyword">new</span> mongoose.Schema({
|
|
334
|
+
vehicle: { type: vehicleSchema, required: <span class="hljs-literal">true</span> }
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
<span class="hljs-comment">// Callback-style middleware, your only option in 4.x</span>
|
|
338
|
+
vehicleSchema.pre(<span class="hljs-string">'save'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">next</span>) </span>{
|
|
339
|
+
Customer.updateMany({ <span class="hljs-string">'vehicle._id'</span>: <span class="hljs-keyword">this</span>._id }, { $set: { vehicle: <span class="hljs-keyword">this</span> } }, (error) => {
|
|
340
|
+
next(error);
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
<span class="hljs-keyword">const</span> Vehicle = mongoose.model(<span class="hljs-string">'Vehicle'</span>, vehicleSchema);
|
|
345
|
+
<span class="hljs-keyword">const</span> Customer = mongoose.model(<span class="hljs-string">'Customer'</span>, customerSchema);
|
|
346
|
+
|
|
347
|
+
run().catch(error => <span class="hljs-built_in">console</span>.error(error.stack));
|
|
348
|
+
|
|
349
|
+
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">run</span>(<span class="hljs-params"></span>) </span>{
|
|
350
|
+
<span class="hljs-keyword">const</span> v = <span class="hljs-keyword">await</span> Vehicle.create({ make: <span class="hljs-string">'Subaru'</span>, model: <span class="hljs-string">'Crosstrek'</span>, year: <span class="hljs-number">2016</span> });
|
|
351
|
+
<span class="hljs-keyword">let</span> customer = <span class="hljs-keyword">await</span> Customer.create({ vehicle: v });
|
|
352
|
+
|
|
353
|
+
v.year = <span class="hljs-number">2018</span>;
|
|
354
|
+
<span class="hljs-keyword">await</span> v.save();
|
|
355
|
+
|
|
356
|
+
<span class="hljs-comment">// `year` will be '2018'</span>
|
|
357
|
+
<span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">await</span> Customer.findById(customer._id));
|
|
358
|
+
}
|
|
359
|
+
</code></pre>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
|
|
364
|
+
<script type="text/javascript">
|
|
365
|
+
(function (window, document) {
|
|
366
|
+
|
|
367
|
+
var layout = document.getElementById('layout'),
|
|
368
|
+
menu = document.getElementById('menu'),
|
|
369
|
+
menuLink = document.getElementById('menuLink'),
|
|
370
|
+
content = document.getElementById('content');
|
|
371
|
+
|
|
372
|
+
function toggleClass(element, className) {
|
|
373
|
+
var classes = element.className.split(/\s+/),
|
|
374
|
+
length = classes.length,
|
|
375
|
+
i = 0;
|
|
376
|
+
|
|
377
|
+
for(; i < length; i++) {
|
|
378
|
+
if (classes[i] === className) {
|
|
379
|
+
classes.splice(i, 1);
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// The className is not found
|
|
384
|
+
if (length === classes.length) {
|
|
385
|
+
classes.push(className);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
element.className = classes.join(' ');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function toggleAll(e) {
|
|
392
|
+
var active = 'active';
|
|
393
|
+
|
|
394
|
+
e.preventDefault();
|
|
395
|
+
toggleClass(layout, active);
|
|
396
|
+
toggleClass(menu, active);
|
|
397
|
+
toggleClass(menuLink, active);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
menuLink.onclick = function (e) {
|
|
401
|
+
toggleAll(e);
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
content.onclick = function(e) {
|
|
405
|
+
if (menu.className.indexOf('active') !== -1) {
|
|
406
|
+
toggleAll(e);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
}(this, this.document));
|
|
411
|
+
</script>
|
|
412
|
+
</body>
|
|
413
|
+
</html>
|
package/lib/aggregate.js
CHANGED
|
@@ -554,7 +554,10 @@ Aggregate.prototype.allowDiskUse = function(value) {
|
|
|
554
554
|
* var agg = Model.aggregate(..).option({ allowDiskUse: true }); // Set the `allowDiskUse` option
|
|
555
555
|
* agg.options; // `{ allowDiskUse: true }`
|
|
556
556
|
*
|
|
557
|
-
* @param {Object}
|
|
557
|
+
* @param {Object} options keys to merge into current options
|
|
558
|
+
* @param [options.maxTimeMS] number limits the time this aggregation will run, see [MongoDB docs on `maxTimeMS`](https://docs.mongodb.com/manual/reference/operator/meta/maxTimeMS/)
|
|
559
|
+
* @param [options.allowDiskUse] boolean if true, the MongoDB server will use the hard drive to store data during this aggregation
|
|
560
|
+
* @param [options.collation] object see [`Aggregate.prototype.collation()`](./docs/api.html#aggregate_Aggregate-collation)
|
|
558
561
|
* @see mongodb http://docs.mongodb.org/manual/reference/command/aggregate/
|
|
559
562
|
* @return {Aggregate} this
|
|
560
563
|
* @api public
|
|
@@ -574,7 +577,7 @@ Aggregate.prototype.option = function(value) {
|
|
|
574
577
|
*
|
|
575
578
|
* ####Example:
|
|
576
579
|
*
|
|
577
|
-
* var cursor = Model.aggregate(..).cursor({ batchSize: 1000 }).exec();
|
|
580
|
+
* var cursor = Model.aggregate(..).cursor({ batchSize: 1000, useMongooseAggCursor: true }).exec();
|
|
578
581
|
* cursor.each(function(error, doc) {
|
|
579
582
|
* // use doc
|
|
580
583
|
* });
|
|
@@ -621,7 +624,6 @@ Aggregate.prototype.addCursorFlag = function(flag, value) {
|
|
|
621
624
|
* Model.aggregate(..).collation({ locale: 'en_US', strength: 1 }).exec();
|
|
622
625
|
*
|
|
623
626
|
* @param {Object} collation options
|
|
624
|
-
* @param {Boolean} value
|
|
625
627
|
* @see mongodb http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#aggregate
|
|
626
628
|
*/
|
|
627
629
|
|
package/lib/document.js
CHANGED
|
@@ -487,10 +487,11 @@ Document.prototype.update = function update() {
|
|
|
487
487
|
* @param {Any} val the value to set
|
|
488
488
|
* @param {Schema|String|Number|Buffer|*} [type] optionally specify a type for "on-the-fly" attributes
|
|
489
489
|
* @param {Object} [options] optionally specify options that modify the behavior of the set
|
|
490
|
+
* @method $set
|
|
490
491
|
* @api public
|
|
491
492
|
*/
|
|
492
493
|
|
|
493
|
-
Document.prototype.$set = function(path, val, type, options) {
|
|
494
|
+
Document.prototype.$set = function $set(path, val, type, options) {
|
|
494
495
|
if (type && utils.getFunctionName(type.constructor) === 'Object') {
|
|
495
496
|
options = type;
|
|
496
497
|
type = undefined;
|
|
@@ -1178,6 +1179,7 @@ Document.prototype.$isDefault = function(path) {
|
|
|
1178
1179
|
*
|
|
1179
1180
|
* @param {Boolean} [val] optional, overrides whether mongoose thinks the doc is deleted
|
|
1180
1181
|
* @return {Boolean} whether mongoose thinks this doc is deleted.
|
|
1182
|
+
* @method $isDeleted
|
|
1181
1183
|
* @api public
|
|
1182
1184
|
*/
|
|
1183
1185
|
|
package/lib/model.js
CHANGED
|
@@ -21,6 +21,7 @@ var castUpdate = require('./services/query/castUpdate');
|
|
|
21
21
|
var discriminator = require('./services/model/discriminator');
|
|
22
22
|
var isPathSelectedInclusive = require('./services/projection/isPathSelectedInclusive');
|
|
23
23
|
var get = require('lodash.get');
|
|
24
|
+
var getSchemaTypes = require('./services/populate/getSchemaTypes');
|
|
24
25
|
var mpath = require('mpath');
|
|
25
26
|
var parallel = require('async/parallel');
|
|
26
27
|
var parallelLimit = require('async/parallelLimit');
|
|
@@ -1686,6 +1687,7 @@ Model.$where = function $where() {
|
|
|
1686
1687
|
* @param {Object} [conditions]
|
|
1687
1688
|
* @param {Object} [update]
|
|
1688
1689
|
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](http://mongoosejs.com/docs/api.html#query_Query-setOptions)
|
|
1690
|
+
* @param {Object} [options.lean] if truthy, mongoose will return the document as a plain JavaScript object rather than a mongoose document. See [`Query.lean()`](http://mongoosejs.com/docs/api.html#query_Query-lean).
|
|
1689
1691
|
* @param {Function} [callback]
|
|
1690
1692
|
* @return {Query}
|
|
1691
1693
|
* @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command
|
|
@@ -1805,6 +1807,7 @@ Model.findOneAndUpdate = function(conditions, update, options, callback) {
|
|
|
1805
1807
|
* @param {Object|Number|String} id value of `_id` to query by
|
|
1806
1808
|
* @param {Object} [update]
|
|
1807
1809
|
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](http://mongoosejs.com/docs/api.html#query_Query-setOptions)
|
|
1810
|
+
* @param {Object} [options.lean] if truthy, mongoose will return the document as a plain JavaScript object rather than a mongoose document. See [`Query.lean()`](http://mongoosejs.com/docs/api.html#query_Query-lean).
|
|
1808
1811
|
* @param {Function} [callback]
|
|
1809
1812
|
* @return {Query}
|
|
1810
1813
|
* @see Model.findOneAndUpdate #model_Model.findOneAndUpdate
|
|
@@ -2968,7 +2971,8 @@ Model.aggregate = function aggregate() {
|
|
|
2968
2971
|
* - `lean` {Boolean} return the raw object instead of the Mongoose Model
|
|
2969
2972
|
*
|
|
2970
2973
|
* @param {Object} conditions an object that specifies the match condition (required)
|
|
2971
|
-
* @param {Object} options for the geoSearch, some (near, maxDistance) are required
|
|
2974
|
+
* @param {Object} [options] for the geoSearch, some (near, maxDistance) are required
|
|
2975
|
+
* @param {Object} [options.lean] if truthy, mongoose will return the document as a plain JavaScript object rather than a mongoose document. See [`Query.lean()`](http://mongoosejs.com/docs/api.html#query_Query-lean).
|
|
2972
2976
|
* @param {Function} [callback] optional callback
|
|
2973
2977
|
* @return {Promise}
|
|
2974
2978
|
* @see http://docs.mongodb.org/manual/reference/command/geoSearch/
|
|
@@ -3261,7 +3265,9 @@ function populate(model, docs, options, callback) {
|
|
|
3261
3265
|
mod.options.options.limit = mod.options.options.limit * ids.length;
|
|
3262
3266
|
}
|
|
3263
3267
|
|
|
3264
|
-
var subPopulate = mod.options.populate
|
|
3268
|
+
var subPopulate = utils.clone(mod.options.populate, {
|
|
3269
|
+
retainKeyOrder: true
|
|
3270
|
+
});
|
|
3265
3271
|
var query = mod.Model.find(match, select, mod.options.options);
|
|
3266
3272
|
|
|
3267
3273
|
// If we're doing virtual populate and projection is inclusive and foreign
|
|
@@ -3546,95 +3552,42 @@ function getModelsMapForPopulate(model, docs, options) {
|
|
|
3546
3552
|
var originalModel = options.model;
|
|
3547
3553
|
var isVirtual = false;
|
|
3548
3554
|
var isRefPathArray = false;
|
|
3549
|
-
|
|
3550
|
-
schema = model._getSchema(options.path);
|
|
3551
|
-
var isUnderneathDocArray = schema && schema.$isUnderneathDocArray;
|
|
3552
|
-
if (isUnderneathDocArray &&
|
|
3553
|
-
options &&
|
|
3554
|
-
options.options &&
|
|
3555
|
-
options.options.sort) {
|
|
3556
|
-
return new Error('Cannot populate with `sort` on path ' + options.path +
|
|
3557
|
-
' because it is a subproperty of a document array');
|
|
3558
|
-
}
|
|
3559
|
-
|
|
3560
|
-
if (schema && schema.caster) {
|
|
3561
|
-
schema = schema.caster;
|
|
3562
|
-
}
|
|
3563
|
-
|
|
3564
|
-
if (!schema && model.discriminators) {
|
|
3565
|
-
discriminatorKey = model.schema.discriminatorMapping.key;
|
|
3566
|
-
}
|
|
3567
|
-
|
|
3568
|
-
refPath = schema && schema.options && schema.options.refPath;
|
|
3555
|
+
var modelSchema = model.schema;
|
|
3569
3556
|
|
|
3570
3557
|
for (i = 0; i < len; i++) {
|
|
3571
3558
|
doc = docs[i];
|
|
3572
3559
|
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
modelForFindSchema = utils.getValue(discriminatorKey, doc);
|
|
3583
|
-
|
|
3584
|
-
if (modelForFindSchema) {
|
|
3585
|
-
try {
|
|
3586
|
-
modelForCurrentDoc = model.db.model(modelForFindSchema);
|
|
3587
|
-
} catch (error) {
|
|
3588
|
-
return error;
|
|
3589
|
-
}
|
|
3590
|
-
|
|
3591
|
-
schemaForCurrentDoc = modelForCurrentDoc._getSchema(options.path);
|
|
3560
|
+
schema = getSchemaTypes(modelSchema, doc, options.path);
|
|
3561
|
+
var isUnderneathDocArray = schema && schema.$isUnderneathDocArray;
|
|
3562
|
+
if (isUnderneathDocArray &&
|
|
3563
|
+
options &&
|
|
3564
|
+
options.options &&
|
|
3565
|
+
options.options.sort) {
|
|
3566
|
+
return new Error('Cannot populate with `sort` on path ' + options.path +
|
|
3567
|
+
' because it is a subproperty of a document array');
|
|
3568
|
+
}
|
|
3592
3569
|
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
schemaForCurrentDoc = schema;
|
|
3570
|
+
if (Array.isArray(schema)) {
|
|
3571
|
+
for (var j = 0; j < schema.length; ++j) {
|
|
3572
|
+
var _modelNames = _getModelNames(doc, schema[j]);
|
|
3573
|
+
if (!_modelNames) {
|
|
3574
|
+
continue;
|
|
3599
3575
|
}
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
modelNames = [ref];
|
|
3605
|
-
} else if ((ref = get(virtual, 'options.ref')) != null) {
|
|
3606
|
-
if (typeof ref === 'function') {
|
|
3607
|
-
ref = ref.call(doc, doc);
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
|
-
// When referencing nested arrays, the ref should be an Array
|
|
3611
|
-
// of modelNames.
|
|
3612
|
-
if (Array.isArray(ref)) {
|
|
3613
|
-
modelNames = ref;
|
|
3614
|
-
} else {
|
|
3615
|
-
modelNames = [ref];
|
|
3576
|
+
modelNames = (modelNames || []);
|
|
3577
|
+
for (var x = 0; x < _modelNames.length; ++x) {
|
|
3578
|
+
if (modelNames.indexOf(_modelNames[x]) === -1) {
|
|
3579
|
+
modelNames.push(_modelNames[x]);
|
|
3616
3580
|
}
|
|
3617
|
-
|
|
3618
|
-
isVirtual = true;
|
|
3619
|
-
} else {
|
|
3620
|
-
// We may have a discriminator, in which case we don't want to
|
|
3621
|
-
// populate using the base model by default
|
|
3622
|
-
modelNames = discriminatorKey ? null : [model.modelName];
|
|
3623
3581
|
}
|
|
3624
|
-
}
|
|
3625
|
-
|
|
3582
|
+
}
|
|
3583
|
+
} else {
|
|
3584
|
+
modelNames = _getModelNames(doc, schema);
|
|
3585
|
+
if (!modelNames) {
|
|
3586
|
+
continue;
|
|
3626
3587
|
}
|
|
3627
3588
|
}
|
|
3628
3589
|
|
|
3629
|
-
|
|
3630
|
-
continue;
|
|
3631
|
-
}
|
|
3632
|
-
|
|
3633
|
-
if (!Array.isArray(modelNames)) {
|
|
3634
|
-
modelNames = [modelNames];
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
|
-
virtual = model.schema._getVirtual(options.path);
|
|
3590
|
+
var virtual = model.schema._getVirtual(options.path);
|
|
3638
3591
|
var localField;
|
|
3639
3592
|
if (virtual && virtual.options) {
|
|
3640
3593
|
var virtualPrefix = virtual.$nestedSchemaPath ?
|
|
@@ -3724,6 +3677,87 @@ function getModelsMapForPopulate(model, docs, options) {
|
|
|
3724
3677
|
}
|
|
3725
3678
|
}
|
|
3726
3679
|
|
|
3680
|
+
function _getModelNames(doc, schema) {
|
|
3681
|
+
var modelNames;
|
|
3682
|
+
var discriminatorKey;
|
|
3683
|
+
|
|
3684
|
+
if (schema && schema.caster) {
|
|
3685
|
+
schema = schema.caster;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
if (!schema && model.discriminators) {
|
|
3689
|
+
discriminatorKey = model.schema.discriminatorMapping.key;
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
refPath = schema && schema.options && schema.options.refPath;
|
|
3693
|
+
|
|
3694
|
+
if (refPath) {
|
|
3695
|
+
modelNames = utils.getValue(refPath, doc);
|
|
3696
|
+
isRefPathArray = Array.isArray(modelNames);
|
|
3697
|
+
} else {
|
|
3698
|
+
if (!modelNameFromQuery) {
|
|
3699
|
+
var modelForCurrentDoc = model;
|
|
3700
|
+
var schemaForCurrentDoc;
|
|
3701
|
+
|
|
3702
|
+
if (!schema && discriminatorKey) {
|
|
3703
|
+
modelForFindSchema = utils.getValue(discriminatorKey, doc);
|
|
3704
|
+
|
|
3705
|
+
if (modelForFindSchema) {
|
|
3706
|
+
try {
|
|
3707
|
+
modelForCurrentDoc = model.db.model(modelForFindSchema);
|
|
3708
|
+
} catch (error) {
|
|
3709
|
+
return error;
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
schemaForCurrentDoc = modelForCurrentDoc.schema._getSchema(options.path);
|
|
3713
|
+
|
|
3714
|
+
if (schemaForCurrentDoc && schemaForCurrentDoc.caster) {
|
|
3715
|
+
schemaForCurrentDoc = schemaForCurrentDoc.caster;
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
} else {
|
|
3719
|
+
schemaForCurrentDoc = schema;
|
|
3720
|
+
}
|
|
3721
|
+
var virtual = modelForCurrentDoc.schema._getVirtual(options.path);
|
|
3722
|
+
|
|
3723
|
+
var ref;
|
|
3724
|
+
if ((ref = get(schemaForCurrentDoc, 'options.ref')) != null) {
|
|
3725
|
+
modelNames = [ref];
|
|
3726
|
+
} else if ((ref = get(virtual, 'options.ref')) != null) {
|
|
3727
|
+
if (typeof ref === 'function') {
|
|
3728
|
+
ref = ref.call(doc, doc);
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
// When referencing nested arrays, the ref should be an Array
|
|
3732
|
+
// of modelNames.
|
|
3733
|
+
if (Array.isArray(ref)) {
|
|
3734
|
+
modelNames = ref;
|
|
3735
|
+
} else {
|
|
3736
|
+
modelNames = [ref];
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
isVirtual = true;
|
|
3740
|
+
} else {
|
|
3741
|
+
// We may have a discriminator, in which case we don't want to
|
|
3742
|
+
// populate using the base model by default
|
|
3743
|
+
modelNames = discriminatorKey ? null : [model.modelName];
|
|
3744
|
+
}
|
|
3745
|
+
} else {
|
|
3746
|
+
modelNames = [modelNameFromQuery]; // query options
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
if (!modelNames) {
|
|
3751
|
+
return;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
if (!Array.isArray(modelNames)) {
|
|
3755
|
+
modelNames = [modelNames];
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
return modelNames;
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3727
3761
|
return map;
|
|
3728
3762
|
}
|
|
3729
3763
|
|
|
@@ -3852,20 +3886,6 @@ function isDoc(doc) {
|
|
|
3852
3886
|
return true;
|
|
3853
3887
|
}
|
|
3854
3888
|
|
|
3855
|
-
/**
|
|
3856
|
-
* Finds the schema for `path`. This is different than
|
|
3857
|
-
* calling `schema.path` as it also resolves paths with
|
|
3858
|
-
* positional selectors (something.$.another.$.path).
|
|
3859
|
-
*
|
|
3860
|
-
* @param {String} path
|
|
3861
|
-
* @return {Schema}
|
|
3862
|
-
* @api private
|
|
3863
|
-
*/
|
|
3864
|
-
|
|
3865
|
-
Model._getSchema = function _getSchema(path) {
|
|
3866
|
-
return this.schema._getSchema(path);
|
|
3867
|
-
};
|
|
3868
|
-
|
|
3869
3889
|
/*!
|
|
3870
3890
|
* Compiler utility.
|
|
3871
3891
|
*
|
package/lib/query.js
CHANGED
|
@@ -1002,13 +1002,16 @@ Query.prototype.read = function read(pref, tags) {
|
|
|
1002
1002
|
* - [readPreference](http://docs.mongodb.org/manual/applications/replication/#read-preference)
|
|
1003
1003
|
* - [hint](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint)
|
|
1004
1004
|
*
|
|
1005
|
-
* The following options are only for `update()`, `updateOne()`, `updateMany()`, `replaceOne()`, and `
|
|
1005
|
+
* The following options are only for `update()`, `updateOne()`, `updateMany()`, `replaceOne()`, `findOneAndUpdate()`, and `findByIdAndUpdate()`:
|
|
1006
1006
|
* - [upsert](https://docs.mongodb.com/manual/reference/method/db.collection.update/)
|
|
1007
1007
|
* - [writeConcern](https://docs.mongodb.com/manual/reference/method/db.collection.update/)
|
|
1008
1008
|
*
|
|
1009
|
-
* The following options are only for `find()`, `findOne()`, `findById()`, and `
|
|
1009
|
+
* The following options are only for `find()`, `findOne()`, `findById()`, `findOneAndUpdate()`, and `findByIdAndUpdate()`:
|
|
1010
1010
|
* - [lean](./api.html#query_Query-lean)
|
|
1011
1011
|
*
|
|
1012
|
+
* The following options are only for all operations **except** `update()`, `updateOne()`, `updateMany()`, `remove()`, `deleteOne()`, and `deleteMany()`:
|
|
1013
|
+
* - [maxTimeMS](https://docs.mongodb.com/manual/reference/operator/meta/maxTimeMS/)
|
|
1014
|
+
*
|
|
1012
1015
|
* The following options are for all operations:
|
|
1013
1016
|
* - [collation](https://docs.mongodb.com/manual/reference/collation/)
|
|
1014
1017
|
*
|
package/lib/queryhelpers.js
CHANGED
|
@@ -19,7 +19,9 @@ exports.preparePopulationOptions = function preparePopulationOptions(query, opti
|
|
|
19
19
|
var pop = utils.object.vals(query.options.populate);
|
|
20
20
|
|
|
21
21
|
// lean options should trickle through all queries
|
|
22
|
-
if (options.lean)
|
|
22
|
+
if (options.lean) {
|
|
23
|
+
pop.forEach(makeLean(options.lean));
|
|
24
|
+
}
|
|
23
25
|
|
|
24
26
|
return pop;
|
|
25
27
|
};
|
|
@@ -37,7 +39,9 @@ exports.preparePopulationOptionsMQ = function preparePopulationOptionsMQ(query,
|
|
|
37
39
|
var pop = utils.object.vals(query._mongooseOptions.populate);
|
|
38
40
|
|
|
39
41
|
// lean options should trickle through all queries
|
|
40
|
-
if (options.lean)
|
|
42
|
+
if (options.lean) {
|
|
43
|
+
pop.forEach(makeLean(options.lean));
|
|
44
|
+
}
|
|
41
45
|
|
|
42
46
|
return pop;
|
|
43
47
|
};
|
|
@@ -207,7 +211,9 @@ exports.applyPaths = function applyPaths(fields, schema) {
|
|
|
207
211
|
* @param {Object} option
|
|
208
212
|
*/
|
|
209
213
|
|
|
210
|
-
function makeLean(
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
function makeLean(val) {
|
|
215
|
+
return function(option) {
|
|
216
|
+
option.options || (option.options = {});
|
|
217
|
+
option.options.lean = val;
|
|
218
|
+
};
|
|
213
219
|
}
|
package/lib/schema/array.js
CHANGED
|
@@ -15,8 +15,6 @@ var Types = {
|
|
|
15
15
|
ObjectId: require('./objectid'),
|
|
16
16
|
Buffer: require('./buffer')
|
|
17
17
|
};
|
|
18
|
-
var MongooseArray = require('../types').Array;
|
|
19
|
-
var EmbeddedDoc = require('../types').Embedded;
|
|
20
18
|
var Mixed = require('./mixed');
|
|
21
19
|
var cast = require('../cast');
|
|
22
20
|
var util = require('util');
|
|
@@ -24,6 +22,9 @@ var utils = require('../utils');
|
|
|
24
22
|
var castToNumber = require('./operators/helpers').castToNumber;
|
|
25
23
|
var geospatial = require('./operators/geospatial');
|
|
26
24
|
|
|
25
|
+
var MongooseArray;
|
|
26
|
+
var EmbeddedDoc;
|
|
27
|
+
|
|
27
28
|
/**
|
|
28
29
|
* Array SchemaType constructor
|
|
29
30
|
*
|
|
@@ -35,6 +36,9 @@ var geospatial = require('./operators/geospatial');
|
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
38
|
function SchemaArray(key, cast, options, schemaOptions) {
|
|
39
|
+
// lazy load
|
|
40
|
+
EmbeddedDoc || (EmbeddedDoc = require('../types').Embedded);
|
|
41
|
+
|
|
38
42
|
var typeKey = 'type';
|
|
39
43
|
if (schemaOptions && schemaOptions.typeKey) {
|
|
40
44
|
typeKey = schemaOptions.typeKey;
|
|
@@ -155,6 +159,9 @@ SchemaArray.prototype.applyGetters = function(value, scope) {
|
|
|
155
159
|
*/
|
|
156
160
|
|
|
157
161
|
SchemaArray.prototype.cast = function(value, doc, init) {
|
|
162
|
+
// lazy load
|
|
163
|
+
MongooseArray || (MongooseArray = require('../types').Array);
|
|
164
|
+
|
|
158
165
|
if (Array.isArray(value)) {
|
|
159
166
|
if (!value.length && doc) {
|
|
160
167
|
var indexes = doc.schema.indexedPaths();
|
package/lib/schema/buffer.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
var handleBitwiseOperator = require('./operators/bitwise');
|
|
6
6
|
var utils = require('../utils');
|
|
7
7
|
|
|
8
|
-
var MongooseBuffer = require('../types')
|
|
8
|
+
var MongooseBuffer = require('../types/buffer');
|
|
9
9
|
var SchemaType = require('../schematype');
|
|
10
10
|
|
|
11
11
|
var Binary = MongooseBuffer.Binary;
|
|
@@ -8,13 +8,14 @@ var ArrayType = require('./array');
|
|
|
8
8
|
var CastError = require('../error/cast');
|
|
9
9
|
var Document = require('../document');
|
|
10
10
|
var EventEmitter = require('events').EventEmitter;
|
|
11
|
-
var MongooseDocumentArray = require('../types/documentarray');
|
|
12
11
|
var SchemaType = require('../schematype');
|
|
13
|
-
var Subdocument = require('../types/embedded');
|
|
14
12
|
var discriminator = require('../services/model/discriminator');
|
|
15
13
|
var util = require('util');
|
|
16
14
|
var utils = require('../utils');
|
|
17
15
|
|
|
16
|
+
var MongooseDocumentArray;
|
|
17
|
+
var Subdocument;
|
|
18
|
+
|
|
18
19
|
/**
|
|
19
20
|
* SubdocsArray SchemaType constructor
|
|
20
21
|
*
|
|
@@ -66,6 +67,8 @@ DocumentArray.prototype.constructor = DocumentArray;
|
|
|
66
67
|
*/
|
|
67
68
|
|
|
68
69
|
function _createConstructor(schema, options) {
|
|
70
|
+
Subdocument || (Subdocument = require('../types/embedded'));
|
|
71
|
+
|
|
69
72
|
// compile an embedded document for this schema
|
|
70
73
|
function EmbeddedDocument() {
|
|
71
74
|
Subdocument.apply(this, arguments);
|
|
@@ -130,6 +133,9 @@ DocumentArray.prototype.discriminator = function(name, schema) {
|
|
|
130
133
|
*/
|
|
131
134
|
|
|
132
135
|
DocumentArray.prototype.doValidate = function(array, fn, scope, options) {
|
|
136
|
+
// lazy load
|
|
137
|
+
MongooseDocumentArray || (MongooseDocumentArray = require('../types/documentarray'));
|
|
138
|
+
|
|
133
139
|
var _this = this;
|
|
134
140
|
SchemaType.prototype.doValidate.call(this, array, function(err) {
|
|
135
141
|
if (err) {
|
|
@@ -251,6 +257,9 @@ DocumentArray.prototype.doValidateSync = function(array, scope) {
|
|
|
251
257
|
*/
|
|
252
258
|
|
|
253
259
|
DocumentArray.prototype.cast = function(value, doc, init, prev, options) {
|
|
260
|
+
// lazy load
|
|
261
|
+
MongooseDocumentArray || (MongooseDocumentArray = require('../types/documentarray'));
|
|
262
|
+
|
|
254
263
|
var selected;
|
|
255
264
|
var subdoc;
|
|
256
265
|
var i;
|
package/lib/schema/embedded.js
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
var $exists = require('./operators/exists');
|
|
8
8
|
var EventEmitter = require('events').EventEmitter;
|
|
9
9
|
var SchemaType = require('../schematype');
|
|
10
|
-
var Subdocument = require('../types/subdocument');
|
|
11
10
|
var castToNumber = require('./operators/helpers').castToNumber;
|
|
12
11
|
var discriminator = require('../services/model/discriminator');
|
|
13
12
|
var geospatial = require('./operators/geospatial');
|
|
14
13
|
|
|
14
|
+
var Subdocument;
|
|
15
|
+
|
|
15
16
|
module.exports = Embedded;
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -43,6 +44,9 @@ Embedded.prototype = Object.create(SchemaType.prototype);
|
|
|
43
44
|
*/
|
|
44
45
|
|
|
45
46
|
function _createConstructor(schema) {
|
|
47
|
+
// lazy load
|
|
48
|
+
Subdocument || (Subdocument = require('../types/subdocument'));
|
|
49
|
+
|
|
46
50
|
var _embedded = function SingleNested(value, path, parent) {
|
|
47
51
|
var _this = this;
|
|
48
52
|
|
package/lib/schema.js
CHANGED
|
@@ -804,22 +804,17 @@ Schema.prototype.hasMixedParent = function(path) {
|
|
|
804
804
|
*/
|
|
805
805
|
Schema.prototype.setupTimestamp = function(timestamps) {
|
|
806
806
|
if (timestamps) {
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
-
var
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
return cur;
|
|
822
|
-
}.bind(this), {});
|
|
807
|
+
var createdAt = handleTimestampOption(timestamps, 'createdAt');
|
|
808
|
+
var updatedAt = handleTimestampOption(timestamps, 'updatedAt');
|
|
809
|
+
var schemaAdditions = {};
|
|
810
|
+
|
|
811
|
+
if (updatedAt && !this.paths[updatedAt]) {
|
|
812
|
+
schemaAdditions[updatedAt] = Date;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
if (createdAt && !this.paths[createdAt]) {
|
|
816
|
+
schemaAdditions[createdAt] = Date;
|
|
817
|
+
}
|
|
823
818
|
|
|
824
819
|
this.add(schemaAdditions);
|
|
825
820
|
|
|
@@ -1403,7 +1398,8 @@ Object.defineProperty(Schema, 'indexTypes', {
|
|
|
1403
1398
|
});
|
|
1404
1399
|
|
|
1405
1400
|
/**
|
|
1406
|
-
*
|
|
1401
|
+
* Returns a list of indexes that this schema declares, via `schema.index()`
|
|
1402
|
+
* or by `index: true` in a path's options.
|
|
1407
1403
|
*
|
|
1408
1404
|
* @api public
|
|
1409
1405
|
*/
|
|
@@ -128,8 +128,11 @@ module.exports = function discriminator(model, name, schema) {
|
|
|
128
128
|
|
|
129
129
|
if (!model.schema.discriminatorMapping) {
|
|
130
130
|
model.schema.discriminatorMapping = {key: key, value: null, isRoot: true};
|
|
131
|
+
model.schema.discriminators = {};
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
model.schema.discriminators[name] = schema;
|
|
135
|
+
|
|
133
136
|
if (model.discriminators[name]) {
|
|
134
137
|
throw new Error('Discriminator with name "' + name + '" already exists');
|
|
135
138
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* ignore
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var Mixed = require('../../schema/mixed');
|
|
8
|
+
var mpath = require('mpath');
|
|
9
|
+
|
|
10
|
+
/*!
|
|
11
|
+
* @param {Schema} schema
|
|
12
|
+
* @param {Object} doc POJO
|
|
13
|
+
* @param {string} path
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
module.exports = function getSchemaTypes(schema, doc, path) {
|
|
17
|
+
var pathschema = schema.path(path);
|
|
18
|
+
|
|
19
|
+
if (pathschema) {
|
|
20
|
+
return pathschema;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function search(parts, schema) {
|
|
24
|
+
var p = parts.length + 1;
|
|
25
|
+
var foundschema;
|
|
26
|
+
var trypath;
|
|
27
|
+
|
|
28
|
+
while (p--) {
|
|
29
|
+
trypath = parts.slice(0, p).join('.');
|
|
30
|
+
foundschema = schema.path(trypath);
|
|
31
|
+
if (foundschema) {
|
|
32
|
+
if (foundschema.caster) {
|
|
33
|
+
// array of Mixed?
|
|
34
|
+
if (foundschema.caster instanceof Mixed) {
|
|
35
|
+
return foundschema.caster;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var schemas = null;
|
|
39
|
+
if (doc != null && foundschema.schema != null && foundschema.schema.discriminators != null) {
|
|
40
|
+
var discriminators = foundschema.schema.discriminators;
|
|
41
|
+
var keys = mpath.get(trypath + '.' + foundschema.schema.options.discriminatorKey,
|
|
42
|
+
doc);
|
|
43
|
+
schemas = Object.keys(discriminators).
|
|
44
|
+
reduce(function(cur, discriminator) {
|
|
45
|
+
if (keys.indexOf(discriminator) !== -1) {
|
|
46
|
+
cur.push(discriminators[discriminator]);
|
|
47
|
+
}
|
|
48
|
+
return cur;
|
|
49
|
+
}, []);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Now that we found the array, we need to check if there
|
|
53
|
+
// are remaining document paths to look up for casting.
|
|
54
|
+
// Also we need to handle array.$.path since schema.path
|
|
55
|
+
// doesn't work for that.
|
|
56
|
+
// If there is no foundschema.schema we are dealing with
|
|
57
|
+
// a path like array.$
|
|
58
|
+
if (p !== parts.length && foundschema.schema) {
|
|
59
|
+
var ret;
|
|
60
|
+
if (parts[p] === '$') {
|
|
61
|
+
if (p + 1 === parts.length) {
|
|
62
|
+
// comments.$
|
|
63
|
+
return foundschema;
|
|
64
|
+
}
|
|
65
|
+
// comments.$.comments.$.title
|
|
66
|
+
ret = search(parts.slice(p + 1), schema);
|
|
67
|
+
if (ret) {
|
|
68
|
+
ret.$isUnderneathDocArray = ret.$isUnderneathDocArray ||
|
|
69
|
+
!foundschema.schema.$isSingleNested;
|
|
70
|
+
}
|
|
71
|
+
return ret;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (schemas != null && schemas.length > 0) {
|
|
75
|
+
ret = [];
|
|
76
|
+
for (var i = 0; i < schemas.length; ++i) {
|
|
77
|
+
var _ret = search(parts.slice(p), schemas[i]);
|
|
78
|
+
if (_ret != null) {
|
|
79
|
+
_ret.$isUnderneathDocArray = _ret.$isUnderneathDocArray ||
|
|
80
|
+
!foundschema.schema.$isSingleNested;
|
|
81
|
+
if (_ret.$isUnderneathDocArray) {
|
|
82
|
+
ret.$isUnderneathDocArray = true;
|
|
83
|
+
}
|
|
84
|
+
ret.push(_ret);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return ret;
|
|
88
|
+
} else {
|
|
89
|
+
ret = search(parts.slice(p), foundschema.schema);
|
|
90
|
+
|
|
91
|
+
if (ret) {
|
|
92
|
+
ret.$isUnderneathDocArray = ret.$isUnderneathDocArray ||
|
|
93
|
+
!foundschema.schema.$isSingleNested;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return ret;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return foundschema;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// look for arrays
|
|
107
|
+
var parts = path.split('.');
|
|
108
|
+
for (var i = 0; i < parts.length; ++i) {
|
|
109
|
+
if (parts[i] === '$') {
|
|
110
|
+
// Re: gh-5628, because `schema.path()` doesn't take $ into account.
|
|
111
|
+
parts[i] = '0';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return search(parts, schema);
|
|
115
|
+
};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongoose",
|
|
3
3
|
"description": "Mongoose MongoDB ODM",
|
|
4
|
-
"version": "4.13.
|
|
4
|
+
"version": "4.13.11",
|
|
5
5
|
"author": "Guillermo Rauch <guillermo@learnboost.com>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mongodb",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"hooks-fixed": "2.0.2",
|
|
25
25
|
"kareem": "1.5.0",
|
|
26
26
|
"lodash.get": "4.4.2",
|
|
27
|
-
"mongodb": "2.2.
|
|
27
|
+
"mongodb": "2.2.34",
|
|
28
28
|
"mpath": "0.3.0",
|
|
29
29
|
"mpromise": "0.5.5",
|
|
30
30
|
"mquery": "2.3.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"jade": "0.26.3",
|
|
47
47
|
"lodash": "4.16.6",
|
|
48
48
|
"markdown": "0.5.0",
|
|
49
|
-
"marked": "0.3.
|
|
49
|
+
"marked": "0.3.9",
|
|
50
50
|
"mocha": "3.2.0",
|
|
51
51
|
"mongoose-long": "0.1.1",
|
|
52
52
|
"mongodb-topology-manager": "1.0.11",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
"install-browser": "npm install `node format_deps.js`",
|
|
78
78
|
"lint": "eslint . --quiet",
|
|
79
79
|
"nsp": "nsp check",
|
|
80
|
+
"release": "git push origin master --tags && npm publish",
|
|
81
|
+
"release-legacy": "git push origin 4.x --tags && npm publish --tag legacy",
|
|
80
82
|
"test": "mocha test/*.test.js test/**/*.test.js",
|
|
81
83
|
"test-cov": "istanbul cover --report text --report html _mocha test/*.test.js"
|
|
82
84
|
},
|
package/release-items.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
## mongoose release procedure
|
|
2
2
|
|
|
3
3
|
1. tests must pass
|
|
4
|
-
2. update package.json version
|
|
5
|
-
3. update History.md using `git changelog` or similar.
|
|
6
|
-
4. git commit -m 'release x.x.x'
|
|
4
|
+
2. update `package.json` and `package-lock.json` version
|
|
5
|
+
3. update History.md using `git changelog` or similar. Add #<TICKET_NUMBER> as well as a link to the github user who fixed it if applicable.
|
|
6
|
+
4. git commit -a -m 'release x.x.x'
|
|
7
7
|
5. git tag x.x.x
|
|
8
|
-
6.
|
|
8
|
+
6. `npm run release`, or `npm run release-legacy` for 4.x
|
|
9
9
|
7. update mongoosejs.com (see "updating the website" below)
|
|
10
10
|
8. tweet changelog link from [@mongoosejs](https://twitter.com/mongoosejs)
|
|
11
11
|
9. Announce on mongoosejsteam slack channel
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
|
|
15
15
|
## updating the website
|
|
16
16
|
|
|
17
|
-
For
|
|
17
|
+
For 5.x
|
|
18
18
|
|
|
19
19
|
0. Change to the master branch
|
|
20
20
|
1. execute `make docs` (when this process completes you'll be on the gh-pages branch)
|
|
21
|
-
2. `git commit -a -m 'chore: website
|
|
21
|
+
2. `git commit -a -m 'chore: website 5.x.x'`
|
|
22
22
|
3. `git push origin gh-pages`
|
|
23
23
|
|
|
24
|
-
For
|
|
24
|
+
For 4.x
|
|
25
25
|
|
|
26
|
-
0. Change to the
|
|
26
|
+
0. Change to the 4.x branch
|
|
27
27
|
1. execute `make docs_legacy` (when this process completes you'll be on the gh-pages branch)
|
|
28
|
-
2. `git commit -a -m 'website
|
|
28
|
+
2. `git commit -a -m 'chore: website 4.x.x'`
|
|
29
29
|
3. `git push origin gh-pages`
|
package/test.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./lib/browserDocument');
|