GithubHelp home page GithubHelp logo

feliixx / mongoplayground Goto Github PK

View Code? Open in Web Editor NEW
178.0 5.0 12.0 3.29 MB

a simple sandbox to test and share MongoDB queries

Home Page: https://mongoplayground.net

License: GNU Affero General Public License v3.0

Shell 0.39% Go 42.86% HTML 18.01% JavaScript 28.84% CSS 4.26% TypeScript 5.64%
mongodb playground fiddle mgodatagen

mongoplayground's Introduction

Go Report Card codecov

Mongo Playground

Mongo playground: a simple sandbox to test and share MongoDB queries. Try it online : https://mongoplayground.net

Shared playgrounds

Shared playgrounds are saved forever. Do not share playground containing sensitive data, as they can get accessed by anyone who get the playground link!

Limitations

Size limitations

This playground has several limitations:

  • a database can't contain more than 10 collections
  • a collection can't contain more than 100 documents

Queries

Currently, the playground can run only find(), aggregate() and update() queries

shell regex

Currently, shell regex doesn't work in query.

so instead of

db.collection.find({
  "k": /pattern/
})

use

db.collection.find({
  "k": {
    "$regex": "pattern"
  }
})

Developpement

To automatically restart the server when a file changes, use:

ls  *.go internal/*.go internal/web/src/* | entr tools/restart.sh

Credits

This playground is heavily inspired from The Go Playground

Editors are created with ace, and the documentation is styled using github-markdown-css

Favicon was created on favicon.io from an emoji provided by twemoji

Queries are executed in an atlas cluster graciously provided by MongoDB

mongoplayground's People

Contributors

andylib93 avatar dependabot[bot] avatar feliixx avatar githubarray avatar rickhg12hs avatar sergeax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mongoplayground's Issues

Aggregate does not seem to work

Thanks for the great program!

Currently, the db.collection.aggregate() seems to be broken.
I run this example:
and the error text is:

invalid query: 
  must match db.coll.find(...) or db.coll.aggregate(...)

Auto formatting on run replaces comments

I like how you successfully implemented auto-commenting lines and highlighted sections on Ctrl+/, but these comments are automatically replaced on run from nice and pleasant to work with

// db.collection.find({
//   founded_month: 10, $or: [
//     {
//       category_code: "web"
//     }, {
//       category_code: "social"
//     }
//   ]
// })

to

/** db.collection.find({*/
/**   founded_month: 10, $or: [*/
/**     {*/
/**       category_code: "web"*/
/**     }, {*/
/**       category_code: "social"*/
/**     }*/
/**   ]*/
/** })*/

which I cannot uncomment by highlighting it and pressing Ctrl+/ (as it was with with //) - it simply adds and removes //. I see no reason for doing that if // works just fine.
Currently I have to manually remove all the auto-added comments on every single line.
Is there any workaround to automatically remove these /** */ comments?

Browser Firefox 86.0 (64-bit) for Ubuntu

Enhancement Request: View Selectable Pipeline Stage Output

It would enhance query/pipeline development if the output of each stage was viewable, even after adding further stages. It is currently possible to "comment out" or cut stages from a pipeline to view a particular stage's output, but it's inconvenient , time consuming, and prone to error.

One possible implementation might be to have an additional tabbed pane in the Result pane for stage output. Some way to select the stage in the Query pane or the new tab in the Result pane would be necessary - there are many possibilities. It would be especially important to show the output as if the following stages do not exist since a typical use case would be to view the stage's output while still having a partial or faulty stage below it under development.

If the "zeroth stage" i.e., the input collection, could be selected, then #113 would be redundant since the collection could be viewed in the stage tab of the Result pane with this enhancement.

Delete playgrounds

Yesterday I sent an email requesting the deletion of 6 playgrounds that have some sensitive data. Could they delete them?

Add support for "update with aggregation pipeline" Starting from MongoDB 4.2

Please add support for update with aggregation pipeline starting from MongoDB 4.2,

Example Document:

[{
    "_id": ObjectId("5fba17c1c4566e57fafdcd7e"),
    "username": "moshe",
    "health": 0,
    "maxHealth": 200
}]

Aggregation Query:

db.collection.update({ username: "moshe" },
[{
    "$set": { "health": "$maxHealth" }
}])

Result: (ERROR)

error in query:
  fail to parse content of query: json: cannot unmarshal array into Go value of type primitive.M

Playground Link: https://mongoplayground.net/p/AV5xJz8KuAD

Enhancement Request: Option to `not` sort output

It would be convenient, and often enhance understanding, if there was an option to not sort the output by field name. This is especially true when viewing explain results that currently "jumbles" the output alphabetically.

Personally, I wouldn't mind if the output was never sorted, but perhaps other users prefer it. Maybe a radio button to select sorted output or not?

indeterministic query behaviour when querying by DBRef

Query result is indeterministic when querying by DBRef. Sometimes a matching document is returned but sometimes is not.

Sample json:

[
  {
    "_id": ObjectId("64c24d0880abcf083d007a61"),
    "dbref": {
      "$ref": "collection2",
      "$id": ObjectId("64c1e71c80abcf083d007a36"),
      "extraField": "test"
    }
  }
]

Sample query:

db.collection.find({
  "dbref": {
    "$ref": "collection2",
    "$id": ObjectId("64c1e71c80abcf083d007a36"),
    "extraField": "test"
  }
})

Mongo Playground

Please support explain clause

First of all, thank you for a great tool! Glad to see it under active development.

I think that it really needs to support "explain", to answer a frequent question "willl this request use my indexes?" and solving other performance-related problems.

I see it as an easy update to .js and can make a pull request, if you like the idea.

`mgodatagen`: offset trouble for `double` generator?

Using a mgodatagen configuration of:

[
  {
    "collection": "collection",
    "count": 10,
    "content": {
      "array": {
        "type": "array",
        "minLength": 10,
        "maxLength": 10,
        "arrayContent": {
          "type": "double",
          "min": -1.0,
          "max": 1.0
        }
      }
    }
  }
]

... all the "array" values are negative.

I haven't tested the standalone mgodatagen to see if the behavior is the same.

Filtering MongoDB document keys inconsistencies

I am using Mongo 5.0.6 and have a document structured like this:

[
  {
    "username": "admin",
    "properties": {
      "bookmarks": {
        "value": [
          1,
          2,
          3
        ]
      },
      "landmark": {
        "value": [
          "home"
        ]
      },
      "other": {
        "value": "should not show"
      }
    }
  }
]

I need to query data based on the properties keys, this works fine in my mongo playground: https://mongoplayground.net/p/lEiLeStWGTn when I query for key that contain mark.

db.collection.aggregate([
  {
    $match: {
      username: "admin"
    }
  },
  {
    $addFields: {
      filtered: {
        $filter: {
          input: {
            $objectToArray: "$properties"
          },
          cond: {
            $regexMatch: {
              input: "$$this.k",
              regex: "mark"
            }
          }
        }
      }
    }
  },
  {
    $project: {
      _id: 0,
      properties: {
        $arrayToObject: "$filtered"
      }
    }
  }
])

However when I use it through my mongoose object I get [] even so the data is exactly as in playground. I am using locally the latest mongoose6 and mondodb5.0.6. I get the same [] result when I run the query against a mongodb.com hosted database. What could be the problem?

My javascript query below, I tried both using mongoose and the driver directly, as shown below:

const data= User.collection.aggregate([
  {
    $match: {
      username: "admin"
    }
  },
  {
    $addFields: {
      filtered: {
        $filter: {
          input: {
            $objectToArray: "$properties"
          },
          cond: {
            $regexMatch: {
              input: "$$this.k",
              regex: "mark"
            }
          }
        }
      }
    }
  },
  {
    $project: {
      _id: 0,
      properties: {
        $arrayToObject: "$filtered"
      }
    }
  }

  
]);
for await (const doc of data) {
    console.log(doc);
}

Always gives me:

{ "properties": {} }

When I take out the $addFields and $project like this:

const data= User.collection.aggregate([
  {
    $match: {
      username: "admin"
    }
  }
 
]);
for await (const doc of data) {
    console.log(doc);
}

I get, so the data is there, but aggregation pipeline isn't working:

[
  {
    "_id": "61b9f2f5d2a6021365aae6d6",
    "username": "admin",
    "properties": {
      "bookmarks": {
        "value": [
          1,
          2,
          3
        ]
      },
      "landmark": {
        "value": [
          "home"
        ]
      },
      "other": {
        "value": "should not show"
      }
    }
  }
]

So the data is there. What am I missing? Do I need to write the query differently?

Add support for multiple collections in `json` mode

TODO:

  • define the new syntax. It has to be backward compatible
  • update javascript BSON parser
  • add a combobox with templates ( single collection,multiple collections, mgodatagen )
  • update documentation

new syntax possibility:

db = {
    "collection1": [
      {
        "_id": 1,
        "k": 2
      },
      {
        "_id": 2,
        "k": 3
      }
    ],
    "collection2": [
      {
        "_id": 1,
        "k2": 12
      },
      {
        "_id": 2,
        "k2": 2
      }
    ]
  }

$documents - query failed: (InvalidNamespace) '$documents' can only be run with {aggregate: 1}

When I try to use $documents operator in playground,

db.collection.aggregate([
  {
    "$documents": [
      {
        "test": 123
      }
    ]
  }
])

I get below error:

query failed: (InvalidNamespace) '$documents' can only be run with {aggregate: 1}

Playground to reproduce.


Alternatives that I have tried(but also failed):
Removing collection in db.collection.aggregate([...]): will get syntax error like:

Invalid query:

Line 1: Expected '.' instead of '('

Playground

What could be a correct way to use $documents in Mongo Playground?

Many links in `docs.html` don't work

I noticed many links in the docs didn't work while learning mgodatagen configurations, etc. You should also know that I am no HTML expert, so my comments about the details may be off the mark.

You can see the href's beginning at https://github.com/feliixx/mongoplayground/blob/dev/internal/web/static/docs.html#L94

        <li><a href="#string">string</a></li>
        <li><a href="#int">int</a></li>
        <li><a href="#long">long</a></li>
        <li><a href="#double">double</a></li>
        <li><a href="#decimal">decimal</a></li>
        <li><a href="#autoincrement">autoincrement</a></li>
        <li><a href="#boolean">boolean</a></li>
        <li><a href="#objectid">objectId</a></li>
        <li><a href="#binary">binary</a></li>
        <li><a href="#date">date</a></li>
        <li><a href="#uuid">UUID</a></li>
        <li><a href="#position">position</a></li>
        <li><a href="#faker">faker</a></li>
    </ul>
    <p>List of composite <code>&lt;generator&gt;</code> types:</p>
    <ul>
        <li><a href="#array">array</a></li>
        <li><a href="#object">object</a></li>
        <li><a href="#constant">constant</a></li>
        <li><a href="#ref">reference</a></li>
        <li><a href="#fromarray">fromArray</a></li>
        <li><a href="#stringFromParts">stringFromParts</a></li>
        <li><a href="#countAggregator">countAggregator</a></li>
        <li><a href="#valueAggregator">valueAggregator</a></li>
        <li><a href="#boundAggregator">boundAggregator</a></li>
    </ul>
    <h3><a id="user-content-string" class="anchor" aria-hidden="true" href="#string"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>String</h3>

Notice the last line above, id="user-content-string". This seems to parallel other id assignments that appear earlier in the document. However, also notice that href="#string" in the list above. Shouldn't it be href="#user-content-string"? ... and all the other href assignments should be changed too? Also notice the last line has href="#string" - this should also probably be changed, or removed?

MongoDB v6.0.2 or mongoplayground bug?

While exploring ways to retrieve or "$merge"/"$out" unique documents from a collection, I ran across the following "oddity".

mongoplayground.net example

mongoplayground mgodatagen configuration:

[
  {
    "collection": "collection",
    "count": 100,
    "content": {
      "key1": {
        "type": "int",
        "minInt": 0,
        "maxInt": 1
      },
      "key2": {
        "type": "int",
        "minInt": 0,
        "maxInt": 1
      }
    }
  }
]

Query:

db.collection.aggregate([
  {
    "$unset": "_id"
  },
  {
    "$group": {
      "_id": "$$ROOT"
    }
  },
  {
    "$replaceWith": "$_id"
  }
])

Result: (should just be 4 docs, but it's not - there are repeats)

[
  {
    "key1": 1,
    "key2": 1
  },
  {
    "key1": 1,
    "key2": 0
  },
  {
    "key1": 1,
    "key2": 0
  },
  {
    "key1": 1,
    "key2": 1
  },
  {
    "key1": 0,
    "key2": 0
  },
  {
    "key1": 0,
    "key2": 1
  },
  {
    "key1": 0,
    "key2": 0
  },
  {
    "key1": 0,
    "key2": 1
  }
]

Using the same collection and query on MongoDB Atlas, the expected output of just 4 documents was produced.

The MongoDB Atlas Cluster I used is at version 5.0.13 so maybe it's a MongoDB server regression?

$function combines "return" and next word/characters when execute the query

Reference: $function operator from MongoDB v4.4,

Original Code (Working in Mongo Shell):

db.collection.aggregate([
  {
    $addFields: {
      locations: {
        $function: {
          body: function(locations, sort_category){
            return locations.sort(function(a, b){
              return a[sort_category]-b[sort_category]
            })
          },
          args: ["$locations", "$sort_category"],
          lang: "js"
        }
      }
    }
  }
])

Implementation on Playground:
https://mongoplayground.net/p/Jq4JdgDf3K2

Behavior after executing in MongoPlayground :
It will combines return with next word,

db.collection.aggregate([
  {
    $addFields: {
      locations: {
        $function: {
          body: function(locations, sort_category){

            /* below line should be "return locations.sort(function(a, b){" */
            returnlocations.sort(function(a, b){

              /* below line should be "return a[sort_category]-b[sort_category]" */
              returna[sort_category]-b[sort_category]

            })
          },
          args: ["$locations", "$sort_category"],
          lang: "js"
        }
      }
    }
  }
])

Display exit confirmation before leaving playground

Hi there!

Context
A lot of times when I'm using this awesome tool to debug MongoDB queries, I spend a considerable amount of time creating a sample collection of data in the playground. If for any reason, I mistakenly navigate away from the page or do anything that causes the page to reload, I lose all the data, both the sample collection and the potential fixed query. I've tried to be very careful when using the tool to avoid situations like this, however, I'm pretty sure I'm not the only one experiencing this, so how about we fix the issue once and for all.

Request
I figured it would be great if we can use the browser beforeUnload event to confirm user action of leaving the page. With this, when a user makes an attempt to leave the page mistakenly or not, a modal pops up to confirm the user action, if user really wants to leave the page, user confirms the action and if not user happily discontinue the exit.

Colon in the value is breaking aggregation queries and also the output order of fields changed too

example here https://mongoplayground.net/p/zULrmihM03z

More details

https://stackoverflow.com/questions/60996149/push-if-object-doesnt-already-exist

"profile_picture": "https://productionstemulistorage.blob.core.windows.net/stemuli/profile-picture-6e609f3b-44cb-44c0-888a-1b6767e3072d"

It works as expected when I run the query locally.

Expected result :

[
  {
    "_id": null,
    "students": [
      {
        "userId": "5dd27452592f600900235945",
        "name": "student  zero",
        "profile_picture": "https://productionstemulistorage.blob.core.windows.net/stemuli/profile-picture-6e609f3b-44cb-44c0-888a-1b6767e3072d"
      }
    ]
  }
]

Also not sure why the fields order has been changed in the result.

Local Setup

I'm new to golang and finding it difficult to setup mongoplayground locally.

I did COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build
I can see it running in my terminal, logs are coming, but unable to find the port at which it is running, is there anything I'm missing?

Questions ?

  • What is the local Port at which the playground is running?
  • Do I need to add/update the config file, if yes what is the thing I need to add?

Enhancement Request: Accept Canonical MongoDB Extended JSON (v2) `"$binary"` in BSON Configuration

It would be convenient , and more closely align mongoplayground.net to MongoDB, if the Canonical MongoDB Extended JSON (v2) "$binary" was accepted in mongoplayground.net's BSON configuration.

Currently, with a BSON configuration of: [mongoplayground.net link]

[
  {
    "_id": {
      "$oid": "6359dd697a7dcbd7a0bae8d9"
    },
    "payload": {
      "$binary": {
        "base64": "SSB3aXNoIHRoaXMgd291bGQgd29yayEK",
        "subType": "00"
      }
    }
  }
]

... the Result shows error:

error in configuration:
  json: cannot unmarshal object into Go value of type []uint8

BinData() is a workaround for this, but it is inconvenient to transform given Canonical MongoDB Extended JSON (v2) "$binary" to this form.

Question about darkmode contribution

Hi @feliixx,
I like your playground and was wondering if a contribution regarding darkmode would be appreciated? I'd go with plain CSS variables in a :root {} block and set the variables according to the users system preferences. Here is an example, so nothing fancy really, but a nice user feature in my opinion. Let me know, what you think.

how long do you keep a "share"d playground on mongoplayground.net?

Hey there, It is a great tool you created here.

I met this for the first time today on MongoDb Forums, where one participant of the topic has used it to test the problem. I loved how it made the trial/error easy.

I now wonder how long you keep those playgrounds around . Since there is no mention of this on the main site, I thought it would be acceptable to ask here.

Draggable columns

I find this tool very helpful!
It would be nice if Configuration,Query and Result could resize on drag.

Enhancement Request: More ``Random'' Control

Awesome tool! Thanks!

It would be useful if there was some control over randomness. For example, when specifying fromArray with "randomOrder": true, the array elements are selected randomly, I suppose, but each press of the run button generates the exact same array. This is useful for many testing scenarios, but more control would also be nice.

Perhaps adding an option to specify a "randomSeed" would be useful. By specifying a "randomSeed", each run would generate the same "content". Without specifying "randomSeed", each run would generate new random "content".

It would definitely be useful to have just one overall "randomSeed", and perhaps useful to some to have a separate "randomSeed" for each instance of a "type" that uses randomness.

Running {$range : [0, 259200000, 1]} server not responds

Reproducing issue:

Input

{
   startDate: ISODate("2020-01-07T00:00:00.000Z"),
   endDate: ISODate("2020-01-10T00:00:00.000Z")
}

Query

db.collection.aggregate([
   {
     $addFields: {
       range: {
         $range:[0, {
             $subtract: [
               "$endDate",
               "$startDate"
             ]
           }, 1]
       }
     }
   }
])

Accidential query execution...

Enhancement request: Add `mgodatagen` and `database/collection` tabs to configuration pane

It would be convenient to view the collection while developing MongoDB queries/pipelines. While it's always possible to use a query to view the collection, it's inconvenient during development to cut the query text and replace it with an empty find, just to view the collection.

One possible enhancement might be to have two tabs, say mgodatagen and database/collection where one could select one or the other. After refining the mgodatagen configuration in it's tab, selecting the other tab would let the user view the generated database/collection.

Not all valid pipeline expression operators listed in popup for `update`.

The popups are very helpful while developing queries, but not all valid expression operators appear in the popup for the update method when using an aggregation pipeline. There may be others, but I noticed "$setIntersection" doesn't appear in the popup.

Here's a valid update method that works, but "$setIntersection" didn't appear in the popup while typing.

db.collection.update({},
[
  {
    "$set": {
      "discountItems": {
        "$setIntersection": [
          [
            "Just coffee",
            "Discount clothing"
          ],
          "$description"
        ]
      }
    }
  }
],
{
  "multi": true
})

Try it on mongoplayground.net.

`mgodatagen`: Can't have an `enum` of `ObjectId`s?

Shouldn't it be possible to have an enum of ObjectIds in the mgodatagen configuration?

I ran into this on mongoplayground.net:

[
  {
    "collection": "collection",
    "count": 10,
    "content": {
      "key": {
        "type": "enum",
        "in": [
          ObjectId("624ac834820a8747b065a561"),
          ObjectId("624ac834820a8747b065a562"),
          ObjectId("624ac834820a8747b065a563"),
          ObjectId("624ac834820a8747b065a564"),
          ObjectId("624ac834820a8747b065a565")
        ]
      }
    }
  }
]

... but this produced an error:

error in configuration:
  error in configuration file: object / array / Date badly formatted: 

		invalid character 'O' looking for beginning of value

Enhancement request: mgodatagen generate reference `"id"`'s

It would be useful if reference "id"'s could be generated, rather than just a constant <int>.

For example, something like this would be useful:
[mgodatagen]

[
  {
    "collection": "users",
    "count": 10,
    "content": {
      "_id": {
        "type": "reference",
        "id": {
          "type": "autoincrement",
          "autoType": "int",
          "startInt": 0
        }
      },
      "refContent": {
        "type": "autoincrement",
        "autoType": "int",
        "startInt": 0
      }
    }
  },
  {
    "collection": "wallets",
    "count": 10,
    "content": {
      "_id": {
        "type": "autoincrement",
        "autoType": "int",
        "startInt": 0
      },
      "userId": {
        "type": "ref",
        "id": {
          "type": "autoincrement",
          "autoType": "int",
          "startInt": 0
        }
      }
    }
  }
]

Then in another collection, the "ref" "id" could also be similarly generated to match.

Or maybe something like this is already possible and the syntax escapes me?

DB Randomly Does not Find Any Document

Description

The DB sometimes randomly returns "no documents" when using $elemMatch in the match.

Setup

Share link: https://mongoplayground.net/p/AylVo0AlDWF

Database type

bson

Database content

[
  {
    "_id": ObjectId("000000000000000000000111"),
    "triggers": [
      {
        "trigger": "sa",
        "method": "liveness_check",
        "source": {
          "service": "example",
          "type": "project",
          "identifier": "222222222222222222222222"
        }
      }
    ]
  },
  {
    "_id": ObjectId("000000000000000000000222"),
    "triggers": [
      {
        "trigger": "sa",
        "method": "liveness_check",
        "source": {
          "service": "example",
          "type": "project",
          "identifier": "111111111111111111111111"
        }
      }
    ]
  },
  {
    "_id": ObjectId("000000000000000000000333"),
    "triggers": []
  },
  {
    "_id": ObjectId("000000000000000000000444"),
    "triggers": [
      {
        "trigger": "sa",
        "method": "liveness_check",
        "source": {
          "service": "example",
          "type": "project",
          "identifier": "ff"
        }
      },
      {
        "trigger": "ff",
        "method": "liveness_check",
        "source": {
          "service": "example",
          "type": "project",
          "identifier": "222222222222222222222222"
        }
      }
    ]
  }
]

Query

db.collection.find({
  triggers: {
    $elemMatch: {
      "trigger": "sa",
      "method": "liveness_check",
      "source": {
        "service": "example",
        "type": "project",
        "identifier": "222222222222222222222222"
      }
    }
  }
})

Expected Result

[
  {
    "_id": ObjectId("000000000000000000000111"),
    "triggers": [
      {
        "method": "liveness_check",
        "source": {
          "identifier": "222222222222222222222222",
          "service": "example",
          "type": "project"
        },
        "trigger": "sa"
      }
    ]
  }
]

Actual Result

Sometimes same as the expected result, sometimes no document found

Improve error messages

improve error message

  • when collection doesn't exist
  • fail to parse configuration
  • better formatting ( multiple lines )

`Template` div is invisible

Recently the Template div disappeared.

Looking at the HTML:

<div>
   <label>Template:</label>
  <div class="js-Dropdown" id="custom-template">
    <button class="js-Dropdown-title" style="width: 0px;">bson single collection</button>
    <ul class="js-Dropdown-list" style="width: 0px;">
    <li data-index="0" class="is-selected">bson single collection</li>
    <li data-index="1">bson multiple collections</li>
    <li data-index="2">mgodatagen</li>
    <li data-index="3">update</li>
    <li data-index="4">indexe</li>
    <li data-index="5">explain</li></ul>
  </div>
  <input id="showDoc" type="button" value="docs">
</div>

... should the width be 0?

The invisibility symptom is the same for me in Chrome and Firefox,

`mgodatagen` `uuid` `"format": "binary"` returns same value for entire collection

mgodatagen uuid "format": "binary" should return a unique value across the entire database, but unfortunately it does not.

This configuration:

[
  {
    "collection": "collection",
    "count": 3,
    "content": {
      "uuid": {
        "type": "uuid",
        "format": "binary"
      }
    }
  }
]

... produces ...

[
  {
    "_id": ObjectId("5a934e000102030405000000"),
    "uuid": BinData(4, "IjPT/G3xTd2+wU7NeAnvtA==")
  },
  {
    "_id": ObjectId("5a934e000102030405000001"),
    "uuid": BinData(4, "IjPT/G3xTd2+wU7NeAnvtA==")
  },
  {
    "_id": ObjectId("5a934e000102030405000002"),
    "uuid": BinData(4, "IjPT/G3xTd2+wU7NeAnvtA==")
  }
]

Error using $dateToString

Hi, I tried to use mongoplayground.net. I faced the issue error in query: fail to parse content of query: json: cannot unmarshal array into Go value of type primitive.M Can you please help. I'm trying to convert an ISO DateTime to EST Date (yyyy-mm-dd) format.

Input Document:

[
  {
    "item": "abc",
    "price": 10,
    "quantity": 2,
    "date": "2014-01-01T08:15:39.736Z"
  }

Query Used:

    $project: {
        "yearMonthDayUTC": {
            "$dateToString": {
                format: "%Y-%m-%d",
                date: "$date"
            }
        }
    }
  }
])```

interface conversion error

stacktrace:

May 25 23:47:19 mongoplayground mongoplayground[2452]: 2021/05/25 23:47:19 http2: panic serving 73.227.210.85:56562: interface conversion: interface {} is primitive.M, not map[string]interface {}
May 25 23:47:19 mongoplayground mongoplayground[2452]: goroutine 384284 [running]:
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.(*http2serverConn).runHandler.func1(0xc0002960d8, 0xc0000ebf8e, 0xc0002b3980)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/h2_bundle.go:5716 +0x193
May 25 23:47:19 mongoplayground mongoplayground[2452]: panic(0xf20880, 0xc00696ec60)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/runtime/panic.go:965 +0x1b9
May 25 23:47:19 mongoplayground mongoplayground[2452]: github.com/feliixx/mongoplayground/internal.sanitize(0xc000284500, 0x2, 0x2, 0x203001, 0x203001, 0x0)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /home/runner/work/mongoplayground/mongoplayground/internal/run.go:569 +0x3df
May 25 23:47:19 mongoplayground mongoplayground[2452]: github.com/feliixx/mongoplayground/internal.runQuery(0x12c40f0, 0xc005eb0340, 0xc0059fca20, 0xc0074a0237, 0x9, 0xc000284500, 0x2, 0x2, 0x0, 0x0, ...
)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /home/runner/work/mongoplayground/mongoplayground/internal/run.go:467 +0x11db
May 25 23:47:19 mongoplayground mongoplayground[2452]: github.com/feliixx/mongoplayground/internal.(*storage).run(0xc0082666c0, 0x12c40f0, 0xc005eb0340, 0xc0001a2b68, 0x16, 0x18, 0x12b65e0, 0xc009984060,
 0x102f599)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /home/runner/work/mongoplayground/mongoplayground/internal/run.go:124 +0x458
May 25 23:47:19 mongoplayground mongoplayground[2452]: github.com/feliixx/mongoplayground/internal.(*storage).runHandler(0xc0082666c0, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /home/runner/work/mongoplayground/mongoplayground/internal/run.go:92 +0x355
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.HandlerFunc.ServeHTTP(0xc009984060, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/server.go:2069 +0x44
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.(*ServeMux).ServeHTTP(0xc0004d8040, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/server.go:2448 +0x1ad
May 25 23:47:19 mongoplayground mongoplayground[2452]: github.com/feliixx/mongoplayground/internal.latencyObserver.func1(0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /home/runner/work/mongoplayground/mongoplayground/internal/server.go:83 +0xa7
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.HandlerFunc.ServeHTTP(0xc00000ecf0, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/server.go:2069 +0x44
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.serverHandler.ServeHTTP(0xc0004c4b60, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/server.go:2887 +0xa3
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.initALPNRequest.ServeHTTP(0x12c4198, 0xc00696e570, 0xc000096000, 0xc0004c4b60, 0x12c2950, 0xc0002960d8, 0xc0002c1600)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/server.go:3459 +0x8d
May 25 23:47:19 mongoplayground mongoplayground[2452]: net/http.(*http2serverConn).runHandler(0xc0002b3980, 0xc0002960d8, 0xc0002c1600, 0xc005ed8330)
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/h2_bundle.go:5723 +0x8b
May 25 23:47:19 mongoplayground mongoplayground[2452]: created by net/http.(*http2serverConn).processHeaders
May 25 23:47:19 mongoplayground mongoplayground[2452]:         /opt/hostedtoolcache/go/1.16.4/x64/src/net/http/h2_bundle.go:5453 +0x505

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.