<commit_before>= mongoid_auto_inc
Add SQL like auto-incrementing fields to your Mongoid documents.  

This gem is inspired by http://ihswebdesign.com/blog/autoincrement-in-mongodb-with-ruby/ and the mongomapper_id2[https://github.com/phstc/mongomapper_id2] gem.
== Install
  gem install mongoid_auto_inc
== Usage
Just add <tt>auto_increment :field</tt> to your Mongoid model where <tt>:field</tt> is the name of the auto-incremented field you want to create.
Example:
  class Book
    include Mongoid::Document

    field :title
    field :author

    auto_increment :sequence
  end
<tt>auto_increment :sequence</tt> will create a field of type <tt>Integer</tt> named <tt>sequence</tt> for <tt>Book</tt>.  Whenever an instance of the model is created (intially saved to mongoDB), the <tt>auto_increment</tt> field will automatically be set to the next number in the sequence.

You can add more than one auto-incremented field per model.
=== Options
  auto_increment :sequence, :collection => :some_collection
<tt>mongoid_auto_inc</tt> keeps track of the current number in the sequence by creating a separate document mongoDB to query and update.  By default <tt>auto_increment</tt> will save this document to a mongoDB collection called <tt>sequences</tt>.  If you wish to save to a different collection use the <tt>:collection</tt> option to specify its name.

  auto_increment :sequence, :seed => 3333
Use the <tt>:seed</tt> option to set the initial value of the auto-incremented field.  The first number assigned from the sequence will be the next number after the seed value.
<commit_msg>Edited README.rdoc via GitHub<commit_after>= mongoid_auto_inc
Add SQL like auto-incrementing fields to your Mongoid documents.  

This gem is inspired by http://ihswebdesign.com/blog/autoincrement-in-mongodb-with-ruby/ and the mongomapper_id2[https://github.com/phstc/mongomapper_id2] gem.
== Install
Note: this is not yet released to RubyGems.org.
  gem install mongoid_auto_inc
== Usage
Just add <tt>auto_increment :field</tt> to your Mongoid model where <tt>:field</tt> is the name of the auto-incremented field you want to create.
Example:
  class Book
    include Mongoid::Document

    field :title
    field :author

    auto_increment :sequence
  end
<tt>auto_increment :sequence</tt> will create a field of type <tt>Integer</tt> named <tt>sequence</tt> for <tt>Book</tt>.  Whenever an instance of the model is created (intially saved to mongoDB), the <tt>auto_increment</tt> field will automatically be set to the next number in the sequence.

You can add more than one auto-incremented field per model.
=== Options
  auto_increment :sequence, :collection => :some_collection
<tt>mongoid_auto_inc</tt> keeps track of the current number in the sequence by creating a separate document mongoDB to query and update.  By default <tt>auto_increment</tt> will save this document to a mongoDB collection called <tt>sequences</tt>.  If you wish to save to a different collection use the <tt>:collection</tt> option to specify its name.

  auto_increment :sequence, :seed => 3333
Use the <tt>:seed</tt> option to set the initial value of the auto-incremented field.  The first number assigned from the sequence will be the next number after the seed value.

{'fraction_non_alphanumeric': 0.08123076923076923, 'fraction_numerical': 0.0036923076923076922, 'mean_word_length': 4.653913043478261, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 55, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5641750', 'n_tokens_mistral': 957, 'n_tokens_neox': 925, 'n_words': 403}