【发布时间】:2021-12-21 21:35:20
【问题描述】:
芒果查询是否可以找到那些在数组字段中提供字符串的文档?
说,
const doc = {
_id: 'testdoc',
tags: ['pouch', 'couch', 'mysql'],
}
$db.find({ selector: {
tags: {
$has: 'pouch' // what goes here?
}
}})
【问题讨论】:
芒果查询是否可以找到那些在数组字段中提供字符串的文档?
说,
const doc = {
_id: 'testdoc',
tags: ['pouch', 'couch', 'mysql'],
}
$db.find({ selector: {
tags: {
$has: 'pouch' // what goes here?
}
}})
【问题讨论】:
【讨论】:
tags: { $elemMatch: { $eq: 'pouch'} }