fix: #13007, replace $ with \uFF04, like .

This commit is contained in:
Barış Soner Uşaklı
2024-12-24 12:37:06 -05:00
parent f478adac2f
commit c60cee5997
3 changed files with 20 additions and 14 deletions

View File

@@ -174,11 +174,12 @@ module.exports = function (module) {
}
const data = {};
fields.forEach((field) => {
fields = fields.map((field) => {
field = helpers.fieldToString(field);
if (field) {
data[field] = 1;
}
return field;
});
const item = await module.client.collection('objects').findOne({ _key: key }, { projection: data });

View File

@@ -23,7 +23,9 @@ helpers.fieldToString = function (field) {
field = field.toString();
}
// if there is a '.' in the field name it inserts subdocument in mongo, replace '.'s with \uff0E
return field.replace(/\./g, '\uff0E');
// replace $ with \uff04 so we can use $ in document fields
return field.replace(/\./g, '\uff0E')
.replace(/\$/g, '\uFF04');
};
helpers.serializeData = function (data) {