struct2mongo 1.0.0

Mongo wrapper for plug and play usage of structs


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

struct2mongo

A Dlang Mongo wrapper of Mondo that allows plug & play usage of structs. Uses the Mondo library to perform its operations.

Example usage:

void main () {
  import mondo;
  import struct2mondo;
  Mongo mongo = new Mongo("mongodb://localhost");
  assert (mongo.connected, `Not connected to Mongo`);
  // Col is the name of struct2mongo's Collection to avoid name clashes.
  auto collection = Col (mongo [`newBase`][`newCollection`]);
  // Be careful if copy pasting this.
  if (collection.exists) collection.drop();

  // true isn't saved because it's the default value.
  auto contact = Contact (`(800)34514129`, true, [3,4,5]);
  collection.insert (contact);
  writeln ('\n', `After contact insertion: `, '\n');
  writeln (collection.findOne!Contact());
}

struct Contact {
    string value;
    bool active = true;
    int [] favoriteNumbers = [1, 2, 3];
}
Authors:
  • Christian Duran C
Dependencies:
mondo
Versions:
1.0.0 2018-Jan-29
0.6.2 2018-Jan-27
0.6.1 2018-Jan-26
0.5.1 2018-Jan-22
0.5.0 2018-Jan-22
Show all 10 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 47 downloads total

Score:
0.0
Short URL:
struct2mongo.dub.pm