MONGOOSE SMART SELECT
Mongoose smart select mongoose property tool
Install
ES6 or later required
npm install mongoose-smart-select
Then in your project
var mongoose =
Ussage
const smartSelect = const Post = let selectpopulate = let posts = Post
Features
With mongoose model:
let categorySchema = mongoosecategorySchema let dateSchema = mongoose let postSchema = mongoose let Post = mongooselet Category = mongoose
Limit field select
// Select name only // Select post.address.location.lat // Select post.date.year
Populate related
// Select all field of category // Select post.category.name only // Select all field of post and name of category
Populate virtuals
// Select category.posts.name with category.posts is virtual field
Select all
== == // Select all other fields