mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
bug fix with $in
This commit is contained in:
parent
112b19a5d9
commit
187156c280
13
db/jsobj.cpp
13
db/jsobj.cpp
@ -424,8 +424,14 @@ JSMatcher::JSMatcher(JSObj &_jsobj) :
|
||||
assert( in == 0 ); // only one per query supported so far. finish...
|
||||
in = new set<Element,element_lt>();
|
||||
JSElemIter i(fe.embeddedObject());
|
||||
while( i.more() )
|
||||
in->insert(i.next());
|
||||
if( i.more() ) {
|
||||
while( 1 ) {
|
||||
Element ie = i.next();
|
||||
if( ie.eoo() )
|
||||
break;
|
||||
in->insert(ie);
|
||||
}
|
||||
}
|
||||
toMatch.push_back(e); // not actually used at the moment
|
||||
compareOp.push_back(opIN);
|
||||
n++;
|
||||
@ -456,7 +462,8 @@ inline int JSMatcher::valuesMatch(Element& l, Element& r, int op) {
|
||||
|
||||
if( op == opIN ) {
|
||||
// { $in : [1,2,3] }
|
||||
return in->count(l);
|
||||
int c = in->count(l);
|
||||
return c;
|
||||
}
|
||||
|
||||
/* check LT, GTE, ... */
|
||||
|
56
db/repl.h
56
db/repl.h
@ -33,34 +33,34 @@ extern bool slave;
|
||||
extern bool master;
|
||||
|
||||
bool cloneFrom(const char *masterHost, string& errmsg);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
class OpTime {
|
||||
unsigned i;
|
||||
unsigned secs;
|
||||
public:
|
||||
OpTime(unsigned a, unsigned b) { secs = a; i = b; }
|
||||
OpTime() { secs = 0; i = 0; }
|
||||
static OpTime now();
|
||||
unsigned long long& asDate() { return *((unsigned long long *) this); }
|
||||
bool isNull() { return secs == 0; }
|
||||
string toString() {
|
||||
stringstream ss;
|
||||
ss << hex << secs << ':' << i;
|
||||
return ss.str();
|
||||
}
|
||||
bool operator==(const OpTime& r) const {
|
||||
return i == r.i && secs == r.secs;
|
||||
}
|
||||
bool operator!=(const OpTime& r) const { return !(*this == r); }
|
||||
bool operator<(const OpTime& r) const {
|
||||
if( secs != r.secs )
|
||||
return secs < r.secs;
|
||||
return i < r.i;
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
class OpTime {
|
||||
unsigned i;
|
||||
unsigned secs;
|
||||
public:
|
||||
OpTime(unsigned a, unsigned b) { secs = a; i = b; }
|
||||
OpTime() { secs = 0; i = 0; }
|
||||
static OpTime now();
|
||||
unsigned long long& asDate() { return *((unsigned long long *) this); }
|
||||
bool isNull() { return secs == 0; }
|
||||
string toString() const {
|
||||
stringstream ss;
|
||||
ss << hex << secs << ':' << i;
|
||||
return ss.str();
|
||||
}
|
||||
bool operator==(const OpTime& r) const {
|
||||
return i == r.i && secs == r.secs;
|
||||
}
|
||||
bool operator!=(const OpTime& r) const { return !(*this == r); }
|
||||
bool operator<(const OpTime& r) const {
|
||||
if( secs != r.secs )
|
||||
return secs < r.secs;
|
||||
return i < r.i;
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct SyncException {
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user