1602 / 1602/jugglingdb

Question: Why AbstractClass._forDB stringify JSON and Array.

Open
#335 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
238
PR merge metrics
No merged PRs in 30d

Description

Hello, I try to use jugglingdb and can't understand for what function "AbstractClass._forDB" converts object and array to string. This limits search by criterias. We have to use regular expressions or exists another way. Thank for help.

```
AbstractClass._forDB = function (data) {
var res = {};
Object.keys(data).forEach(function (propName) {
var typeName = this.whatTypeName(propName);
if (!typeName && !data[propName] instanceof Array) {
return;
}
if (typeName === 'JSON' || data[propName] instanceof Array) {
res[propName] = JSON.stringify(data[propName]);
} else {
res[propName] = data[propName];
}
}.bind(this));
return res;
};
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Look at the AbstractClass._forDB function in the codebase, likely in a file like lib/abstract_class.js. Understand how JSON and Array data is handled for different database adapters (redis, mongodb, mysql, etc.). Check if there are existing tests for this function or related search functionality. Determine if the stringification is necessary for all adapters or if it can be conditional.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, mysql, node.js, postgresql, redis, sqlite
Domain
backend-api-design, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.