0
0
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:
dwight 2008-08-04 07:00:48 -04:00
parent 112b19a5d9
commit 187156c280
2 changed files with 38 additions and 31 deletions

View File

@ -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, ... */

View File

@ -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 {
};