[SERVER-6691] mongodumping oplog with timestamp query Created: 02/Aug/12  Updated: 15/Aug/12  Resolved: 02/Aug/12

Status: Closed
Project: Core Server
Component/s: Querying, Tools
Affects Version/s: 2.0.6
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Nemanja Dubravac Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-6564 mongodump query had different behavio... Closed
Operating System: ALL
Participants:

 Description   

we're trying to dump a part of our oplog.rs collection, buy issuing this query:

mongodump -d local -c oplog.rs -q '{"ts":{"$gte": {"$timestamp":{"t":1343842923000,"i":0}}}}'

but it doesn't output anything, even though this query from the mongo client gives 2 million results:

db.oplog.rs.find({ts: {$gte: Timestamp(1343842923000, 0) } }).count()

please help



 Comments   
Comment by Nemanja Dubravac [ 02/Aug/12 ]

i was using 2.0.6, so i guess that was the problem..
thanks

Comment by Spencer Brody (Inactive) [ 02/Aug/12 ]

Also, what version of mongodump are you using? Mongodump from the 2.0 series doesn't support the $timestamp syntax for the query argument, you have to use mongodump from 2.2-rc0. It should be fine to use mongodump from 2.2-rc0 with a server from 2.0.6

Comment by Spencer Brody (Inactive) [ 02/Aug/12 ]

So try something like this instead:

./mongodump -d local -c oplog.rs -q "{ts : { \"\$gte\" : { \"\$timestamp\" : { \"t\" : 1343842923000, \"i\" : 0 } } }}"

Comment by Spencer Brody (Inactive) [ 02/Aug/12 ]

Make sure to escape all dollar signs and quotes properly with backslashes, you can see behavior like that if a symbol isn't escaped.

Comment by Nemanja Dubravac [ 02/Aug/12 ]

the exact output from mongodump is:

connected to: 127.0.0.1
DATABASE: local	 to 	dump/local
	local.oplog.rs to dump/local/oplog.rs.bson
		 0 objects

Generated at Thu Feb 08 03:12:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.