syntax error at or near "WHERE" in findOne (typeorm - nestjs) - postgresql

Error in findOne() (getPhonById)
Full error in following images:
Error screenshots: https://imgur.com/a/joHuo3Y
Tried deleting table and creating new, tried using find() but same question.
code in screenshots above
expected 1 record from db

Looks fine to me, I've replicated it only difference being that i use mySQL and it works. You can add a line to your typeorm.config.ts file: logging: true,
it will output your query to the console and then you can see what's wrong with it.

Related

How to eliminate Query error: 403 in Grafana? Example is a Substring

I'm trying to receive a result similiar to '13:49:31' in this panel. Here is the code:
select SUBSTRING(CONVERT(VARCHAR,DATEADD(HOUR,-3,SYSDATETIME())),12,8)
This is the message: "Query error: 403"
I copied the code and executed it at SQL Server Management Studio and it worked.
If I remove the substring function, it works. Like this "select CONVERT(VARCHAR,DATEADD(HOUR,-3,SYSDATETIME()))"
However, I really need this format '13:49:31'

Mongodb: How to drop a collection named "stats"?

I created a collection named "stats" but whenever I try to delete it by using db.stats.drop() cmd line. It shows an error.
TypeError: db.stats.drop is not a function
Even tried this.
db["stats"].drop
Any solution?
if the collection exists db.stats.drop() should work (depending on the mongodb version maybe) or else perhaps db.getCollection("stats").drop();
but if all else fails, run: db.runCommand({drop : "stats"}) this should drop it if it exists without any error at least.

Update in MongoDB Meteor

Is there any scenario that explains why the update is not working, I can't seem to pinpoint the cause and I don't see any errors whatsoever. Is there a way to check the output of the update function because currently the update is not doing anything. That means the last log line shows a value different than 20170615-7702.
Db.find().forEach(function(item){
console.log(item._id+ " =======> " + item.build.parameters.BUILD_NUM);
Db.update({"_id":item._id}, {$set:{"build.parameters.BUILD_NUM":"20170615-7702"}});
console.log(Db.findOne({"_id": item._id}).build.parameters.BUILD_NUM);});
Thank you
The code above should work. I think that the problem above is that it is not able to update the document as fast as it prints the output. First try:
var itemUpdated = Db.findOne({"_id": item._id});
console.log(itemUpdated._id)
The other option is very simple go to the command line and run meteor mongo. Then see all the entries in the collection and their properties.
Third and maybe the best option to test here is to use setTimeout() for the console.log().
Hope it helps.

Progress DB charindex syntax error

I'm trying to create a query in progress DB that gets the name portion off the email address. This is what I have so far:
substring("PUB"."NAME"."INTERNET-ADDRESS", 1, CHARINDEX('#', "PUB"."NAME"."INTERNET-ADDRESS") ) as Name
However, I'm getting a syntax error around the CHARINDEX(...
I'm not a progress guy and knowing SQL is just enough to get me into trouble...
Do you see the error in my ways?
Try this:
substring("PUB"."NAME"."INTERNET-ADDRESS", 1, INSTR("PUB"."NAME"."INTERNET-ADDRESS",'#') ).
Here you have the entire suite of documentation:
https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1329.openedge-product-documentation-overview

Julia MongoDB save raw variable

I would like to save some variables in Julia to a database using MongoDB. I ran into a problem when using the following function:
insert(client, "myDB.rawInfo", { "raw" => status})
This works when saving simple information, like strings or ints. However, status is of type Array{Any,1}. When saving, I get the following error message:
`build` has no method matching build(::Ptr{None}, ::Dict{String,Any})
while loading In[256], in expression starting on line 18
in append at C:\Users\Guido\.julia\v0.3\Mongo\src\BSON.jl:225
in append at C:\Users\Guido\.julia\v0.3\Mongo\src\BSON.jl:231 (repeats 2 times)
in build at C:\Users\Guido\.julia\v0.3\Mongo\src\BSON.jl:207
in BSONObject at C:\Users\Guido\.julia\v0.3\Mongo\src\BSON.jl:82
in find_one at C:\Users\Guido\.julia\v0.3\Mongo\src\Mongo.jl:30
in find_one at C:\Users\Guido\.julia\v0.3\Mongo\src\Mongo.jl:34
Can anyone help me?
There seems to be something wrong with the MongoDB package for Julia which causes the malfunction of nested variables. A fix has been made a while ago and can be applied by manually reinstalling this version of MongoDB for Julia (first uninstall, than manually reinstall): https://github.com/rened/Mongo.jl