I am trying to create a query object for mongoose, so
let countryCondition = {};
searchQuery = {
"$text": {
"$search": searchString
}
};
query = {
searchQuery,
countryCondition
};
console.log('$query:', query);
When i console.log query, i see the ouput as,
$query: {
searchQuery: {
'$text': {
'$search': '2017'
}
},
countryCondition: {}
}
but i need
[{ '$text': { '$search': '2017' } }, {}]
[{ '$text': { '$search': '2017' } }, {}]?