发布于 2015-09-14 15:03:54 | 164 次阅读 | 评论: 0 | 来源: 网络整理

也可以参考

$elemMatch (projection)

$elemMatch

1.4 新版功能.

The $elemMatch operator matches more than one component within an array element. For example,

db.collection.find( { array: { $elemMatch: { value1: 1, value2: { $gt: 1 } } } } );

returns all documents in collection where the array array satisfies all of the conditions in the $elemMatch expression, or where the value of value1 is 1 and the value of value2 is greater than 1. Matching arrays must have at least one element that matches all specified criteria. Therefore, the following document would not match the above query:

{ array: [ { value1:1, value2:0 }, { value1:2, value2:2 } ] }

while the following document would match this query:

{ array: [ { value1:1, value2:0 }, { value1:1, value2:2 } ] }
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务