Giter Club home page Giter Club logo

ewd-document-store's People

Contributors

killmenot avatar robtweed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ewd-document-store's Issues

"forEachChild" method provides different results for Cache and Gtm providers

Hi,

The following test falls when 'gtm' provider is used for running integration tests
https://github.com/robtweed/ewd-document-store/blob/master/spec/integration/ewd-document-store.spec.js#L295

It seems that works fine for InterSystem Caché (have no chance to run it without cache.node) but fails when Gtm used.

The problem is here:
(1) https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L83
(2) https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L87

For Gtm (2) returns the following result

node before =  '{"global":"temp","subscripts":["foo","Davisþ"]}'
end / result = undefined

However, if I comment out (1), (2) returns the following:

node before =  '{"global":"temp","subscripts":["foo","Davis"]}'
end/result =  'Douglas'

and seems works.

Also, please note that FIELD_MARK also used here
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L75

@robtweed Do you have any ideas?

node has data and has sub nodes question

@robtweed Please take a look:

if (defined === 1 || defined === 11) {
document[index] = db.get(node).data;
if (document[index] === 'true') document[index] = true;
if (document[index] === 'false') document[index] = false;
//document[index] = removeDoubleQuotes(document[index], db);
}
if (defined === 10 || defined === 11) {
document[index] = getSubnodes(node);
}

What if node has data and has sub nodes (defined = 11)? In this case data set on line 97 was replaced on line 103. Is it correct?

The execution never stops with forEach

Hi @robtweed

During fixing memory db that I use for tests I found an interesting scenario that breaks forEachChild. The execution never stops for me.

It relates with the following functionality:
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78

The test case:

var documentStore = new DocumentStore(db); // db - GTM
var documentNode = new documentStore.DocumentNode('temp');

documentNode.delete();

var foo = {
  a: 'this is a',
  b: 'this is b',
  Barton: 'J',
  Briggs: 'A',
  Davies: 'D',
  Davis: 'T',
  Douglas: 'N',
  c: ['a', 's', 'd'],
  d: {
    a: 'a',
    b: 'b'
  }
};

documentNode.$('foo').setDocument(foo);

documentNode.$('foo').forEachChild({
  range: {
    to: '123'
  }
}, function (nodeName, node) {
  // do somethng
});

Even if the test case is not correct, I think we need to handle this behaviour. Another question, could you please provide me with example of correct test case for https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78 I guess it should work with arrays only

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.