Look at the example: http://pastie.org/5901177
In that code I create 3 clients and push them into user.clients array. After that I added one more client on a top of user.clients array. So when I do
Client.where('_id').in(user.clients)
I'm getting clients in wrong order. Look at this please via console.
Does anybody know what's problem in my code?
The order of the returned documents is not affected by the order of the array elements of the $in operator used to identify them in a find.
You always need to explicitly sort if you want a specific document order from a find.
Related
I have been working with cts:search in my project but somehow it feels the result time are taking a bit longer than expected. Can search:search help? If so, how?
For example I have the query as
let $query := cts:and-query((cts:element-value-query(xs:QName("Applicability"),"Yes")))
and I want to fetch the document URIs. I was using:
cts:search(collection("abc"), $query)
and it returned the URIs, but how can this be extracted using search:search?
Or is there something other than search can help for improving the execution time?
Are you interested in retrieving the documents, or just the URIs?
If you are only looking to retrieve the URIs of the documents that have an element with that value, then use cts:uris() instead of cts:search(). The cts:uris() function runs unfiltered and will only return URIs from the lexicon, instead of retrieving all of the documents, which can be a lot more expensive than cts:search if you don't need the content.
cts:uris("", (), cts:and-query(( collection("abc"), $query)) )
When using cts:search, the first thing that I would try is to add the unfiltered option to your search and see if that helps.
By default cts:search executes filtered:
A filtered search (the default). Filtered searches eliminate any false-positive matches and properly resolve cases where there are multiple candidate matches within the same fragment. Filtered search results fully satisfy the specified cts:query.
So, try executing the same query with the "unfiltered" option:
cts:search(collection("abc"), $query, "unfiltered")
You could also look to create an index on that Applicability element, with either an element-range-index or a field-range-index, and then use the appropriate range-query instead of a value-query.
Team, I am using FHIR bluebutton for CMS data (Claims data) and
now I want to apply sorting in FHIR data
we are getting bundle of explanation of Benefit(EOB)
https://www.hl7.org/fhir/search.html#sort
I have tried passing date and status params in that _sort
but still not getting sorted data
and I am very much in confusion what to pass as a parameter
suppose I want to sort by ClaimNumber
what to pass, please help and suggest me
You will have to use a search parameter as input for the sorting. For example sorting on last updated date descending would look like this:
GET [base]/ExplanationOfBenefit?_sort=-_lastUpdated
I'm not familiar with which field of ExplanationOfBenefit would hold the ClaimNumber you mention, but if you mean the EOB identifier, the request could be this:
GET [base]/ExplanationOfBenefit?_sort=identifier
If you use the correct syntax, success will still depend on whether the server has implemented sorting on that parameter.
I am doing a query with solr where I need to find documents without a given field say 'name' and I am trying following part;
$q=+status:active -name:["" TO *]'
But it sends both all the documents with and without that field.
Can anyone help me figure this out?
the field name is a normal String type and is indexed.
I am using nodejs. Can anyone help me with this
According to docs:
-field:[* TO *] finds all documents without a value for field
Update
I tried it but it sends even the ones with the field non empty
Then my wild quess is that you are using search query q instead of using filter query fq. Since you are using multiple statements in query I assume that q does some extra magic to get the most relevant documents for you, which can lead to returning some non-wanted results.
If you want to get the strict set of results you should use filter query fq instead, see docs.
Is there a way to do a fetch that only returns a list of all the values a specific attribute in a group of entities.
For example, I have a bunch of User entities and they all have an attribute userId. Is there a way to perform a fetch to get all the userIds without having to fetch everything for every user?
I do not know of a way of doing this with a predicate since usually it is used to match attributes that have a specific value (or at least this is how I use it). For example NSPredicate("id = %#),String(a_id)). Which isn't useful for me in this situation. I also tried using something like request.propertiesToFetch = ["id","lastActivityAt"] in an attempt to do this but with two attributes. However this still resulted in me getting every attribute for the students.
Any ideas? I'm doing this in hopes of quicker fetches.
Thanks!
If you're using propertiesToFetch, you also need to use the dictionary result type. That should do you, though it might not make your fetch quicker.
first of all I'm totally new to FAST but I already have a couple of issues I need to solve, so I'm sorry if my questions are very basic =)
Well, the problem is that I have a field in the FAST index which in the source document is something like "ABC 12345" (please note the intentional whitespaces) but when stored in the index is in the form "ABC 123456" (please note that now there is a single space).
If I retrieve all the document values then this specific value is OK (with all the whitespaces), my only problem is with the way the value is stored in the index since I need to retrieve and display it to my user just like it appears in the original document, and I don't want to go to the full document just for this value, I want the value that I already have in the index. I think I need to update one of the FAST XML configuration files but I don't have enough documentation at hand in order to decide where to perform the change, index_profile.xml? in the XMLMapper file?
I've found the answer by myself. I'm using a XMLMapper for my collection, all I had to do was to add the ignore-whitespace attribute to the Mapping element and then set this attribute value to "false". This solved the problem and the raw data now when retrieved from the index contains the expected inner whitespaces.
Thanks.