search with multiple field in node js mongodb
db.test.find({
$or:[
{
$and: [
{'stocknumber':12346},
{'model':'bmx'},
{'make':2002},
{'rego':'KA01HG6268'},
{'adate':'2017-10-01T05:07:10.969Z'},
{'cdate':'2017-10-01T05:07:10.969Z'}
]
},
{
$and: [
{'stocknumber':12347},
{'model':'bmy'},
{'make':2003}
]
}
]
}).pretty()> 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 }
Also in JavaScript:
- javascript check if is nan
- lexical scope javascript
- redux saga fetch api
- how to interrupt scroll with jquery
- react native image
- identify chrome on android using javascript
- node parameter add memory
- facebook pixel
- compare string by several strings js
- v-on:change vue
- js roll function
- check if js is enabled
- react open on different url instead of localhost
- node ubutun
- in select option how to make one default in angular
- creating a nested loop of a chessboard in javascript
- check if a variable is undefined jquery
- toastr.js notification for laravel
- react quick tutorial
- how to parse json
- convert number to k m b javascript
- js stop form submit
- how to change string to array in javascript
- jquery creating several items