Build up your query object programmatically:
var query = {
player: 'player'
};
if (obj.action) {
query.action = obj.action;
}
Entry.find(query).exec(function(err, res){
console.log(res);
});
More Related Contents:
- Querying after populate in Mongoose
- Populate nested array in mongoose
- Cannot overwrite model once compiled Mongoose
- Comparing mongoose _id and strings
- Mongoose Unique values in nested array of objects
- Mongoose Schema hasn’t been registered for model
- Mongoose findByIdAndUpdate not returning correct model
- Mongoose duplicate key error with upsert
- How to protect the password field in Mongoose/MongoDB so it won’t return in a query when I populate collections?
- How can I use a cursor.forEach() in MongoDB using Node.js?
- Fill missing dates in records
- Mongoose, find, return specific properties
- How to drop a database with Mongoose?
- How to use mongoose findOne
- Mongoose indexing in production code
- Model.find().toArray() claiming to not have .toArray() method
- Mongodb sort with case insensitive manner
- Difference between MongoDB and Mongoose
- How can I save multiple documents concurrently in Mongoose/Node.js?
- Fail to connect Mongoose to Atlas
- Which SchemaType in Mongoose is Best for Timestamp?
- nodejs mongodb object id to string
- How to reference another schema in my Mongoose schema?
- Mongoose: ObjectId Comparisons fail inconsistently
- Mongoose multiple connections
- set field as empty for mongo object using mongoose
- Mongoose overwrite the document rather that `$set` fields
- Mongodb $lookup dynamic collection
- Mongoose complex (async) virtuals
- Create unique autoincrement field with mongoose [duplicate]