Okay, so I'm trying to compile a program on Ubuntu using Mono, and this is the command I'm using:
gmcs main.cs mongo.cs -r:MongoDB.Bson.dll -r:MongoDB.Driver.dll -r:MongoDB.Driver.Core.dll
I'm just trying to query with the QueryBuilder, but it's telling me things like 'The name `Query' does not exist in the current context'... Unless I try to include MongoDB.Driver.Builders, then it gives me this error instead:
mongo.cs(3,22): error CS0305: Using the generic type `MongoDB.Driver.Builders<TDocument>' requires `1' type argument(s)
But I'm just trying to include a namespace... Notice how it's throwing the error on line 3...
I'm trying to do something like this:
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using MongoDB.Driver.Linq;
// etc.
var collection = _database.GetCollection<BsonDocument>("users");
var query = Query.And(
Query.EQ("username", username),
Query.EQ("password", password)
);
var fields = Fields.Include("username");
var user = collection.Find(query).SetFields(fields).SetLimit(1).FirstOrDefault();
Type currentType = user.GetType();
return currentType.ToString();
-----
Thanks for any guideance, even if just pointing me to another way to do this that won't error me out.