Skip to content

Commit 3e16deb

Browse files
committed
fix: Make sure selectors are valid JSON before storing them in mango_idx:add
1 parent 7f87ba6 commit 3e16deb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mango/src/mango_idx.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ add(DDoc, Idx) ->
154154
{ok, NewDDoc1} = Mod:add(DDoc, Idx),
155155
NewDDoc2 = set_ddoc_partitioned(NewDDoc1, Idx),
156156
% Round trip through JSON for normalization
157-
Body = ?JSON_DECODE(?JSON_ENCODE(NewDDoc2#doc.body)),
157+
Body = ?JSON_DECODE(?JSON_ENCODE(mango_util:join_keys(NewDDoc2#doc.body))),
158158
{ok, NewDDoc2#doc{body = Body}}.
159159

160160
remove(DDoc, Idx) ->

0 commit comments

Comments
 (0)