Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Levels of nested Objects #158

Open
rakshitmidha opened this issue Apr 11, 2019 · 2 comments
Open

Multiple Levels of nested Objects #158

rakshitmidha opened this issue Apr 11, 2019 · 2 comments

Comments

@rakshitmidha
Copy link

I'm not able to view multiple levels of nested objects using TaffyDb.
I'm using the similar style as MongoDb.

let me know if this is already working, or it's an issue in general.

@lixinlin
Copy link

lixinlin commented Feb 6, 2020

add the follow code for TAFFY.has function before line "switch ( T.typeOf( var1 ) ){":
if(T.isObject(var2)){
let f = returnFilter(var2);
switch ( T.typeOf( var1 ) ) {
case 'array':
let found = false;
eachin( var1, function ( v, n ) {
if(found) return;
re = runFilters( v, f );
if(re){
found = true;
return TAFFY.EXIT;
}
});
break;
default:
re = runFilters( var1, f );
break;
}
return re;
}

the filter object : {'skus':{'has':{'tt': { 'has':{'aa': {'has':{'bb':{'gt': 0}}}}}}}}
the data object structure:[{"skus":[{"tt":{"aa":{"bb":1}}}]}];
in this case , the has/hasAll be used as a sub function
{'skus':{'has':{'tt': { 'has':{'aa':{'bb':1}}}}}} got same result without has, but with the fixed value

@lixinlin
Copy link

lixinlin commented Feb 6, 2020

another place should be patch, in TAFFY.has function, and switch section:
if ( T.isObject( var2 ) ){
eachin( var2, function ( v, n ) {
if ( re === true && !T.isUndefined( var1[n] ) &&

change to :
if ( T.isObject( var2 ) ){
eachin( var2, function ( v, n ) {
if (!T.isUndefined( var1[n] ) &&

re === true condition maybe a bug, res always false in this place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants