Siva
Siva

Reputation: 2811

MongoDB GetDate Syntax

In SQL Server while trying to insert records you have the option to specify

GETDATE()-1, GETDATE()

I tried below statement for MongoDB

db.TableA.insert({Name:ABC,SaleDate:this.date.getDate-1,SaleValue:2500,City:XYZ})

This does not work. What is the MongoDB equivalent syntax to insert getDate value for a table column?

I am also looking into MongoDB documentation, but I am still figuring it out.

Upvotes: 0

Views: 4792

Answers (1)

grant
grant

Reputation: 872

Just typing "new Date()" should do it.

http://www.mongodb.org/display/DOCS/Dates

Upvotes: 1

Related Questions