Mongodb查找数组不为空的记录

原创文章,转载请注明来源并保留原文链接

假设tags类型为数组

# Mongoid
Record.exists('tags.1' => true)
db.document.find({'tags.1': {$exists: true}})

Leave a Reply

Your email address will not be published. Required fields are marked *