react-redux-firebase

Firestore to query by an array's field value

别说谁变了你拦得住时间么 提交于 2019-12-03 07:41:29
I'm trying to run a simple query, where I search for a document that contains a value inside an object array. For instance, look at my database structure: I want to run a query similar to this: db.collection('identites').where("partyMembers", "array-contains", {name: "John Travolta"}) What is the correct way to achieve this, is it even possible with Firestore? Thanks. The array-contains operations checks if an array, contains a specific (complete) value. It can't check if an array of objects, contains an item with a specific value for a property. The only way to do your query, is to add an

Firestore to query by an array's field value

此生再无相见时 提交于 2019-11-27 05:37:17
I'm trying to run a simple query, where I search for a document that contains a value inside an object array. For instance, look at my database structure: I want to run a query similar to this: db.collection('identites').where("partyMembers", "array-contains", {name: "John Travolta"}) What is the correct way to achieve this, is it even possible with Firestore? Thanks. The array-contains operations checks if an array, contains a specific (complete) value. It can't check if an array of objects, contains an item with a specific value for a property. The only way to do your query, is to add an

Firestore to query by an array's field value

给你一囗甜甜゛ 提交于 2019-11-26 09:13:40
问题 I\'m trying to run a simple query, where I search for a document that contains a value inside an object array. For instance, look at my database structure: I want to run a query similar to this: db.collection(\'identites\').where(\"partyMembers\", \"array-contains\", {name: \"John Travolta\"}) What is the correct way to achieve this, is it even possible with Firestore? Thanks. 回答1: The array-contains operations checks if an array, contains a specific (complete) value. It can't check if an