Skip to content

Instantly share code, notes, and snippets.

@aheckmann
Created May 14, 2012 20:11
Show Gist options
  • Save aheckmann/2696364 to your computer and use it in GitHub Desktop.
Save aheckmann/2696364 to your computer and use it in GitHub Desktop.
var jade = require('jade')
, mongoose =require('mongoose')
, Schema = mongoose.Schema
var s = new Schema({ a: String });
s.virtual('asdf').get(function () {
return 'i am a vritual'
});
var S = mongoose.model('S', s);
a = new S({ a: 'hi' });
fn = jade.compile('s = JSON.stringify(doc.toJSON({virtuals:true}))\nscript\n var b = !{s}');
console.log(fn({ doc: a }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment