Questions tagged [unwind]

26 questions
0
votes
0 answers

How can i merge multiple fields with same id in MongoDB with Nodejs?

I used $unwind operator, it is a stage in the MongoDB aggregation pipeline that is used to deconstruct an array field into multiple documents, each representing a single array element. The $unwind operator takes an array field as input and outputs…
user
  • 1
  • 3
0
votes
0 answers

Unwind multiple arrays mongodb

I am using @grapecity/activereports-react in my react app. I am using my mongodb database as datasource. I created Server and endpoint to read my data from db ; app.get('/:collectionName', async (req, res) => { try { const collectionName =…
user
  • 1
  • 3
0
votes
0 answers

mongodb iterate over array elements without unwind

[ { "_id": 1, c: [ { d: [ { b: [ { a: 1 }, { a: 2 }, { a: 2 }, …
0
votes
0 answers

Simplifying a MongoDB aggregate query

I made that aggregate query below to handle a social network main feed that will be able to show the posts and then answer then. Is there a way to simplify that query or the right choice for that case is to lookup, unwind and project? `[ { …
0
votes
1 answer

Aggregate on MongoDB based on arrays

I'm trying to do an array based on the next structure: { _id:573a1390f plot:"A greedy tycoon decides, on a whim, to corner the world market in whea…", genres:"Short","Drama", countries:"México","USA" }, { _id:573a1390f …
0
votes
1 answer

org.neo4j.driver.exceptions.ClientException: Invalid input 'ConfigNode': expected an identifier (line 1, column 86 (offset: 85))

Exception: org.neo4j.driver.exceptions.ClientException: Invalid input 'ConfigNode': expected an identifier (line 1, column 86 (offset: 85)) "WITH $batch AS document UNWIND document.data AS data FOREACH (node in data| CREATE(m:'ConfigNode') SET m =…
user3574108
  • 33
  • 2
  • 6
0
votes
0 answers

Issue with mongosh (mongo shell) and $unwind

We've used the following code (saved as example.js) in the past prior to mongosh. // DB Connection conn = new Mongo("localhost:27017"); db = conn.getDB("College2"); collSect = db.getCollection("Section"); collStudent =…
0
votes
2 answers

create a complex mongodb query from a json with multi-level array

i have this json : { "_id": "id", "field1": "value1", "field2": "value2", "field3": "value3", "field4": "value4", "field5": "value5", "field6": [ { "field7": "value_a7_level1", "field8": "value_a8_level1", …
0
votes
1 answer

How to unwind/merge arrays from hierarchical document structure?

I have a nested document structure and I am able to filter it with pluck to show the relevant parts: Is there an elegant way to merge all entries of the last level to a single array? Expected result (entries are not unique on…
Stefan
  • 10,010
  • 7
  • 61
  • 117
0
votes
1 answer

Some weird results of apoc.coll.zip()

I create 3 test nodes with name properties are "a", "b", "c", and use apoc.coll.zip() to combine two lists together: MATCH (n:test) WITH collect(n.name) as nodes WITH apoc.coll.zip(nodes, range(0, size(nodes))) as pairs RETURN…
Ooker
  • 1,969
  • 4
  • 28
  • 58
1
2