mongodb match multiple fields
$match:
{
$and: [
{'ExtraFields.value': {$in: ["A52A2A"]}},
{'ExtraFields.fieldID': ObjectId("5535627631efa0843554b0ea")}
]
}
mongodb match multiple fields
$match:
{
$and: [
{'ExtraFields.value': {$in: ["A52A2A"]}},
{'ExtraFields.fieldID': ObjectId("5535627631efa0843554b0ea")}
]
}
working with multiple db in single query mongodb
// Switch to admin database and get list of databases.
db = db.getSiblingDB("admin");
dbs = db.runCommand({ "listDatabases": 1 }).databases;
// Iterate through each database.
dbs.forEach(function(database) {
db = db.getSiblingDB(database.name);
// Get the Group collection
collection = db.getCollection("Group");
// Iterate through all documents in collection.
/*
collection.find().forEach(function(doc) {
// Print the meldingId field.
print(doc.meldingId);
});
*/
var meldingIds = collection.distinct('meldingId');
print(meldingIds);
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us