大佬教程收集整理的这篇文章主要介绍了node.js – Mongoose:只查找并选择虚拟中指定的字段,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
var UserscheR_386_11845@a = new scheR_386_11845@a({ name: String,username: String,email: String,role: {type: String,default: 'user'},following: [{type: scheR_386_11845@a.objectId,ref: 'User'}],followers: [{type: scheR_386_11845@a.objectId,hashedpassword: String,provider: String,salt: String,facebook: {},twitter: {},github: {},google: {} });
UserscheR_386_11845@a .virtual('profile') .get(function() { return { 'username': this.username,'name': this.name,'role': this.role }; });
我的问题是如何在我发出查找请求时只获取此信息.这是我的代码:
UserscheR_386_11845@a.statics = { list: function (options,callBACk) { var criteria = options.criteria || {}; this.find(criteria) .SELEct(/* what to put here? */) .limit(options.perPagE) .skip(options.perPage * options.pagE) .exec(callBACk); } };
以上是大佬教程为你收集整理的node.js – Mongoose:只查找并选择虚拟中指定的字段全部内容,希望文章能够帮你解决node.js – Mongoose:只查找并选择虚拟中指定的字段所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。