[DOCS-932] Add documentation for fixed sized arrays Created: 01/Jan/13  Updated: 04/Mar/23  Resolved: 03/Jan/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: mongodb-2.4

Type: Task Priority: Major - P3
Reporter: Sam Weaver Assignee: Sam Kleinman (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-991 $push with $slice + $sort Closed
Duplicate
duplicates DOCS-874 Add New $push operator syntax Closed
Participants:
Days since reply: 11 years, 7 weeks, 1 day ago

 Description   

From http://codereview.10gen.com/8998011/

{ $push: { a:

{ $each: [ 1 2 3] }

} }
is the new $pushAll. The latter will be deprecated in favor of this

Syntax for creating a fixed sized array is:

{ $push: { a:

{ $each: [1], $trimTo: 5 }

} }

I.e after appending the elements in $each, we'd trim the resulting array to 5 elements.


Generated at Thu Feb 08 07:39:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.