Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose findone exclude own document

Product
    .find({
        $and: [
             { _id: {$ne: someId} },
             { $or: [
                   { 'tags': { $regex: criteria, $options: 'i' }, },
                   { 'name': { $regex: criteria, $options: 'i' }, },
             ]},
         ]
    })
    .limit(10)
    .exec((err, similar) => {
        //...
    })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #findone #exclude #document
ADD COMMENT
Topic
Name
2+9 =