Create an ISODate with pyMongo

You just need to store an instance of datetime.datetime. Inserting from the python shell: >>> c.test.test.insert({‘date’: datetime.datetime.utcnow()}) ObjectId(‘4e8b388367d5bd2de0000000′) >>> c.test.test.find_one() {u’date’: datetime.datetime(2011, 10, 4, 16, 46, 59, 786000), u’_id’: ObjectId(‘4e8b388367d5bd2de0000000’)} Querying in the mongo shell: > db.test.findOne() { “_id” : ObjectId(“4e8b388367d5bd2de0000000”), “date” : ISODate(“2011-10-04T16:46:59.786Z”) }

Date query with ISODate in mongodb doesn’t seem to work

Although $date is a part of MongoDB Extended JSON and that’s what you get as default with mongoexport, I don’t think you can really use it as a part of the query. If try exact search with $date like below: db.foo.find({dt: {“$date”: “2012-01-01T15:00:00.000Z”}}) you’ll get the error: error: { “$err” : “invalid operator: $date”, “code” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)