So I am trying to run a few queries and need to put them in Month group.
{"_id":{"$oid":"5f1021f15b43e19dabb13a81"},"artist":"Isaac Larson","song":"Network Protocol","station":"PERTHRadio","timeplay":{"$date":{"$numberLong":"1594896360000"}},"__v":{"$numberInt":"0"},"history":["8609f491-97e7-4862-a848-3712aeb2117e","3f102559-307a-45a5-a9fc-eaa84e0ed491"]}
(note picture is of the query above unsure why timeplay has copied from the database that way.
I have tried to use the documentation provided here https://docs.mongodb.com/manual/reference/operator/aggregation/month/
To fetch the month. However I'm having issues saying my query is wrong.
{$month:{'timeplay': new Date("Jul 16, 2020")}}
The error
The provided parameters were invalid. Check your query and try again.
Related
I'm using Sequelize to query my items from the local Postgres database, then I found something really scary.
I just query all database entries of a specific model using:
model.findAll({attributes: ["columnName"]}).then((data) => {
console.log(data.length); // logged: 800
});
Everything looks good, but then I went and bind the Postgres datasource directly from my IDE, opened a console from there and ran the same query to validate the overall number of items returned from Sequelize:
select count(*) from tableOfModel; # returned: 600
I got a shock from that moment as the number of items I was getting was only a total of 600 items and was different from what I got with Sequelize.
What might be wrong here?
I found where the error was: a collaborator changed the database configuration without telling me so, so the database was remotely hosted on server, so everything was okay with Sequelize. I should have noticed it at first :).
We are facing one interesting issue in my production DB.
We are using Db2 data base , after issuing update command(from command center, dqlsuirrel....all) and commit , not able to retrieve the latest data/updated data from select query with UR(It is returning previous data).But if i use the select clause with RR then i am able to see the latest data.
One more interesting thing if update the data today , i can't get the latest by using Select with UR on the same day but i am able to retrive the latest data(which i updated on previous day) on next day (By using select ...from ABC with UR).
I found the problem.
A MQT is created on this base table(XYZ) so whenever i query the against table (XYZ) it is getting data from MQT table/buffer.
Giving a PostId i'm trying to retrieve all the comments attached to this post by using the graphApi. Its simple to retrieve the comments for the first time, i just keep following the next link in the paging propertie of the api response.
But to keep this list of comments up to date i need to retrieve the newly added comments. I tried using the cursor After (stored from the last retrieved page) but it's not working as expected, using the parameter since in the query doesn't work either (seems that it is not supported by the endpoints /comments).
Can please someone gives me an alternative solution?
As i said 'since' is not supported by the endpoint '/comments' because the api use cursors for the pagination (next, after and befor fields).
The use of the cursor 'after' will not work neither, because the its value is valide for a short period of time (docs link)
So my solution was to use an ordred query to get the comments
https://graph.facebook.com/v2.6/[post-id]/comments/&filter=stream&order=reverse_chronological
, i save the created_timeof the first comment as last_update_time. Then the next time i execute my code i check for each comment the time when it has been created if it's grater than the last update time i save it
while (comment.created_time > last_update_time):
comments_list.add(comment)
comment = comments.next()
if (len(comments_list)>0):
last_update_time = comments_list[0].created_time
Posting data to firebase generate new items similar to the following example:
log
-K4JVL1PZUpMc0r0xYcw
-K4jVRhOeL7fH6CoNNI8
-K4Jw0Uo0gUcxZ74MWBO
I struggle to find how to e.g. delete entries that is older than x days - preferably with the REST API. Suggestions appreciated.
You can do a range query.
This technique requires you to have a timestamp property for each record.
Using orderBy and endAt you can retrieve all of the items before a specified date.
curl https://<my-firebase-app>.firebaseio.com/category/.json?orderBy="timestamp"&endAt=1449754918067
Then with the result, you can delete each individual item.
I was trying to using the like function in iReport 4.0.1. Checked online but none seem to work.
Currently trying to use:
where name LIKE'%$P!{px_name}%'
also tried
'%$P{px_name}%'
but when running the report it comes up saying 'No document'.
But when using where name =$P{px_name} it works perfectly fine.
Where clause will be same as you have used in first step which is :-
where name LIKE '%$P!{px_name}%'
But as you said report says 'The document has no pages' means the query is returning 0 row so just use the same string in LIKE and run the same query in database. Simplest solution is first run the query in database with LIKE operator , if it returns the rows in database then that should also work in iReport.