Git Product home page Git Product logo

Comments (5)

clun avatar clun commented on June 8, 2024

Hum... is it a trick from the mongodb-driver returning different BSONList if the list is empty ? I'm pretty sure to test this behaviour if roles are set.

Well I would like to cast to the common upper class "BSONObject" but it's not iterable.... I will have to use the ugly (instanceof ?) beurk...

from ff4j.

clun avatar clun commented on June 8, 2024

Well, cannot reproduce this one (Mongodb v2.6.3, MongoDriver v2.12.2)

db.feature.find({"_id":"AwesomeFeature"}).pretty();

{
    "_id" : "AwesomeFeature",
    "enable" : true,
    "description" : "some desc",
    "groupname" : null,
    "strategy" : null,
    "expression" : null,
    "roles" : [ ]
}

Test passing (no exception at least)

// Given
 MongoCredential credential = MongoCredential.createMongoCRCredential("xx", "yyy", "xxx".toCharArray());
ServerAddress adr = new ServerAddress("localhost", 22012);
MongoClient mongoClient = new MongoClient(adr, Arrays.asList(credential));
DBCollection features = mongoClient.getDB( "FF4J" ).getCollection("feature");
// When
FeatureStore mongoStore = new FeatureStoreMongoDB(features, "ff4j.xml");
Feature f = mongoStore.read("AwesomeFeature");

still investigate...

from ff4j.

hlassiege avatar hlassiege commented on June 8, 2024

Hum... I'm using the same versions

I made a little patch for my purpose and I just check the existence of the field in mapAuthorization method (FeatureDBObjectMapper.java)

        if (dbObject.containsField(ROLES)) {
            for (Object role : (Iterable) dbObject.get(ROLES)) {
                authorisation.add(role.toString());
            }
        }

Could you check with a null value instead of an empty value ?

(I'm sorry, I'm not on this bug right now, I'll try again and I'll give you more informations)

from ff4j.

clun avatar clun commented on June 8, 2024

I also test with the null value and same result. The test for existence was already there but casting as Iterable is a good enough solution work in all cases. I will go this way.

from ff4j.

clun avatar clun commented on June 8, 2024

Corrected in 1.3.1 with the iterable trick

from ff4j.

Related Issues (20)

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.