Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-6666

Provide example of $push with currentDate()

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual, Server

    Description

      Cases like adding currentDate while doing push to an array is needed e.g.

      collection.update(
                  {
                      '_id': user_id
                  },
                  {
                  '$push' : {
                      'projects': {
                          '_id': project_id,
                          'name': 'risky',
                          'description': "A test project for Dynamic Risk."
                      },                
                  },
                  '$currentDate': {'projects.last_modified': True}
              })
      
      

      (Which doesn't work and there is no documentation of it)

      Attachments

        Activity

          People

            Unassigned Unassigned
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 14 weeks, 1 day ago