Try this out:
db.blogpost.find({ 'tags' : 'tag1'}); //1
db.blogpost.find({ 'tags' : { $all : [ 'tag1', 'tag2' ] }}); //2
db.blogpost.find({ 'tags' : { $in : [ 'tag3', 'tag4' ] }}); //3
More Related Contents:
- How does MongoDB sort records when no sort order is specified?
- How to listen for changes to a MongoDB collection?
- Cascade style delete in Mongoose
- Check that Field Exists with MongoDB
- MongoDB – Update an object in nested Array
- Creating Multifield Indexes in Mongoose / MongoDB
- Mongodb Explain for Aggregation framework
- MongoDB aggregation comparison: group(), $group and MapReduce
- MongoDB group by array inner-elements
- Multiple Counts with single query in mongodb
- NoSQL (MongoDB) vs Lucene (or Solr) as your database [closed]
- Delete everything in a MongoDB database
- How to return array of string with mongodb aggregation
- How to return just the nested documents of an array from all documents
- Mongoose’s find method with $or condition does not work properly
- return query based on date
- MongoParseError: options useCreateIndex, useFindAndModify are not supported
- mgo – query performance seems consistently slow (500-650ms)
- Can’t find documents searching by ObjectId using Mongoose
- Mongodb aggregation $group, restrict length of array
- mongodb – Find document with closest integer value
- mongodb, replicates and error: { “$err” : “not master and slaveOk=false”, “code” : 13435 }
- MongoDB/NoSQL: Keeping Document Change History
- Update a value in MongoDB based on its current value
- How to connect to external MongoDB instance in Meteor?
- Generating a Structure for Aggregation
- Modify and replay MongoDB oplog
- Creating custom Object ID in MongoDB
- Sort nested array of objects
- How to create a Mongo Docker Image with default collections and data?