Marklogic to Postgresql - postgresql

Please can some one tell me what will be the equivalent Postgresql query for below marklogic cts query
cts:element-query( xs:QName('party'), cts:query(search:parse( $text )) )
Note : Here 'party' is xml tag in document.

Related

Bulk insert in Mongodb and Postgresql

I am doing a comparison on Postgresql vs Mongodb on insert.I am using the copy command (from file to table) in Postgresql and i am wondering what is the equivalent command in mongodb.I think that the answer is the insert_many(dict)But i want be sure.Any advice would be appreciated.Thanks in advance!
If you want to insert multiple documents in mongodb, you can use
db.collectionName.insertMany([{title: 'doc 1'},{title: 'doc2'},......]}

MongoDb db.collection.find() With Special Character

I am trying to write a simple query in MongoDb using PyMongo driver as such
mongo.db.people.find_one({'name': 'Tést Name'})
mongo.db.people.find_one({'name': 'Test_O%27Name'})
Both of these queries are returning null. I have checked to make sure the data exists in the db. How do I change the query so that find() is able to find it?
Thanks
You can use like this
db.myCollection.find({ myKey : /.*\$tes.*/i });
You have to escape $ by :

What should be the query for delete field from mongo db collection on groovy language

What should be the query for delete field from mongo db collection on groovy language
I am looking to delete parameter from collection.
normal mongo db query its working
db.users.updateOne({"userId.name":"LastName"},{$unset:{nationality:"",occupation:"",friendlyName: ""}});
but using groovy it doesn't
collection.deleteMany(eq("userId.name", "Lastname"),combine(set("nationality", ""),set("occupation", ""),set("friendlyName", "")));
with this query it doesnt work.
You don't need this combine bit as for the user removal you don't need to unset the nationality, occupation and friendlyName
Consider using MongoCollection.deleteOne() function and provide only userId.name attribute like:
def deleteResult = collection.deleteOne(eq("userId.name", "LastName"))
More information: MongoDB Performance Testing with JMeter

Find hashed data with MongoDB

Is it possible with MongoDB to find data by its hash?
I'm trying to find the MongoDB equivalent of this MySQL query:
SELECT column FROM table WHERE SHA1(column) = "value"
It doesn't seems there is any such functionality (a bit old, but couldn't find in docs.mongodb.com either), but you can include a library that contains sha1 functionality (e.g. js-sha1) in mongo shell with load function, then use it within your mongo operation.

Alternative for mongodb $push function in postgres

Converting the MongoDb queries into postgresql.
In mongoDb we the basic usage of $push is as follows :
https://docs.mongodb.org/v3.0/reference/operator/aggregation/push/
Is there any alternative for this in postgresql or we need to implement it using the code.
You can do this using array_agg function in Postgres.
See Sample code(shamelessly copied ) : http://www.sqlfiddle.com/#!15/21b2b/1