Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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()
Comment

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 }
Comment

PREVIOUS NEXT
Code Example
Javascript :: for loop react 
Javascript :: js split string 
Javascript :: how to pass callback function in javascript 
Javascript :: redux action 
Javascript :: cm to inches 
Javascript :: uirouter 
Javascript :: how to display words from an array in a box in javascript 
Javascript :: django csrf failed ajax case 
Javascript :: js rename onclick function 
Javascript :: uncaughtException javascript 
Javascript :: The .querySelector() Method 
Javascript :: can we fine a key with help of value in array of objects javascript 
Javascript :: usenavigate and uselocation in react 
Javascript :: js alertify.success parameters 
Javascript :: js remove all children 
Javascript :: disable google analytics gatsby config.js 
Javascript :: let a = {y;10}; 
Javascript :: nodejs get appdata path 
Javascript :: react component key prop 
Javascript :: rivets js bind 
Javascript :: how to check if a browser is supported 
Javascript :: javascript coding challenges with solutions 
Javascript :: jquery prev 
Javascript :: how calculate number of digits of number 
Javascript :: remove green lines on google maps js 
Javascript :: javascript push 
Javascript :: double function call javascript 
Javascript :: nodejs export all mongodb collections 
Javascript :: loading screen html css js 
Javascript :: json ld product schema 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =