MONGOIMPORT(1) Mongo Database MONGOIMPORT(1)NAME
mongoimport - the Mongo import tool
SYNOPSIS
mongoimport [OPTIONS]
DESCRIPTION
mongoimport is a tool to import a MongoDB collection from JSON, CSV, or TSV. The query can be filtered or a list of fields to input can be
given.
OPTIONS
--help show usage information
-h, --host HOST
server to connect to (default HOST=localhost)
-d, --db DATABASE
database to use
-c, --c COLLECTION
collection to use (some commands)
--dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
-v, --verbose
be more verbose (include multiple times for more verbosity e.g. -vvvvv)
-f, --fields NAMES
comma separated list of field names e.g. -f name,age
--fieldFile FILE
file with fields names - 1 per line
--jsonArray
load a json array, not one item per line. Currently limited to 4MB.
--ignoreBlanks
if given, empty fields in csv and tsv will be ignored
--type TYPE
type of file to import. default: json (json,csv,tsv)
--file FILE
file to import from; if not specified stdin is used
--drop drop collection first
--headerline
CSV,TSV only - use first line as headers
COPYRIGHT
Copyright 2007-2009 10gen
SEE ALSO
For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org.
AUTHOR
Kristina Chodorow
10gen January 2010 MONGOIMPORT(1)
Check Out this Related Man Page
MongoDB::OID(3pm) User Contributed Perl Documentation MongoDB::OID(3pm)NAME
MongoDB::OID - A Mongo ObjectId
SYNOPSIS
If no "_id" field is provided when a document is inserted into the database, an "_id" field will be added with a new "MongoDB::OID" as its
value.
my $id = $collection->insert({'name' => 'Alice', age => 20});
$id will be a "MongoDB::OID" that can be used to retreive or update the saved document:
$collection->update({_id => $id}, {'age' => {'$inc' => 1}});
# now Alice is 21
To create a copy of an existing OID, you must set the value attribute in the constructor. For example:
my $id1 = MongoDB::OID->new;
my $id2 = MongoDB::OID->new(value => $id1->value);
Now $id1 and $id2 will have the same value.
Warning: at the moment, OID generation is not thread safe.
SEE ALSO
Core documentation on object ids: <http://dochub.mongodb.org/core/objectids>.
ATTRIBUTES
value
The OID value. A random value will be generated if none exists already. It is a 24-character hexidecimal string (12 bytes).
Its string representation is the 24-character string.
METHODS
to_string
my $hex = $oid->to_string;
Gets the value of this OID as a 24-digit hexidecimal string.
get_time
my $date = DateTime->from_epoch(epoch => $id->get_time);
Each OID contains a 4 bytes timestamp from when it was created. This method extracts the timestamp.
TO_JSON
my $json = JSON->new;
$json->allow_blessed;
$json->convert_blessed;
$json->encode(MongoDB::OID->new);
Returns a JSON string for this OID. This is compatible with the strict JSON representation used by MongoDB, that is, an OID with the value
"012345678901234567890123" will be represented as "{"$oid" : "012345678901234567890123"}".
AUTHOR
Kristina Chodorow <kristina@mongodb.org>
perl v5.14.2 2011-09-07 MongoDB::OID(3pm)
I need specific instructions on how to to a csv file from my medical manager unix system w/my patients demographics so I can put on new IMedica windows XP professional system. (12 Replies)
Anyone have a simple UNIX script to look at for doing this? I'm interested in how to convert from csv to tsv, and then back again, if I want to.
Thanks! (13 Replies)
I need to insert data into a perticular field of a csv file, lets say second field.
Can any one help me to do this?
I found that we can do it with sed. can any one guide me to accomplish this?
thanks in advance. (12 Replies)
I have a csv file which has no header. the file has 15 fields and needs to go out with a header of 8 fields.
The header content needs to have some variables and some fixed that i have set up:
variable header fields
OUTFILE_YEAR=`date '+%y'`
DATE=`date '+%d%m%y'`
TIME=`date '+%H:%M:%S'`... (6 Replies)
Hi I have a very large csv file with some hundreds of thousands of rows of data.
The data is in the following format:
Up to four alpha numeric characters for the first word. This is either set as 2 characters followed by 2 spaces, or as a single 4character word. This is then followed by an 8... (7 Replies)
Hello, i am bit stuck with making script for automatic procedure.
Case:
Two files. One is flat file, other is csv file.
csv file has two column/fields with comma delimited data.
Here is what i need (explained way)
CSV file:
field1 | field2
"hello","byebye"
"hello2","byebye2"... (23 Replies)
I have played with this for some time but i dont seem like i am getting it right. I am trying to change the delimiters on a file so i can import it into a database. this file has rows of data separated by enter
Right now the delimiters are represented by tabs and " ".
e.g.
"dlfkldfs... (9 Replies)
sort -k2 tmp.tsv | sed -n '/\
If I use the hard coded values it works fine.
How to use the variable in place of date.
value of var1='6/Jul/2010'
var2='7/Jul/2010'
i.e sort -k2 tmp.tsv | sed -n '/\[$var1:06:00:00/,/\[$var2:09:00:00/p' > tab.tsv
abd I also get the error as
sed: -e... (6 Replies)
Hi All,
I have some 10 files named samp1.csv, samp2.csv,... samp10.csv
Each file having the same number of fields like,
Count, field1, field2, field3.
And a source.csv file which has three fields field1, field2, field3.
Now, i want to find the total count by taking the field1,... (8 Replies)
hi..
I have a text file which looks likes this
2258
4569
1239
258
473
i need to convert it into comma seperated format
eg:2258,4569,1239,258,437
pls help (8 Replies)
Hi Guys
I have a file which have some data..
I want to fetch some data and creating csv file from that file
Input file format
20/11/11
SQL CD : 100
query
select name,class from table school
I have to create a csv file which have these columns
date,sql code,entire text (entire file... (7 Replies)
Hi! I need to learn that how a shell script can transverse a csv file n check if any field is empty or not. means its contains two comma or space b/w commas i.e., "" or " ".
can anyone help me out how I can do that.... (10 Replies)
Hi experts,
I have a csv file which has one field (ID) repeated multiple times with corresponding other field values.
I need to convert this file in a format where for a ID all other values has to be present in single field.
For Eg : Here in below file ID 1 is repeated 3 times with different... (7 Replies)
hello masters,
I am working with csv files that open just fine in excel, but have sub-fields which are comma separated as well.
a 3 column csv looks like
a,b,"c,d,e"
f,g,h
How do I make join or sort believe that "c,d,e" is just 1 field? (8 Replies)
Hi All,
This is my first thread. Hopefully you guys can help me out. I have a csv file, that provides access to managers to a tool. The file is loaded onto our server containing all the assc id's with a trailing comma.
For ex: 182950,
123456,
However, we receive a file that... (8 Replies)