Unable to query for recent data

Steve,

Here is the code of NodeJS

const mongoose = require('mongoose');

const Schema = mongoose.Schema;

mongoose.connect('mongodb://WHATEVERIP:27017/DBNAME?authSource=DBNAME', {

    user: "admin",

    pass: "passs",

    useNewUrlParser: true,

    useUnifiedTopology: true

});

var MarketingSchema = new Schema({}, { strict: false });

var MarketingModel = mongoose.model('Marketing', MarketingSchema, 'Marketing');

// r_time is 64 bit timestamp field

var DataRecord = await MarketingModel.find({ ip: "PUT IP OF CLIENT HERE" }).sort({ r_time: -1 }).lean().limit(1).exec();

if (!DataRecord.length) {

    console.log("NOT FOUND");

}

Here is the C++ code,

#include <iostream>

#include <string>

#include <nlohmann/json.hpp>

#include <bsoncxx/builder/stream/document.hpp>

#include <bsoncxx/json.hpp>

#include <mongocxx/client.hpp>

#include <mongocxx/stdx.hpp>

#include <mongocxx/uri.hpp>

#include <mongocxx/instance.hpp>

// Connect to Database

mongocxx::instance instance{};

mongocxx::uri uri("mongodb://user:pass@YOURIPGUESHERE:27017/?authSource=DBNAMEGOESHERE");

mongocxx::client client(uri);

mongocxx::database database = client["DBNAMEGOESHERE"];

long long getUnixTimeInMS()

{

    long long milliseconds_since_epoch = std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1);

    return milliseconds_since_epoch;

}

int main() {

    long long rtime = getUnixTimeInMS();

    // Get Marketing Table from Database

    mongocxx::collection table = ::database["Marketing"];

    nlohmann::json body;

    body["r_time"] = rtime;

    body["ip"] = "127.0.0.1";

    std::string jsonString = body.dump();

    auto document = bsoncxx::from_json(jsonString);

    table.insert_one(document.view());

    return 0;

}