How do I fetch data using a temporary view with ektorp. I would like to pass the map javascript function to couchdb as a string and get the results. (This is definitely possible with CouchDB4J)
Fortunately CouchDB have well-documented API and you can do this using HttpURLConnection. That's not the easiest way, but that will work in any case
Related
Is it a bad practice to use a template engine to restructure a JSON object? Of course i can do it manually but i want to avoid the null check route if possible.
Update: Can those who downvoted at least explain why?
For something like XPath for JSON, use JSONPath:
http://goessner.net/articles/JsonPath/
https://github.com/s3u/JSONPath
JSONPath produces an array of items matching the selection. You can combine that with JavaScript array forEach method to do most of what is typically done in XSLT templates.
Alternatively, you can use jsonpath-object-transform which provides a little bit more in the way of templates:
https://github.com/dvdln/jsonpath-object-transform#readme
I'm working on a server query engine that will return FHIR resources and I've run into a problem.
I can successfully receive an Get and Search queries that use simple parameters (like Composition/4 or Patient?name=smith) but I can't get it to recognize more complex, and useful, parameters like Composition?subject:Patient=4 or type=[system]|[value].
How are these types of parameters passed and what should I be looking for on the server?
if you look at the bottom of the Composition page, you'll see this has a search param called "type", which is of type "token". As you already found out yourself, this has the form
[system]|[value]
where the system is a full url. Some common systems in use can be found here: http://hl7.org/fhir/2015May/terminologies-systems.html
In this case, you should be using type=http://loinc.org|60591-5
The formats of all more complex search params can be found on the search documentation page (http://hl7.org/fhir/2015May/search.html#2.1.1.1).
If you need an example of how to implement search for this, take a look at the open-source .NET implementation called Spark: https://github.com/furore-fhir/spark
Which table in Liferay stores the predefined values given for a structure.
Also is there a facility in Liferay to populate these values dynamically using webservices?
The API used to be JournalStructureService, however, as the documentation states, this has been replaced with the Dynamic Data Display API, which, for example, you can find under DDMStructureService in version 6.2.
This gives you a hint where to find the underlying data, however, you don't want to manually write to the database. You do want to use the API to change values. Trust me. Consider the database to be an implementation detail and leave it alone - if nothing else to make your next upgrade experience easier. You should never change any values in the database manually without knowing exactly what you're doing. And, trust me, the keyword here is "exactly", and you'll fail to know all the possible side effects. Don't touch it.
As said #Olaf, depends on Liferay version you will need to use the JournalStructureService or the DDMStructureService. So, if you want to use the Liferay Service by web api you have two options the Axis api where you can obtain WSDL (domain:port/api/axis) or you can use the Json api (domain:port/api/axis). In many cases you are going to need a token to use this services.
Are there a good way to get async data from an EJS file?
Sails.js only have async methods to get data from a database.
I have a collection of Pages with their associated content Values. In some cases I want to get a specific Value from another Page (e.g.: in a related page module, a navigation module...). And I need to do that server side, to keep the front-end part SEO friendly.
The easier way should be to retrieve all the Pages and Values inside the controller, and then expose a function to my EJS to get the specific data I need. But I really don't want to retrieve each time all the data from a collection.
I'm working on a CMS so I would avoid creating a new controller/view for each specific cases that I will have.
EDIT:
It seems there is no good way to do that, so I reworked my controller to make it a bit more intelligent. It solve my problem for now.
Assuming I understand you correctly....
data is sent to the view by passing an object into the view funciton
return res.view({data: "important data"});
I'm guessing that you want to call a method for some specific data mid-render. Because having all the data ready on the res.view() call is too slow. As far as I know this is not possible. That would almost certainly be "blocking" code.
Best option I could recommend is to grab specific data using ajax on the client after page load. One of the best features of using sails :)
From using other frameworks I've gotten used to not building out and mapping forms to db objects manually. Since using node.js and mongoose. I'm looking for a form builder that allows the following:
automatically maps mongoose objects to form fields
handles both 'new' and 'update' use cases
allows class injection around form fields for styling
includes validation
allows one to add custom fields
Does anyone know of any such form builders for node.js, express, mongoose?
I haven't used it, or looked at it in depth, but https://github.com/oJshua/mongoose-forms looks like it may be of interest.
I know this is kind of old discussion but I just wanted to recommend checking out Formage (npm: formage)
https://github.com/Empeeric/formage
Setup is easy and straightforward. You can check it out in matter of minutes and hopefully this can help you.