MongoDB 中的查询方法。
2022/6/1 2:51:47
本文主要是介绍MongoDB 中的查询方法。,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
使用 Robo 3T
查找
对象结构
{ "_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}这篇关于MongoDB 中的查询方法。的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-20go-zero 框架的 RPC 服务 启动start和停止 底层是怎么实现的?-icode9专业技术文章分享
- 2024-12-19Go-Zero 框架的 RPC 服务启动和停止的基本机制和过程是怎么实现的?-icode9专业技术文章分享
- 2024-12-18怎么在golang中使用gRPC测试mock数据?-icode9专业技术文章分享
- 2024-12-15掌握PageRank算法核心!你离Google优化高手只差一步!
- 2024-12-15GORM 中的标签 gorm:"index"是什么?-icode9专业技术文章分享
- 2024-12-11怎么在 Go 语言中获取 Open vSwitch (OVS) 的桥接信息(Bridge)?-icode9专业技术文章分享
- 2024-12-11怎么用Go 语言的库来与 Open vSwitch 进行交互?-icode9专业技术文章分享
- 2024-12-11怎么在 go-zero 项目中发送阿里云短信?-icode9专业技术文章分享
- 2024-12-11怎么使用阿里云 Go SDK (alibaba-cloud-sdk-go) 发送短信?-icode9专业技术文章分享
- 2024-12-10搭建个人博客网站之一、使用hugo创建个人博客网站