0

我正在使用 nedb 嵌入式数据库。我在数据库中有以下 6 条记录,

{"file":"LogFile4","time":"2018-05-30","ip":"20:12:36:169","process_id":"9492","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":"72","function_name":"uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1533316439751},"_id":"04dcgjqvamb3Q2ZP"}

{"file":"LogFile1","time":"2018-05-30","ip":"20:12:36:169","process_id":"9492","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":"72","function_name":"uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1533316401978},"_id":"30REJoEkoDRz2Pa7"}

{"file":"LogFile","time":"2018-05-30","ip":"20:12:36:169","process_id":"9492","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":"72","function_name":"uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1534183887217},"_id":"5KUJtLyIoid55wNL"}

{"file":"LogFile2","time":"2018-05-30","ip":"20:12:36:169","process_id":"9492","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":" 72","function_name":" uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1533316421021},"_id":"83jMpB2SB1hnpuXU"}

{"file":"LogFile3","time":"2018-05-30","ip":"20:12:36:169","process_id":"9492","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":" 72","function_name":" uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1533316430692},"_id":"MJETZ6PtNxMXk817"}

{"file":"LogFile","time":"2018-05-30","ip":"20:12:36:169","process_id":"9493","thread_id":"984" ,"component_id":"Standalone","lock_level":1,"source_file":" /m_uac_helpers.cpp","lan_no":" 72","function_name":" uGetProcessIntegrityLevel()","description":" 正在运行中等完整性级别","date":{"$$date":1533316384810},"_id":"WUdpGQ8ec7WqwaJh"}

我不想要包含 file = "LogFile" 和 process_id="9493" 的记录,但我想要那些只包含其中一个的记录。

我正在使用以下查询,'$and': [ { '$not': { process_id: "9493"} }, {file: "LogFile"} ] ,

但它也排除了只有 process_id:“9493”或文件:“LogFile”的记录。

如何仅删除两个字段都存在的那些记录。

谢谢

4

0 回答 0