将MongoDB查询转换为mongoexport

将MongoDB查询转换为mongoexport,mongodb,mongoexport,Mongodb,Mongoexport,我有以下Mongo查询 db.CustUser.find( {"transactionData": {"$elemMatch": {"createdAt": {"$lte": ISODate("2013-07-15T00:00:00Z")}}}, "emailsSubscribed": true}, {"fname": 1, "email": 1, "_id": 0}).limit(150000).sort({"_id": -1}) 我正在尝试将结果导出到CSV。mongoexport能够进行

我有以下Mongo查询

db.CustUser.find(
{"transactionData": {"$elemMatch": {"createdAt": {"$lte": ISODate("2013-07-15T00:00:00Z")}}}, "emailsSubscribed": true},
{"fname": 1, "email": 1, "_id": 0}).limit(150000).sort({"_id": -1})
我正在尝试将结果导出到CSV。mongoexport能够进行这样的查询吗?感谢您的帮助


使用MongoDB版本2.2.3

Mongoexport版本2.2.x可以完成一些任务—查询和排序。它不支持限制-该选项在2.6版中受支持

查询将作为json文档传递给mongoexport:

--查询

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
您可以通过$orderby进行排序(未记录,但这里有一个很好的讨论):

例如:

--query '{ $query: {}, $orderby: {count: -1} }'
在版本2.6之前不支持限制:

--限制

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
2.6还有不同的排序语法:

--排序

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
超过32兆字节

Use --sort conjunction with --skip and --limit to limit number of exported documents.
链接:


Mongoexport 2.2.x版可以执行一些操作—查询和排序。它不支持限制-该选项在2.6版中受支持

查询将作为json文档传递给mongoexport:

--查询

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
您可以通过$orderby进行排序(未记录,但这里有一个很好的讨论):

例如:

--query '{ $query: {}, $orderby: {count: -1} }'
在版本2.6之前不支持限制:

--限制

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
2.6还有不同的排序语法:

--排序

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
超过32兆字节

Use --sort conjunction with --skip and --limit to limit number of exported documents.
链接:


Mongoexport 2.2.x版可以执行一些操作—查询和排序。它不支持限制-该选项在2.6版中受支持

查询将作为json文档传递给mongoexport:

--查询

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
您可以通过$orderby进行排序(未记录,但这里有一个很好的讨论):

例如:

--query '{ $query: {}, $orderby: {count: -1} }'
在版本2.6之前不支持限制:

--限制

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
2.6还有不同的排序语法:

--排序

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
超过32兆字节

Use --sort conjunction with --skip and --limit to limit number of exported documents.
链接:


Mongoexport 2.2.x版可以执行一些操作—查询和排序。它不支持限制-该选项在2.6版中受支持

查询将作为json文档传递给mongoexport:

--查询

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
您可以通过$orderby进行排序(未记录,但这里有一个很好的讨论):

例如:

--query '{ $query: {}, $orderby: {count: -1} }'
在版本2.6之前不支持限制:

--限制

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
2.6还有不同的排序语法:

--排序

Provides a JSON document as a query that optionally limits the documents returned in the export.
Specifies a maximum number of documents to include in the export. See limit() for information about the underlying operation.
Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less
超过32兆字节

Use --sort conjunction with --skip and --limit to limit number of exported documents.
链接:


如果没有,我就写一个脚本。对于mongoexport是否可以在这种情况下使用,我多少有些好奇。如果不能,我将继续写一个脚本。对于mongoexport是否可以在这种情况下使用,我多少有些好奇。如果不能,我将继续写一个脚本。对于mongoexport是否可以在这种情况下使用,我多少有些好奇。如果不能,我将继续写一个脚本。在这种情况下是否可以使用mongoexport,多少有些好奇。