Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21794

Array field limitation in query document [Only one array field may appear in the query document.]

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None

      Hello,

      Related page: https://docs.mongodb.org/manual/reference/operator/projection/positional/#array-field-limitation

      Actually I can figure it out why this limitation is present. The issue might be regarding other operations. Especially `update`.

      Is there any possibility of adding a new feature which providing usage of the second array field in the query document as a new feature in the feature?
      (maybe by using sub-operator like `$arr1` and `$arr2`)

      It seems as a private issue. However, cannot perform two-phase commits if an array value would be updated.

      For instance;

      	var query = { 
      		_id: t.customer_id, 
      		invoices: { $elemMatch: { 'year': t.year, 'month': t.month } }
      	        pendingTransactions: t._id
      	}
      	var update = {
      		'invoices.$.amount': 549,
      		$push: { pendingTransactions: t._id }
      	}
      	db.customers.update(query, update)
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            efkan efkan turen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: