Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions php_phongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ bool phongo_query_init(php_phongo_query_t *query, bson_t *filter, bson_t *option


if (bson_iter_init_find(&iter, options, "modifiers")) {
bson_t tmp;
uint32_t len = 0;
const uint8_t *data = NULL;

Expand All @@ -329,9 +328,13 @@ bool phongo_query_init(php_phongo_query_t *query, bson_t *filter, bson_t *option
}

bson_iter_document(&iter, &len, &data);
bson_init_static(&tmp, data, len);
bson_copy_to_excluding_noinit(&tmp, query->query, "nadastrada", NULL);
bson_destroy (&tmp);
if (len) {
bson_t tmp;

bson_init_static(&tmp, data, len);
bson_copy_to_excluding_noinit(&tmp, query->query, "nadastrada", NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does nadastrada mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"nada" means "nothing", "strada" means "road" and rimes with "nada".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise that, but what meaning does it have in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing. It can be any value, its not used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - that needs to be changed to something descriptive then.

bson_destroy (&tmp);
}
}

if (bson_iter_init_find(&iter, options, "projection")) {
Expand All @@ -344,11 +347,12 @@ bool phongo_query_init(php_phongo_query_t *query, bson_t *filter, bson_t *option
}

bson_iter_document(&iter, &len, &data);
query->selector = bson_new_from_data(data, len);
if (len) {
query->selector = bson_new_from_data(data, len);
}
}

if (bson_iter_init_find(&iter, options, "sort")) {
bson_t tmp;
uint32_t len = 0;
const uint8_t *data = NULL;

Expand All @@ -358,9 +362,13 @@ bool phongo_query_init(php_phongo_query_t *query, bson_t *filter, bson_t *option
}

phongo_bson_iter_as_document(&iter, &len, &data);
bson_init_static(&tmp, data, len);
bson_append_document(query->query, "$orderby", -1, &tmp);
bson_destroy(&tmp);
if (len) {
bson_t tmp;

bson_init_static(&tmp, data, len);
bson_append_document(query->query, "$orderby", -1, &tmp);
bson_destroy(&tmp);
}
}
}

Expand Down