Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Andrea Di Cesare
    @ujibang
    We need to add a new type. It's quite simple and will add to next release....
    If you add a issue on github it will help!
    Andrea Di Cesare
    @ujibang

    H @jdimi_gitlab I double checked, I think that you can use graphql type Long to map mongodb type BsonInt64

    see https://github.com/SoftInstigate/restheart/blob/master/graphql/src/main/java/org/restheart/graphql/scalars/bsonCoercing/GraphQLBsonInt64Coercing.java

    John DiMiceli
    @jdimi_gitlab
    Absent a creating a custom class copying the techniques of GraphQLBsonInt64Coercing.java, substituting Long for Int in the schema results in this error: "... GraphQLIllegalAppDefinitionException... The Field type 'Long' is not present when resolving type 'MyType'"
    Andrea Di Cesare
    @ujibang
    I pushed 8d6acdb that shouyld fix it . You can try the snapshot build. See how at https://github.com/SoftInstigate/restheart/blob/master/README.md#snapshot-builds
    Andrea Di Cesare
    @ujibang
    Urg build failed, will fix it tomorrow!
    Andrea Di Cesare
    @ujibang

    ok fixed @jdimi_gitlab . you can try 92b51be

    note: you need java 17 to run this snapshot release!

    With the following GraphQL app definition
    {
      "_id": "testLong",
      "descriptor": {
        "name": "TestLong",
        "description": "GraphQL App to test Long scalar",
        "enabled": true,
        "uri": "testLong"
      },
      "schema": "type Test{  _id: ObjectId n: Long  } type Query { all: [Test] }",
      "mappings": {
        "Test": {
        },
        "Query": {
            "all": {
              "db": "restheart",
              "collection": "test"
            }
          }
      }
    }
    creating in the collection test documents like
    {
        "n": {
            "$numberLong": "2398239058230985"
        }
    }

    the following GraphQL request works as expected

    { all { _id n  } }

    reponse

    {
        "data": {
            "all": [
                {
                    "_id": {
                        "$oid": "61b8d1502b29d754e337350c"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d1512b29d754e337350f"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d1632b29d754e3373514"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d16c2b29d754e3373518"
                    },
                    "n": 2398239058230985
                },
                {
                    "_id": {
                        "$oid": "61b9b25bbb8a4542b608c7ea"
                    },
                    "n": 2398239058230985
                }
            ]
        }
    John DiMiceli
    @jdimi_gitlab
    Thanks! Don't know if I'll be able to use your snapshot, but care to predict when the next versioned release will have it?
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab se will release the fix by next week
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab we added a more complete description of the GraphQL/Bson types mapping at https://restheart.org/docs/graphql/#bson-types
    the Long-> BsonInt64 mapping will be in 6.1.5 (out very soon)
    Andrea Di Cesare
    @ujibang
    6.1.5 is out!
    Harald Wiesinger
    @s3ppo
    @ujibang i heard about the log2shell security problem for java software.. is this relevant to restheart? ;)
    Andrea Di Cesare
    @ujibang
    No, RESTHeart does not use Log4j
    🍾
    Harald Wiesinger
    @s3ppo
    🎉🥳🥳
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab we found a bug in 6.1.5, going to release 6.1.6 soon. Please update!
    Maurizio Turatti
    @mkjsix
    Maurizio Turatti
    @mkjsix
    henczi-espirit
    @henczi-espirit

    Hello all. I am Nico from e-Spirit and I have a question:
    I wanted to know which query parameters do NOT have the form ?key=value (so for example ?count or ?np). For this I tried to find in the documentation some kind of list of all possible query parameters. Unfortunately I had no success with it. Is there such a list?

    Additionally, I noticed that ?count and ?np no longer exist in the current v6 documentation. I haven't looked through all the release notes yet, but I guess this means that these parameters are deprecated?

    Thanks in advance.
    I hope you had a good start into the new year.

    Ghost
    @ghost~61d5c9a96da03739848db0c8

    Hello everyone,

    I have a simple question, but cannot figure a way out to work. I would like to use RESTHeart with docker and connect to a remote database. However, I don’t really know how to do so.

    In the default.properties file I change the mongo-uri and root-mongo-resource. I tried to connect to a local database running on localhost and to a hosted database on DigitalOcean, neither works. Do I have to change anything else?

    Maurizio Turatti
    @mkjsix
    if you look at the docs at https://hub.docker.com/r/softinstigate/restheart
    3) Run a RESTHeart container
    
    docker run -d --rm --network restheart-network -p "8080:8080" -e MONGO_URI="mongodb://mongodb" softinstigate/restheart
    2 replies
    so you need to pass the MONGO_URI
    if you are running with docker-compose you just need to edit the MONGO_URI environment variable in the docker-compose.yml (https://raw.githubusercontent.com/SoftInstigate/restheart/master/docker-compose.yml)
    11 replies
    Alternatively you need to run the docker container mounting a docker volume overriding the restheart.propeties file, the local one is immutable
    Maurizio Turatti
    @mkjsix
    @tolbri if you have issues with this let us know
    Andrea Di Cesare
    @ujibang
    image.png

    hi @henczi-espirit , the query parameters that don't require a value (although you can actually set one as in ?checkEtag equals to ?checkEtag=whatever) are: ?checkEtag, ?count and ?np

    Note that HAL representation is deprecated (in favour of standard representation, see https://restheart.org/docs/representation-format/#other-representation-formats).

    1 reply
    HAL and SHAL are deprecated in version 6.0 and will likely be removed in a future release.
    Andrea Di Cesare
    @ujibang

    hi @tolbri , we have updated the documentation. http://127.0.0.1:4000/docs/setup/#run-with-docker

    If you want to run RESTHeart with docker and have MongoDB running on localhost you can just run the following command

    $ docker run -it --rm -p "8080:8080" -e MONGO_URI='mongodb://host.docker.internal' softinstigate/restheart
    Harald Wiesinger
    @s3ppo
    @ujibang after last docker pull my container dont come up.. are there any breaking changes to last version?
    i got:
    09:54:16.741 [main] ERROR org.restheart.Bootstrapper - Unmatched argument at index 1: '/rh/etc/restheart.yml' Usage: java -Dfile.encoding=UTF-8 -jar -server restheart.jar [-hv] [--fork]
    Andrea Di Cesare
    @ujibang
    Hi @s3ppo yes we changed the Dockerfile of the native image to align with the structure of the other images
    This means that the configuration file should be mounted under /opt/restheart/etc/restheart.yml (before was /rh/etc/restheart.yml)
    and the corresponing new docker-compose-native.yml at https://github.com/SoftInstigate/restheart/blob/master/docker-compose.yml
    Andrea Di Cesare
    @ujibang
    you also don't need to pass the argument /rh/etc/restheart.yml, it points to /opt/restheart/etc/restheart.yml by default
    Harald Wiesinger
    @s3ppo
    @ujibang thank you, its up again :-)
    Andrea Di Cesare
    @ujibang
    @s3ppo well done!
    A Sadeghioon
    @Babamon_gitlab
    Hi everyone , I have migrated from postgresql to mongoDB and started using restheart and I have to say I love it, however I had a question that I cannot find the answer to. Is it possible to request the data as CSV ? I know it is possible to upload but is it possible to also download ? Thank you for your help in advance
    Andrea Di Cesare
    @ujibang
    Hi @Babamon_gitlab, you can transform the response developing an Interceptor, see https://restheart.org/docs/plugins/core-plugins/#interceptors
    Andrea Di Cesare
    @ujibang
    I'm posting here a possibile implementation
    @RegisterPlugin(name = "csvTransformer",
        interceptPoint = InterceptPoint.RESPONSE,
        description = "transform the response to CSV format",
        enabledByDefault = true)
    public class CsvTransformer implements MongoInterceptor {
        @Override
        public void handle(MongoRequest request, MongoResponse response) {
            var docs = response.getContent().asArray();
            var sb = new StringBuilder();
    
            // add the header
            if (docs.size() > 0) {
                docs.get(0).asDocument().keySet().forEach(k -> sb.append(k).append(","));
                sb.append("\n");
            }
    
            // add rows
            docs.stream()
                .map(BsonValue::asDocument)
                .forEach(fdoc -> {
                    sb.append(fdoc.entrySet().stream()
                        .map(e -> e.getValue())
                        .map(v -> BsonUtils.toJson(v))
                        .collect(Collectors.joining(",")));
    
                    sb.append("\n");
                });
    
            response.setContentType("text/csv");
    
            response.setCustomSender(() ->  response.getExchange().getResponseSender().send(sb.toString()));
        }
    
        @Override
        public boolean resolve(MongoRequest request, MongoResponse response) {
            return request.isGet()
                && request.isCollection()
                && response.getContent() != null
                && request.getQueryParameterOfDefault("csv", null) != null;
        }
    }
    with it
    $ http -b -a admin:secret :8080/coll\?csv
    _id,a,_etag,
    {"$oid":"6202562ce5078606d08b79e2"},1,{"$oid":"6202562ce5078606d08b79e1"}
    {"$oid":"62025626e5078606d08b79df"},1,{"$oid":"62025662e5078606d08b79e5"}