Re: How do I filter out data from mongodb in D-code
On Tuesday, 10 October 2017 at 09:43:10 UTC, Anders S wrote: I'm working on a middleware application that reads array of data from a POSIX pipe and insert data into the db if any position in the array has changed. This is where my problem lays, in order not to duplicate data I want to fetch the latest data/document in the array of documents. To clarify, This is where my problem lays, in order not to duplicate data I want to fetch the >latest data/document in the array of documents. refers to latest inserted data/document in the mongodb collection. Also that the insert of document that changed include a timestamp like this dateAdded: new Date()
How do I filter out data from mongodb in D-code
Hi, I'm working on a middleware application that reads array of data from a POSIX pipe and insert data into the db if any position in the array has changed. This is where my problem lays, in order not to duplicate data I want to fetch the latest data/document in the array of documents. I'm using MS Code and dub to code and compile. This is the code: Collection ct = mongo.boxweb.celltab; int i = 1; for(;i < 10; i++ ){ auto cell = ct.find({"number":i}).sort({_id:-1}).limit(2).pretty(); if (insert... i++; Where "number" is the document nr in the array I get these errors source/app.d(166,54): Error: found : when expecting ; following statement source/app.d(166,56): Error: found } when expecting ; following statement source/app.d(166,57): Error: found ) instead of statement dmd failed with exit code 1. Any ideas? Isn't there a way to markup code in the forum message to separate from the bodytext? /anders