我正在分析MongoDB数据源以检查其质量.我想知道每个文档是否包含属性time:所以我使用了这两个命令
> db.droppay.find().count();
291822
> db.droppay.find({time: {$exists : true}}).count()
293525
Run Code Online (Sandbox Code Playgroud)
如何使用给定字段的元素多于整个集合中包含的元素?出了什么问题?我无法找到错误.如果有必要,我可以发布文件的预期结构.
Mongo Shell版本是1.8.3.Mongo Db版本是1.8.3.
提前致谢
这是文档条目的预期结构:
{
"_id" : ObjectId("4e6729cc96babe974c710611"),
"action" : "send",
"event" : "sent",
"job_id" : "50a1b7ac-7482-4ad6-ba7d-853249d6a123",
"result_code" : "0",
"sender" : "",
"service" : "webcontents",
"service_name" : "webcontents",
"tariff" : "0",
"time" : "2011-09-07 10:22:35",
"timestamp" : "1315383755",
"trace_id" : "372",
"ts" : "2011-09-07 09:28:42"
}
Run Code Online (Sandbox Code Playgroud) 我很确定这很简单.我只是想从另一个空格中返回一个字符串.
public static void LinkWorker(string baseURLString)
{
// do some stuff here
HTMLWork(baseURLStringCycle)
--> this is where i need xstring returned
foreach(string xyString in xstring.split('\n'))
{
}
}
public static void HTMLWork(string baseURLStringCycle)
{
//do HTML work here
// create x string
string xString = ; //the result of the htmlwork
}
Run Code Online (Sandbox Code Playgroud) 我在以下行之后遇到了段错误:
this->my_set.insert(my_string);
Run Code Online (Sandbox Code Playgroud)
该集已初始化,它包含std :: string.插入字符串不是指一个dandling指针,它是以null结尾的.集合中包含的所有其他字符串都不为null,并以'\ 0'结尾.
这是回溯:
#0 0xb7076bdb in std::_Rb_tree_insert_and_rebalance () from /usr/lib/libstdc++.so.6
#1 0xb7480795 in std::_Rb_tree<std::string, std::string, std::_Identity<std::string>, std::less<std::string>, std::allocator<std::string> >::_M_insert_ (
this=0x97bf918, __x=0x0, __p=0x980aa78, __v=@0xaabfc1c4) at /usr/include/c++/4.3/bits/stl_tree.h:854<br/>
#2 0xb7480b96 in std::_Rb_tree<std::string, std::string, std::_Identity<std::string>, std::less<std::string>, std::allocator<std::string> >::_M_insert_unique (this=0x97bf918, __v=@0xaabfc1c4) at /usr/include/c++/4.3/bits/stl_tree.h:1148
#3 0xb74fab2d in std::set<std::string, std::less<std::string>, std::allocator<std::string> >::insert (this=0x97bf918, __x=@0xaabfc1c4)
at /usr/include/c++/4.3/bits/stl_set.h:381
Run Code Online (Sandbox Code Playgroud)
任何的想法?
编辑
更多代码:
set<string> dangerous_messages; //placed in header file
qpid::client::Message msg;
msg = (*mylocal_queues)[queue]->get(10*1e9);
string msgUID = msg.getHeaders().getAsString("UID");
if(this->dangerous_messages.count(msgUID))
{
warning("(read_local_queue) Duplicate message \""+msgUID+"\" discarded");
} …Run Code Online (Sandbox Code Playgroud)