logo
Search
showing results for - "mongoose search combine fields"
Enrico
17 Apr 2019
1db.collection.aggregate([
2  {
3    $addFields: {
4      nameFilter: {
5        $concat: ["$name", " ", "$surname"],
6      },
7      locationFilter: {
8        $concat: ["$workplace", " ", "$location"],
9      },
10    },
11  },
12  {
13    $match: {
14      nameFilter: {
15        $regex: req.query.name,
16        $options: "i",
17      },
18      locationFilter: {
19        $regex: req.query.place,
20        $options: "i",
21      },
22    },
23  },
24]);
source
similar questions
mongoose join multiple collectionsmongo mongoose join aggregation lookupmongoose find multiple conditionsmongodb mongoose aggregate two collections using lookup 26 format the result set nested json schema mongoosemongoose populate filtermongoose search in multiple fieldsmongoose find 28 29 examplemongoose find or createmongodb mongoose concatenate two values before getmongoose findone exclude own documentmongoose update array push multiplemongoose multi update req bodyupdate multiple documents by id set mongoosemongoose find multiple and update
queries leading to this page
mongoose schema combine two fieldsmongoose search combine fieldsmongoose find then combine results with other findmongodb update and concatenateconcat group id mongoosemongoose concatinate two fields and then run search queryhow to concat fields while find in mongoosemongodb update 2b concatenatemongoose select with concat 2 fieldsmongoose search combine fields
privacy policyterms of useinstagram
Crafted with  ♥  for everyone

sign in to continue
your answer for
you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content
please ensure to add code which is syntactically corrent and executes properly
sign in to continue
ask question on maxinterview
you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content
please be clear, to the point and respectful
sign in to continue