Skip to content

Instantly share code, notes, and snippets.

@aarkerio
Created January 22, 2025 23:01
Show Gist options
  • Save aarkerio/d6eb0ecec35278f8a64b208b09522df9 to your computer and use it in GitHub Desktop.
Save aarkerio/d6eb0ecec35278f8a64b208b09522df9 to your computer and use it in GitHub Desktop.
MongoDB
Query to get the last one:
db.fundraisers.find().sort({'_id': -1}).limit(1)
Result:
[
{
_id: ObjectId("6769c7c016906665787708e1"),
event_name: 'RHA Gala',
giving_number_formatted: '(833) 374-0837',
donations: [
{
reference_number: 'b07da0f68518a9c430a9bc57c5',
donor: { full_name: 'Ganz Foundation' },
amount_cents: 1000000,
created_at: ISODate("2025-01-22T04:02:19.487Z"),
_id: ObjectId("67916b2ae21244a1a3fc9258")
}
]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment