Thanks for your reply, and yes i am well aware about DATE command and its relevant formats, kindly follow my first post carefully as i mentioned that i cannot use any ls options because i am getting file listing from ftp server. Is there any command which can give me desired result directly from ftp while using ls?
TIA
--- Post updated at 07:10 PM ---
Thank you @Ravinder,
I understood very well what you explained. Also can you tell me what if i have to extract year if i get input like this:
Here 2019 is not whole word rather part of second field, tried using substr but not able to get the idea that how to nest split and substr function.
Hi all ..
As per rule i searched the forum i am not able found out ...
I want to display the year in when listing the files .. when i use ls -lt it is not displaying files with recent 6 month old ..
I know that perderabo has written a script for that if you give that link it will be... (3 Replies)
Hi,
When retrieving parameters of a file using ls command i need to print the year part . When i do ls -ltr the following output is displayed
-rwxrwxrwx 1 d_infd d_infd 1711 Jan 8 2004 wf1.class.
Here the year part is not displayed only Jan 8 is displayed.
Can any one... (9 Replies)
Hi All,
i want the last login details along with year.
i tried below command but not giving me the year of last login.
last <$Userid> | head -1
i heard that if it is current year then it wont display the year else it will display the year. is it so?
if yes then , is there any way of... (1 Reply)
Hi All,
i want the last login details along with year.
i tried below command but not giving me the year of last login.
last <$Userid> | head -1
i heard that if it is current year then it wont display the year else it will display the year. is it so?
if yes then , is there any way of... (1 Reply)
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Hi Guys, I'm trying to identify the last logins by all the users in the system in AIX. the last command gives me the output, but there is no year displayed for it . Since there is a duplication of months i mean Apr 2010 and Apr 2009 also its giving me inaccurate data.. Is there a way I can filter... (4 Replies)
Hi,
Well my title isn't very clear I think. So to understand my goal:
I have a script "test1"
#!/bin/bash
xvkbd -text blabla
with xbindkeys, I bind F5 key in order it runs my test1 script
So when I press F5, test1 runs.
I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
What is the uptime command output when the server is running more than one year?
My doubt is whether it show in number of days format or number years and number of days format?
For example, Assume the server is running 400 days 3 hrs 3 min 3 secs. The output like 400 days 3:3 min or 1 year 5... (3 Replies)
hi all,
I use
date +%Y
which gives Current year.
Requirement: I want previous year to be printed. Please help me.
Note: I tried
date +%d/%m/%Y -d "-1 years" which is not working. (10 Replies)
Discussion started by: wasim999
10 Replies
LEARN ABOUT PHP
mongocollection.aggregatecursor
MONGOCOLLECTION.AGGREGATECURSOR(3) 1 MONGOCOLLECTION.AGGREGATECURSOR(3)MongoCollection::aggregateCursor - Execute an aggregation pipeline command and retrieve results through a cursor
SYNOPSIS
public MongoCommandCursor MongoCollection::aggregateCursor (array $command, [array $options])
DESCRIPTION
With this method you can execute Aggregation Framework pipelines and retrieve the results through a cursor, instead of getting just one
document back as you would with MongoCollection::aggregate. This method returns a MongoCommandCursor object. This cursor object implements
the Iterator interface just like the MongoCursor objects that are returned by the MongoCollection::find method.
Note
The resulting MongoCommandCursor will inherit this collection's read preference. MongoCommandCursor::setReadPreference may be used
to change the read preference before iterating on the cursor.
PARAMETERS
o $pipeline
- The Aggregation Framework pipeline to execute.
o $options
-Options for the aggregation command. Valid options include:
o "allowDiskUse"Allow aggregation stages to write to temporary files
o "cursor" It is possible to configure how many initial documents the server should return with the first result set. The
default initial batch size is 101. You can change it by adding the batchSize option:
<?php
$collection->aggregateCursor(
$pipeline,
[ "cursor" => [ "batchSize" => 4 ] ]
);
MongoCommandCursor::batchSize method on the returned MongoCommandCursor object.
o "explain" Return information on the processing of the pipeline. This option may cause the command to return a result docu-
ment that is unsuitable for constructing a MongoCommandCursor. If you need to use this option, you should consider using
MongoCollection::aggregate.
o "maxTimeMS"Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If
the operation is not completed within the timeout period, a MongoExecutionTimeoutException will be thrown.
RETURN VALUES
Returns a MongoCommandCursor object. Because this implements the Iterator interface you can iterate over each of the results as returned
by the command query. The MongoCommandCursor also implements the MongoCursorInterface interface which adds the MongoCommandCursor::batch-
Size, MongoCommandCursor::dead, MongoCommandCursor::info methods.
EXAMPLES
Example #1
MongoCollection.aggregateCursor(3) example
Finding all of the distinct values for a key.
<?php
$m = new MongoClient;
$db = $m->test;
$people = $db->people;
$people->drop();
$people->insert(array("name" => "Joe", "points" => 4));
$people->insert(array("name" => "Molly", "points" => 43));
$people->insert(array("name" => "Sally", "points" => 22));
$people->insert(array("name" => "Joe", "points" => 22));
$people->insert(array("name" => "Molly", "points" => 87));
$ages = $people->aggregateCursor( [
[ '$group' => [ '_id' => '$name', 'points' => [ '$sum' => '$points' ] ] ],
[ '$sort' => [ 'points' => -1 ] ],
] );
foreach ($ages as $person) {
echo "{$person['_id']}: {$person['points']}
";
}
?>
The above example will output something similar to:
Joe: 26 Sally: 22
Example #2
MongoCollection.aggregateCursor(3) example with different initial batch size
Finding all of the distinct values for a key.
<?php
$m = new MongoClient;
$db = $m->test;
$people = $db->people;
$people->drop();
/* Insert some sample data */
$people->insert(array("name" => "Joe", "points" => 4));
$people->insert(array("name" => "Molly", "points" => 43));
$people->insert(array("name" => "Sally", "points" => 22));
$people->insert(array("name" => "Joe", "points" => 22));
$people->insert(array("name" => "Molly", "points" => 87));
/* Run the command cursor */
$ages = $people->aggregateCursor(
[
[ '$group' => [ '_id' => '$name', 'points' => [ '$sum' => '$points' ] ] ],
[ '$sort' => [ 'points' => -1 ] ],
],
[ "cursor" => [ "batchSize" => 4 ] ]
);
foreach ($ages as $person) {
echo "{$person['_id']}: {$person['points']}
";
}
?>
The above example will output something similar to:
Joe: 26 Sally: 22
SEE ALSO
MongoDB::command, MongoCommandCursor, MongoCommandCursor::batchSize, MongoCollection::aggregate, The MongoDB aggregation framework.
PHP Documentation Group MONGOCOLLECTION.AGGREGATECURSOR(3)