if (src->updateobj) {
target->updateobj = bson_dup(src->updateobj);
}
+ if (src->$ufields) {
+ target->$ufields = tcmapdup(src->$ufields);
+ }
}
/* Clone query object */
bson_init_size(&bsout, bson_size(&bsout));
}
if (q->$ifields) { //we have positional $(projection)
- assert(imode == true); //ensure we are in include mode
+ assert(imode == true); //ensure we are in include mode
if (!_ifields) {
_ifields = tcmapnew2(TCMAPRNUM(q->$ifields));
} else {
tcxstrprintf(ifield, "%d", ctx.iamachidx);
tcmapput(_fkfields, TCXSTRPTR(ifield), TCXSTRSIZE(ifield), "0", strlen("0"));
tcxstrcat(ifield, dpos + 1, sp - (dpos - dfpath) - 1);
- tcmapput(_ifields, TCXSTRPTR(ifield), TCXSTRSIZE(ifield), &yes, sizeof(yes));
+ tcmapput(_ifields, TCXSTRPTR(ifield), TCXSTRSIZE(ifield), &yes, sizeof (yes));
} else {
assert(false); //something wrong, it should never be happen
}
if (qf->updateobj == NULL) {
continue;
}
+
+ //todo #91
+
if (qf->flags & EJCONDSET) { //$set
setqf = qf;
continue;
*ifields = fmap;
}
}
- }
+ } //eof hints
const int scoreexact = 100;
const int scoregtlt = 50;
if (qf->updateobj) {
bson_del(qf->updateobj);
}
+ if (qf->$ufields) {
+ tcmapdel(qf->$ufields);
+ }
if (qf->regex && !(EJQINTERNAL & q->flags)) {
//We do not clear regex_t data because it not deep copy in internal queries
regfree((regex_t *) qf->regex);
//$addToSetAll & $pullAll accepts arrays only as argument
continue;
}
+ if (qf.flags & (EJCONDSET | EJCONDINC)) { //Checking the $(query) positional operator.
+ const char* key = BSON_ITERATOR_KEY(&sit);
+ char *pptr;
+ if ((pptr = strstr(key, ".$")) && pptr && (*(pptr + 2) == '\0' || *(pptr + 2) == '.')) {// '.$' || '.$.'
+ //todo #91!!!
+ }
+ }
bson_append_field_from_iterator(&sit, qf.updateobj);
}
bson_finish(qf.updateobj);
const TDBIDX *idx; /**> Column index for this field if exists */
bson *idxmeta; /**> Index metainfo */
bson *updateobj; /**> Update bson object for $set and $inc operations */
+ TCMAP *$ufields; /**> Update $(query) prositional fields */
TCLIST *exprlist; /**> List representation of expression */
TCMAP *exprmap; /**> Hash map for expression tokens used in $in matching operation. */
void *regex; /**> Regular expression object */