Hi,
When using
[
{
"_id": 1,
"name": "Player 1",
"might": 2,
"endurance": 7,
"inventory": [
{
"name": "Battery",
"desc": "A battery",
"qty": 2
},
{
"name": "Rations",
"desc": "Food",
"qty": 2
}
]
}
]
this query works in the playground you provide
{
"$and": [
{
"inventory": {
"$elemMatch": {
"name": "Battery",
"qty": {
"$gte": 2
}
}
}
},
{
"inventory": {
"$elemMatch": {
"name": "Rations",
"qty": {
"$gte": 1
}
}
}
}
]
}
but it doesn't work in my local setup using Vue, but this one works
{
$and: [
{
inventory: {
$and: [
{ name: "Battery" },
{
qty: {
$gte: 2,
},
},
],
},
},
{
inventory: {
$and: [
{ name: "Rations" },
{
qty: {
$gte: 1,
},
},
],
},
},
],
}
Anything that I am doing wrong?
const collection = db.collection(aw.who);
const result = collection.find(test); //test is the queries above
Thank you
Hi,
When using
this query works in the playground you provide
but it doesn't work in my local setup using Vue, but this one works
Anything that I am doing wrong?
Thank you