MongoDB 中的查询方法。
使用 Robo 3T
查找
对象结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | { "_id" : "051723f8-dacf-422d-ba84-d7d88b1ca540" , "TaskName" : "_SpreadJS V10 Edge Testing" , "Description" : "" , "VCSList" : [ { "_t" : "TFS_VCS" , "Enable" : true , "VCSRootName" : "%SpreadJSV10%" , "VCSRootID" : "SpreadJSV10Test" , "SourceRootPath" : "$/XIANToolsTest/Development/SpreadJSAutoTestV10" , "StepName" : "TFS Get Test Source" , "LocalPath" : "%SpreadJSV10%" , "TFSURL" : "http://xa-cm-tfs2:8080/tfs" , "CollectionName" : "XAToolsCollection" , "UserName" : "SunLiu" , "Password" : "Ljc19711209" , "Domain" : "GrapeCity" } ], "BuildStepList" : [ { "_t" : "MSBuildRunner" , "Enable" : true , "StepName" : "Build Scripts" , "BuildFilePath" : "%SpreadJSV10%\\SpreadJS_TestScript.sln" , "OutputPath" : "%Root%\\Bin" , "CommandLineParameters" : "/p:Configuration=Debug /nologo /t:rebuild /verbosity:m" }, { "_t" : "CopyContentRunner" , "Enable" : true , "StepName" : "Copy Config File" , "SourceFilePath" : "%SpreadJSV10%\\SpreadJS_TestScript\\TestConfigrationFile\\EdgeTest.config" , "TargetFilePath" : "%Root%\\Bin\\SpreadJS_TestScript.dll.config" } ], "TaskSettings" : { "IsSendComparedMail" : true }, "TestSettings" : { "ToolType" : 1, "ResourcePath" : null , "RunFailureCaseTimes" : 3, "ToolPath" : "" , "TestAssemblies" : [ "%Root%\\Bin\\SpreadJS_TestScript.dll" ], "ReportPath" : "" , "EnableTestToolLog" : false , "IsRestartAgentClientBeforeTest" : true , "RestartAgentClientDelayTime" : 5, "MustWindowsClassicTheme" : true , "ResolutionX" : 1280, "ResolutionY" : 1024, "IsSendMail" : false , "MailSubject" : "SpreadJS V10 Edge Testing" , "MailFrom" : "at@contact.grapecity.com" , "MailFromDisplay" : "AutoTest Managment System" , "MailTo" : "robert.wang@grapecity.com;Ally.zhang@grapecity.com;sun.liu@grapecity.com" , "MailSMTPServer" : "10.32.0.200" , "MailPort" : "25" , "MailPassword" : "" , "MailAccount" : "" , "MailEnableSSL" : false , "TestTimeout" : 300000, "IsResetTimeZone" : false , "TimeZoneId" : "China Standard Time" , "ResetKeyboard" : true , "ResetMouse" : true , "MouseResetPosition" : 1, "CustomMouseResetPositionX" : 0, "CustomMouseResetPositionY" : 0, "IsMonitorLeakage" : true , "MemoryLoad" : 85, "HandleLoad" : 90, "AutoTesterAccount" : "Component Test" , "AutoTesterPassword" : "xA070613" , "AutoTesterLoginAddress" : "" , "AutoTesterTaskAddress" : "" , "MaxTestResultCount" : 200 }, "PerformanceSettings" : {}, "Trigger" : [ { "_t" : "DailySchedule" , "TriggerID" : "1ed10150-10b8-44ea-9d16-f573a583ca63" , "Enable" : false , "LastExecutionTime" : ISODate( "2018-01-08T04:30:00.643Z" ), "ExecutionTime" : ISODate( "1981-03-01T04:30:00.000Z" ), "TaskID" : "051723f8-dacf-422d-ba84-d7d88b1ca540" } ], "Requirement" : { "AgentList" : [ "XA-AT-015W10J64" ], "ExcludedAgentList" : [], "OSType" : 4, "MustJPVersion" : null , "Must64BitOS" : null , "MustSupportWebAii" : null , "IEVersion" : 0, "InputLanguage" : 7, "RuntimeEnvironment" : 1, "HasChrome" : false , "HasFireFox" : false , "HasSafari" : false }, "ProcessCollectionName" : "SpreadJSv10EdgeTesting" , "PerformanceCollectionName" : null } |
获取属性 -id
db.getCollection('TestTask').find({"_id":"051723f8-dacf-422d-ba84-d7d88b1ca540"});
获取子对象中的属性:
db.getCollection('TestTask').find({ "Requirement.AgentList":"XA-AT-015W10J64" })
获取字符串包含内容,需要使用正则来获得。
db.getCollection('TestTask').find({"Requirement.AgentList" : /^.*AT.*$/})
{ "_id" : "051723f8-dacf-422d-ba84-d7d88b1ca540", "TaskName" : "_SpreadJS V10 Edge Testing", "Description" : "", "VCSList" : [ { "_t" : "TFS_VCS", "Enable" : true, "VCSRootName" : "%SpreadJSV10%", "VCSRootID" : "SpreadJSV10Test", "SourceRootPath" : "$/XIANToolsTest/Development/SpreadJSAutoTestV10", "StepName" : "TFS Get Test Source", "LocalPath" : "%SpreadJSV10%", "TFSURL" : "http://xa-cm-tfs2:8080/tfs", "CollectionName" : "XAToolsCollection", "UserName" : "SunLiu", "Password" : "Ljc19711209", "Domain" : "GrapeCity" } ], "BuildStepList" : [ { "_t" : "MSBuildRunner", "Enable" : true, "StepName" : "Build Scripts", "BuildFilePath" : "%SpreadJSV10%\\SpreadJS_TestScript.sln", "OutputPath" : "%Root%\\Bin", "CommandLineParameters" : "/p:Configuration=Debug /nologo /t:rebuild /verbosity:m" }, { "_t" : "CopyContentRunner", "Enable" : true, "StepName" : "Copy Config File", "SourceFilePath" : "%SpreadJSV10%\\SpreadJS_TestScript\\TestConfigrationFile\\EdgeTest.config", "TargetFilePath" : "%Root%\\Bin\\SpreadJS_TestScript.dll.config" } ], "TaskSettings" : { "IsSendComparedMail" : true }, "TestSettings" : { "ToolType" : 1, "ResourcePath" : null, "RunFailureCaseTimes" : 3, "ToolPath" : "", "TestAssemblies" : [ "%Root%\\Bin\\SpreadJS_TestScript.dll" ], "ReportPath" : "", "EnableTestToolLog" : false, "IsRestartAgentClientBeforeTest" : true, "RestartAgentClientDelayTime" : 5, "MustWindowsClassicTheme" : true, "ResolutionX" : 1280, "ResolutionY" : 1024, "IsSendMail" : false, "MailSubject" : "SpreadJS V10 Edge Testing", "MailFrom" : "at@contact.grapecity.com", "MailFromDisplay" : "AutoTest Managment System", "MailTo" : "robert.wang@grapecity.com;Ally.zhang@grapecity.com;sun.liu@grapecity.com", "MailSMTPServer" : "10.32.0.200", "MailPort" : "25", "MailPassword" : "", "MailAccount" : "", "MailEnableSSL" : false, "TestTimeout" : 300000, "IsResetTimeZone" : false, "TimeZoneId" : "China Standard Time", "ResetKeyboard" : true, "ResetMouse" : true, "MouseResetPosition" : 1, "CustomMouseResetPositionX" : 0, "CustomMouseResetPositionY" : 0, "IsMonitorLeakage" : true, "MemoryLoad" : 85, "HandleLoad" : 90, "AutoTesterAccount" : "Component Test", "AutoTesterPassword" : "xA070613", "AutoTesterLoginAddress" : "", "AutoTesterTaskAddress" : "", "MaxTestResultCount" : 200 }, "PerformanceSettings" : {}, "Trigger" : [ { "_t" : "DailySchedule", "TriggerID" : "1ed10150-10b8-44ea-9d16-f573a583ca63", "Enable" : false, "LastExecutionTime" : ISODate("2018-01-08T04:30:00.643Z"), "ExecutionTime" : ISODate("1981-03-01T04:30:00.000Z"), "TaskID" : "051723f8-dacf-422d-ba84-d7d88b1ca540" } ], "Requirement" : { "AgentList" : [ "XA-AT-015W10J64" ], "ExcludedAgentList" : [], "OSType" : 4, "MustJPVersion" : null, "Must64BitOS" : null, "MustSupportWebAii" : null, "IEVersion" : 0, "InputLanguage" : 7, "RuntimeEnvironment" : 1, "HasChrome" : false, "HasFireFox" : false, "HasSafari" : false }, "ProcessCollectionName" : "SpreadJSv10EdgeTesting", "PerformanceCollectionName" : null}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!