Spring-Data-LDAP alternative for "in" query - spring-data-ldap

Is there any alternative for IN queries in Spring-Data-LDAP?
I'm facing a problem in order to retrieve users from an email list:
The Spring-Data query is something like the following:
this.ldapUserRepository.findByEmailIn(emailList);
where emailList is a List<String> and the error is the following:
IN (1): [IsIn, In] queries are not supported for LDAP repositories

Related

How do I write this query without using raw query in sequelize?

I would like to a bulk update in sequelize. Unfortunately it seems like sequelize does not support bulk updates I am using sequelize-typescript if that helps and using postgresql 14
My query in raw SQL looks like this
UPDATE feed_items SET tags = val.tags FROM
(
VALUES ('ddab8ce7-afa3-824f-7b65-edfb53a71764'::uuid,ARRAY[]::VARCHAR(255)[]),
('ece9f2fc-2a09-4a95-16ce-07293b0a14d2'::uuid,ARRAY[]::VARCHAR(255)[])
) AS val(id, tags) WHERE feed_items.id = val.id
I would like to generate this query from a given array of string and array values. The tags is implemented as a string array in my table.
Is there a way to generate the above query without using raw query?
Or an SQL injection safe way of generating the above query?

Disable Schema Validation for Cosmos DB?

I'm using Cosmos DB in Azure. I recently changed the schema to add more information. However, I'm confused because Cosmos uses SQL to query the database. Further, it seems I can't query based on the new schema because I receive the following error messsage:
Message: {"errors":[{"severity":"Error","location":{"start":22,"end":29},"code":"SC2001","message":"Identifier 'comment' could not be resolved."}]}
So I'm wondering is it possible to disable schema validation so I can query on the new comment attribute, without getting this error message.
Further, I'm confused how Cosmos DB can be considered a NoSQL database if it behaves much the same as MySQL.
Edit: The query I am using is
SELECT * FROM c
WHERE comment = ""
The error is not related to the schema, the error is saying your query is incorrectly written.
Following the official documentation (for example, https://learn.microsoft.com/azure/cosmos-db/sql/sql-query-getting-started#query-the-json-items)
The query should be:
SELECT * FROM c
WHERE c.comment = ""
Keep in mind that that query is not checking for documents that do not have the comment property, it's basically filtering documents that do have the comment property with an empty string value.

Marklogic QueryByExample in collection NodeJS

TLDR
Is there a way to limit queryByExample to a collection in NodeJS?
Problem faced
I have a complex query with some optional fields (i.e. sometimes some search fields will be omitted). So I need to create a query dynamically, e.g. in JSON. QueryByExample seems to be the right tool to use here as it gives me that flexibility to pass a JSON. However my problem is that I would like to limit my search to only one collection or directory.
e.g. I was hoping for something like
searchJSON = {
title: { $word: "test" },
description: { $word: "desc" }
};
//query
db.documents.query(qb.where(
qb.collection("collectionName"),
qb.byExample(searchJSON)
)).result()...
In this case searchJSON could have been built dynamically, for example maybe sometimes title may be omitted from the search.
This doesn't work because the query builder only allows queryByExample to be the only query. But I'd instead like to built a dynamic search query which is limited to a collection or directory.
At present, I think you would have to express the query with QueryBuilder instead of Query By Example using
qb.and([
qb.collection('collectionName'),
qb.word('title', 'test'),
qb.word('description', 'desc')
])
See http://docs.marklogic.com/jsdoc/queryBuilder.html#word
That said, it should be possible for the Node.js API to relax that restriction based on the fixes in MarkLogic 9.0-2
Please file an issue on https://github.com/marklogic/node-client-api

Private fields with sql query

I recently changed my queries on the SQL database from
Model.findOne().populate("Model2").exec(function(err, result) {
})
to :
Model.query(sqlQuery, parameters, function(err, result) {
})
The reason I changed the queries are performances problems : it goes much faster using the second way than the first one (when you join tables).
My question is the following : Using the Waterline syntax, I was able to retrieve only the elements I wanted (elements defined in the model), but using the query method ("Select * from model ...") gives me the result I ask to the database, but I'd like to be able to filter the fields that are defined in my model. Is that possible?.
Your model definitions are on the sails.models.MODEL object.
You could reference the available attributes there.
Object.keys(sails.models.MODEL._attributes).join(',')

ldap queries for an OU in knowing tree structure

I 'm trying 2 things in an tool called Itop on a Centos desktop.
I post here because it's about general ldap queries. I'm trying my queries with ldap explore and Itop.
1.import several users from an OU but it's not working.
My ldap query maybe isn't good:
(&(objectCategory=organizationalUnit)(memberOf=CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=mydomain,DC=local))
or
(&(objectCategory=user)(memberOf=OU=Users,OU=Informatique,OU=Administration,DC=mydomain,DC=local))
knowing that my tree structure is like that:
DC=mydomain,DC=local => OU=Administration => OU=Informatique, OU=Users
2.import a specific user:
(objectcategory=user)((cn=seb))
The query is working but I have an error in Itop perhaps a field missed:
error:
An error occured while processing 1: Object not following integrity rules: issues = Unexpected value for attribute 'name': Null not allowed, Unexpected value for attribute 'email': Wrong format [seb#mydomain.local], class = Person, id =
How resolve that? with which queries?
Thanks,
seta
I can try to help you with the query. The (memberOf=parameter) filter is for groups, not OUs. An LDAP query has three components: base, filter, and scope. If you want all the users in your OU, then you need to set
base to the OU's distinguished name
OU=Users,OU=Informatique,OU=Administration,DC=mydomain,DC=local
filter to get only users
(objectCategory=user)
scope to Subtree (or OneLevel if you don't want to search the OU's underneath the target OU).

Resources