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
Reference virtual in virtual? #3423
Labels
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
Comments
Should be possible. Is this code not working for you? |
above code is not working for me. :( Did I miss something? |
The following script executes without error for me: 'use strict';
var assert = require('assert');
var mongoose = require('mongoose');
var ObjectId = mongoose.Types.ObjectId;
mongoose.set('debug', true);
mongoose.connect('mongodb://localhost:27017/gh3423');
var userSchema = new mongoose.Schema({
firstName: String,
lastName: String
});
userSchema.virtual('fullName').get(function() {
return this.firstName + ' ' + this.lastName;
});
userSchema.virtual('link').get(function() {
return 'test:' + this.fullName;
});
var User = mongoose.model('User', userSchema);
var user = new User({ firstName: 'Axl', lastName: 'Rose' });
assert.equal(user.link, 'test:Axl Rose');
process.exit(0); Please modify it to reproduce your issue. |
vkarpov15
added
the
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
label
Oct 2, 2015
It worked now. I Thank you for kind example anyway. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
Is it possible referencing virtual attribute in other virtual attribute?
Here is what I tried and
user.editLink
was<a href="/users/some_user_id">undefined</a>
.I'm using mongodb 2.4.17 and mongoose 4.1.6.
The text was updated successfully, but these errors were encountered: