MongoDB按字段值查询子文档

时间:2018-02-08 20:28:08

标签: node.js mongodb mongodb-query

"vmwVmCpus": {
"name": "vmwVmCpus", 
"oid": "1.3.6.1.4.1.6876.2.1.1.9", 
"nodetype": "column", 
"class": "objecttype", 
"syntax":
  {
  "type": "Integer32", 
  "class": "type"
   }, 
"maxaccess": "read-only", 
"status": "current"} 

返回正确的结果

db.collectionName.find({ "vmwVmCpus.oid": "1.3.6.1.4.1.6876.2.1.1.9" });

我需要能够查询“1.3.6.1.4.1.6876.2.1.1.9”并返回结果。 我试过以下但是没有用。

db.collectionName.find(
  {"oid" : {$regex :/.*1\.3\.6\.1\.4\.1\.6876\.4\.1\.0\.306.*/i}}
 );

0 个答案:

没有答案