Answer the question
In order to leave comments, you need to log in
How to get multiple records in MongoDB with different ones?
Hello. I am familiar with Cockpit CMS and it uses MongoDB. I need to get the records where the field name = z,x and c.
Here is a query that displays a record with name = z without any problems.
fetch('/cms/api/collections/get/ende?token=account-2d62f0209212457d0138c79cefaa06', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filter: {name: 'z'},
})
})
.then(res=>res.json())
.then(res => console.log(res));
filter: {$and: [{name: 'x'},{name: 'z'},{name:"с"}] }
Answer the question
In order to leave comments, you need to log in
Hmm, I'm not familiar with MongoDB yet, but maybe instead of $and you should write $or
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question