Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit803090d

Browse files
committed
fix(schema): make aliases handle mongoose-lean-virtuals
Backport fix for#6069 andmongoosejs/mongoose-lean-virtuals#6
1 parent6a8b381 commit803090d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎lib/schema.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,20 @@ function aliasFields(schema) {
143143

144144
if(alias){
145145
if('string'===typeofalias&&alias.length>0){
146-
if(schema.aliases[alias])
146+
if(schema.aliases[alias]){
147147
thrownewError('Duplicate alias, alias '+alias+' is used more than once');
148-
else
148+
}else{
149149
schema.aliases[alias]=prop;
150+
}
150151

151152
schema
152153
.virtual(alias)
153154
.get((function(p){
154155
returnfunction(){
155-
returnthis.get(p);
156+
if(typeofthis.get==='function'){
157+
returnthis.get(p);
158+
}
159+
returnthis[p];
156160
};
157161
})(prop))
158162
.set((function(p){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp