Skip to content

Database

To report bugs, please use our SERVER JIRA project.

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback

37 results found

  1. Sorting support on Array fields.

    Presently, I'm attempting to arrange(sort) the documents within my collection based on a key nested within an array object. However, sorting isn't functioning as expected in this scenario.

    A proper explanation with example is here what I mean.
    https://www.mongodb.com/community/forums/t/how-to-sort-documents-in-collection-on-basis-of-array-fields/270867?u=samrat_n_a

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  2. JSON

    I'm converting a lot of data for export from MongoDB -> Postgresql

    I would like an aggregation function to convert an object to JSON

    {
    "$addField": {
    "_id": true,
    "json": {
    '$convert': {
    'input': '$subdocument',
    'to': 'json', # // Idealy, +1 for msgpack https://msgpack.org/
    }
    }
    }
    }

    thus object.json would be a STRING "{abc: true}"

    FYI: Postgresql supports JSON(B) in it's field structures: https://www.postgresql.org/docs/current/datatype-json.html

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  3. support parallel query executions include find(), aggregation()

    To use multi-core environment and enhance the query performance w/ a large amount of documents, need a parallel execution.
    Sharding or microsharding is not an alternative in this case.

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  4. define the random seed manually, for $rand and $sample

    It will be great if an additional paramater to define the seed for $rand and $sample could be use.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  5. $group all fields

    $group should have the ability to allow specifying all fields in a document (without explicitly defining them all, which can lead to duplicating dozens of lines just to do "key: $first")

    This will help users that use $unwind and then want to $group the results without having to do a subsequent $lookup and $mergeObjects (or similar) to get the final document structure they're looking for.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  6. Flatten arrays in group stage

    Have group operators to flatten document arrays into a single one with or without repeated elements.
    So ->
    doc1 = {arr: [1,2,3,4], gr: "group"}, doc2 = {arr: [5, 6, 7, 8], gr: "group"}
    {$group: {id: "$gr", arrays: {$***: "$arr"} } }
    =>
    {
    id: "gr", arrays: [1, 2, 3, 4, 5, 6, 7, 8]}

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  7. $merge

    Report number of docs matched, merged, skipped, etc. from a $merge stage. Alternatively, return the merged doc results as a pipeline result to pass to additional stages.

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  8. Add SHA2, SHA3 and ECDSA functions to agg framework

    It is very useful (and valuable security-wise) to be able to reverify hashes and signatures "on-engine" instead of dragging material out to a client app and running the algo there. The implementations are straightforward and everywhere now so it's not a huge lift for the backend. Example use:
    aggregate([
    {$match: whatever},
    {$addFields: {
    hashok: {$cond: [ {$eq: [ {$sha3: "path.to.struct"}, "path.to.stored.sha3"} ], 1, 0},
    sig
    ok: { $verify: { sig: "path.to.sig", pubkey: "path.to.pubkey", algo: "name of curve to use eg. SECP256k1}}
    }
    ])
    The digest function would operate on the raw BSON behind the scenes.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  9. Improve the mongo query language

    Sometimes I find Mongo query language as not put very well together, sometimes it feels like a patch job. It would be nice, if you could make you query language easier to reason about. It would be awesome, if you could introduce fluent style api builder instead of building bson documents.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  10. Add functionality to specify the readConcern level at db.collection.findOne()

    Add functionality to specify the readConcern at db.collection.findOne(). At the version 5.0.14 it's not supported.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  11. geo

    It would be nice to get the length of an LineString of a geo-json object or the possibility to write an aggregation to calculate it.

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  12. Add hash function (eg. md5) to aggregation pipeline

    I would like to implement hash-based sharding in my own application on top of MongoDB. For that purpose, I would like to pull a stable pseudorandom subset of documents into each of my servers, and I would like to do so without enlarging the documents by adding additional fields, and without using JavaScript in the aggregation pipeline (for performance reasons).

    The idea: add a hash function, such as md5, to aggregation pipelines. The function would accept an object/array containing the data to be hashed, and would return the hash, ideally as a number.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  13. $dateDiff operator should be useful to calculate age

    In the documentation it says: " For example, two dates that are 18 months apart would return 1 year difference instead of 1.5 years.". But if startDate is 2021-08-01 and endDate is 2023-02-01, the result is 2 years difference. I think it should be good if this operator could be used to calculate the age.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  14. $currentDate option to only update if the document was modified

    A common pattern in a data model is to have a field that denotes when the data was last modified. For this example, let this field be called "updated". I want to toggle a field on a document called "enabled", and if the value is modified I also want to update the "updated" field.

    This behavior is possible right now via a comment shown in SERVER-42084, but ONLY if we include the entire document, which is not acceptable when you only want to modify a single field. This document could have other fields that are numeric and are updated atomically,…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  15. Support compound/multiple grouping keys in $bucket

    We often need to compute statistical/summarizing aggregations grouped by more than one field where all fields are of a $bucket-able type.

    An example, would be to count all orders grouped by their status and some custom time ranges of their creation date.
    This can be achieved by using $group in combination with a $switch expression (sometimes simplified with $trunc), however, that is cumbersome and prevents efficient grouping since e.g. no binary search can be employed to identify the bucket boundaries efficiently.

    The query syntax of $bucket would not need to change much. It would simply need to allow for nested…

    6 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  16. Need an array query operator like elem match which matches all array nested object instead of at least one array element

    as per documentation elem match query matches at least one match in array of nested object,
    same we need a array query operator which returns the whole document only if elem match like criteria matches all elements in array of nested objects.
    I have gone through usecase of $all with $elemMatch but it behaviour different it is like $and with $elemMatch instead excepted behaviour i am asking or excepting mentioned earlier.
    https://www.mongodb.com/docs/manual/reference/operator/query/all/#use--all-with--elemmatch
    https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  17. Handle Daylight Saving Time when $densify is used on a date field

    When using "day" as "unit" for a $densify pipeline stage on a date field, the date is always advanced of 24 hours. This is however not always the expected result in timezones in which the year has one 23-hour and one 25-hour long day, because of Daylight Saving Time.

    It would be useful to have the possibility to pass an optional timezone parameter in the $densify stage and, when present, have the stage account for these exceptions when appropriate.

    Here follows an example.

    Assume we have a collection containing the following documents:

    db.densifyDateExample.insertMany([
        {_id: "a", d: ISODate("2022-10-28T22:00:00Z")},
        {_id: "b", d:
    7 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  18. Document scoped RBAC - Permission for collection document fields

    Roles and accesses can be defined on the basis of collections that define roles for users.
    It would be nice if these access permissions could be made within the scope of the fields under the collection and the query results would be returned accordingly.

    Current:

    privileges: [
    { resource: { db: "users", collection: "user" }, actions: [ "find"] },
    }

    Expected:

    { resource: { db: "users", collection: "user", field: "email" }, actions: [ "find"] },

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  19. Make redundant createView() a no-op

    If I call createView() with params that match an existing view (in name and all other attributes), it returns an error. It'd be more convenient if the call simply succeeded without doing any work. The behavior I propose is analogous to the way that createIndex() behaves. With the current behavior my only choices are to (1) unconditionally drop and recreate the view, or (2) read the current view definition and see whether it matches the definition I want. The first choice is unacceptable because for a period of time (albeit a short one) the view won't exist and queries that…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  20. Allow Dynamic Object In $project and $addFields

    Assume I have a field mapping defined in some configuration collection of my application. And this field mapping varies for different clients on my application.

    I would like to pass the dynamic object in my $project or $addFields stage

    Like:

    $project: {
    {$arrayToObject: "$field_mapping"},
    }

    {$arrayToObject: "$field_mapping"} would return something like

    "email" : "$data.Email",
    "phone" : "$data.Phone,
    "firstname" : "$data.FirstName",
    "last
    name" : "$data.LastName",
    "preferredchannel" : "$data.Channel",
    "preferred
    language" : "$data.LanguageCode",
    "emailchannel" : "$data.Email",
    "sms
    channel" : "$data.SMS",
    "province" : "$data.CustomerState"

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
← Previous 1
  • Don't see your idea?

Feedback and Knowledge Base