[SERVER-19386] insert {_id:Timestamp()} no longer expand Created: 14/Jul/15  Updated: 15/Jul/15  Resolved: 14/Jul/15

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: wenchaomeng Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I use mongo2.2, insert data as follows:

{_id:Timestamp()} Timestamp will expand.

but in mongo2.6 and mongo 3.0, it won't expand.
If I upgrade from mongo2.2 to mongo2.6, current system will not work.

Is there a way to support that?



 Comments   
Comment by Daniel Pasette (Inactive) [ 15/Jul/15 ]

There isn't a perfect workaround for your situation other than changing your code on the client side. See SERVER-12349, where we specifically removed the expansion of Timestamp for _id.

Is it possible for you to change your application to set the Timestamp for the _id on the client ?

Comment by wenchaomeng [ 15/Jul/15 ]

Thanks a lot for your answer!

There are some issuse I have to consider:

1、This has to be supported from mongo2.2 to mongo3.0(Now I am using 2.2, and I want to upgrade it to 3.0 )
2、Current system use it as _id, and consumes the message in sequence(order by id).
3、Current system is a cluser, so I have to upgrade all the system one by one. In the meantime, it has to work normally durating all the time.

Do you have any idea about that?

Comment by Sam Kleinman (Inactive) [ 14/Jul/15 ]

I would encourage you to consider the Date() constructor to generate a date object in the mongo shell javascript client, if that's what you're looking for. You can also use the $currentDate docs update operator in 2.6 and later.

Also see the release notes section in the documentation on the new releases for MongoDB, including complete upgrade instructions.

The SERVER project is for bugs and feature requests related to the core MongoDB database server. Questions like this are probably best suited to the mongodb-users group or Stack Overflow with the mongodb tag.

Regards,
sam

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