Monday, 29 May 2017

Node/Mongo: How to insert variable properly so the querys can be efficient?

I'm inserting inputs (errors or proper insertions) in mongoDB through Node.js. Those inputs are stored in a variable. Here's what I have

collection.insert({
                        "fields": 
                            {
                                "fname": [stackErrors]

                              },
                        }), (etc)

And the output of a find() query is:

{
"_id" : ObjectId("592bfb979b047027983a7283"),
"fields" : {
    "fname" : [
        {
            "message" : "expected '' to be NaN",
            "showDiff" : false,
            "actual" : "",
            "expected" : null,
            "name" : "AssertionError"
        }
    ]

But I guess i'm doing the insert wrong because I cannot do an efficient query to find e.g. the Assertion errors, wich is my goal. I want to find the assertion error or the inputs of the fname field and so on with a propper query. Can anyone help out? Thanks



via FuManchu

No comments:

Post a Comment