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
    @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"}
    I'm going to add it to the restheart examples repo https://github.com/softInstigate/restheart-examples in the following days
    A Sadeghioon
    @Babamon_gitlab
    @ujibang Thank you so much for your help ,
    @ujibang I will try to learn how to use the plugin , one more question if I want to GET the full collection not using the csv (can be very large ) with normal Get command it only returns a small section of it. is there a limit on the return size and also how can I get back the whole thing
    Andrea Di Cesare
    @ujibang
    Hi @Babamon_gitlab , you cannot get back the whole collection. The response are paginated, see https://restheart.org/docs/mongodb-rest/read-docs/#paging
    You need to keep sending requests GET /coll?page=1, GET /coll?page=2,…. until you reach the page with an empty array.
    Ming Fang
    @mingfang
    I like to share a my set of Terraform modules to run RESTHeart and MongoDB inside Kubernetes.
    https://github.com/mingfang/terraform-k8s-modules/tree/master/examples/mongodb
    A Sadeghioon
    @Babamon_gitlab
    @ujibang Thank you for the CSV output modification, I think its a great addition to restheart for larger datasets with fixed structures as the transfer sizes are significantly smaller (almost half) than Json as you dont need to transfer keys all the time
    A Sadeghioon
    @Babamon_gitlab
    Just curios is are there any downside of using large page sizes (i.e. 1000) compared to the default 100)
    Andrea Di Cesare
    @ujibang
    Hi @mingfang, thanks for the contribuition. It looks very interesting and we will give it a look and link it into the documentation...
    Andrea Di Cesare
    @ujibang
    @Babamon_gitlab regarding your question about the pagesize, it depends on the size of documents. MongoDB allows to create documents up to 16Mbytes. If you have large documents, a big pagesize can result in a significant network and bson to json conversion overhead. So you need to adjust the pagesize according to your use case.
    In the configuration file you'll find few options that allow you to tune the read performance
    ## Read Performance
    
    # default-pagesize is the number of documents returned when the pagesize query
    # parameter is not specified
    # see https://restheart.org/docs/mongodb-rest/read-docs#paging
    default-pagesize: 100
    
    # max-pagesize sets the maximum allowed value of the pagesize query parameter
    # generally, the greater the pagesize, the more json serializan overhead occurs
    # the rule of thumb is not exeeding 1000
    max-pagesize: 1000
    
    # cursor-batch-size sets the mongodb cursor batchSize
    # see https://docs.mongodb.com/manual/reference/method/cursor.batchSize/
    # cursor-batch-size should be smaller or equal to the max-pagesize
    # the rule of thumb is setting cursor-batch-size equal to max-pagesize
    # a small cursor-batch-size (e.g. 101, the default mongodb batchSize)
    # speeds up requests with small pagesize
    cursor-batch-size: 1000