Answers for "mongodb search multiple fields vs one field"

Go
0

mongodb match multiple fields

$match:
{
	$and: [
    {'ExtraFields.value': {$in: ["A52A2A"]}}, 
    {'ExtraFields.fieldID': ObjectId("5535627631efa0843554b0ea")}
    ]
}
Posted by: Guest on July-01-2020
0

search with multiple field in node js mongodb

> db.test.find({$or: [{Description: {$regex: '^225/65R16'}, Brand: {$regex: '^Hankook'}}]})
{ "Description" : "225/65R16 71T K715", "Brand" : "Hankook", "Ref" : 123455 }
{"Description" : "225/65R16 94T", "Brand" : "Hankook", "Ref" : 123455 }

> db.test.find({$or: [{Description: {$regex: '^225'}, Brand: {$regex: '^Han'}}]})
{ "Description" : "225/65R16 71T K715", "Brand" : "Hankook", "Ref" : 123455 }
{ "Description" : "225/65R16 94T", "Brand" : "Hankook", "Ref" : 123455 }
Posted by: Guest on July-29-2020

Code answers related to "mongodb search multiple fields vs one field"

Browse Popular Code Answers by Language