Find count and percentage of students failed in a subject

Find count and percentage of students failed in a subject

I am new to MongoDB and learning to write mongodb queries. I need help for below problem:
Input data is a collection student having five records:
[
{
“_id”:0,
“name”:”Maxy”,
“results”:[
{
“subject”:”maths”,
“score”:1.46
},… Read the rest “Find count and percentage of students failed in a subject”

App fails to connect to MongoDB Enterprise with “Authentication failed” and Ops Manager stuck in “AdjustUsers”

App fails to connect to MongoDB Enterprise with “Authentication failed” and Ops Manager stuck in “AdjustUsers”

The credentials of a newly deployed app are rejected by MongoDB with “Authentication failed”. The MongoDB Ops Manager is stuck on “AdjustUsers” for a few hours already.

Verified by:… Read the rest “App fails to connect to MongoDB Enterprise with “Authentication failed” and Ops Manager stuck in “AdjustUsers””

update multiple documents with sub array elements in mongodb without $ operator

update multiple documents with sub array elements in mongodb without $ operator

I want to update the element of subarray with another element of same array index. Actually what mistake what I have done is typo mistake in column name (reviews, review) so want to … Read the rest “update multiple documents with sub array elements in mongodb without $ operator”

How to do an aggregate operation with $cond checking for null values in same array while grouping

How to do an aggregate operation with $cond checking for null values in same array while grouping

This is my document,
{
“_id”: “58aecaa3758fbff4176db088”,
“actualEndDate”: “2017-02-27T00:00:00.000Z”,
“Details”: [
{
“projectId”: “58a585f6758fbff4176dadb9”,
}
]
},
{
“_id”: “58aecac8758fbff4176db08b”,
“actualEndDate”: “2017-03-12T00:00:00.000Z”,
“Details”: [
{
“projectId”: “58a585f6758fbff4176dadb9”,
}… Read the rest “How to do an aggregate operation with $cond checking for null values in same array while grouping”

jq: Flatten objects with unnecessary nested levels

jq: Flatten objects with unnecessary nested levels

I’m facing the problem of having a json file where the same key sometimes has a flat value, while others it has an additional nested (and for my purposes unnecessary) level which then includes the related value.
The … Read the rest “jq: Flatten objects with unnecessary nested levels”

MongoImport Error: X509_STORE_add_cert:cert already in hash table

MongoImport Error: X509_STORE_add_cert:cert already in hash table

I am currently trying to import a group of JSON files containing data into my mongo database hosted on IBM Bluemix/Compose.
I have a script that runs through the files creating and then running a mongoimport command to … Read the rest “MongoImport Error: X509_STORE_add_cert:cert already in hash table”

Mongoose encryption middleware doesn’t call after aggregation

Mongoose encryption middleware doesn’t call after aggregation

I have a mongoose’s schema with a ‘mongoose-encryption’ plugin, for example:
let someSchema = new Schema({name, age});

someSchema.plugin(mongoose-encryption, {
encryptionKey: ‘eKey’,
signingKey: ‘sKey’,
encryptedFields: [‘age’],
decryptPostSave: false
});

After initiating the model and the repository I tried to … Read the rest “Mongoose encryption middleware doesn’t call after aggregation”

How to create c# mongodb pipeline that includes $redact

How to create c# mongodb pipeline that includes $redact

I am trying to create a a mongodb aggregate pipeline using the C# driver that includes redact followed by a project. I have tried several ways shown below but in each case only the first stage … Read the rest “How to create c# mongodb pipeline that includes $redact”

mongodb most efficient way to store gps tracking data

mongodb most efficient way to store gps tracking data

I need to store gps points (timestamp, lon, lat) from different users.
should I have a separate users collection and a gps data collection:
users
{_id: 1, name: ‘A’}

gps
{_id: 1, userId: 1, timestamp: …, … Read the rest “mongodb most efficient way to store gps tracking data”