How do I filter out data from mongodb in D-code
Anders S
anders at xore.se
Tue Oct 10 09:43:10 UTC 2017
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 (<data from pipe[i].pos1 == cell.pos1) then do some
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
More information about the Digitalmars-d
mailing list