我正在尝试执行此mongodb查询:
int get_next_line(int fd, char **line)
{
char *buff;
int bwr;
char *ptr;
int bol;
static char *rem;
bol = 1;
buff = (char *)malloc(sizeof(char) * (BUFFER_SIZE + 1));
if(rem)
{
*line = ft_strdup(rem);
printf("---1ST---%s\n", rem);
free(rem);
printf("---2ND---%s\n", rem);
}
else
*line = ft_strdup("");
while (bol && (bwr = read(fd, buff, BUFFER_SIZE)))
{
buff[bwr] = '\0';
if ((ptr = ft_strchr(buff, '\n')))
{
rem = ft_strdup(ptr + 1);
*ptr = '\0';
bol = 0;
}
*line = ft_strjoin(*line ,buff);
}
return(0);
}
但是我遇到了这个错误:
db.getCollection('collection').aggregate([
{$project: {yearMonthDay: { $dateToString: { format: "%Y-%m-%d", date: "$date" } }}},
{$match: { yearMonthDay: { $eq: "2018-03-02" } }}
]).count()