Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含多个模型的主干 js 集合:
Model 1: tag: 1 id : 2 name: test Model 2: tag: 3 id: 3 name: test3
如何按标签属性搜索特定模型的集合?就像我想找到带有 tag=2 的模型...我该怎么做?
使用findWhere:
findWhere
仅返回集合中与传递的属性匹配的第一个模型。
collection.findWhere({tag: 2})